Well its fine to say something works, but if its works in direct contradiction to how maya gets it performance its not very sane. You can do this, but its like not brushing your teeth, you will quite likely pay for not understanding it one day. ill post again to explain this later.
i agree this is insanely complex way to do the same thing, but its doing the dg a local favor at expense of memory. The node is very very much much better. Anywya now im doing it the way dg wants things done. its important since DG IS MAYA!
QUOTE(Ptb @ 06/29/07, 07:23 PM) [snapback]268916[/snapback]
And the dublication of the anim curve is no good idea because you loose the keyframe control for the time offset which is very valuable.
Not necessarily, what you do is when you duplicate your node in the scriptjob (monitor the keyframe list), you insert a custom time into it and this custom time itself is derived form your current time fed by plu minus average node. Now thsi si setup heavy way so i dont use it, but its smarter in many ways because it plays ball with the dg in rather nice way.
here let me exemplify this VERY quickly (this si definitely not production ready but exemplifies the idea):
CODE
global proc refreshCrv(string $str){
copyKey -time ":" -float ":" -hierarchy none -controlPoints 0 -shape 1 ("nurbsSphere1."+$str);
pasteKey -option replaceCompletely -copies 1 -connect 1 -timeOffset 0 -floatOffset 0 -valueOffset 0 ("nurbsSphere2."+$str);
}
{
file -f -new;
sphere -p 0 0 0 -ax 0 1 0 -ssw 0 -esw 360 -r 1 -d 3;
sphere -p 0 0 0 -ax 0 1 0 -ssw 0 -esw 360 -r 1 -d 3;
refresh;
currentTime 1;
setKeyframe -breakdown 0 -hierarchy none -controlPoints 0 -shape 0 {"nurbsSphere1"};
currentTime 24;
move -r 0 0 10 nurbsSphere1;
setKeyframe -breakdown 0 -hierarchy none -controlPoints 0 -shape 0 {"nurbsSphere1"};
createNode -n Tz animCurveTL;
connectAttr -f Tz.output nurbsSphere2.tz;
createNode -n Tx animCurveTL;
connectAttr -f Tx.output nurbsSphere2.tx;
createNode -n Ty animCurveTL;
connectAttr -f Ty.output nurbsSphere2.ty;
createNode plusMinusAverage;
connectAttr -f plusMinusAverage1.output1D Tx.input;
connectAttr -f plusMinusAverage1.output1D Ty.input;
connectAttr -f plusMinusAverage1.output1D Tz.input;
//this will control offset its nonkeyable because you
//dont want to automatkcally key thsi but you can still individualy key it
addAttr -ln "offsetTime" -at double |nurbsSphere1;
setAttr -cb true |nurbsSphere1.offsetTime;
connectAttr -f time1.outTime plusMinusAverage1.input1D[0];
connectAttr -f nurbsSphere1.offsetTime plusMinusAverage1.input1D[1];
refreshCrv("tx");
refreshCrv("ty");
refreshCrv("tz");
setAttr "nurbsSphere1.offsetTime" -4;
}
//okay nothing fancy thi will drop out of the effect but wait
//this will hook chanages in curve editor
scriptJob -ac nurbsSphere1_translateZ.a "refreshCrv(\"tz\")";
scriptJob -ac nurbsSphere1_translateX.a "refreshCrv(\"tx\")";
scriptJob -ac nurbsSphere1_translateY.a "refreshCrv(\"ty\")";
now important: i intetionaly left out acting on set key its not hard to add but i got to go... you get the picture. just that i have other things to do and the following luines get a bit trciky (Its not that its 3 lines in fact but i need to insert it quite deep into mayas factory scripts). To get the picture edit the curve in the curve editor and it the child will update on release (you can make it update on drag but thats a api job).
PS you must see the difference in gui actions and nongui actions.
PPS. it is possible to use the api functions to get out the onioning data directly wich makes this faster bt the loop node is better general utility