Hi - I'm trying to build an expression to drive semi-configurable noise on a large number of groups. Each group that will be driven by the expression will have a parent controller object which will have the attributes for things like the noise amount and noise frequency that are used int the noise calculation. In addition, I want to have a global noise value/frequency on the root node so that noise-driven nodes can provide an override value or, if a "useGlobalNoise" boolean is true, look at the attributes on the root node.
My question is how to reference parent nodes and the root node of the expression-driven group's heirarchy.
I see there's a listRelatives command that I would think should be able to let me use this expression on multiple things, each of which would look at their corresponding parent node for attributes as well as the root node.
However, I keep getting syntax errors as I'm new to MEL.
Can anyone help unravel this code to help me understand what I'm doing wrong?
My goal is to define this expression once so I can re-use it throughout my various assets that have animation rig. I'm used to JS/Actionscript syntax so I may be doing stupid Noob stuff with variable declarations or referencing.
string $myParent = 'listRelatives -p';
string $roots[] = ls -assemblies
;
string $myRoot = $roots[0];
float $noiseValue;
if ($myParent.useGlobalNoise){
$noiseValue = $myRoot.noiseAmount*($myRoot.noiseFrequency*time);
}else if($myParent.noiseAmount >0){
$noiseValue = $myParent.noiseAmount*($myParent.noiseFrequency*time);
}else {
$noiseValue = 0;
}
rotateZ = $noiseValue;