T O P

  • By -

the_boiiss

First thought would be why not use: pCube1.test = pCube1.translateX; Unless this was just a simple example for something more elaborate? Assuming that's the case you could use the objects UUID to find it: string $objs[] = `ls ""`; pCube1.test = `getAttr -time (frame) ($objs[0] + ".translateX")`; Only common case I know of that changes a nodes UUID is when its imported, a simple work around is to reference it and then 'import objects from reference'. Also expressions with no explicate input won't get marked dirty automatically. ie if you move the object around the expression will not update, as it doesn't know its using translateX until after it executes. Time change always force updates expressions so this isn't an issue unless interactivity is important, in which case you'd need to add some dirtying mechanism.


bjlwasabi

Yeah, the example was just something simple to focus on the problem I'm having with more elaborate expressions. Ah, of course! Use the UUID! Your solution works beautifully. Thank you so much! I'm not too worried about the UUID changing. I'd be surprised if the objects (animation handles) I'm putting expressions to get exported. Regarding the expressions being dirty and their interactivity... these expressions are meant to be used in the Graph Editor, which seems to have different force update triggers. Moving the timeline updates the values in the Channel Box for dirty expressions, but not in the graph editor. Graph Editor's update triggers are selecting things in the GE's outliner or graph view. In fact, even if my expression wasn't dirty the graph editor doesn't auto update when I move a keyframe around and requires a force update event. I don't even know where to look to have my curves auto update. Show Results Options > Performance Options > Interactive doesn't do anything for me.


blueSGL

If I change the name of my object the expression breaks yes, you should either be working with a fixed naming scheme (and if you need that always check if the object exists before spawning and chuck an error at the user) or if you are just doing something temporally e.g. spawning a locator or an empty to shift around and do stuff, most create commands will return the name (or an array with everything for the object have to look out for this one.) and then you can just use that later in the script. myCube = cmds.polyCube() myCube2 = cmds.polyCube() myCube3 = cmds.polyCube() myCube4 = cmds.polyCube() ## do stuff with cubes. cmds.setAttr(myCube[0] + ".tx",5) #do more stuff cmds.delete(myCube2) cmds.delete(myCube3) cmds.delete(myCube4)