>: CG Forums on 3dtotal - The best forums for CG artists :.
threedy forums home
 


top-table-gradient
Go Back   3DTotal Forums > Archives > Archives > Scripting & coding
bottom-table-gradient

Reply
 
Thread Tools Display Modes
Old 25-02-2005, 06:35 PM   #1
artoon
Registered User
 
Join Date: Jun 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
(Maya) Connection via expressions

Hi, I am using maya and I don't know much about mel.

I'll give you an example to show what I want to know.

Say I have a cube and a sphere (polys). I created a new attribute for the cube called "Spin" and I want to control the rotation Y of the sphere.
So far so good, all I have to do is open de connection editor and make the connections (or the expression editor - pSphere1.rotatey = pCube1.spin ).

But, I set the min value of the "Spin" to -10 and the max to 10 with defalt 0. If I connect them with those values, the sphere will rotate only 10 degrees in Y in both directions.

What I want to know is: what I have to type in the expression editor to connect the min value of the sphere (-360 degrees) to the min of the "Spin" value (-10) and the positive values as well (360 = 10) and when I scrub the "Spin" value to 10, the sphere rotates its max value (360).

Thanks in advance,

Artur
artoon is offline   Reply With Quote
Old 09-03-2005, 09:38 PM   #2
Black
Unpopular
 
Join Date: Oct 2004
Posts: 1,579
Thanks: 0
Thanked 0 Times in 0 Posts
Artoon;
This may sound a bit too simple... but if I got your wuestion right.. leave the expression editor aside and do it with SetDrivenKeys!

The thing about expresions are they are aLWAYS active and if you have some they are good.. but if you have ALOT of them they are VERY effective in slowing down your scene.
How it works is.. MaYA see's that this scene has an expression. Reads it.. and evaluates the conditions needed to excecute it. So it scans through the whole scene to se if the conditions are met or not.

You do the math!


Well there are alternatives to expressions in many cases. So get yourself used to finding them.
Like in your situation.. just make the one you would like to push and tug the driver and have the other your driven.
if you set key to pSphere1.rotatey=360 with pCube1.spin=10
or likewise;
pSphere1.rotatey=0 with pCube1.spin=-10
This would also get you clean inbetween tweens.

Just let me know if you haven't used SetDrivenKeys before... OR if I totally misundersttod the question.. let me know.

Black

Ps; Another advice is to avoid numbers like '-360' or '-180' in Mel. Preffer to find ways around it to get it to '0' or '180'. Oddly with 90 it's not exactly the same thing.. or to any agnl up to 180...
__________________
"I refuse to allow a disability to determine how I live my life.
I don't mean to be reckless, but setting a goal that seems a bit daunting actually is very helpful toward recovery,...
"

Christopher Reeve

25 September 1952-10 October 2004
Black is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 08:50 AM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
all images displayed on this site are copyright the original artists and may not be reproduced, copied or published elsewhere without their express permission