Mesh._notifySkeleton() causes error

mrkissinger

04-09-2007 06:09:06

I try to load a skeleton and attach it to a mesh object like this:


mm = ogre.MaterialManager.getSingleton()
rm = ogre.ResourceGroupManager.getSingleton()
tm = ogre.TextureManager.getSingleton()
meshm=ogre.MeshManager.getSingleton()
sm = ogre.SkeletonManager.getSingleton()

tm.setDefaultNumMipmaps (5)
mm.setDefaultTextureFiltering(ogre.TFO_ANISOTROPIC)
mm.setDefaultAnisotropy(2)
rm.initialiseAllResourceGroups()


mesh=meshm.load('data/Mesh/robot.mesh',ogre.ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME)
logger.debug("Mesh ===> %s " % mesh.getName() )
submesh=mesh.getSubMesh(0)
logger.debug("Submesh ===> %s" % submesh )

ds = rm.openResource("data/Material/robot.material", "General", True)
mm.parseScript(ds, "General")

material=mm.getByName("Robot")
logger.debug("Material ===> %s, %s" % (material.getName(), material) )

name="data/Map/r2skin.jpg"

mpass=material.getTechnique(0).getPass(0)
texture=mpass.createTextureUnitState(name)
skeleton=sm.load("data/Skeleton/robot.skeleton",ogre.ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME)
logger.debug("Skeleton ===> %s " % (skeleton) )


#mesh.setSkeletonName(skeleton.getName())
mesh._notifySkeleton(skeleton)



Because the mesh does NOT contain material & skeleton informations (they are known at runtime), I load material and skeleton manually.

Before I attach the skeleton object to the mesh object, the material works correctly.
Once I attach the skeleton object, the material become wrong like this:



If I do NOT attach the material to the mesh object, the skeleton works correctly.

It seems that the material and the skeleton are sharing same memory.

What should I do to resolve this problem?

pitmodano12

10-09-2007 08:13:54

Hi!
I agree completely. Wow this topic is moving fast today!