Copy transformations data when we clone node (bug #5163)

pull/2529/head
Andrei Kortunov 5 years ago
parent 13a0b3bf5a
commit e568ad30ea

@ -144,6 +144,7 @@
Bug #5159: NiMaterialColorController can only control the diffuse color
Bug #5161: Creature companions can't be activated when they are knocked down
Bug #5164: Faction owned items handling is incorrect
Bug #5163: UserData is not copied during node cloning
Bug #5166: Scripts still should be executed after player's death
Feature #1774: Handle AvoidNode
Feature #2229: Improve pathfinding AI

@ -6,8 +6,9 @@
#include <osgParticle/ParticleSystemUpdater>
#include <osgParticle/Emitter>
#include <components/sceneutil/morphgeometry.hpp>
#include <components/nifosg/userdata.hpp>
#include <components/sceneutil/morphgeometry.hpp>
#include <components/sceneutil/riggeometry.hpp>
namespace SceneUtil
@ -30,6 +31,15 @@ namespace SceneUtil
return const_cast<osg::StateSet*>(stateset);
}
osg::Object* CopyOp::operator ()(const osg::Object* node) const
{
// We should copy node transformations when we copy node
if (const NifOsg::NodeUserData* data = dynamic_cast<const NifOsg::NodeUserData*>(node))
return osg::clone(data, *this);
return osg::CopyOp::operator()(node);
}
osg::Node* CopyOp::operator ()(const osg::Node* node) const
{
if (const osgParticle::ParticleProcessor* processor = dynamic_cast<const osgParticle::ParticleProcessor*>(node))

@ -32,6 +32,7 @@ namespace SceneUtil
virtual osg::Drawable* operator() (const osg::Drawable* drawable) const;
virtual osg::StateSet* operator() (const osg::StateSet* stateset) const;
virtual osg::Object* operator ()(const osg::Object* node) const;
private:
// maps new ParticleProcessor to their old ParticleSystem pointer

Loading…
Cancel
Save