dropdownlist change colorpicker

hi all

how would i go about setting a list of colours from a dropdownlist change the colourpickers in the script

---------------------------------------------
-- PLUGIN DECLARATION
---------------------------------------------
plugin textureMap Colours
name: "Colours"
classID:#(0x82b4cdc4, 0x4f75873e)
extends:Cellular
replaceUI:true
(

----------------------------------------------
-- INTERFACE DESIGN PARAMS
----------------------------------------------
parameters main rollout:params
(
DColor1 type:#color default:(color 214 199 148) ui:color1
DColor2 type:#color default:(color 214 199 148) ui:color2
on DColor1 set val do delegate.divColor1 = delegate.divColor2 = val
on DColor2 set val do delegate.cellColor = val
)

---------------------------------------------
-- ROLLOUR & BUTTONS DEFINITION
---------------------------------------------
rollout params "color set"
(
label l "Please Select Colour From the Dropdown Below"

dropdownlist dd ""\
items:#("1","2","3","4","5","6","7","8","9","10") height:6
on dd selected i do

colorpicker color1 "Base Color" align:#right fieldwidth:244 fieldheight: 50
colorpicker color2 "" align:#right fieldwidth:0
--You will get 5 items in the dropdown list. --Change height to 5, and you will get 4.

)

----------------------------------------------
-- SHADER CREATION IN THE MATERIAL EDITOR
----------------------------------------------
on create do
(
)

)

Comments

Comment viewing options

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

Just add this to the

Just add this to the parameters

dd1 type:#integer ui:dd

Just like the bits for the colorpickers, this adds a variable to the plugin, which will be usable in the "on create" bit (also, in the $.material.(whichever slot the texturemap is in).dd1), but in this case you have a number, which corresponds to which item you picked in the dropdownlist. Since it is a parameter of the plugin, and is connected to the rollout, each time you select the texturemap (and therefore open the rollout) the dropdownlist will be set to whatever was last chosen.

GSSArchitecture's picture

errrrrr

thanks for that, however i genuinely have no idea how to do that. very new to the game.

thanks anyways

brttd's picture

Only the items in the

Only the items in the parameters section are stored for the plugin. Only the rollout items which are referenced in the parameters will keep their settings, so you need to add the dropdownlist as a parameter, (Set the type to integer).

GSSArchitecture's picture

cheers for the reply

thanks cheese

one final question. when i select lets say item 6 it adjusts the colour. if i back out of the texturemap and go back into it, it keeps the colour selection, but the dropdown has reset back to showing number 1, making it a bit confusing.

is there any way i can get the item 6 to stay at all times.

cheers

sam

brttd's picture

http://docs.autodesk.com/3DSM

http://docs.autodesk.com/3DSMAX/16/ENU/MAXScript-Help/index.html?url=fil...

Something like this should work

rollout params "color set"
(
 label l "Please Select Colour From the Dropdown Below"
 
 dropdownlist dd ""\
 items:#("1","2","3","4","5","6","7","8","9","10") height:6
 
 colorpicker color1 "Base Color" align:#right fieldwidth:244 fieldheight: 50
 colorpicker color2 "" align:#right fieldwidth:0
 --You will get 5 items in the dropdown list. --Change height to 5, and you will get 4.
 
 on dd selected sel do
 (
  case sel of (
   1: (
    color1.color=[0,0,0]
    color2.color=[255,255,255]
   )
   2: (
    color1.color=[255,0,0]
    color2.color=[0,0,0]
   )
   3: (
    color1.color=[0,255,0]
    color2.color=[0,0,0]
   )
   4: (
    color1.color=[0,0,255]
    color2.color=[0,0,0]
   )
   5: (
    color1.color=[255,255,255]
    color2.color=[0,0,0]
   )
   --Add as many as you want
  )--End of case of
 
 )--End of dropdownlist selected
 
)--End of rollout

Comment viewing options

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