PDA

View Full Version : setting an stringArray attr


secretalienlab
07-14-2005, 09:05 PM
Hello!
I'm having trouble setting a stringArray attr. My last attemt is below. It feels funny to build a (very) long string from my array when it's an array I want to set. I guess I'm missing something..


for($each in $sel){
for($each2 in $attr){
$line = $line+"\""+$each2+"\" ";
}
$n = size($attr);
setAttr ($each+".aGrpMem") -type stringArray ($n) ($line);
}

As far as I understand this would build the exact example from the docs.. ?

//Example setAttr node.stringArrayAttr -type stringArray 3 "a" "b" "c";

Here's my error msg: Error reading data element number 5:

Thanks!
-mattias

-------------
Well, what I get from searching the web is not much, mostly "consider other solutions".
Has anybody ever used this attr-type or is it there just for show?
When I assign values explicitly ("hey.tx" "yo.rx") it works as expected.

secretalienlab
07-22-2005, 01:08 PM
Well, it finally worked.. kind of wicked but I had to build the exact expression-line and use eval() to run it.. if anyone's interested, this is how it worked ->

$exp = ("setAttr "+$each+".stringArrayAttr -type stringArray "+$n+" "+$line+";");
eval($exp);

-mattias

CGTalk Moderation
07-22-2005, 01:08 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.