Vsai
03-20-2009, 08:34 PM
So I've got what I figured was a simple script..
A toolbar with 2 checkbuttons, one for the status of vray DR, one for the status of Autosave. simple enough, see below. problem is i can't seem to get it to unRegisterDialogBar at any point so that i can destroy the dialog before recreating it. is there some magic syntax that i'm missing?
(
--needs to be global for the callback to be usable?!
global g_roll_CheckDRSave
rollout g_roll_CheckDRSave "Toggles" width:100
(
checkbutton CheckDR "DR" width:30 pos:[2,2]
checkbutton CheckAsave "ASave" pos:[34,2]
fn updateChkButtons =
(
CheckAsave.checked = autosave.enable
if (matchpattern (renderers.current as string) pattern:"*V_Ray*") then (
CheckDR.enabled = true
CheckDR.checked = renderers.current.system_distributedRender
)else CheckDR.enabled = false
)
on g_roll_CheckDRSave open do updateChkButtons()
on CheckDR changed val do renderers.current.system_distributedRender = CheckDR.checked
on CheckAsave changed val do autosave.enable = CheckAsave.checked
timer timerCheckDR active:true interval:250
on timerCheckDR tick do updateChkButtons()
--autosave.Interval
)
callbacks.removeScripts id:#UpdateDRToolbar
callbacks.addScript #postRendererChange "try(g_roll_CheckDRSave.updateChkButtons())catch(print \"fail while updating the DRToolbar\")" id:#UpdateDRToolbar
try(cui.FloatDialogBar g_roll_CheckDRSave)catch()
try(cui.unRegisterDialogBar g_roll_CheckDRSave)catch()
try(DestroyDialog g_roll_CheckDRSave)catch()
CreateDialog g_roll_CheckDRSave
cui.RegisterDialogBar g_roll_CheckDRSave style:#(#cui_dock_horz,#cui_floatable,#cui_handles)
cui.DockDialogBar g_roll_CheckDRSave #cui_dock_top
)
A toolbar with 2 checkbuttons, one for the status of vray DR, one for the status of Autosave. simple enough, see below. problem is i can't seem to get it to unRegisterDialogBar at any point so that i can destroy the dialog before recreating it. is there some magic syntax that i'm missing?
(
--needs to be global for the callback to be usable?!
global g_roll_CheckDRSave
rollout g_roll_CheckDRSave "Toggles" width:100
(
checkbutton CheckDR "DR" width:30 pos:[2,2]
checkbutton CheckAsave "ASave" pos:[34,2]
fn updateChkButtons =
(
CheckAsave.checked = autosave.enable
if (matchpattern (renderers.current as string) pattern:"*V_Ray*") then (
CheckDR.enabled = true
CheckDR.checked = renderers.current.system_distributedRender
)else CheckDR.enabled = false
)
on g_roll_CheckDRSave open do updateChkButtons()
on CheckDR changed val do renderers.current.system_distributedRender = CheckDR.checked
on CheckAsave changed val do autosave.enable = CheckAsave.checked
timer timerCheckDR active:true interval:250
on timerCheckDR tick do updateChkButtons()
--autosave.Interval
)
callbacks.removeScripts id:#UpdateDRToolbar
callbacks.addScript #postRendererChange "try(g_roll_CheckDRSave.updateChkButtons())catch(print \"fail while updating the DRToolbar\")" id:#UpdateDRToolbar
try(cui.FloatDialogBar g_roll_CheckDRSave)catch()
try(cui.unRegisterDialogBar g_roll_CheckDRSave)catch()
try(DestroyDialog g_roll_CheckDRSave)catch()
CreateDialog g_roll_CheckDRSave
cui.RegisterDialogBar g_roll_CheckDRSave style:#(#cui_dock_horz,#cui_floatable,#cui_handles)
cui.DockDialogBar g_roll_CheckDRSave #cui_dock_top
)
