try(destroyDialog ::bgaRoll)catch()
objTMData = attributes objData
(
local objTMS = for o in objects collect DataPair o o.transform
fn setObjTM arr =
for i in 1 to arr.count where isValidNode arr[i].v1 do
arr[i].v1.transform = arr[i].v2
)
rollout bgaRoll "• • •"
(
fn collectStates = (for s in 1 to sceneStateMgr.GetCount() collect sceneStateMgr.GetSceneState s)
fn collectCameras ddl lb = if (cams = for c in cameras where not isKindof c TargetObject collect c).count != 0 do
(
local states = collectStates(), stCamList = #(), avCamList = #()
for c in cams do
(
userProp = getUserPropBuffer c
if userProp == "" then append avCamList c.name else
(
if findItem states userProp != 0 then append stCamList c.name else
(
setUserPropBuffer c "" ; append avCamList c.name
)
)
)
ddl.items = avCamList ; lb.items = stCamList
)
dropDownList ddl1 "Scene States:" width:190 pos:[5,5]
dropDownList ddl2 "Available Cameras:" width:190 pos:[5,45]
button btn1 "Set State To Camera" width:110 height:20 pos:[5,86]
button btn2 "Refresh All" width:78 height:20 pos:[117,86]
listbox lbox "State Cameras:" width:190 height:15 pos:[5,110]
fn init =
(
local d = FreeCamera()
custAttributes.add d objTMData
bgaRoll.ddl1.items = collectStates()
collectCameras bgaRoll.ddl2 bgaRoll.lbox
)
on bgaRoll open do init()
on btn2 pressed do
(
--init()
ca = custAttributes.get d objTMData
ca.setObjTM ca.objTMS
)
on btn1 pressed do
(
if bgaRoll.ddl1.items.count != 0 and bgaRoll.ddl2.items.count != 0 do
(
if (cam = getNodeByName bgaRoll.ddl2.selected) != undefined do
(
setUserPropBuffer cam bgaRoll.ddl1.selected
bgaRoll.lbox.items = append bgaRoll.lbox.items bgaRoll.ddl2.selected
bgaRoll.ddl2.items = deleteitem bgaRoll.ddl2.items bgaRoll.ddl2.selection
)
)
)
on lbox selected itm do
(
if isValidNode (c = (getNodeByName bgaRoll.lbox.selected)) then select c else init()
)
on lbox doubleClicked itm do
(
if isValidNode (c = (getNodeByName bgaRoll.lbox.selected)) then
(
if sceneStateMgr.FindSceneState (st = getUserPropBuffer c) != 0 do
(
sceneStateMgr.RestoreAllParts st
viewport.setCamera c
)
) else init()
)
)
createDialog bgaRoll 200 330 10 110 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)