Hi people!
I’m having some problems in using egg-optchar for model optimization.
In few words…
I have a model and several animations. The animations have to be blended. At the same time I want to control a joint for procedural animation (eg. the eyes).
If I run egg-optchar on the whole bundle, I got a zero global scale on the controlled joint which leads to an assertion error when I am calling NodePath.lookAt on that joint.
Here is the code…
from direct.showbase.ShowBase import ShowBase
from direct.actor.Actor import Actor
class OptcharTest(ShowBase):
MODEL = 'Humanoid.egg'
IDLE = 'Humanoid_idle.egg'
TRY_OPTCHAR = True
def __init__(self):
ShowBase.__init__(self)
if OptcharTest.TRY_OPTCHAR:
self.MODEL = 'opt/' + OptcharTest.MODEL
self.IDLE = 'opt/' + OptcharTest.IDLE
act = Actor( self.MODEL )
act.reparentTo( render )
act.makeSubpart( 'mainSub', ['modelRoot' ], ['spine4'] )
act.loadAnims( {'idle':self.IDLE}, partName='mainSub' )
ctrl_idle = act.getAnimControl( 'idle', partName='mainSub' )
ctrl_idle.loop( True )
act.setBlend( animBlend=True )
act.setControlEffect( 'idle', 1.0, partName='mainSub' )
face = act.exposeJoint( None, 'modelRoot', 'face_top_parent' )
eyel = act.controlJoint( None, 'modelRoot', 'eyeball_left' )
eyel.reparentTo( face )
print "###################################################"
node = eyel
while not node.isEmpty( ):
print "%s scale = %s" % (node, node.getScale( ))
node = node.getParent( )
print "\n"
print "eyeball_left global scale: ", eyel.getScale( render )
print "###################################################"
eyel.lookAt( render )
if __name__ == '__main__':
OptcharTest( )
run( )
Here is how I used egg-optchar:
egg-optchar -d opt -flag Humanoid_joints=joints -keep spine4,face_top_parent,eyeball_left,eyeball_right Humanoid.egg Humanoid_idle.egg
I got a zero scale error only when the control effect of the idle animation is greater than 0. Do you have any clue about this?
The problem seems to come either from egg-optchar or from the model itself.
Model, anim and test script are here: http://dl.dropbox.com/u/80827/test.zip
Regards,
cla