Lost Adventurer, Aleks Kirilenko (3D)
LC #42 Pipers Alley

View Full Version : Getting Parent Nodes

05-27-2003, 08:17 PM
ARGH! Computer ATE my original post!! :thumbsdow

Oh well, here in an abreviated form, is my question:

I have a list of nonLinear deforms, in this case ONLY bends:
$t = `ls -et nonLinear`;
Now, I want to change change the curvature attribute once I've gotten into a for loop and picked out a bend. How do I access with MEL the shapeNode of an object? And because I suspect they may not be the same question, how do you access an inputNode in general of any sort from a base node?
Sitting here typing makes me suspect you select the bend individually and then.... right, a command I don't know... Any help appreciated!!


05-27-2003, 08:57 PM
This method may be dirty but quick and easy:
get your object and use the pickWalk command

select -r pCube1 ;
pickWalk -d down;
// Result: pCubeShape1 //

But there are probably tons of slicker methods
I hope this helps

05-27-2003, 09:53 PM
The "nice" way to do it:

listRelatives -c -s

05-27-2003, 11:46 PM
This is a common question!!


-- Mark

05-29-2003, 10:15 PM
First of all, THANK YOU! :) It's nice to have a place where you can ask questions and get ANSWERS.

SECONDLY: AAARGH! I was really hoping I was gonna get this on my own after that first bit of help, but Maya just ISN'T cooperating. pickWalk just doesn't seem to work... here's my code

$t = `ls -et nonLinear`;
for($c in $t)
select -r $c;
pickWalk -d down;
$s = `ls -sl`;
$s.curvature = $curve;

As far as I can tell, this should work, right? Grab the list, go through, select each component in the array, move down 1 node, put the now selected node in a variable, adjust to hearts content? I've put print() functions everywhere and it just doesn't seem to be moving down with pickwalk, tried with `` around it, tried $l = `pickWalk -d down`; and everything. I checked and made sure I wanted to go down, the pickWalk command is C&C from the script editor from when I did it by hand.


05-30-2003, 02:30 AM
try somethinig like (not sure about the legality of the syntax)
$s[0].curvature = $curve;

I think ls always returns a string[]

05-30-2003, 02:37 AM
more like this: ( I kept your variables and the pickwalk, though this slows it down a little ) and I assume $curve is a value already declared

string $t[] = `ls -et nonLinear`;// you need an array

for ( $c in $t )
select -r $c;
pickWalk -d down;
string $tempStringArray[] = `ls -sl`;
$c = $tempStringArray[0];
setAttr ( $c + ".curvature" ) $curve;

05-30-2003, 08:23 AM
I haven`t tested your code, but when I use "da good ol` dirty pickWalk style" I make a string that catches the result like:

select -r $obj;
string $shape = `pickWalk -d down`;

string $shape = `pickWalk -d down $obj`;

The reason is that when you use it on a Mesh to get the shape, Maya doesn`t really select the shape node, like when you use the pickWalk to go through your Hierarchy.
Hope this helps

CGTalk Moderation
01-15-2006, 07:00 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.