View Full Version : GUI for animation list

07 July 2011, 09:58 AM
I'm writing a exporter for a game engine.
Most of it is done, except this last part, which is where you define your animations.

What I need is a track list.
It has to contain the following:

Animation name
array of objects that is defined in this animation (can be multiple objects.).

What I need input on, is how to handle the list.

What GUI item is good to use for the list?
How can I make sure it get's saved with the .max file?
How do I populate it when opening the max file again?

I suspect that .net can be a good thing to use for this, but I have not implemented .net in my maxscripts before.

I have attached a similar UI from a plugin we currently use (just to make it more clear).
and all the other things I can handle, just need help with the list.

07 July 2011, 06:39 PM
Here is a GUI example to get you started:

for i = 1 to 5 do teapot()

exampleData = #( \
#("Track 1", 150, #($Teapot01,$Teapot02)),
#("Track 2", 120, #($Teapot03,$Teapot04)),
#("Track 3", 10, #($Teapot05))

try(destroyDialog myRollout)catch()

rollout myRollout "Dotnet Listview" width:500 height:400
local lvColumns = #(#("Name",150),#("Length",70),#("Objects",236))
local itemClass = dotNetClass "ListViewItem"

dotNetControl lv "ListView" width:460 height:360 pos:[20,20]

fn stringFromNodesArray nodes =
local str = ""
local comma = ", "
for n = 1 to nodes.count-1 do str+= (nodes[n].name+comma)

fn populateLv =
local items = for data in exampleData collect
dotNetObject itemClass #(data[1],(data[2] as string),(stringFromNodesArray data[3]))
lv.Items.AddRange items

on myRollout open do
lv.View = lv.View.Details
lv.GridLines = on
lv.FullRowSelect = on
for column in lvColumns do lv.Columns.Add column[1] column[2]

on lv SelectedIndexChanged s e do
format "Currently selected indices: %\n" (for i = 0 to s.selectedIndices.count-1 collect s.selectedIndices.item[i])
createDialog myRollout

07 July 2011, 07:00 PM
awesome, thank you VERY much for this code.
that was beyond my expectations.

I'll get to it tomorrow, and adapt it to this.

Thank you again!

07 July 2011, 08:04 PM
Let me know how it goes

07 July 2011, 05:26 AM
should this one run as it is?
I get a error when running it.
stops at line 23

for n = 1 to nodes.count-1 do str+= (nodes[n].name+comma)

MAXScript Rollout Handler Exception
-- Unknown property: "name" in undefined

07 July 2011, 05:37 AM
Oh I guess if you're on a newer version of max the example teapots would be named $Teapot001, not $Teapot01. Perhaps that's the problem.

07 July 2011, 05:46 AM
Ah, I did not notice, works now after changing that :)
I'll use time to understand how it works now, and see if I can implement it.

CGTalk Moderation
07 July 2011, 05:46 AM
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.