Notifications
Clear all

[Closed] dropdownlist with scene cameras

hello everyone after scavenging the max script reference for something like this:

a dropdownlist with all of my scene cameras

i found myself lost and i came here for some help
here is where i stant:

sceneCam = cameras as array
rollout ddl_test “DropDownlist Cameras”
(
dropdownlist scale_dd “Cams” items:sceneCam
on scale_dd selected i do
print i.name
)

i can´t seem to define an array with just the scene cameras (not the targets) because max can´t convert the names to strings…

Thanks alot bernielomax

2 Replies
1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

 
 (
 sceneCam = for o in cameras where classof o != TargetObject collect o
 sceneCamNames = for o in sceneCam collect o.name
 rollout ddl_test "DropDownlist Cameras"
 (
 dropdownlist scale_dd "Cams" items:sceneCamNames
 on scale_dd selected i do
 print sceneCam[i]
 )
 createDialog ddl_test 
 )

First, cameras as array returns both cameras AND their targets. You have to filter the targets out.
Then, you need an array of camera names because dropdownlist expects an array of strings for the .items property.
In the handler, you can use the i argument to point into the original camera array to print the actual camera corresponding to the selected name, as both arrays are in-synch (the sceneCamNames array was made by traversing the sceneCam array)

woaw bobo jesus thnakx alot…
so complicated for one so simple for others
hugs bern