pechart
Hi!

Is it possible to store incoming list vector data on a current frame somehow with the pyExpression?
Example: I have a pyExpression node with some animated objects translate vectors connected to the pyExpression node. I want to check the position on frame X and store it somehow. When the frame is > Y i want to apply the pos from frame X to the OV. Any tipps are appreciated! Thanks!


Reply 0 0
pshipkov
You cannot do that easily with the version out there. At each evaluation creates new instance of the base class and fills in the current data on the inputs. Which is pretty inefficient actually. Maybe later it will be create only one class permanent class instance per session and keep reusing that during evaluation.
What you can do is something like that:

try: createAttr thisNode.tempArrayData
except: pass

if frame == 5: setAttr thisNode.tempArrayData myArray

...

reuse that array any way you want.

Actually thinking about this now i am not sure the createAttribute can be executed during evaluation time. Maybe you can pre-create it.

Reply 0 0
pechart
Thanks, I'm trying this now - also I don't know the correct syntax for parsing the vectorArray data to the new attribute by now. But this should work somehow, i guess. 
Reply 0 0
pshipkov
pyExpression does not handle arrays directly. But you can easily obtain the data, like this:

Select the node that holds the arrays data, then shift select the pyExpression node. In the AE go to "input node" and press the "add" button. Then in the text field below type this:

import maya.cmds as mc
vectorArray = mc.getAttr(N[0]+".myArrayAttr")
print vectorArray

Press the "execute" button.

Reply 0 0
Reply