PDA

View Full Version : selecting using mel


pukvete
10-07-2005, 10:25 AM
I have a for-loop which creates 100 cubes. I need to apply a shader to each cube... how would I do that with sets -e -forceElement ShaderSG; any idea?

if I could select the cube that was recently created but I don't know how


shadingNode -asShader lambert -name Asteroids;
setAttr Asteroids.color 1 0 0;
sets -renderable true -noSurfaceShader true -empty -name AsteroidsSG;
connectAttr -f Asteroids.outColor AsteroidsSG.surfaceShader;

for ($i=0; $i<100; $i++)
{
nurbsCube -name "asteroid#";

// select the created cube here
sets -e -forceElement AsteroidsSG;
}

mhovland
10-07-2005, 12:44 PM
Try the modified code below.


shadingNode -asShader lambert -name Asteroids;
setAttr Asteroids.color 1 0 0;
sets -renderable true -noSurfaceShader true -empty -name AsteroidsSG;
connectAttr -f Asteroids.outColor AsteroidsSG.surfaceShader;

for ($i=0; $i<100; $i++)
{
string $cube[] = `nurbsCube -name "asteroid#"`;

select -r $cube[0];
sets -e -forceElement AsteroidsSG;
}

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