Linking A Custom Attribute to Another Custom Attribute

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  11 November 2005
Linking A Custom Attribute to Another Custom Attribute

Hi guys, long time reader first time poster. I have a pair of eyes with a modeled pupil, iris etc. Now I wanted to control the size of the pupil with a linked xform parented to a point helper, but this didn't work out. I then decided to use an xform modifier on the faces that built up the pupil and control the gizmo's scale with a wired parameter...needless to say I spent several hours trying to figure out a way of manipulating the gizmo's scale....it didn't work so after searching through the modifiers I thought it would be easier to use the Squeeze modifier and control the squeeze amount with a parameter wired to the point helpers custom attribute.

I've done this for both eyes pupils (left eye/squeeze amount ->Ctrl_Both_Eyes/Left_Pupil and right eye/squeeze amount ->Ctrl_Both_Eyes/Right_Pupil) But I want to be able to control both pupils at the same time aswell, so I added another custom attribute to the Ctrl_Both_Eyes helper but can't figure out how to connect both Left_Pupil and Right_Pupil to Both_Pupils without voiding their previous wirings.

For instance after I wired each eyes pupils, I wired both_Pupils to Left_Pupil and then repeated the process and wired it to Right_Pupil. Now when the slider for both_Pupils is moved...then both pupils contract and expand...but if Left_Pupils or Right_Pupils sliders are manipulated nothing happens as they have been overwritten by the previous wirings....hope that makes sense


So bottom line is. How do you wire one custom attribute to control another but still have it's dependancy. like a parent-child setup with two bones. you can move the child seperatly but if you move the parent then both move. I'd like one controller to be able to be controlled by the other but still be independant.
 
  12 December 2005
Just posting because I've left this thread for a while and no-one has replied. Does anyone have a clue how to solve my problem? It's cropped up again as I have created a a distal, middle, primal and curl attribute on a dummy which controls a finger. now the distal, primary and middle fingers work fine, but I want to link the curl attribute to control the rotations of the distal, middle, and primary joints altogether without using the parameter collector.

It may seem trivial...but I like to have all my controls on the dummy helper as it just save time in the short and long run and is neater. Does anyone know how to solve this...or at least write some sort of script where I can control an attribute with another attribute on the same helper?
 
  12 December 2005
Just a quick post before I leave..

Generally I have found that a little bit of max scripting goes a long way and is simpler to use than the wire parameters dialog. Have a look at the Max reference and Max script reference on 'script controllers'. (Although I have to say that this might be the one area where the max help isn't that good.)

The script controller is a fantastically powerful tool once you get to grips with it so I recommend learning it.

If you want I try and post an example tomorrow morning (I’m in the UK)

good luck
__________________
ken

my articles and MAXScripts... www.designimage.co.uk
 
  12 December 2005
How's it going Nefertari? Have you figured out a solution?
__________________
ken

my articles and MAXScripts... www.designimage.co.uk
 
  12 December 2005
Unfortunately, this can't be done through the custom attributes editor.

Here's an example which creates a new custom attribute using maxscript. It has two spinners "Left" and "Right" and a checkbox to link the spinners. The CA is applied to the selected object (see bottom of script).

Cheers,
Martijn
Attached Files
File Type: txt ca_with_linked_spinners.ms.txt (910 Bytes, 30 views)
 
  12 December 2005
cant you for each ca eg left pupil/right pupil make it a bezier float then add a float list controller on it. Wire it in the first slot then in the available add say a bezier float set that to active.

Its like constraining a point to another point with a pos constraint, but in the available slot add a bezier float so you can still move it around, as well as its being contstrained. So why cant it be done with a ca slider?

Also the way i do iris changes is by wireing the uv coardinates of the iris material to a slider. So essentially it stretches by creating more black.

eek
__________________
Disclaimer: My opinions are not those of my employer.



Last edited by eek : 12 December 2005 at 07:03 AM.
 
  02 February 2006
Hi, sorry I stopped monitoring this post because no one replied, I just so happened to come across it again and noticed there were some responses.

thanks for them by the by. I did look through the max script tutorials and references...but they are rubbish. Unfortunately for someone like me who isn't used to Max's syntax of programming, there really needs to be more info and examples on each function you know?


I do however think you are right in saying that doing this with a wired parameter custom attribute is not the way to go about it. I've finally realised that WP's are just a really bad way to do anything...I mean for something that reset's itself when the syntax is wrong causing you to update every second to save your hard earned typing is just bad programming.


I still personally haven't found out a way of doing this, but I'd imagine that if someone did it would be a very useful tool for rigging. I asked my tutor at uni and he seemed as dumbfounded as me, he said it would have to be done with some form of script....which I have no problem with, I just wouldn't know where to start.
 
  02 February 2006
here you go

The eyeballs are animated using two slider manipulators.
one for dilation and one for balance.

To look at the script contoller open the dope sheet, navigate to an eye, then
-modified object-morpher-[1]line02- and right click to get the tracks properties.

the 'DependsOn' tells the script controller what objects in the scene to use.

The value of the final equation is passed to the morph target controller.
__________________
ken

my articles and MAXScripts... www.designimage.co.uk
 
  02 February 2006
Quote: So bottom line is. How do you wire one custom attribute to control another but still have it's dependancy. like a parent-child setup with two bones. you can move the child seperatly but if you move the parent then both move. I'd like one controller to be able to be controlled by the other but still be independant.


Id look at list_controllers.

Ken T,

Theres some oddness going on with the balance slider, when going from left to right. The eyes dilate weirdly.

You have one slider driving the size of the dillation right? This dillation being a morph target. And im guessing you have each eye treat this eye as a morph, like the value of a morph driving a morph?

So:

eye 1 is a morpher with a target: dillated



eye 2,3 use eye 1 as a morph with update always on. Then you just drive these two morphs with a simple slider. controller.weight[1] = slider1 etc etc

eek
__________________
Disclaimer: My opinions are not those of my employer.


 
  02 February 2006
Yes the sliders do behave a bit weirdly. It was ment help to get Nefertari started with script controllers......

I just realised that because i use dual montiors you guys might not of been able to find the script controller code (because it would of appeared off screen). I'll upload a new version of the file to fix this...

The script controller for the left eye looks like this:


dependsOn $SliderDilate $sliderbalance

Dilate = $SliderDilate.value
Balance = $sliderbalance.value
(1-Dilate) *100*(1-abs(balance)) + ((1-Balance) * 50)*(abs(balance))


The script controller for the Right eye looks like this:


dependsOn $SliderDilate $sliderbalance

Dilate = $SliderDilate.value
Balance = $sliderbalance.value
(1-Dilate) *100*(1-abs(balance)) + ((1+Balance) * 50)*(abs(balance))



There is no value of a morph driving a morph. Each eye calculates the value of its morph channel directly from the code above. (you could delete the morph target line02 and it would all still work).

You could do all this with list controllers ..... But some rigging problems can only be solved with script controllers so it worth learning them if you have the time....

Having said that I guess i should of spent more time writing a nicer example function.
I 'll see what i can do tonight to make it smoother.
Attached Files
File Type: zip EyeScriptController.zip (39.7 KB, 4 views)
__________________
ken

my articles and MAXScripts... www.designimage.co.uk

Last edited by Kenzor : 02 February 2006 at 12:23 AM.
 
  02 February 2006
Smooth gamma curve style control

Ok I've updated the script controllers to give a smooth curve, and it should be much nicer to use.Balance now contols the balance of a gamma curve.

The left Eye script looks like..

dependsOn $SliderDilate $sliderbalance

x = 1 - $SliderDilate.value
b = $sliderbalance.value

(b*x*x + (1-b)*x)*100

The Right Eye script is the same except

b = -$sliderbalance.value



Have a go...
Attached Files
File Type: zip EyeScriptController01.zip (39.7 KB, 16 views)
__________________
ken

my articles and MAXScripts... www.designimage.co.uk
 
  02 February 2006
Originally Posted by ken T: Ok I've updated the script controllers to give a smooth curve, and it should be much nicer to use.Balance now contols the balance of a gamma curve.

The left Eye script looks like..

dependsOn $SliderDilate $sliderbalance

x = 1 - $SliderDilate.value
b = $sliderbalance.value

(b*x*x + (1-b)*x)*100

The Right Eye script is the same except

b = -$sliderbalance.value



Have a go...


Interesting, this is a gamma function you say. Hmmm ill have to look into this. Is this similair to exponential ramp: n^2.618?



eek
__________________
Disclaimer: My opinions are not those of my employer.


 
  02 February 2006
To be precise it’s a 2nd order approximation of a gamma curve. A friend of mine did the math to derive the approximation so I can’t claim credit for that.

In my code the gamma value is (1+balance)/2.

It’s loses accuracy when compared to a real gamma curve when ‘balance’ is close to +1 or –1. But mostly we want something that ‘feels right’ and runs fast, so that’s usually fine.

I'm not familiar with an exponential ramp: n^2.618. Could you give me an example eek?
__________________
ken

my articles and MAXScripts... www.designimage.co.uk
 
  02 February 2006
Hey Ken it looks much like a bezier curve what you have there. Interesting way of dealing with it. Thanks for sharing.
__________________
Paul Neale
http://paulneale.com
 
  02 February 2006
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 12:55 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.