Yonnji
March 28, 2021, 8:26pm
1
I have a rigged model with bones and key shapes (morph targets).
The model in gltf and imported using panda3d-gltf.
I can see the “morph” line using actor.listJoints()
I have tried something like this:
np = actor.control_joint(None, 'modelRoot', '1')
np.set_x(1.0)
But panda keeps telling: “Actor(warning): Cannot control joint 1”
I even tried to use key shape names instead of index.
As far as I know, you need to call the egg-optchar
utility to get access to the node. However it is not entirely clear how to apply this to gltf
https://docs.panda3d.org/1.10/python/programming/scene-graph/manipulating-a-piece-of-a-model
rdb
March 28, 2021, 8:56pm
3
No, what you’re doing is correct, no egg-optchar needed. Can you share the file?
Yonnji
March 28, 2021, 9:21pm
4
Made a simple example for testing:
#!/usr/bin/env python3
import sys
from direct.showbase.ShowBase import ShowBase
from direct.actor.Actor import Actor
class Demo(ShowBase):
def __init__(self):
super().__init__()
self.actor = Actor('cube.glb')
self.actor.reparent_to(self.render)
self.actor.listJoints()
self.morph = self.actor.control_joint(None, 'modelRoot', '1')
self.morph.set_x(1.0)
self.cam.set_y(-10)
self.accept('q', sys.exit)
self.accept('f3', self.toggleWireframe)
if __name__ == '__main__':
demo = Demo()
demo.run()
cube.glb (56.7 KB)
cube.blend (795.1 KB)
rdb
March 28, 2021, 9:34pm
5
No CharacterSlider is being created for this morph. Please file this test case as a bug report on the panda3d-gltf project, thanks!
It looks like what’s happening is that panda3d-gltf is expecting the mesh to have default weights assigned, which this one doesn’t.
rdb
March 28, 2021, 9:42pm
6
Actually, this looks like a trivial fix. I just pushed a fix to panda3d-gltf; please try the latest version.
Note that the morph is named “Test” and not “1”, so it should be accessed as “Test”.
Yonnji
March 28, 2021, 9:51pm
7
It still doesn’t work. I have tried with a morph name (Test) as well.
rdb
March 28, 2021, 9:51pm
8
It works for me with latest Git panda3d-gltf and manipulating “Test”.
Did you touch cube.glb
or clear the model-cache after the update?
Yonnji
March 28, 2021, 9:55pm
9
Nice. It works now. It was cached. Thanks!