Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animating a subPart of Actor does not use the animation from the model #647

Closed
TheCheapestPixels opened this issue May 6, 2019 · 1 comment

Comments

@TheCheapestPixels
Copy link
Contributor

commented May 6, 2019

The model https://github.com/TheCheapestPixels/friction_zero/raw/magnesium-animation-bug/assets/cars/Ricardeaut_Magnesium.bam contains two animations (currently one, but the error of one being not present gets silently swallowed at the moment, for reasons that this bug also shows) for two different parts of the vehicle. Since the animations shouldn't be blended, we create subparts for them. Upon wanting to play one of them, Actor seems to look for a file containing the animation.

from direct.showbase.ShowBase import ShowBase
from direct.actor.Actor import Actor


s = ShowBase()


AIRBRAKE = 'airbrake'
STABILIZER_FINS = 'stabilizer_fins'


actor = Actor('Ricardeaut_Magnesium.bam')
airbrake_joints = [joint.name
                   for joint in actor.getJoints()
                   if joint.name.startswith(AIRBRAKE)
]
actor.makeSubpart(AIRBRAKE, airbrake_joints)
stabilizer_joints = [joint.name
                     for joint in actor.getJoints()
                     if joint.name.startswith(STABILIZER_FINS)
]
actor.makeSubpart(STABILIZER_FINS, stabilizer_joints)
actor.play(AIRBRAKE, partName=AIRBRAKE)

Traceback:

Traceback (most recent call last):
  File "actor_bug.py", line 23, in <module>
    actor.play(AIRBRAKE, partName=AIRBRAKE)
  File "/home/baribal/.virtualenvs/py3/lib/python3.5/site-packages/direct/actor/Actor.py", line 1536, in play
    for control in self.getAnimControls(animName, partName):
  File "/home/baribal/.virtualenvs/py3/lib/python3.5/site-packages/direct/actor/Actor.py", line 1849, in getAnimControls
    allowAsyncBind = allowAsyncBind)
  File "/home/baribal/.virtualenvs/py3/lib/python3.5/site-packages/direct/actor/Actor.py", line 2362, in __bindAnimToPart
    self.loader, Filename(anim.filename), -1,
TypeError: expected str, bytes, Path or Filename object, not NoneType

@rdb rdb self-assigned this Jul 18, 2019

@rdb rdb added the bug label Jul 18, 2019

@rdb rdb added this to the 1.10.4 milestone Jul 18, 2019

@rdb

This comment has been minimized.

Copy link
Member

commented Jul 18, 2019

Yeah, it looks like this combination of edge cases ("virtual" subparts on models with pre-bound animations) probably hadn't been tested. It looks like this has a fairly easy fix and I think I can get this in 1.0.4.

Note that blending can be used as alternative (that doesn't require setting up subsets of joints) if you just set the blend weights to 1 explicitly. You shouldn't expect trouble with that approach if the animations target different joints.

@rdb rdb closed this in 22d5029 Jul 18, 2019

PointSource-xx added a commit to PointSource-xx/panda3d that referenced this issue Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.