Community
Maya Animation and Rigging
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya animation topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to control curve color using Node Editor

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
gautham.chandran47
3476 Views, 8 Replies

How to control curve color using Node Editor

Is there any way to control a curves color using node editor ? Smiley Frustrated

I know we can change the color using drawing overrides. But how to contol it ? Smiley Sad

My need is I want to make my controller change its color if its value is greater than zero. So it  makes a visual representation of the values I tweaked ( facial UI controls ) Smiley Very Happy

 



Goutham Chandran
Cinematic Animator | Rockstar Games
Linkedin | Instagram | Facebook

8 REPLIES 8
Message 2 of 9

Yes, it is possible to connect to attributes like the override color even though they are not visible by default.

The easiest way is to use MEL:

 

setAttr "myNURBSCurve.overrideEnabled" 1;
connectAttr myControlNode.outColor myNURBSCurve.overrideColorRGB

 

Then you get this:

 

grafik.png

 

You can also RMB on the node with the hidden attributes and "Show all Attributes":

 

grafik.png

 

... and then locate the attribute and connect:

 

grafik.png

 

Message 3 of 9

Thanks for the quick replay, Smiley Very Happy

It worked as you said, but unfortunately I couldn't change the color Smiley Embarassed 

The "myControlNode" you mentioned is a layered texture ? Thats how I connected it.

If else would you please tell me which node is the "myControlNode" ?



Goutham Chandran
Cinematic Animator | Rockstar Games
Linkedin | Instagram | Facebook

Message 4 of 9

I wouldn't take a texture node because how do you then control the color change?

 

For a rig with a certain condition to change the color an expression might be the right way.

 

This example would change the color of the nurbsCircle1 at frame 26:

 

if (frame>25) {

     nurbsCircle1.overrideColorR = 1;

     nurbsCircle1.overrideColorG = 0;

     nurbsCircle1.overrideColorB = 0;

} else {

     nurbsCircle1.overrideColorR = 0;

     nurbsCircle1.overrideColorG = 0;

     nurbsCircle1.overrideColorB = 1;

}

 

You can't enter the expression editor from the Attribute Editor (like with most other attributes), you have to open it and create the expression from scratch.

 

 

Message 5 of 9

unfortunately if doesn't seems working. I now understand i should put a texture node to control curve color, but is there any other node we can use in this situation ? the script is giving me errors. 



Goutham Chandran
Cinematic Animator | Rockstar Games
Linkedin | Instagram | Facebook

Message 6 of 9

Yes, it won't work in the Script Editor.

This example works only in the Expression Editor:

 

Create a NURBS circle.

Set "Enable Overrides" ON and "Color" to "RGB"

 

grafik.png

 

and then in the Expression Editor:

 

grafik.png

Message 7 of 9

I did everything as you mentioned and the expressions didn't give any errors but I cant find the out put. The color is not changing.. Smiley Sad 

Any idea why ?

Could you please post the work file for a reference maybe ?

I dont know what I'm doing wrong. 



Goutham Chandran
Cinematic Animator | Rockstar Games
Linkedin | Instagram | Facebook

Message 8 of 9

When i combined the both methods you mentioned it came out alive Smiley Very Happy...   



Goutham Chandran
Cinematic Animator | Rockstar Games
Linkedin | Instagram | Facebook

Message 9 of 9

Thanks a lot . as you mentioned I created a "layerd textured node" and curve and renamed it accordingly;

 

setAttr "myNURBSCurve.overrideEnabled" 1;
connectAttr myControlNode.outColor myNURBSCurve.overrideColorRGB

 

You were right about using a texture node to control curve color,

so I changed the "color" mode from "index" to "RGB" in the drawing overrides on attribute editor.

And after that I could easily change the color of the curve through the layered texture's properties.

I can even animate it.

 

Screenshot (193).png



Goutham Chandran
Cinematic Animator | Rockstar Games
Linkedin | Instagram | Facebook

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report