PDA

View Full Version : 'ls -type' bug???


AtrusDni
05-13-2009, 10:25 PM
Ok so im writing a script to edit a scenes shaders. Long story short, has anyone experienced this before?

Start a fresh scene, and create a blinn.
In the hypershade, you have the default lambert (lambert1) and the new blinn (blinn1).

In the script editor, do a type check on each of them:
nodeType lambert1;
// Result: lambert //
nodeType blinn1;
// Result: blinn //

Ok so far so good, each one reports back its correct node type. Now, if I do a list by type on all lambert materials . . .
string $lambert[] = `ls -type lambert`;
// Result: blinn1 lambert1 //

Why does it return the blinn as well? WTF? Is this a bug? If I list type blinn, only blinn1 is returned (as it should be). I dont get it . . .

wrend
05-14-2009, 12:31 AM
Its because blinn inherits from lambert. Read: blinn is a type of lambert (you can see this in the node hierachy docs). You'll just have to do an additional nodeType check, or use another list filtering method (eg, you could use lsType if you find their method satisfactory).

AtrusDni
05-14-2009, 12:39 AM
Yeah, I resorted to the lsType method. I understand that it may inherit from lambert, but it should still be listed separate from lambert. Took me hours to figure out why my simple script wasn't working right. Oh well . . .

wrend
05-14-2009, 01:00 AM
I understand that it may inherit from lambert, but it should still be listed separate from lambert.

Not sure about 'should' - its the kind of behaviour I'd expect, and want. Maybe you'd have prefered lambert as it is now to have been abstract, and have the 'real' lambert nodes as another type (albeit a duplicate).

CGTalk Moderation
05-14-2009, 01: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.