PDA

View Full Version : Objects rotation


Manta
05-12-2003, 09:51 PM
Hi all,
I'm working in a MEL window for control the Y rotation of some objects using sliders. I know how to control the rotation of one object. How could I control diferent objects in a same window?

Regards

mark_wilkins
05-12-2003, 10:46 PM
Tell me how you're doing it with one object and I'll tell you how you should do something similar with many objects.

-- Mark

Manta
05-13-2003, 12:18 AM
I select the object and use attrFieldSliderGrp at ry

mark_wilkins
05-13-2003, 12:52 AM
Here's one way. The trick is to make a locator node that's driven by the slider, then connect the driven attribute on the locator to all the other rotations:


string $sphereList[5];

string $sphereName[] = `sphere`;
move 0 1 1;
$sphereList[0] = $sphereName[0];

string $sphereName[] = `sphere`;
move 0 1 1;
$sphereList[1] = $sphereName[0];

string $sphereName[] = `sphere`;
move 0 2 2;
$sphereList[2] = $sphereName[0];

string $sphereName[] = `sphere`;
move 0 3 3;
$sphereList[3] = $sphereName[0];

string $sphereName[] = `sphere`;
move 0 4 4;
$sphereList[4] = $sphereName[0];

string $LocName[] = `spaceLocator`;

for ($currSphere in $sphereList) {
connectAttr ($LocName[0] + ".ry") ($currSphere + ".ry");
}

window -title "Attr Field Slider Groups";
columnLayout;
attrFieldSliderGrp -min -10.0 -max 10.0 -at ($LocName[0] + ".ry");
showWindow;

-- Mark

ajk48n
05-13-2003, 06:57 AM
This is sort of a question about the attrFieldGrp. When a vertex is passed to the -attribute, how does it know to connect it to translation.

Is it just because translation is the only attribute on a vertex?

Manta
05-13-2003, 07:35 AM
Thanks for the trick Mark,
All I want to do is 1 window with 1 slider for every object.
Each slider only rotates 1 object. How could I do that?

mark_wilkins
05-13-2003, 05:41 PM
Here's the script that does what you want, Manta. Just call attrFieldSliderGrp repeatedly in a loop while building the window:


string $sphereList[5];

string $sphereName[] = `sphere`;
move 0 1 1;
$sphereList[0] = $sphereName[0];

string $sphereName[] = `sphere`;
move 0 1 1;
$sphereList[1] = $sphereName[0];

string $sphereName[] = `sphere`;
move 0 2 2;
$sphereList[2] = $sphereName[0];

string $sphereName[] = `sphere`;
move 0 3 3;
$sphereList[3] = $sphereName[0];

string $sphereName[] = `sphere`;
move 0 4 4;
$sphereList[4] = $sphereName[0];




window -title "Attr Field Slider Groups";
columnLayout;

for ($currSphere in $sphereList) {
attrFieldSliderGrp -min -10.0 -max 10.0 -at ($currSphere + ".ry");
}

showWindow;

asoka
05-19-2005, 10:07 AM
just i started doing mel

how we can do same thing with while loop or do while

it it's possible

anybody can explain wanna

--------------------------------

CGTalk Moderation
05-19-2005, 10:07 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.