Notifications
Clear all

[Closed] local array for rolout?

I want to make a rolout with 2 buttons, the first for loading animation frames and the second to aply them to some scene object(s). How to load frames is no problem and if the frames are stored in an array also no problem to aply them. The problem is with the array, which should be conected to the rolout and when the rolout is deleted (closed) the array should be deleted to.

11 Replies

My suggestion is storing animation values in an xml file. That way you can even copy paste animations between different Max windows.

I personaly would really like to avoid using any IO, specially XML files, since if I got it right .net is necesary for worcking with XML and I dont want to use it.
In some code I´ve seen on the net there were arrays defined as locale inside a rolout, is that posibly a solution?

By the way do you want to keep the array or delete it?
I don’t think it wil keep local variables afer you close the rollout. Try to declare your array before your rollout decleration but! : As soon as you re-run your script your initial array decleration will take over and delete anything stored in the array. So you should check if “yourAnimArray==undefined” before declaring the animation array and then declare your array.
Keep in mind any array values stored in the memory will be erased if max session is ended.

The array should exist only as long the rolout exists, once the roloutfloater is closed, the memory used by the array should be freed.

free your array like
yourArray=#()
with
on <rollout_or_utility> close do <expr>

I have already tried that on <rollout_or_utility> close do , but have problems because not really understanding what that <rollout_or_utility> should be.

My msitake, should have been more clear…
that <rollout _or_uıtility> is the name of your rollout.
your code should be something like

try (DestroyDialog myRollout) catch()
Rollout myRollout "MyRollout" width:100 height:100
(
on myRollout close do( messageBox "opss")
)

createDialog myRollout

Thanks.

The problem is with the array, which should be conected to the rolout and when the rolout is deleted (closed) the array should be deleted to.

my questions are –
why do you think the local array has to be deleted?
what’s the reason?
do you care about memory use?

Page 1 / 2