Notifications
Clear all
[Closed] change orbit camera flyout state ?
Dec 28, 2010 5:11 am
Hello everyone
is there a way to change by script (or even better, a shortcut ? ) the flyout state of the navigation buttons ?
I am specifically speaking of the orbit camera flyout which allows either rotating around target or camera. (I’s called orbit/Pan camera, but is different from pan view)
any help will be much appreciated.
Jerome
2 Replies
Dec 28, 2010 5:11 am
Try this one, I made it some year ago
rollout CameraTools "Camera Tools" rolledUp:false
(
group "Camera"
(
button btCamPanLeft "pan left" width:60 pos:[10,30]
button btCamPanRight "pan right" width:55 pos:[115,30]
spinner snumber "" pos:[71,32] type:#float range:[0,100,4] scale:0.1 width:42 height:18
button btCamPanUp "pan up" width:78 pos:[10,55]
button btCamPanDown "pan down" width:78 pos:[92,55]
button btCamZoomIn "zoom in" width:78 pos:[10,80]
button btCamZoomOut "zoom out" width:78 pos:[92,80]
button btCamRollLeft "roll left" width:78 pos:[10,105]
button btCamRollRight "roll right" width:78 pos:[92,105]
button btCamRotateLeft "yaw left" width:78 pos:[10,130]
button btCamRotateRight "yaw right" width:78 pos:[92,130]
)
function getCamDirection cam =
(
local pos1 = cam.pos
local pos2 = cam.target.pos
local dir = pos2-pos1
local dis = length dir
dir = normalize dir
return #(dir,dis)
)
function getCam =
(
local cam = getActiveCamera()
if (cam == undefined) then
cam = $
return cam
)
on btCamZoomIn pressed do
(
local cam = getCam()
local val = getCamDirection cam
cam.pos += val[1]*val[2]*snumber.value/100.0
)
on btCamZoomOut pressed do
(
local cam = getCam()
local val = getCamDirection cam
cam.pos -= val[1]*val[2]*snumber.value/100.0
)
on btCamRollLeft pressed do
(
local cam = getCam()
local val = getCamDirection cam
rotate cam (angleaxis (-60*snumber.value/100.0) val[1])
)
on btCamRollRight pressed do
(
local cam = getCam()
local val = getCamDirection cam
rotate cam (angleaxis (60*snumber.value/100.0) val[1])
)
on btCamRotateLeft pressed do
(
local cam = getCam()
local val = getCamDirection cam
local q = quat 0 0 1 (snumber.value)
local target = cam.target.pos
local pos = cam.pos
v = pos - target
v = v*q
pos = v + target
cam.pos = pos
)
on btCamRotateRight pressed do
(
local cam = getCam()
local val = getCamDirection cam
local q = quat 0 0 1 (-snumber.value)
local target = cam.target.pos
local pos = cam.pos
v = pos - target
v = v*q
pos = v + target
cam.pos = pos
)
on btCamPanLeft pressed do
(
local cam = getCam()
local val = getCamDirection cam
local dir = cross [0,0,1] val[1]
cam.target.pos -= dir*val[2]*snumber.value/100.0
)
on btCamPanRight pressed do
(
local cam = getCam()
local val = getCamDirection cam
local dir = cross [0,0,1] val[1]
cam.target.pos += dir*val[2]*snumber.value/100.0
)
on btCamPanUp pressed do
(
local cam = getCam()
local val = getCamDirection cam
local dir = cross [1,0,0] val[1]
cam.target.pos += dir*val[2]*snumber.value/100.0
)
on btCamPanDown pressed do
(
local cam = getCam()
local val = getCamDirection cam
local dir = cross [-1,0,1] val[1]
cam.target.pos += dir*val[2]*snumber.value/100.0
)
)
createDialog CameraTools width:180
Dec 28, 2010 5:11 am
Thank you very much. That’s not qhuite what I was looking for, but it may be a good replacement… and it gives me an idea of a custom tool…