Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey Guys,
Im VERY new to MEL-Scripting and I'm trying to do the following in a script:
Before the script:
1. select 1 Object (object1)
2. select a second Object (object2)
The Script:
1.Parent object1 to object2 (so object2 is the parent of object1)
2. Zero Out Transforms (translate+rotate) of object2
3. Unparent object2
My Problem: Parenting and unparenting seems to be working correctly. But my script also sets the values of the Parent to 0, but i only want to set the values of the originally second selected object to 0.
Here is the exact Script I am using:
{
string $nodes[] = `ls -selection`;
parent;
select ($nodes [1])
int $rX = getAttr ($node[1] + ".rotateX")`;
int $rY = getAttr ($node[1] + ".rotateY")`;
int $rZ = getAttr ($node[1] + ".rotateZ")`;
int $tX = getAttr ($node[1] + ".translateX")`;
int $tY = getAttr ($node[1] + ".translateY")`;
int $tZ = getAttr ($node[1] + ".translateZ")`;
setAttr ($node[1] + ".rotateX") ($rX = 0);
setAttr ($node[1] + ".rotateY") ($rY = 0);
setAttr ($node[1] + ".rotateZ") ($rZ = 0);
setAttr ($node[1] + ".translateX") ($tX = 0);
setAttr ($node[1] + ".translateY") ($tY = 0);
setAttr ($node[1] + ".translateZ") ($tZ = 0);
parent -w;
}
Solved! Go to Solution.