Dashboard_avatar
Feb 08, 2010
Post id: 301615 Report Item

Hi there,

I have a question;
is it possible to create an expression which ensures that when the value of a certain channel is < then X a different channel will stay locked.

For example, I have these 2 channels;
    If the 1st channel, called "eyes_digits" (Float: min val 0, max val 10), < 10,
    the second channel called "eyes_expressions" (Enum: 6 possibilities) is locked.

        Else, if channel "eyes_digits" = 10, (or == 10??)
        channel "eyes_expressions" is unlocked.

- I am working in the Expression Editor because I want it to constantly check the 'if statement'.

- I want to use this because the 2nd channel should not be keyable while animating if channel1 is has a lesser value then 10.

My current expression looks like this... It doesn`t update (constantly check) and only works once after 'editing'...
I am a nooby at scripting, it was just an attempt:) here it is;

//Expression Editor Script Example

if (cc_expression01.eyes_digits < 10) {
    setAttr -lock true cc_expression01.
eyes_expressions;
}else{
    setAttr -lock false cc_expression01.
eyes_expressions;
}


If anyone could help me out I would really appreciate it!:)

Thanks in forward,

Mark



Thnkr4twitter
Feb 09, 2010
Post id: 301622 Report Item

Expressions only evaluate when the time changes, or when you edit them. You need to use a scriptJob that triggers when an attribute changes.

global proc myProc() {
    if (`getAttr pCube1.translateX` > 10) {
        setAttr -lock true pCube1.scaleX;
    }
    else {
        setAttr -lock false pCube1.scaleX;
    }
}


scriptJob -ac pCube1.translateX myProc;

Write a Post

You must be logged in to Post

Login at the top of this page, or click here to create an account.

Related Marketplace Items

  • Abrams1

  • Ida-chev-x1

  • Pan2

  • Bed-default-thumb

  • Eros1

  • 1

  • Klcc1_0008

  • Ornmnt_01