hello!!!!
How can i list last changed attribute/s???
suppose i set the value like:
setAttr "lambert2.diffuse" 1;
then what i want is just the attribute name, "diffuse" in the string.
I would greatly appreciate for help.
with thanx!!!!!
hello!!!!
How can i list last changed attribute/s???
suppose i set the value like:
setAttr "lambert2.diffuse" 1;
then what i want is just the attribute name, "diffuse" in the string.
I would greatly appreciate for help.
with thanx!!!!!
Well, elementary you can not do this. That is you can sort of do something like this but its not possible to do so without either lot of luck, or insane preparation beforehand. Theres just no table where this kind of data is stored. Be prepared to redefine your requirements to get something useful done.
It really depends quite much on your scope, What is recent? How much do you want to monitor?
The first thing to do is read your command undo history, unfortunately many times this will not work because the history itself is not in form where you can easily make a 100% record of what happened, without going very very deep into maya. But unfortunately a lot of tools leave no trail so this wouldn't work as a general approach. But a bit depending onw hat you need this might work, and if it does for your special case thsi is easiest in very narrow scope (but don't expect it to work on a real tool that just need to work for every possible user out there)
If you want a more robust feature you can hook up to listen for changes, but then you need to do this before you notice the need to ask. However this will only even remotely practically work if and only if you can somehow narrow down the amount of attributes your listening to. Maya has a the awful tendency to change a lot of attributes when time is changed (yes in a medium scene the amount of attributes that fire is easily in millions), and they all fire at once. Maya doesn't differentiate at this level HOW something changed just that they did, and maya will spam you a lot. This is also technically quite challenging to do so that you don't slow maya down significantly and dont eat all memory up. Also best done in raw C++ also consider making a node. WARNING: Scripjobs don't work whenever a event fires, they work whenever a event fires and maya is NOT updating the DG.
You can use double bookkeeping to snapshot changes. Now this can work with preparation or in conjunction with undo. This is also not practical on every level, so best used only to investigate small changes to certain subsets of all nodes, unless you want to double up maya memory consumption. (tough if you filter out any geometry data attribues it could be manageable). Using with undo is also potenttially very slow and dangerous, but works.
PS: is this some work proposition, if so be prepared to fail. I maen your the 6 guy to try to force this withing 3 months.
Maybe OP is just looking for something simple, like
1
2
3
setAttr "pPlane1.rotateY" 30;
import re;re.split('[\W]+', cmds.undoInfo(q=1,un=1))[2]
# Result: rotateY #
setAttr "pPlane1.rotateY" 30;
import re;re.split('[\W]+', cmds.undoInfo(q=1,un=1))[2]
# Result: rotateY #
Perhaps, however its not as simple as you suppose. Ive disused this problematic in paragraph 3 above. It only works if you can narrow the possibilities of attribute changes down considerably. This might be desirable what he is after but we can not know the question does not enlighten the situation.
Anyway your tactic does not work out very well, as a general solution as nothing says the attribute is simple it might be a compound attribute. It might be a string attribute that has more flags, it might have a namespace etc etc. One has to be a bit careful when showing things that work in a limited scope, people might not realize what the caveat of the solution is and dig their own grave. Since obviously a lot of the stuffs you do in teh gui do not get echoed into undo info. And quite obviously if your trying to limit your attacks on existing singular commnds you might aswell change the source? No? Anyway the example can be made much more robust than that.
PS: thing is its clear that some source is trying to make a macro recorder or repeat last s set on next object of some kind. No this may work for you and me but normal users dont really appreciate tools that for magical reasons don't work out randomly. So much of the desired solution depends on the TARGET audience not the coder per see. If its the coders code for himself only then its another issue.
thankz for ur valuable suggestions...