Need some advice and testing before doing final posting. Thoughts everyone?
--Bugs
--Delay only affects DOF Keys
--Delay does not offset each individual key properly in frames
--Needs to place a key at 0 even though there is an delay value
rollout rlCameraFocus "Camera Focus"
(
local FocusObj
local RendCam
local start = animationRange.start
local end = animationRange.end
fn ObjFilter obj =
(
superclassof obj != Camera --Helpers
)
fn camFilter obj =
(
superclassof obj == Camera --Cameras
)
groupbox gpbxFocusObj "Focus Object" width:140 height:52 pos:[5,2]
pickbutton pkbtnFocusObj "Pick Object" width:120 height:24 pos:[15,20] filter:ObjFilter
groupbox gpbxCamera "Camera" width:140 height:52 pos:[5,60]
pickbutton pkbtnCamera "Pick Camera" width:120 height:24 pos:[15,80] filter:camFilter
groupbox gpbxAnimate " " width:140 height:52 pos:[5,118] enabled:true
checkbox ckbxAnimateOn "Animate" pos:[15,118] checked: true
spinner spnKeyAmount "Key every: " fieldwidth:35 pos:[16,142] range:[0,999999,6] type:#float enabled:true
label lbFrames "frs" pos:[122,142] enabled:true
groupbox gpbxDelay "" width:140 height:38 pos:[5,162] enabled:true
spinner spnDelayAmount "DOF Delay: " fieldwidth:35 pos:[14,176] range:[0,999999,0] type:#float enabled:true
label lbFramesDelay "frs" pos:[122,176] enabled:true
button btnMakeInFocus "Make In Focus" width:140 height:24 pos:[5,210]
on ckbxAnimateOn changed state do
(
if ckbxAnimateOn.checked == true then
(
lbFramesDelay.enabled = spnDelayAmount.enabled = spnKeyAmount.enabled = lbFrames.enabled = true
)
else
(
lbFramesDelay.enabled = spnDelayAmount.enabled = spnKeyAmount.enabled = lbFrames.enabled = false
)
)
on pkbtnCamera picked obj do
(
RendCam = obj
pkbtnCamera.text = RendCam.name
)
on pkbtnFocusObj picked obj do
(
FocusObj = obj
pkbtnFocusObj.text = FocusObj.name
)
-- Calculation
on btnMakeInFocus pressed do
(
if FocusObj != undefined then
(
if RendCam != undefined then
(
if ckbxAnimateOn.checked == true then --Animate On
(
with animate on
(
for FV = start to end by spnKeyAmount.value do
(
at time FV
(
fromHere = RendCam
toThere = FocusObj
FocVal = (distance fromHere toThere)
RendCam.baseObject.targetDistance = FocVal
moveKeys RendCam (spnDelayAmount.value)
)
)
)
)
else --Animate Off
(
fromHere = RendCam
toThere = FocusObj
FocVal = (distance fromHere toThere)
print FocVal
RendCam.baseObject.targetDistance = FocVal
)
)
)
)
)
createDialog rlCameraFocus 150 240
By JokerMartini · 2011-02-09