PDA

View Full Version : List all Cameras in a Dropdown list, how?


Teriander
04-09-2008, 04:45 AM
You know when you press C you get a list of all your Cameras that you can select? How do I apply this to a dropdownlist and when the user selects the camera from the list, the viewport now views from that camera?

Im completely lost on where to start with this. Here is what I have:

group "Camera"
(
dropdownlist camSelect
)

I hope thats not too complicated ;)

Zbuffer
04-09-2008, 10:37 AM
Hi,

here you go ;)


(
rollout test_rollout "test"
(
local cams=#()
dropdownlist camSelect

on test_rollout open do
(
-- grab al cameras in the scene
cams = for c in cameras where classof c != TargetObject collect c
-- get the camera names
items = for c in cams collect c.name
-- populate the dropdown list items
camSelect.items = items
)
on camSelect selected i do
(
-- set the viewport to the chosen camera
viewport.setCamera cams[i]
)
)
createdialog test_rollout
)

soulburn3d
04-09-2008, 03:23 PM
You can also use my ViewportControl script...

http://www.neilblevins.com/soulburnscripts/soulburnscripts.htm

Just use the viewportControlCamera macroscript and hook it up to an icon or hotkey.

- Neil

Teriander
04-09-2008, 06:51 PM
Thanks for the reply guys! ZBuffer, I used your script and it works great! Thanks for the help on this :)

SoulBurn, I will check out your script also, thanks for posting!

CGTalk Moderation
04-09-2008, 06:51 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.