mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-25 16:43:33 +00:00
Check whether model is empty before trying to insert object
This commit is contained in:
parent
964f288c13
commit
6e0d660dd5
@ -45,7 +45,6 @@ namespace MWClass
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -23,14 +23,11 @@ namespace MWClass
|
||||
}
|
||||
|
||||
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())
|
||||
MWBase::Environment::get().getWorld()->enableActorCollision(ptr, false);
|
||||
}
|
||||
}
|
||||
|
||||
bool Actor::useAnim() const
|
||||
{
|
||||
|
@ -111,7 +111,6 @@ namespace MWClass
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,6 @@ namespace MWClass
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,6 @@ namespace MWClass
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -125,6 +125,7 @@ namespace
|
||||
// Restore effect particles
|
||||
MWBase::Environment::get().getWorld()->applyLoopingParticles(ptr);
|
||||
|
||||
if (!model.empty())
|
||||
ptr.getClass().insertObject(ptr, model, rotation, physics);
|
||||
|
||||
MWBase::Environment::get().getLuaManager()->objectAddedToScene(ptr);
|
||||
@ -584,12 +585,16 @@ namespace MWWorld
|
||||
if(ptr.mRef->mData.mPhysicsPostponed)
|
||||
{
|
||||
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());
|
||||
if (!model.empty())
|
||||
{
|
||||
const auto rotation = makeNodeRotation(ptr, RotationOrder::direct);
|
||||
ptr.getClass().insertObjectPhysics(ptr, model, rotation, *mPhysics);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user