View Full Version : instance translate nodes between objects?
marktsang 01-24-2010, 07:51 PM hi,
i am from a 3ds max background and i just started using maya. in max you have controllers the control the transform of objects - with these you can INSTANCE the controller to multiple objects - this means that if you affect the transform on one ojbject it affects them all the same - so if you move one on the x axis they all move on the x axis.
now in maya there is not this concept - i can connect all the x translate nodes but then only one object can be manipulated to control them all --
is there a way in maya to instance translate nodes??
thanks
mark
|
|
Darksuit
01-25-2010, 10:37 PM
you can actually do this a number of ways.
1. You can group all objects so that you move the one group you move everything.
2. You can parent constrain the objects to one master object with maintain offset on. This will move everything together at the same time.
3. if you parent ("shift+p") the other objects to the one object you will get the same.
4. when creating the object you can use the Duplicate Special (instance) which will create an instanced copy of the object that will mimic the behavior of the original.
There are also expressions that will replicate this effect as well. We (as a community) might be bale to offer more specific advice if we know what the end goal is that you are attempting to achieve. Is this a modeling method that your trying to repilcate or animation?
There may be better solutions that we know of to help you achieve what you need to do. =)
Chinwagon
01-25-2010, 11:29 PM
Funny. This reminds me of when I first started learning maya and I would go around to all the other people I was working with and ask if this could be done. They all looked at me like I was speaking a foreign language.
Maya doesn't really have the concept of instancing in the way max users know it. You can instance shapes but not transforms. The whole thing with maya is that everything is designed to work in a downstream pipe. One input to multiple outputs. It's a very powerful workflow once you realise that all of the nodes maya has work as a giant toolbox to create extremely powerful and complex effects. However, max's instancing goes against this concept as more than one object affects the input of what in your case is a transform value.
The short answer is "not really". The closest I've come is that you can connect the output of an animCurve node to more than one object's attributes. This allows you to have the same animation on two objects and you can adjust that animation by adjusting any of the connected objects. BUT only one object will update when you adjust it. You'll need to scrub the timeslider to see the result on all of them. Secondly, if you delete the animation from any of the connected objects, you delete the animCurve and break the connection.
If I knew how to write plugins, I'd love to write a value instancer as I do miss this feature from max. It'd be nice to have something like an IK blend attribute be on both IK and FK controls and have it adjust the one value. The animCurve node shows that this sort of upstream input thing can be done in maya, it just needs to be a proper node that doesn't delete itself when the animation is deleted.
Good luck and welcome to the red side.
:¬)
marktsang
01-26-2010, 12:05 AM
Hi guys
thanks for the replies.
Darksuit: thanks for the suggestions unfortunately my issue is different to this
brad: Bingo! That's exactly what I found out. I was hoping I could upate object that's not moved somehow but I guess not
finding Maya different that's for sure, some things better some things worse!
Thanks for taking the time guys
mark
gonzalimator
01-26-2010, 12:21 AM
It'd be nice to have something like an IK blend attribute be on both IK and FK controls and have it adjust the one value.
@Chinwagon: This can be done using an instance duplicated shape. We had this feature on our rigs on Zeke's Pad so that if we had any control selected for say an arm , the IK FK blend would always be available on the shape node. Paxton Gerrish was the lead character TD and he has included this feature on his Paxton's Rig (http://www.creativecrash.com/maya/downloads/character-rigs/c/paxton-s-rig).
If you create an object and add your FK IK blend attribute to its shape, then instance duplicate it as many times as you have relevant controllers, all you then do is parent this shape to all of your controllers (don't forget to turn off its visibility). Now it doesn't matter which control you have selected when you want to access this attribute. Obviously any attributes you want to "spread around" can be added to the same shape node and it immediately propagates to all of the instances.
Darksuit
01-26-2010, 05:21 AM
@Marktsang
The thing is that there is a lot that Maya can do it can just do it in a lot of different ways. The way to think about doing something in maya I have found that helps me out more than anything is to figure out what the end goal is and not to get hung up on just one way of doing something.
Describe what the actual end goal is that your trying to achieve.
@Chinwagon this is true except in the case of expressions. Since expressions have no defined order of operation they update on the fly. So you do not have to scru the timeline to see them work.
There is very little in Maya you can't do, you just need to know what the end result is that you are attempting to achieve and there is more than likely more than one way to get there.
A good example of the updating on the fly expression is the makeRoll command. If you keep move the timeline to a number greater than 1 the ball will start to free roll and update when it is moved.
marktsang
01-26-2010, 09:37 AM
thanks for replies
@darksuit
a simple expample of what i want to achieve:
say you have 2 loctors locator1 and locator2 - now i want to have it so that when i move locator1 on its z axis that locator2 moves the same on its z axis, but i also want to be able to move locator2 on its z axis (and when i do locator1 will move the same on its z axis) the other two axis should remain independent.
i want this all to update realtime in the viewport while i am manipulating it without the need to scrub the timeline to force an update (for the object that wasnt manipulated)
does that make sense?
thanks,
mark
Darksuit
01-26-2010, 01:34 PM
you would do that with an expression in both of the locators... I don't quite have the time here this morning to write that out. The biggest trick to watch out for when doing this is to make sure that you don't fall into a cyclic loop. You can certainly query the expression and mel scripting forum about this.
You can't achieve this effect with nodes since they have a defined order of operation. Expressions would be the primary way to achieve it.
At first glance you would need to create an attribute that would hold the expression and the modified distance. Then you need the expression to check to see which attribute moved in which direction You could use the one attribute to cover all three directons. I'd most likely start with something that started out like the makeRoll expression. But it can be done, it just a matter of thinking about it. Once its done, you can script it into a button to apply to any object, much like max, but more effiencent.
marktsang
01-26-2010, 05:51 PM
hi
@darksuit
but if i use an expression on the z axis translate , the channel is locked an cannot be manipulated?
cheers
mark
Darksuit
01-26-2010, 05:54 PM
No you'd create the expression on a seperate attribute that would enhance the Z or any axis. you could theorically use it to drive the rotation as well...
take some time and look up the makeRoll command in the maya MEL reference.
Darksuit
01-26-2010, 09:25 PM
oh I just did a test and Maya's instances does work this way, you just have to remember how.. =)
So here is the test scenerio.
I create a polygon piece of Geo... lets Say a Cube. It works for a nice simple test (simple and small scale tests work best)
Second I use Duplicate special to Create (lets say 4 ) some cubes. I make sure when duplicating special I want to have instance checked.
I then select each object in "Object" mode (then mode type makes a big difference) and postion the cubes randomly (remember this is a test so I want to have controlled varibles).
Now I can see that each cube can move all by itself without interacting or effecting another cube. When I switch to "Component" Mode and select the cubes Vertices all of the instanced Geo will select the same vertex locations and it will mimic all rotations, scales, translates and geometry deformations. Remember this only happens in Vertex / "Component" Mode.
Chinwagon
01-26-2010, 10:35 PM
Yeah, but what you're doing is instancing the shape nodes. Mark needs the transform nodes instanced. And yes, if you connect the output of an expression to a transform attribute, it is locked just like connecting any other nodes output to it.
Another solution may be to have a script job that resides in your scene that says that when you adjust the transform values of one object, copy those transform values to the other and vice versa. It's a little ugly but it'll work. Unfortunately, there isn't a solution as simple and efficient as how max allows you to do it.
My recommendation would be take a look at why you actually need them to be instanced. Do they really need to be controlled as two or more individual objects or would it be a better workaround to change things so that there is one controlling object affecting a bunch of others? This is the way it's normally done in maya and how most maya users expect things to work.
Sorry, it's a bit of cop out but I must say, I don't really feel the need for instancing transforms any more now that I know it's not easily done and there are alternatives that can be just as good - if not better.
I'd still like that plugin though!
:¬)
Darksuit
01-27-2010, 05:12 AM
@Chinwagon
actually they would only be locked if you drive the expression from the attribute itself, if you run the expression off the attribute in a false attribute whose only goal in life would be to hold the expression you can modify all normal tranforms...
go take a look at the makeRoll command. The Expression resides int eh Translate Y but it doesn't have to. It can reside in a number of places. The Expression specifically locks the Y translate. But does not lock the rotate of X Y or Z which is it modifiying actively on the fly. If fact you can modify the rotation manually then grab the translate to keep rolling the ball.
So you statement is not correct. Feel Free to conduct the expreiment yourself.
Remember that pretty much anything can be done in Maya it just takes some planning and thought.
Chinwagon
01-27-2010, 11:21 AM
I think we're coming to the same solution (well, I may be coming more towards yours, who knows).
You're right about the expression but what it's doing is basically a setAttr at the current time which would be what a script job would do.
I wouldn't say that the statement of "if you connect the output of an expression to a transform attribute, it is locked..." is incorrect; maybe just lacking a clearer explanation. It depends on how you output that transform from the expression.
If you write "blahBlah.translateY = $variable" then it will be locked.
If you write "setAttr blahBlah.translateY $variable" it won't.
An expression is very similar to a script node in that they both hold a bunch of code. You can have that code run when it detects the change of an attribute (eg. when the translateX of one object changes, copy that translateX value to the other object). It's kind of like a script controller in max but you can be more specific about when it gets evaluated.
:¬)
marktsang
01-27-2010, 11:43 AM
Hi guys,
thanks to you both on the explainations
I will check this out
thanks
mark
Darksuit
01-27-2010, 01:09 PM
the difference your missing is that a scriptjob has a defined order of operation, while an expression does not. What this means is that a expression can update in realtime. It is the one and maybe only time I would use an expression to solve an issue.
Marien
03-03-2010, 04:45 PM
Hi everyone
I encountered this issue and found this thread which is relevant, so I'm posting here...
I think I have instanced Transform Nodes in a scene. In this image, I have two standard instances on the right, the Shape is connected to a Shading Group, no problem. On the right, all those Transforms share the same Shape, but they are also themselves purpled out like instances. And when I do move them around, simply translating, so simply modifying the Transforms, they do follow each other across the scene mirroredly (they are symmetrical).
That's very useful, problem is, I have no idea how I did that... I know I didn't use MEL.
http://img687.imageshack.us/img687/7973/dryd.th.jpg (http://img687.imageshack.us/i/dryd.jpg/)
Also while researching about that I found this page, which says Transform Nodes can indeed be instanced : http://caad.arch.ethz.ch/info/maya/manual/DevKit/PlugInsAPI/PlugInsDAGhierarchy.doc.html
I tried the options in Duplicate Special but couldn't reproduce it...
Darksuit
03-03-2010, 05:57 PM
if you put you mouse of the Purple arrows it will show you what nodes you are connected to. Also you can select the object, open the hypershader and show the inputs and outputs of the object and it should show you all the connections. Then it's only a matter of looking to see how they are conencted (mouse over the arrows.)
Marien
03-03-2010, 06:21 PM
if you put you mouse of the Purple arrows it will show you what nodes you are connected to. Also you can select the object, open the hypershader and show the inputs and outputs of the object and it should show you all the connections. Then it's only a matter of looking to see how they are conencted (mouse over the arrows.)
The relationships between Transform and Shape nodes, thus the instances, are not displayed as connections in the *graph Editors. The connections here are from the Shape Nodes to their Shading Group, for rendering. (first pic)
There is a little line in the Hypergraph in Hierarchy mode though (second pic), I didn't think about looking here...
http://img535.imageshack.us/img535/110/xdg.th.jpg (http://img535.imageshack.us/i/xdg.jpg/)
Okay I just got it. I actually grouped the objects and instanced the group... That way you are able to move the objects themselves around on their Transform level and the translations are applied to the instances as well, with whatever symmetry you want specified on the group created as an instance. Guess I should've searched harder. But I think that's what OP wanted, no ?... It's pretty easy that way.
theflash
03-05-2010, 10:28 AM
@Chinwagon this is true except in the case of expressions. Since expressions have no defined order of operation they update on the fly. So you do not have to scru the timeline to see them work.
There is very little in Maya you can't do, you just need to know what the end result is that you are attempting to achieve and there is more than likely more than one way to get there.
A good example of the updating on the fly expression is the makeRoll command. If you keep move the timeline to a number greater than 1 the ball will start to free roll and update when it is moved.
Expression node is not really special except that it can execute mel commands, esp setAttr. Expression node will be evaluated if time changes or one of its inputs changes (On Demand for input changes and Always is for time+inputs). Expression takes an array of inputs (based on assignment lines, e.g. $var = $pSphere1.tx ), executes given mel code and gives output in output[] array (based on assignments). So the expression node is evaluated similar to the normal nodes, i.e. when input plugs are marked dirty and if output calculation is required. You can actually use .I[0] .I[1]... for inputs and .O[0] .O[1] .... for outputs and expression will replace them by connected attribute if any.
If you need bidirectionality on translation you can connect obj1.translate to obj2Grp.translate and obj2.translate to obj1Grp.translate. This only works in local space, not in worldspace. So be careful about that.
theflash
03-05-2010, 10:56 AM
To make a transform node instance just group the transform node and create instance duplicate of that group node. However, only one transform exists even if it shows two copies. Any change to transform node reflects on all instances. And if you try to parent it to world it will create a new transform node on top to keep instances separate.
CGTalk Moderation
03-05-2010, 10:56 AM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.