I'm not sure what you are aiming to do after you get connected_expressions set. It is likely that the node attribute change has not yet been computed by maya.
I'd have to kick the tires a bit, but I imagine you could change the way you are wiring things up to get the data you need. Another option might be running cmds.evalDeferred(). This would probably cause some confusion in the way that your code is written. It would also mean that the code may not execute when you expect. On Tue, Oct 1, 2013 at 9:59 AM, Mark Dietel <[email protected]> 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.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 [email protected]. > To post to this group, send email to [email protected]. > 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. > -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CANESWi0GKT956xmrv_whf%3DhL4SZN2oT0uHMON3UWFAanWw%3DqDw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
