View Full Version : changing an object to another object
Elliotjnewman 07-01-2003, 11:20 PM is there a way to select, say a cube and then a sphere and change the sphere to the cube at the click of a button? (so i dont have to duplicate out the cube and place it in the same place as the sphere and then delete the sphere...)
Ell.
|
|
weedman
07-01-2003, 11:31 PM
that sounds like a custom mel thingy
i guess it would work, just like you said, it would dele obj A and move/dup Obj B to its place.
check on Highend3d.com to see if there is such a MEL that already exist, i haven't encounter one yet
galactor
07-01-2003, 11:41 PM
Do you only want the position to change or also the shape of the object?
Cause if you only want to change the position it would be easy.
:: Galactor ::
misterdi
07-02-2003, 04:54 AM
Not in a single click at first time, you need to create a MEL script for this, then if you store your MEL script in the shelf, you got your right click.
Here is the MEL (for polymesh only and no error trapping and error handling though, it's bare).
//Begin script ------------------------
//get your selections
//1st object is the object to change
//2nd object is the object to change to
string $selections[] = `ls -sl`;
select -cl;
//get the shape nodes
string $firstObj[] = `pickWalk -d down $selections[0]`;
string $scndObj[] = `pickWalk -d down $selections[1]`;
//connect the attribute
connectAttr -f ($scndObj[0] + ".outMesh") ($firstObj[0] + ".inMesh");
//End script ---------------------------
As I said no error checking, no filtering etc, so you need to select exactly 2 polymesh object in sequence, first one change to second one.
Best regards
misterdi
07-02-2003, 04:57 AM
I forgot to mention, that this connection still live until you delete history of the first object.
Which mean if you change the geometry of the second object it will automatically carried over to the first object.
Best regards,
Kaiser_Sose
07-02-2003, 08:16 AM
I think he is referring to replacing an object
For example, in LW you can select an object and replace it with another
Elliotjnewman
07-02-2003, 09:27 AM
OK Cheers guys. Im going to have a look and see if I can get that script to work. Ill keep u posted...
L
MasonDoran
07-02-2003, 10:23 AM
to go into depth of what that script actually does...(you can manually do this in the hypergraph)
every polymesh has a shape node that stores the geometry information: ie: vertices and their cordinates. The script just removes one of the shape nodes and replaces it with the desired shape node. This, in essence is what an instanced object is.
to know whats going...just look in the hypergraph to see the how the shape node is connected.....(connection editor goes into more detail)
CGTalk Moderation
01-15-2006, 01:00 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.