PDA

View Full Version : another important ? if u dont mind


Firas
07-31-2003, 12:30 PM
hi all ,,

i need to know whats the material on the selected object ?

GDC
07-31-2003, 05:58 PM
Here is one way to get this info. This is assuming you want it for the object and not the componenets! (for that it's a little different)

// get the selection
string $sel[]=`ls -sl`;

// assume it's a transform (You will probably want to check this)
// and get it's shape
string $shape[]=`listRelatives -c $sel[0]`;
string $connections[]=`listConnections -s 0 -d 1 -type shadingEngine`;
string $materialConnection[]=`connectionInfo -sfd ($connections[0]+".surfaceShader")`;
string $buffer[];
tokenize($materialConnection[0],".",$buffer);

// the material name is $buffer[0]


Hope that helps
--g

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