Notifications
Clear all
[Closed] Dynamic listbox
Jan 30, 2007 3:13 pm
Hi All,
I’m working on this script to update morphs in our pipeline. What i need to do is select a max file and list the objects in the max file onto a listbox, or anything of that sort. Then I will merge the morph and replace the existing one by comparing the name string.
My problem is I do not know how to list objects from a max file in a new box/ window and let a user select it. I have figured out the rest.
My code is as follows : (this will give you an idea of what I need)
global flname = ""
global obj_names = #()
rollout updateMorph "Update Morpher"
(
button btn1 "Select Max file with correct morph(s)"
on btn1 pressed do
(
flname = getopenFileName caption:"morphs"
messagebox (flname as string)
obj_names = getmaxfileobjectnames flname
)
listbox Objects "Objects:" items:(obj_names)
button btn2 "Merge Selected nodes and update"
)
createDialog updateMorph width:200
Thanks ,
Vikram
2 Replies
Jan 30, 2007 3:13 pm
If you pick a file once and open the dialog again, it should still contain
(
global obj_names --declare the variable first
if obj_names == undefined do obj_names = #() --if nothing assigned yet, initialize it
global flname
rollout updateMorph "Update Morpher"
(
button btn1 "Select Max file with correct morph(s)"
listbox lbx_objects "Objects:" items:obj_names --"objects" is a reseved name!
button btn2 "Merge Selected nodes and update"
on btn1 pressed do
(
flname = getopenFileName caption:"morphs"
if flname != undefined do --if the user did not cancel out...
(
obj_names = getmaxfileobjectnames flname
lbx_objects.items = obj_names --assign the names to the listbox
)
)
)
createDialog updateMorph width:200
)
Jan 30, 2007 3:13 pm
Thanks for the prompt reply Bobo,
I shall try this as soon as possible,
Thanks Again,
Vikram