Message 1 of 4
Scripted Custom Attributes & DropDownLists
Not applicable
02-05-2009
12:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Everyone,
First of all, if anything I mention here sounds inefficient please feel free point it out...
I'm working on a game and I need to pass information defined by the Art Team (in Max) out to our game engine.
So, I'm using Scripted Custom Attributes as a holders for this new info (that way everything gets saved with their associated object.)
The first test I did, was with a simple checkbox. It worked just fine.
Then, (because need to represent a list of predefined choices) I tried using a dropdownlist.
Here is the script...
The problem is that the selection that I make in the dropdownlist get's lost as soon as I change selections.
However, if I select the object and execute the following in the Max Script Listener...
The attribute that I defined is still correct, just not represented in the dropdownlist UI anymore.
Am I missing something simple here?
Because, no other UI Control lost track of it's data.
Thanx for any help you can provide.
-Red
First of all, if anything I mention here sounds inefficient please feel free point it out...
I'm working on a game and I need to pass information defined by the Art Team (in Max) out to our game engine.
So, I'm using Scripted Custom Attributes as a holders for this new info (that way everything gets saved with their associated object.)
The first test I did, was with a simple checkbox. It worked just fine.
Then, (because need to represent a list of predefined choices) I tried using a dropdownlist.
Here is the script...
-- ========================================
-- Define
-- ========================================
NewAttrs = attributes MyNewAttrs --attribID:#(0x9cf491c, 0x4c7a0cf0) --generated by genClassID()
(
parameters params rollout:MyAttrs_rollout
(
Item_Things type:#string ui:ddl_Things
)
rollout MyAttrs_rollout "My Attributes"
(
-- ----------------------------------------
-- UI Controls
-- ----------------------------------------
dropdownlist ddl_Things "Pick Thing" \
items:#("First Thing", "Second Thing", "Third Thing")
-- ----------------------------------------
-- Event Handlers
-- ----------------------------------------
on ddl_Things selected ddl_ret do
(
Item_Things = ddl_Things.items
format "Item_Things: %\n" Item_Things
)
)
)
-- ========================================
-- Assign
-- ========================================
custAttributes.add $ NewAttrs
The problem is that the selection that I make in the dropdownlist get's lost as soon as I change selections.
However, if I select the object and execute the following in the Max Script Listener...
$.Item_Things
The attribute that I defined is still correct, just not represented in the dropdownlist UI anymore.
Am I missing something simple here?
Because, no other UI Control lost track of it's data.
Thanx for any help you can provide.
-Red