Hey, it has been a while, my first post of 2020, anyway I have a simple issue with blending, that is if a animation uses setControlEffect() when I attempt to unloadAnims() on it, the actor freaks out and stops animating to the point where to reverts back to the default blender3d pose.
I want to know what is happening and is it possible to unsetControlEffect on it? I guess this also brings up additional concerns for cleanup like what is being added or flagged to those animations that panda some how knows they were effected by setControlEffect. any help is appreciated, thanks.
Sorry fell asleep, I donāt know what the error means, but I donāt get it when I leave the parentheses blank, so I assume it means you cannot enable/disable blend on a single animation (setting a string name to it), maybe enable/disable blend was designed purely for the actor as a whole and not itās individual animations?
I mean, I have a poorer method that works, of recording animations loaded then not touching them until it is time to remove the entire node, but I have my concerns about this method such as what is the limit on the total animations a actor can have in Panda3d, and does removeNode() also remove seemingly this extra information caused by setControlEffect. (have to imagine it is some kind of weight data)
Could you show what code you called to trigger that error? It is hard for us to understand what is happening otherwise. I am curious whether there is a bug or whether you are simply passing in an incorrect parameter somewhere.
The correct way to remove the effects of setControlEffect is to call setControlEffect again, but pass in an effect value of 0.
What you might be seeing is that Panda3D automatically restores the actor to its default, unanimated pose when setting all control effects back to 0. If you do not want this behaviour, set this Config.prc variable:
restore-initial-pose false
If you set that to false, then Panda will instead keep the current pose when the last control-effect is removed.
For the record, unloadAnims() calls .clearControlEffects() on the underlying PartBundle, which is equivalent to calling setControlEffect(anim, 0) on every bound animation. So this is not the problem.
Did you try restore-initial-pose? What you can do to set it in Python code is this:
loadPrcFileData("", "restore-initial-pose false")
EDIT: I originally stated that disableBlend() calls clearControlEffects(), but I meant to say that unloadAnims() does so.
Yes, it is possible to disable control effects for a single animation. Itās called setControlEffect(anim, 0). As I pointed out, however, unloadAnims() clears the control effects for all animations. So any other calls to setControlEffect are completely redundant.
Rather than continuing to try different methods that have slightly different semantics but do the same thing, maybe you could try the restore-initial-pose solution I suggested?
so I got it working, but the character stopped moving.
EDIT: hold on, Iām going to try a trick.
EDIT2: the trick did not work, I attempted to call loadPrcFileData("", ārestore-initial-pose trueā) after the animation was unloaded but it restored the issue I had previous.
I wonder if this behaviour is working against you here? That calling unloadAnims() with a single animation is clearing the control effects for other animations?
Maybe, instead of unloadAnims, you could give this code a try, which does the same thing as unloadAnims but without clearing all the control effects:
prevAnim[pridx] = "Animation Name"
proplst[pridx].setControlEffect(prevAnim[pridx], 0.0)
cdict = proplst[pridx].getAnimControlDict()
lodNames = cdict.keys()
partNames = cdict[next(iter(lodNames))].keys()
for lodName in lodNames:
for partName in partNames:
animDef = cdict[lodName][partName].get(prevAnim[pridx])
if animDef:
animDef.animControl = None