PDA

View Full Version : Expression Nodes realtime evaluation


wajdyf
05-01-2006, 10:30 AM
Hello,

I am facing a problem with expression node evaluation .
a simple expression like pSphere1.tx=pCube1.tx; will evaluate real time (no problem)
bearing in mind that the "Evalution" drop down menu is set to "Always".

but an expression like :

float $x1[]=`xform -q -ws -t curve1.cv[6]`;
float $x2[]=`xform -q -ws -t curve2.cv[6]`;

float $xf[];
$xf[0]=($x1[0]-$x2[0])*0.5+$x2[0];
$xf[1]=($x1[1]-$x2[1])*0.5+$x2[1];
$xf[2]=($x1[2]-$x2[2])*0.5+$x2[2];


pSphere1.translateX=$xf[0];
pSphere1.translateY=$xf[1];
pSphere1.translateZ=$xf[2];


which is also not that complex , and is connected to an attribute or in this case multiple attrs, will not evaluate untill the time have changed , (scrubing).

MY Question: How do I make my expression nodes evaluate realtime, regardless of their content.
something a bit more stable than scriptJob.

Thank You

AndersEgleus
05-01-2006, 10:18 PM
Since your sphere's translation is dependent on the evaluation of a mel command, the expression doesn't "know" of this dependancy. For an expression to know of a dependency, both the inputs and outputs must be established using "true" connections (e.g. sphere1.tx = cube1.tx; or float $tx = cube1.tx; sphere1.tx = $tx;). I'm guessing your expression is setup the way it is because you want visual feedback on both the curve and the sphere. You could easily get the same result by creating a cluster for each of the cv:s you want to manipulate, then one group for each cluster, which you snap to the cluster and then parent the cluster to (since clusters are created at 0 0 0 in worldspace), then connect the translation of the groups to the expression like so:$null1X = null1.tx;
$null1Y = null1.ty;
$null1Z = null1.tz;

$null2X = null2.tx;
$null2Y = null2.ty;
$null2Z = null2.tz;

pSphere1.translateX = ($null1X - $null2X)*0.5+$null2X;
pSphere1.translateY = ($null1Y - $null2Y)*0.5+$null2Y;
pSphere1.translateZ = ($null1Z - $null2Z)*0.5+$null2Z;That should make the dependencies work and give you realtime update.

CGTalk Moderation
05-01-2006, 10:18 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.