help me make this work!!
Hay all forum member and maxScripter i’m newbie in maxscrpt and need help developing my script, bassiclly it based on copy paste modifier but im try to remodel it a little bit and get dizzy how it work so here is my problem !!
-------------------------------------------- ---------------------------------------------
rollout kie “Untitled”
(
button btn1 “Button” pos:[1,3] width:132 height:22
on btn1 pressed do
(
sel=selection as array
rollout kio “Temp”
(
multilistBox lbx1 “item” pos:[3,1] width:155 height:5 i
)
createDialog kio
)
)
createDialog kie
-------------------------------------------- --------------------------------------------- -------
bassicly I want to add modifier name as item in multibox list when I click object that had a modifier and do nothing if item in selection doesn’t have any (btn1 click createDialog and automaticlly add modier name in multilistbox thing.... this is very very dizzy I tried every method I know and still not working ), clear multibox list automaticly when I clear selection () and add item automaticlly (modifier object when I click object that have an a modifer ) bassiclly like multilist box in command panel.
Comments
Here is a solution with a
Here is a solution with a few extra things you might find helpful.
I attached this script as an ms in the attachment also.
-----------------------------------------------
Rollout TestModDialog "List Mods"
(
MultiListBox LstBx "Mods"
-- not necessary -- items:#("A","B","C") selection:#(1,3)
Button GetMods "Get Mods"
--- The names are stored in a global variable
--- we make the option to clear it automatically
-- each time a pose is added or keep adding modifiers
-- to what is there and keep everything that is
-- already in the list.
Checkbox AutoClear "Auto Empty Buffer"
Button ClearTheList "Clear the list"
on GetMods pressed do
(
MyObjs = GetCurrentSelection()
-- equivalent to selection as array
if ModArray == undefined then
(
Global ModArray = #() -- empty array
)
Else
(
-- if auto clear active
-- set Modarray to empty array
-- else just add to whats in
-- the global array
If AutoClear.state == true then
(
Global ModArray = #()
)
Else
(
ModArray = ModArray
)
)
-- Loop through the objects and Check for
-- modifiers
for i in MyObjs do
(
-- If the count of the modifiers is 0
-- then we know the object has no
-- modifiers
if i.modifiers.count != 0 then
(
-- append the modifiers to the array
-- append means array = array + value
for m in i.modifiers do
(
append ModArray m.name
)
)
-- if there were modifiers set the items in the
-- list to the new array
) -- end for
if ModArray.count > 0 then ( LstBx.items = ModArray )
) -- end button GetMods
/*
This button has option to automatically
clear the update the list and then update it
with the newly selected objects modifier names
*/
-- But Here is a seperate button to clear the list then
On ClearTheList pressed do
(
LstBx.items = #()
-- you may or may not choose to
-- clear the global variable for the
-- buffer to
ModArray = #()
) -- end button ClearTheList
) -- end rollout
TestRollFloat = NewRolloutFloater "Test Rollout" 200 280
addRollout TestModDialog TestRollFloat
-- see rollout floater windows in maxscript help
/*
There are shorter ways to do this
but I figured I'd share a number of
techniques all in one go.
for example you do not have to store
the mod names in an array
you could just append the names
directly to the list box
LstBx.items = LstBx.items + #(m.name)
-- be sure to include the m.name in an array
-- array + array
-- see array values in maxscript help
*/
Matthew
[email protected]
http://s18.photobucket.com/albums/b117/dalek333/
http://www.freewebs.com/lamoreart/index.htm
http://www.scriptspot.com/3ds-max/joint-bend-rig
http://forums.cgsociety.org/showthread.php?p=5991554#post5991554
k....as a hint for you. You
k....as a hint for you. You can get the modifiers from a selected object via
$.modifiers
you can get the top modifier only via
$.modifiers[1]
if you have more than one node selected you can use
selection[1] to get the first selected node.
that should get you started.
...gregory
...gregory
mertens3d.com - recent architectural rendering