|04 April 2003||#1|
Join Date: Aug 2002
tokenize giving error on first run
i've got this bit of code to return the matrial of a selected object and then make it semi transparent. it works...apart from the first time i run it..i get this error
// Error: Invalid call to "tokenize". Check number and types of arguments expected by the procedure. //
but then if i run it straight after, it all works fine.
here is the code, try it yourself.
$sel = `ls -flatten -sl `;
$setArray = `listSets -type 1 -ets -o $sel`;
$material = `connectionInfo -sfd ($setArray + ".surfaceShader")`;
tokenize $material "." $buffer;
$selmat = $buffer+".transparency";
setAttr $selmat -type double3 0.5 0.5 0.5 ;
just select an object with a material assigned to it, and it should make it 50% transparent.
i cant see what is wrong with the way i have used tokenize, i have tried it several other ways also, but always get the same error. could it be somethign to do with not being inside a global procedure?
|04 April 2003||#3|
Off the top of my head, I think the problem is more likely to be with the kind of data you are feeding it. ConnectionInfo can return boolean, string and stringArray so I would check to see what's in your $material var when the script fails.
Note that in the code you posted, you did not explicitly declare $material as a string, so it can take on any datatype that connectionInfo returns, which is probably misdirecting you to think that the problem lies with the tokenize command.
|Thread Closed share thread|