I've been looking at the Kadish pillar animations and the associated Python script to see how it's done, and I've made the following observations:
- The plATCAnim names have the form prefix_middle_anim_N where prefix is the channel name contained in plAGModifier; middle is the name passed in as a Python parameter; and N is some indicator of the animation's order in a series (or just 0 if it is a single animation).
- The animation-related Python parameters provided to the plPythonFileMod are an AnimationName (i.e. the middle part of the animation name) followed by an Animation (that has a reference to the plAGMasterMod) - and they share the same ID/index.
- The Python script has just one attribute for this collection of python parameters - a ptAttribAnimation instance. Somehow, the animation name and subsequent animations are all folded into this one attribute.
- The use of the optional byObject flag seems to be when the script wants to activate each animation in the group individually. If it is specified, then all uses of the ptAttribAnimation in the script must use the byObject map to access the individual animation.
- When not using the byObject flag, the 'value' and 'animation' members of the ptAttribAnimation seem to be interchangeable.
I tried enabling the use of animation arguments in the 1.5.X plug-in code base, where if plPythonParameter._ExportScript() detects an 'animationlist' type argument in the AlcScript argument list for the python file mod, it recurses on the references, creating a plPythonParameter with the same ID/index. For example, the AlcScript for the animationlist looks like this:
- Code: Select all
- type: animationlist
refs:
- type: animationname
value: DoorOpen
- type: animation
ref: 006D:s111Door0
Note that the reference is to the plAGMasterMod (0x006D).
To test this, I made sure my animations followed the naming convention I've seen above. After exporting and examining the PRP file, it appears that the Python arguments were created correctly. When running in URU, the Python script does obtain a seemingly valid ptAttribAnimation. I can print out the return value of the getdef() method and animation.getFirstKey().getName(), which appear to be in order. But when I call the animation.play() method, nothing happens. I encased the call in a try-except block, but no exceptions are thrown. And no animation.

[And yes - I delete the .SAV file each time before firing up URU.]
Has anyone tried triggering animations from within Python scripts? Have you had any success?