View Full Version : what's wrong with the syntax in my expression?
kronique 11-03-2012, 01:54 AM this really simple but i've broken it down several times
i keep getting the same errors "Error: Line 3.125: Invalid use of Maya object "_bn_R_wristB01.rotateZ". //
it actually gives me that error for all the bones im setting ranges for
//r fold if(( _bn_R_elbow01.rotateZ >= 0 && _bn_R_WristB01.rotateZ >= 0) || (_bn_R_elbow01.rotateZ >= -76 && _bn_R_wristB01.rotateZ <= 26)) cluster2Handle.envelope = `smoothstep 0 1 (.5 )`; else cluster2Handle.envelope = 0;
let me know this is confounding!
|
|
kronique
11-03-2012, 01:55 AM
this really simple but i've broken it down several times
i keep getting the same errors "Error: Line 3.125: Invalid use of Maya object "_bn_R_wristB01.rotateZ". //
it actually gives me that error for all the bones im setting ranges for
i dont understand because this is the most basic way to access an attribute for an object?
//r fold
if(( _bn_R_elbow01.rotateZ >= 0 && _bn_R_WristB01.rotateZ >= 0) || (_bn_R_elbow01.rotateZ >= -76 && _bn_R_wristB01.rotateZ <= 26))
cluster2Handle.envelope = `smoothstep 0 1 (.5 )`;
else
cluster2Handle.envelope = 0;
ldunham1
11-03-2012, 02:07 AM
AFAIK you cant use an object's attributes like that.
Instead try using getAttr.
... although I could be wrong...
kronique
11-03-2012, 05:17 AM
AFAIK you cant use an object's attributes like that.
Instead try using getAttr.
... although I could be wrong...
thanks for your reply.
i tried using getAttr and setAttr and got some improvements but i still get this.
// Error: Line 6.51: Invalid use of Maya object "cluster2Handle.envelope". //
//r fold
$elbowRotateZ = `getAttr _bn_R_elbow01.rotate.z`;
$wristRotateZ = `getAttr _bn_R_elbow01.rotate.z`;
if(( $elbowRotateZ >= 0 || $elbowRotateZ >= -76) && ($wristRotateZ >= 0 || $wristRotateZ <= 26))
cluster2Handle.envelope = `smoothstep 0 1 (.5 )`;
else cluster2Handle.envelope = `smoothstep 1 0 (.5)`;
just fyi i tried putting getAttr before cluster2Handle.envelope and this came up
// Error: setAttr cluster2Handle.envelope = `smoothstep 0 1 (.5 )`;
//
// Error: Line 6.35: Syntax error //
// Error: else setAttr cluster2Handle.envelope = `smoothstep 1 0 (.5)`; //
Lets clarify what you are trying to do. Is this an expression (implied by your thread title), or a mel script (or mel code being typed in the mel script editor) ?
Expression syntax is different to mel syntax (although they have similarities).
If it is mel, then remove the equals sign
setAttr cluster2Handle.envelope `smoothstep 0 1 (.5 )`;
David
kronique
11-03-2012, 05:52 AM
Lets clarify what you are trying to do. Is this an expression (implied by your thread title), or a mel script (or mel code being typed in the mel script editor) ?
Expression syntax is different to mel syntax (although they have similarities).
If it is mel, then remove the equals sign
setAttr cluster2Handle.envelope `smoothstep 0 1 (.5 )`;
David
this is an expression.
You do not need setAttr and getAttr in an expression. You can just use the names like in your first post.
For an expression your original syntax looks ok to me.
I copied and pasted your expression into my scene and only changed the names to match objects that I actually had in my scene and it worked correctly.
David
kronique
11-03-2012, 06:40 AM
You do not need setAttr and getAttr in an expression. You can just use the names like in your first post.
For an expression your original syntax looks ok to me.
I copied and pasted your expression into my scene and only changed the names to match objects that I actually had in my scene and it worked correctly.
David
this is so not working for me
i cannot use set driven keys for this either as you cant load cluster envelopes as driven attributes
i should have mentioned i was looking for errors in script editor
when i try to create the expression i not only get errors for the joint names but this as well
// Error: Attribute not found or variable missing '$': cluster2Handle.envelope
kronique
11-03-2012, 07:14 AM
okay turns out this was a bug in maya.
initially i wanted to use set driven keys but i couldn't load the envelope for the cluster.
i'd get an error when i tried to use set driven keys from the attribute editor.
// Attribute name not recognized. //
i tried to connect the envelope to a custom attr and couldnt get it to load in there. i reloaded set driven keys with the cluster and the envelope magically showed up.. so i just achieved what i wanted without an expression:D
what kind of error makes a cluster envelop or an attribute unrecognizable and will it make my rig unstable?? tia
// Error: Attribute not found or variable missing $ cluster2Handle.envelope
This is because the envelope attribute is on the cluster not on the handle transform.
David
Aikiman
11-06-2012, 10:49 PM
Doh! :scream:
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.