[Closed] User attributes
Hi, been a bit stuck
How can I apply a getUserProp value, in this case numbers to each selected model in increments.
say I have 5 objects in the scene, I select them all and press a button, which takes the number given by spinner and for every model after first (which would be the number in the spinner) adds 1
and also when (because I can do that first part one by one and set each test model individually just not in selection) one by one they’ll print to listener the correct number but when I try to read from them all together (selected) it comes back… ok …instead of their individual numbers
I have a feeling what Im doing wrong for the first problem is very similar the the second but Im lost
thanks
Is this what you’re asking for?
(
rollout windowSetValue ""
(
spinner spValue "Start value:" type:#integer align:#left
button btSetValue "Set to selection" width:160 align:#center
button btListValues "List selection values to listener" width:160 align:#center
on btSetValue pressed do
(
currentValue = spValue.value
for obj in (selection as array) do
(
setUserProp obj "myValue" currentValue
currentValue += 1
)
)
on btListValues pressed do
(
for obj in (selection as array) do
(
myValue = getUserProp obj "myValue"
if (myValue == undefined) do myValue = "No value set!"
format "Object:%, Value:%
" obj.name myValue
)
)
)
createDialog windowSetValue
)
Wow, I was actually quite close but Yes, that works perfectly.
Thanks for your help.