Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

settAttr outside the undo queue on TimeChanged

settAttr outside the undo queue on TimeChanged

AronDurkin
Enthusiast Enthusiast
686 Views
3 Replies
Message 1 of 4

settAttr outside the undo queue on TimeChanged

AronDurkin
Enthusiast
Enthusiast

Hey Folks

 

I've got a scriptNode with "setAttr" on a string attribute in on timeChanged, this is filling up the undoQueue and annoying people. Can I efficiently get it out of the undo stack or set a stringg attr some other way? Genereally I'd like scriptNodes and scriptJobs to not be in the undo stack. 

 

Thanks

0 Likes
Accepted solutions (1)
687 Views
3 Replies
Replies (3)
Message 2 of 4

stuzzz
Collaborator
Collaborator

I believe that the OpenMaya commands have no history record.

The solution would be to use the MPlug class

Here's a C++ snippet, you can switch to python if needed.

MFnDependencyNode plugFn(nodeObj);
MPlug plug = plugFn.findPlug(plugname, false);
plug.setXXX(value);
0 Likes
Message 3 of 4

AronDurkin
Enthusiast
Enthusiast
Accepted solution

thanks, is this preferable / more performant (if called from python API) than putting the setAttr into "eval -ue 0" which I recently tried?

0 Likes
Message 4 of 4

stuzzz
Collaborator
Collaborator

It's a matter of a fraction of microseconds. It won't alter your performance at all.

 

0 Likes