Modifier Plugin Help

I'm having issues with a modifier plugin i'm writing. This plugin uses a list box which loses its information when the object is deselected and selected again. I need the listbox to update or not change every time the object is reselected.

Any ideas?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
pacermike's picture

Hi! Could you elaborate a

Could you elaborate a little bit? I'm having the same exact problem. I'm adding UI to the Morpher Modifier with Custom Attributes and the listbox data keeps disappearing on deselect. I don't really know what to call on the "on open do" handler to get the list back like you're suggesting.

Are you hooking your listbox up to the parameters block? If so, how are you doing it? Currently I can only get one item to show up in the listbox at a time. Every time I append it it just overwrites the existing slot :\


I wasn't able to get the list to persist with the "on open do" handler. Instead I declared "local lb_addChnl_array = #()" above the "parameters" block.

Then in the "rollout" block I put "listbox lb_addChnl items:lb_addChnl_array"

The list will now survive deselection and will let me build as many items as I want in the list like I'd expect it to.


This method does not withstand a save and reload. Save, exit, reload... the list is gone.

Anubis's picture

the Helps shows a good

the Helps shows a good example on how to store array in the param block (using Tabed types), quote:

height1 type:#index animatable:true default:1 ui:height1
height3 type:#indexTab tabSizeVariable:true
m3a type:#matrix3 default:(matrix3 [1,0,0] [0,0,1] [0,-1,0] [53.1187,-6.50834e-007,14.8893])
m3b type:#matrix3tab tabSizeVariable:true

my recent MAXScripts RSS (archive here)

pacermike's picture

Ok, I think I got this all

Ok, I think I got this all worked out.

The "on open do" handler worked to populate my listbox when the scene was saved and reloaded, but only if I unselected then reselected the object. I couldn't get it to update automatically without me having to manually do something to it (my custom attributes are on an object's morpher modifier.)

But then I figured this out:

parameters main rollout:test
testList type:#stringTab tabSizeVariable:true

rollout test "Testy test test"
listbox lb_tstLst items:(if testList.count > 0 then
(for i in testList collect i) else #())

If you directly put "items:testList" you get an error like "items: wanted Array, got #()" which is nuts because "#()" IS an array, so this drove me crazy for a few days. Then I finally decided to try collecting the array in to an array with the for loop, and so far its working perfect. When you load a saved scene the list is automatically populated with the saved data in the testList #stringTab! This requires no extra handlers and seems like the cleanest way I could figure out to make this work. If anyone has any suggestions on how to make this better, let me know.

Using tabbed types works great for this. Thanks Anubis :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.