This post isn't python specific, so forgive me if it's misplaced.
I'm having some trouble interacting with an imagePlane after enabling the "useFrameExtension" attribute. Once this attribute is enabled, there should be an expression connected to the imagePlane node. I want to delete that expression in order to create my own key frames. The problem is that when I script these actions the expression doesn't get created until Maya regains control from the script.
For example, if I run this script;
imagePlaneName = "imagePlane1" # assuming this has already been created
cmds.setAttr( "%s.useFrameExtension" % imagePlaneName, 1 )
connected_expressions = cmds.listConnections("%s.frameExtension" % imagePlaneName, source=True, destination=False)
connected_expressions will be empty.
I've tried sleeping the script and looping over the listConnections like this
cmds.setAttr( "%s.useFrameExtension" % imagePlaneName, 1 )
while not connected_expressions:
connected_expressions = cmds.listConnections("%s.frameExtension" % imagePlaneName, source=True, destination=False)
time.sleep(1)
...but neither seems to allow Maya to create the expression. The only thing that seems to work is to stop the script entirely and give control back to Maya. Like this;
cmds.setAttr( "%s.useFrameExtension" % imagePlaneName, 1 )
STOP THE SCRIPT
connected_expressions = cmds.listConnections("%s.frameExtension" % imagePlaneName, source=True, destination=False)
In this final case, the connected_expressions variable will contain a list of at least one expression. The one I need.
How can I delay my script or force Maya to continue the expression creation so that I can act on the expression?
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To post to this group, send email to python_in...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/f9676b7a-74b4-4522-8cf6-b9ee2cfe553b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
It turns out my approach was flawed. I wanted to get the expression so that I could remove it and replace it. However, since it doesn't exist until the termination of the script, I have just attached my own expression during script run time. Maya never has a chance to connect it's own.
Problem solved. (I suppose, there never really was a problem. Problem...uninvented?)
On Tuesday, October 1, 2013 9:59:12 AM UTC-7, Mark Dietel wrote:
Hey guys,This post isn't python specific, so forgive me if it's misplaced.
I'm having some trouble interacting with an imagePlane after enabling the "useFrameExtension" attribute. Once this attribute is enabled, there should be an expression connected to the imagePlane node. I want to delete that expression in order to create my own key frames. The problem is that when I script these actions the expression doesn't get created until Maya regains control from the script.
For example, if I run this script;
imagePlaneName = "imagePlane1" # assuming this has already been created
cmds.setAttr( "%s.useFrameExtension" % imagePlaneName, 1 )
connected_expressions = cmds.listConnections("%s.frameExtension" % imagePlaneName, source=True, destination=False)
connected_expressions will be empty.I've tried sleeping the script and looping over the listConnections like this
cmds.setAttr( "%s.useFrameExtension" % imagePlaneName, 1 )
while not connected_expressions:
connected_expressions = cmds.listConneuseFrameExtensionctions("%s.frameExtension" % imagePlaneName, source=True, destination=False)
time.sleep(1)
...but neither seems to allow Maya to create the expression. The only thing that seems to work is to stop the script entirely and give control back to Maya. Like this;cmds.setAttr( "%s.useFrameExtension" % imagePlaneName, 1 )
STOP THE SCRIPT
connected_expressions = cmds.listConnections("%s.frameExtension" % imagePlaneName, source=True, destination=False)In this final case, the connected_expressions variable will contain a list of at least one expression. The one I need.
How can I delay my script or force Maya to continue the expression creation so that I can act on the expression?
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To post to this group, send email to python_in...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/7fd3979e-c534-4d1e-b005-26bea42c7163%40googlegroups.com.