View Full Version : query last command in undo queue


pixlix2
08 August 2007, 01:12 PM
Hello everyone,

I'm trying to find out what command has been executeted last.

lets say I changed an attribute in the attribute editor and maya executes this command:

setAttr "directionalLightShape14.intensity" 1.405;

How can I retrieve this command as a string value so I can work with it in the script?
I tried it with "undoInfo" but it does return nothing at all:

undoInfo -q -undoName;

Any ideas?
Many thanks!

ps.: if this should not be possible, do you see any other approaches... for example could I make a script that is run before an attribute is changed and it monitors which one has been changed...

hibigibees
08 August 2007, 12:23 PM
hi,

it works for me - :)
string $undoName = `undoInfo -q -undoName`;

// Result:setAttr "directionalLightShape1.intensity" 5;//

please check your undo preferences (status and queue size), maybe its set to off or something

for the other idea, you can monitor a given attribute or a set of attributes and monitoring all of them is quite heavy. I mean if you have an expression which says node1.attr = node2.attr; then whenever the node2.attr is changed the node1.attr is updated and you can write something like this in the 2nd line;

if(`getAttr node2.attr` > 5) setAttr node2.attr 4.5;

by this you are restricting the user from manipulating attributes futher ... but there are other approches to limit attributes (the inbuilt one is only for TRS)...

you can build custom UI in mel and when a node is selected you can fire a UI through a script job for changing attributes - which will have only limited range to set values.

or you can run a script using 'idle event' in scriptjob to check for values and change them to something else, which the user might not like it or it might be heavy if not killed properly later...

reg, sriram

pixlix2
08 August 2007, 12:48 PM
thanks for your detailed answer... the thing is I would have to monitor ALL attributes which would be too heavy, I guess.
I want to write something like an extension for the attribute editor so that you can change attributes for all selected objects simultaniously without using the ugly, cluttery spreadsheet or making attributes keyable so they show up in the channelbox.

OK, so that what i found out now, it really frustrating for me:

undoInfo will ONLY work if you use the channelbox to change the attributes AND you have to type in the value, so you can't use the virtual sliders (and here again is an exeption for the transform parameters, because the virtual slider trigers the move/rotate/scale commands instead of using setAttr-statements)

Arrrrghhh... and I really need to know which parameter has been changed in the AttributeEditor!!!

CGTalk Moderation
08 August 2007, 12:48 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.


1