ScriptSpot

Forum topic · General Scripting

dumb setUserProps question

By coyote808 · 2012-02-08

Description

Hi -
Hoping it's not forbidden to as novice questions here.

I'm trying to set a bunch of user defined properties on a selection list of objects but those user properties need to be slightly different for each member of the selection set. The

for obj in $ do

syntax works great for cycling thru the selected objects, but the only way the setUserProp function seems to work is with the $ node argument. Result is that each time through the for loop ALL the objects in the $ selection set get the most recently composed user properties.

Is there a way to set user properties for objects in a selection set, one member at a time - as I cycle through using the above for loop?

Thanks for any advice.

Mike

Comments (3)

dumb setUserProps question

coyote808 · 2012-02-08

Excellent! Thanks Anubis. That does just what i need.

Anubis · 2012-02-08

Somehow you answer yourself. An example code w'd help us to see what you try to do. Next code for example will set uni-id prop to each object in selection:

for id = 1 to selection.count do
setUserProp selection[id] "ID" id

" "

TsveTan · 2012-02-08

Hi,
I just registered to the side.
I think you need a 2d array.
You can use the get/setinisettings (or another writing method) to capture the user's options to a file (as a 2d array) or only change the array without saving.

-- 1st member = option1, 2nd member = option2 ... --subarray members
it should look something like:
useroptions = #(#(true,false,true ..),#(false,false,false ..),#(true,false,false ..))
To change the n - member in the k - subarray the syntax is useroptions[k][n] = ...
If needed you can use also a 2d looping.