PDA

View Full Version : Listbox Question


jpn5
01-21-2009, 05:42 PM
Hi everyone,

I've been trying to construct a listbox on my rollout that will offer 6 animation presets;
The presets will contain variations on the following information:

animationRange = interval 0 960
at time 0 l.color = (color 191 94 85)
at time 480 l.color = (color 201 145 88)
at time 960 l.color = (color 210 168 58)

anyone got any ideas on how i can link this information to the items in the listbox?

I was using the following- But couldn't work out how to add any of the keyframe information in with the array.


local DynArray = #()


fn buildDynList =
(

struct sDyn ( name,value )

append DynArray (sDyn "Dynamic Reds" (interval 0 960))
append DynArray (sDyn "Dynamic Greens" (interval 0 500))
append DynArray (sDyn "Dynamic Blues" (interval 0 60))
append DynArray (sDyn "Dynamic Circadian" (interval 0 300))
append DynArray (sDyn "kaleidoscope" (interval 0 200))
append DynArray (sDyn "Colour Temeratures"(interval 0 1100))
)

on Apply2 pressed do
(
if queryBox "This operation will adjust the animation length. Do you want to continue?" beep:false then
local theDynamic = for d in DynArray where d.name == dynamicLst.selected collect d.value

for l in lights where l.isSelected do
with animate on
animationRange = theDynamic[1]

)



Thanks for your time,

JPN5

ZeBoxx2
01-21-2009, 06:06 PM
several ways you could go about it - I think the easiest might be replacing the single 'value' in your sDyn struct with two arrays:


struct sDyn (
name,
colorTimes,
colorValues
)

myDyn = sDyn \
name:"myDyn" \
colorTimes:#(0,480,960) \
colorValues:#((color 191 94 85), (color 201 145 88), (color 210 168 58))

for i = 1 to myDyn.colorTimes.count do (
at time (myDyn.colorTimes[i]) ( l.color = myDyn.colorValues[i] )
)


Edit: wrapped the myDyn line - the 'keyword:' bits are optional

CGTalk Moderation
01-21-2009, 06:06 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.