mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-28 19:21:04 +00:00
Check whether model is empty before trying to insert object
This commit is contained in:
parent
964f288c13
commit
6e0d660dd5
@ -45,8 +45,7 @@ namespace MWClass
|
|||||||
|
|
||||||
void Activator::insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation, MWPhysics::PhysicsSystem& physics) const
|
void Activator::insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation, MWPhysics::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
if(!model.empty())
|
physics.addObject(ptr, model, rotation, MWPhysics::CollisionType_World);
|
||||||
physics.addObject(ptr, model, rotation, MWPhysics::CollisionType_World);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Activator::getModel(const MWWorld::ConstPtr &ptr) const
|
std::string Activator::getModel(const MWWorld::ConstPtr &ptr) const
|
||||||
|
@ -24,12 +24,9 @@ namespace MWClass
|
|||||||
|
|
||||||
void Actor::insertObject(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation, MWPhysics::PhysicsSystem& physics) const
|
void Actor::insertObject(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation, MWPhysics::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
if (!model.empty())
|
physics.addActor(ptr, model);
|
||||||
{
|
if (getCreatureStats(ptr).isDead() && getCreatureStats(ptr).isDeathAnimationFinished())
|
||||||
physics.addActor(ptr, model);
|
MWBase::Environment::get().getWorld()->enableActorCollision(ptr, false);
|
||||||
if (getCreatureStats(ptr).isDead() && getCreatureStats(ptr).isDeathAnimationFinished())
|
|
||||||
MWBase::Environment::get().getWorld()->enableActorCollision(ptr, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Actor::useAnim() const
|
bool Actor::useAnim() const
|
||||||
|
@ -111,8 +111,7 @@ namespace MWClass
|
|||||||
|
|
||||||
void Container::insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation, MWPhysics::PhysicsSystem& physics) const
|
void Container::insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation, MWPhysics::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
if(!model.empty())
|
physics.addObject(ptr, model, rotation, MWPhysics::CollisionType_World);
|
||||||
physics.addObject(ptr, model, rotation, MWPhysics::CollisionType_World);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Container::getModel(const MWWorld::ConstPtr &ptr) const
|
std::string Container::getModel(const MWWorld::ConstPtr &ptr) const
|
||||||
|
@ -72,8 +72,7 @@ namespace MWClass
|
|||||||
|
|
||||||
void Door::insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation, MWPhysics::PhysicsSystem& physics) const
|
void Door::insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation, MWPhysics::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
if(!model.empty())
|
physics.addObject(ptr, model, rotation, MWPhysics::CollisionType_Door);
|
||||||
physics.addObject(ptr, model, rotation, MWPhysics::CollisionType_Door);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Door::isDoor() const
|
bool Door::isDoor() const
|
||||||
|
@ -50,7 +50,7 @@ namespace MWClass
|
|||||||
void Light::insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation, MWPhysics::PhysicsSystem& physics) const
|
void Light::insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation, MWPhysics::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
// TODO: add option somewhere to enable collision for placeable objects
|
// TODO: add option somewhere to enable collision for placeable objects
|
||||||
if (!model.empty() && (ptr.get<ESM::Light>()->mBase->mData.mFlags & ESM::Light::Carry) == 0)
|
if ((ptr.get<ESM::Light>()->mBase->mData.mFlags & ESM::Light::Carry) == 0)
|
||||||
physics.addObject(ptr, model, rotation, MWPhysics::CollisionType_World);
|
physics.addObject(ptr, model, rotation, MWPhysics::CollisionType_World);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,8 +30,7 @@ namespace MWClass
|
|||||||
|
|
||||||
void Static::insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation, MWPhysics::PhysicsSystem& physics) const
|
void Static::insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation, MWPhysics::PhysicsSystem& physics) const
|
||||||
{
|
{
|
||||||
if(!model.empty())
|
physics.addObject(ptr, model, rotation, MWPhysics::CollisionType_World);
|
||||||
physics.addObject(ptr, model, rotation, MWPhysics::CollisionType_World);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Static::getModel(const MWWorld::ConstPtr &ptr) const
|
std::string Static::getModel(const MWWorld::ConstPtr &ptr) const
|
||||||
|
@ -125,7 +125,8 @@ namespace
|
|||||||
// Restore effect particles
|
// Restore effect particles
|
||||||
MWBase::Environment::get().getWorld()->applyLoopingParticles(ptr);
|
MWBase::Environment::get().getWorld()->applyLoopingParticles(ptr);
|
||||||
|
|
||||||
ptr.getClass().insertObject (ptr, model, rotation, physics);
|
if (!model.empty())
|
||||||
|
ptr.getClass().insertObject(ptr, model, rotation, physics);
|
||||||
|
|
||||||
MWBase::Environment::get().getLuaManager()->objectAddedToScene(ptr);
|
MWBase::Environment::get().getLuaManager()->objectAddedToScene(ptr);
|
||||||
}
|
}
|
||||||
@ -584,10 +585,14 @@ namespace MWWorld
|
|||||||
if(ptr.mRef->mData.mPhysicsPostponed)
|
if(ptr.mRef->mData.mPhysicsPostponed)
|
||||||
{
|
{
|
||||||
ptr.mRef->mData.mPhysicsPostponed = false;
|
ptr.mRef->mData.mPhysicsPostponed = false;
|
||||||
if(ptr.mRef->mData.isEnabled() && ptr.mRef->mData.getCount() > 0) {
|
if (ptr.mRef->mData.isEnabled() && ptr.mRef->mData.getCount() > 0)
|
||||||
|
{
|
||||||
std::string model = getModel(ptr, MWBase::Environment::get().getResourceSystem()->getVFS());
|
std::string model = getModel(ptr, MWBase::Environment::get().getResourceSystem()->getVFS());
|
||||||
const auto rotation = makeNodeRotation(ptr, RotationOrder::direct);
|
if (!model.empty())
|
||||||
ptr.getClass().insertObjectPhysics(ptr, model, rotation, *mPhysics);
|
{
|
||||||
|
const auto rotation = makeNodeRotation(ptr, RotationOrder::direct);
|
||||||
|
ptr.getClass().insertObjectPhysics(ptr, model, rotation, *mPhysics);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user