PDA

View Full Version : Ma.set and Ma.get.. and can you update them to access updated values?



Sculley
12-23-2011, 07:03 AM
I am trying to find out if there are any functions in a motion script that has the same effect as cleanup in other scripts.

Il try to explain, I am using a motion script and then I want to output the objects values, motion,rotation etc having changed them via process.

Im trying to find a way to

process:ma time bla bla
{
run this

ma.get etc
ma.set etc
}

afterprocess:
{
do something after above process is complete.. its this I need an equivalent for.
}

Anyone have any ideas? Im currently using Gizmo as a workaround to do it but obviously its not going to work anytime the interface is not refreshed in Layout such as in render or if display is not set to refresh every frame.

Stephen

xchrisx
12-31-2011, 09:46 PM
maybe i am misunderstanding you but cant you just:

process:ma time bla bla
{
run this

ma.get etc
ma.set etc
afterprocess();
}

evenflcw
01-01-2012, 05:56 AM
I think the issue is that LW will not have been updated to reflect what was put in ma.set() yet. Ie, you cannot read or count on the effects of ma.set() being in place before process() has ended and LW done what it needs to do to update it's internals.

Sculley. I think the workaround you did already is your best bet. It's the most clever and clean. Other options will require more extensive workarounds. Obviously what you want/need to do is catch LW at different stages of evaluation. As I see it you have three stages you can catch - before IK, after IK, and drawing stage. (Possibly another stage aswell through channel mods).

The next best workaround, if you have the option, I think is executing ma.set() before IK and reading it after IK. You might need two motion modifiers for this however (one with AFTERIK flag unset and one with it set)! After that, it's adding a custom object, which will essentially do the same as using the gizmos evaluation pass. After that comes various methods of trying to "cache" and keep track of the effects of ma.set() yourself and calling Refresh() in a very selective manner to force LW to reevaluate until things are updated as you wanted - essentially squeezing more motion evaluation passes into the standard two (beforeIK, afterIK). Obviously this will have negative effect on performance, and high risk of failing, being affected by or affecting other active modifiers negatively.

Sculley
01-01-2012, 06:33 AM
I thought that too when I first tried, but it would only ever return values prior to ma.set, even by accessing the object as an item.getPosition etc. Maybe when I tried I caused something to prevent it.. I'll have to hav a look later and try again. Been to busy to get back on it.

Cheers Evenflcw for your thought, I never thought about the IK system as two different periods to catch... may be usefull at a later date. I think under this circumstance it mat cause issues being tho I set objects rotations and positions for Ma.set I don't create any keys since I write to independent envelopes.. so i can disable the plug. If I had wrote directly to the main channels then ma.get would return the results I require straight away, but because each time the plug loads it runs of the first key created in layout and is not updated for my envelope automatically I had to find a work around... sometimes LScript annoys me.. like limits on embedded data lengths :(

Happy New Year :D