View Full Version : value sharing across two attributes?
04 April 2006, 04:10 AM
Ok I am not sure if this can be done using an expression or using mel or just some type of connection but this is what I would like:
Say I have two objects in a scene and both have an extra attribute called, say "cross". I have a third object in which is controled by these attributes. But here is the catch, I basically want both of the objects with "cross" to share the same value going back and forth.
For example if I change object_A.cross to a value of 5, object_B.cross will change to 5, and same goes in reverse if I change object_B.cross to 10, object_A.cross would then change to 10.
Is this possible without having to copy over the atttribute value with a script. Expressions don't help because then it will just lock off the attribute so I can't change it.
So any help in this concept if its even possible. The reason to do it this way is to keep from having to select a control with this attribute just to change the value when working with another control and vice versa.
thanks in advanced!
04 April 2006, 11:26 AM
unfortunately you can't have bi-driectional connections between two attributes, however you can create a script job on the node's that get run when the attributes change their value.
You may also have to create a scriptNode in your scene so that the scriptJob gets initialised when the scene gets loaded.
04 April 2006, 01:26 PM
Hey dude. Imagine if you have two cubes. pCube1 and pCube2. You can make a simple expression to connect the translateZ of the two cubes, like:
pCube1.translateZ = pCube2.translateZ;
I dont know if Robert was talking of something else. But this is what I understood. Am I right scottiedoo?!?! Did I interpret well your doubt?
04 April 2006, 04:56 PM
thanks for you help guys
Robert Bateman: yeah I thought having a script job run to transfer the values say on when I select an the object it would quickly grab the value from the other object, but that may work if there is a value change that it will update the other object and vice versa, i will have to test that out.
Stucky: no that won't work because if you do have a direct connection in either the expression editor or connection editor, it locks you out from changing that attribute on that object since there is aready something controling it. I need both objects with the attribute to be changable not simply one driving the other
I'll keep that idea in mind Robert, thanks for your help and anyone else who may have another idea, i'll all ears!
04 April 2006, 05:03 PM
Oh I see. You wanna be able to change the values by hand. I said that thing about the expression cause I tested only translating the cube in the viewport, I forgot that part of manual inserting the values.. Sorry dude...But Robert is right. Go ahead with his idea.
04 April 2006, 05:03 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.