View Full Version : controller property problem.
holycause 06-24-2008, 09:43 PM i m back. :P
i m trying all afternoon to find why i can't add a controller to a mbl selection.
how it should work;
1) select some elements in the mlb items
2) by clicking on a button, add a link_constraint
local list= ListRollout.listMlb.selection
for i in list do i.controller = link_constraint()
and i the result is this;
>> MAXScript Rollout Handler Exception: -- Unknown property: "controller" in 4 <<
if i try this in the MAXScript Listener, it works fine;
P = $Point* as array
p.controller = link_constraint () -- or the next line
p[1].controller =link_constraint ()
i'm really wondering what's wrong.:banghead:
|
|
ZeBoxx2
06-24-2008, 10:09 PM
you're trying to assign a controller to the value of the 'i' selection value of a (multi)listbox. That 'i' selection value is just a number; can't assign controllers to numbers.
If that selection value corresponds with an object, then the best way to handle this is to collect the objects in an array so that you would access objArray[i], and assign the controller to that.
Best place to build that object array is in the same piece of code where you create the array for the (multi)listbox's items property.
holycause
06-25-2008, 01:55 PM
thx for your answer,
i will try this
holycause
06-25-2008, 08:18 PM
it's working fine.
thx again.
ZeBoxx2
06-25-2008, 08:33 PM
excellent :) happy scripting!
holycause
06-25-2008, 08:38 PM
btw, i tried to do the same with a dropDownList, but i'vegot this error:
>> MAXScript Rollout Handler Exception: -- No "map" function for 2 <<
for o in objects do if classof o == PF_Source do append PFSArr o
--------
on ddlPFS selected itm do
PFSItmSel = for i in ddlPFS.selection collect PFSArr[i]
btw, i tried to do the same with a dropDownList, but i'vegot this error:
>> MAXScript Rollout Handler Exception: -- No "map" function for 2 <<
for o in objects do if classof o == PF_Source do append PFSArr o
--------
on ddlPFS selected itm do
PFSItmSel = for i in ddlPFS.selection collect PFSArr[i]
A dropdownlist's .selection property is a single integer, so in your case, you are trying to loop through 2 which is a no-no, thus the error. A multilistbox has a .selection which is a bitarray with bits set for the items that are selected. A listbox and dropdownlist can have only one item selected, so .selection is just a number.
In other words, you would have to say simply
PFSItmSel = PFSArr[ddlPFS.selection]
holycause
06-25-2008, 09:00 PM
thx a lot Bobo, it made me crazy :P
CGTalk Moderation
06-25-2008, 09:00 PM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.