[SOLVED]Manual parsing of material script

saladin

03-06-2007 09:04:52

Hi,

In my project sometimes resources are added to existing resource groups on the fly. This calls for scripts (overlay, material etc) to be parsed manually.

Here's what I did

ds = ogre.ResourceManager.openResource("myMaterial.material", "General", True)


ds is an ogre.DataStream object. Calling ds.getAsString() seems to be returning the right contents. However if I go on to call ogre.MaterialManager.getSingleton().parseScript(ds), it returns None. Calling ogre.MaterialManager.getSingleton().getByName() shows that the materials have not been parsed and loaded.

Can someone shine some light please?

andy

06-06-2007 02:33:54

I've looked at this again and it seems to work OK for me.. However the example code you gave is certainly not correct so I wonder what version of Python-Ogre you are using...
mm = ogre.MaterialManager.getSingleton()
rm = ogre.ResourceGroupManager.getSingleton()
ds = rm.openResource("mine.material", "General", True)
mm.parseScript(ds, "General")

Cheers

Andy

saladin

06-06-2007 21:49:07

I've looked at this again and it seems to work OK for me.. However the example code you gave is certainly not correct so I wonder what version of Python-Ogre you are using...
mm = ogre.MaterialManager.getSingleton()
rm = ogre.ResourceGroupManager.getSingleton()
ds = rm.openResource("mine.material", "General", True)
mm.parseScript(ds, "General")

Cheers

Andy


sorry, my mistake. I did something really stupid. cloning the material, deleting the original and then trying to find it.