PDA

View Full Version : How to control Custom Attributes?


Jausn
04-13-2009, 02:41 AM
Hello everybody!

I wanna add a custom attributes to a spline to control the animation. I added a listbox and a pickbutton to it, and gonna achieve this: picked an object then the object's name display in the listbox item.

Here's my script:
testCA = attributes listBoxTest
(
parameters main rollout params
(
-------------------------------------------------------
)

rollout params "Test"
(
fn shapesOnly obj = isKindOf obj shape

listBox objLb ""
pickbutton objPb "Pick an Object" filter:shapesOnly

on objPb picked obj do
objLb.items = #(obj.name)
)
)

custAttributes.add $.modifiers[1] testCA

But when I selected another object then selected the object again, the data was gone.
So how to save the data? I know that I should set some parameters but how to do it?

Thank you.

eek
04-13-2009, 06:30 AM
your missing parameter attributes, you can associate with a UI element, that can be animated.

testCA = attributes listBoxTest
(
parameters main rollout params
(
theNode type:#node
theString type:#stringTab tabSizeVariable:true default:#()
)

rollout params "Test"
(
fn shapesOnly obj = isKindOf obj shape

listBox objLb ""
pickbutton objPb "Pick an Object" filter:shapesOnly

on objPb picked obj do
(
theNode = obj
append theString obj.name
objLb.items = theString
)

on params open do
(
objLb.items = theString
)

)
)

custAttributes.add $.modifiers[1] testCA

Jausn
04-13-2009, 07:44 AM
Thank you.
And do you know how to set this rollout to a float dialog?

ZeBoxx2
04-13-2009, 10:51 AM
the rollout can't be open twice, so you'll have to remove it, then open it as a dialog; not pretty

removeRollout $.params
createDialog $.params

Jausn
04-15-2009, 02:35 AM
I'm sorry, but it didn't work. You've tried it?

ZeBoxx2
04-15-2009, 09:39 AM
of course - only with minimal testing, though... again, parameters weren't really meant to be in a floating dialog :)


myAttribs = attributes test (
rollout roll_test "Test" (
spinner spn_test "test spinner"
checkbutton ckb_float "float me"
on ckb_float changed state do (
if (state) then (
if (not (roll_test.inDialog)) then (
removeRollout roll_test
createDialog roll_test
)
ckb_float.text = "unfloat me"
ckb_float.checked = true
)
else (
destroyDialog roll_test
addRollout roll_test
ckb_float.text = "float me"
)
)
)
parameters main rollout:roll_test (
someValue type:#float ui:spn_test
on someValue set val do (
format "someValue set to: %\n" val
)
)
)
mySphere = sphere()
select mySphere
custAttributes.add mySphere myAttribs

Jausn
04-16-2009, 04:13 AM
:cool: Thank you. I'm learning it.

CGTalk Moderation
04-16-2009, 04:13 AM
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.