PDA

View Full Version : Please point me in the right direction :/


Diancoff
04-06-2009, 09:42 AM
Since I didn't see any threads like "What is MEL" or "What's Python" I decided to ask here. Sure I can google those, but I have another question. Is there a way to write a code that applies to the entire scene, at all times? I mean so you don't have to manually execute that script.

Here's an example. I have a cube and it's transform.Y is equal to the transform.Y of another cube. But

if (cube1.transform.Y >= 100) cube1.transform.Y = 100;

So no matter what I do I want the cube1's maximum Y coord to be no greater than 100. So where should I code that?

I'm doing a project with lots of mechanic stuff and moving parts and I would really like to code each one of them to move exactly how I want it. Much easier than animating them manually.

Any help will be appreciated :thumbsup:
Cheers!

Robert Bateman
04-06-2009, 11:22 AM
if (cube1.transform.Y >= 100) cube1.transform.Y = 100;

The above code is a bad way of creating a limit. Select the node, and have a look in the attribute editor. Make sure you are looking at the nodes transform (and not the shape). Open the "Limit Information" -> "Translate" section. Check the box next to Max Y, and type in the value 100.

Diancoff
04-06-2009, 11:26 AM
Yes, thanks for that tip. But that was just an example about what kind of code I want to implement in my scene. Say I want a more complex limitation, including many "if" statements, something like that. I understand I can't write "if" statements in the expression editor, so where should I code that?

I hope you got me right.
Cheers!

Robert Bateman
04-06-2009, 11:36 AM
Condition, +/- Average, Array Mapper, Distance Between, Multiply/Divide, Blend Colors, Clamp, Single to Quad Switch, and a whole host or other nodes allow you to create complex character rigs. The idea behind Maya is to fundamentally avoid expressions and all explicit coding like the plague, and instead use the DG (which is after all a data driven visual programming framework). There's never any need to write expressions, or infact hard code anything in maya. The DG can do it all for you.

Cheesestraws
04-06-2009, 11:44 AM
There's never any need to write expressions

Except with particles. :sad:

Diancoff
04-06-2009, 11:51 AM
Sorry for the dumb question, but I'm a mover from Max. What is DG? :bowdown:

Robert Bateman
04-06-2009, 12:04 PM
The Dependency-Graph. It's the core fundamental philosophy behind Maya. Take a look at the HyperShade, or the HyperGraph. The act of making connections creates dependencies between attributes so that X is updated when Y changes. There are nodes that do if statements, so it's just a case of setting up the correct connections in the hypergraph/hypershade.

CGTalk Moderation
04-06-2009, 12:04 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.