[Closed] Draw a number with dropdown selection
What does this mean for us?
- must be done quickly
- should be simple to save debugging time
- solve special cases, not general ones
- the whole value of the project lies in the practice of writing scripts, training, user interface solutions. All this may be required in future projects.
I think each person is able to evaluate the prospect of their project The script I have is already working as it meant, but I would like to improve the visual feedback for some features. That’s why I came here.
Can you help me implement the part of your code in my(?):
rollout RipTools “Ripping Tools”
(
– some code
)
createDialog RipTools
I really want it to work now without me learning new things.
p.s.: I learn things anyway. For so many years the maxscript helped me learn c#, python, C++, autoit. That will not be possible without small victories since I’m not a programmer at all but an artist who want to automate things in work.
try(destroydialog _params) catch()
rollout _params "Parameters" width:191
(
local wb = 12
local hb = 23
local _x = 28
local _y = 8
local texture_states = #(1,1,1,1,1,1,1,1,1,1,1,1)
local texture_one = 1
local texture_two = 2
local texture_types = #
(
"Ambient",
"Diffuse",
"Specular",
"Specular Level",
"Glossiness",
"Self-Illumination",
"Opacity",
"Filter",
"Bump",
"Reflection",
"Refraction",
"Displacement",
""
)
checkbutton info "?" width:wb height:hb pos:[4, _y] tooltip:"Show States" highlightcolor:brown enabled:on
checkbutton bt01 "" width:wb height:hb pos:[_x + 00*(wb + 1), _y] tooltip:texture_types[1]
checkbutton bt02 "" width:wb height:hb pos:[_x + 01*(wb + 1), _y] tooltip:texture_types[2]
checkbutton bt03 "" width:wb height:hb pos:[_x + 02*(wb + 1), _y] tooltip:texture_types[3]
checkbutton bt04 "" width:wb height:hb pos:[_x + 03*(wb + 1), _y] tooltip:texture_types[4]
checkbutton bt05 "" width:wb height:hb pos:[_x + 04*(wb + 1), _y] tooltip:texture_types[5]
checkbutton bt06 "" width:wb height:hb pos:[_x + 05*(wb + 1), _y] tooltip:texture_types[6]
checkbutton bt07 "" width:wb height:hb pos:[_x + 06*(wb + 1), _y] tooltip:texture_types[7]
checkbutton bt08 "" width:wb height:hb pos:[_x + 07*(wb + 1), _y] tooltip:texture_types[8]
checkbutton bt09 "" width:wb height:hb pos:[_x + 08*(wb + 1), _y] tooltip:texture_types[8]
checkbutton bt10 "" width:wb height:hb pos:[_x + 09*(wb + 1), _y] tooltip:texture_types[10]
checkbutton bt11 "" width:wb height:hb pos:[_x + 10*(wb + 1), _y] tooltip:texture_types[11]
checkbutton bt12 "" width:wb height:hb pos:[_x + 11*(wb + 1), _y] tooltip:texture_types[12]
label lb_texture_one "Primary:" align:#right offset:[-30,6] across:2
dropdownlist ui_texture_one items:texture_types selection:01 width:114 height:14 align:#left offset:[-26,4]
label lb_texture_two "Secondary:" align:#right offset:[-30,0] across:2
dropdownlist ui_texture_two items:texture_types selection:13 width:114 height:14 align:#left offset:[-26,-2]
local buttons = #(bt01, bt02, bt03, bt04, bt05, bt06, bt07, bt08, bt09, bt10, bt11, bt12)
fn changeTextureState index: state: =
(
if state != unsupplied do
(
texture_states[index] = state
)
if index != unsupplied and index < 13 do
(
state = texture_states[index]
if state == 1 do
(
ui_texture_one.selection = index
if ui_texture_two.selection == index do ui_texture_two.selection = 13
)
if state == 2 do
(
ui_texture_two.selection = index
if ui_texture_one.selection == index do ui_texture_one.selection = 13
)
)
for k=1 to buttons.count do
(
if info.state then
(
buttons[k].text = texture_states[k] as string
)
else
(
if (k == ui_texture_one.selection) then
(
buttons[k].text = if (k == ui_texture_two.selection) then "x" else "1"
)
else
(
buttons[k].text = if (k == ui_texture_two.selection) then "2" else ""
)
)
buttons[k].state = (k == ui_texture_one.selection) or (k == ui_texture_two.selection)
)
)
on ui_current_alt changed state do
(
if (texture_one == texture_two) do
(
texture_states[texture_one] = state
changeTextureState index:texture_one
)
)
on info changed state do changeTextureState()
on bt01 changed state do changeTextureState index:1
on bt02 changed state do changeTextureState index:2
on bt03 changed state do changeTextureState index:3
on bt04 changed state do changeTextureState index:4
on bt05 changed state do changeTextureState index:5
on bt06 changed state do changeTextureState index:6
on bt07 changed state do changeTextureState index:7
on bt08 changed state do changeTextureState index:8
on bt09 changed state do changeTextureState index:9
on bt10 changed state do changeTextureState index:10
on bt11 changed state do changeTextureState index:11
on bt12 changed state do changeTextureState index:12
fn toggleTextureState index: =
(
if buttons[index].state do
(
texture_states[index] = if texture_states[index] == 1 then 2 else 1
changeTextureState index:index
)
)
on bt01 rightclick do toggleTextureState index:1
on bt02 rightclick do toggleTextureState index:2
on bt03 rightclick do toggleTextureState index:3
on bt04 rightclick do toggleTextureState index:4
on bt05 rightclick do toggleTextureState index:5
on bt06 rightclick do toggleTextureState index:6
on bt07 rightclick do toggleTextureState index:7
on bt08 rightclick do toggleTextureState index:8
on bt09 rightclick do toggleTextureState index:9
on bt10 rightclick do toggleTextureState index:10
on bt11 rightclick do toggleTextureState index:11
on bt12 rightclick do toggleTextureState index:12
on ui_texture_one selected index do
(
if index < 13 and index == ui_texture_two.selection do ui_texture_two.selection = 13
changeTextureState index:index state:1
)
on ui_texture_two selected index do
(
if index < 13 and index == ui_texture_one.selection do ui_texture_one.selection = 13
changeTextureState index:index state:2
)
on _params lbuttondown pos do
(
for k=1 to texture_states.count do
(
buttons[k].text = texture_states[k] as string
buttons[k].state = texture_states[k] != 1
)
)
on _params lbuttonup pos do
(
changeTextureState()
buttons.state = off
)
on _params open do undo off
(
changeTextureState()
)
)
createdialog _params
some new features added… try to find them … maybe you will like some of them
Okay, this is what I can understand. Thank you! But in this version for some reason when I chose diffuse in the top and then diffuse in the bottom the top became overwritten and number 1
is no longer visible in the rectangles. The same happens the other way around.
This is one of the new features… there is no more the “x” situation. Situation “x” couldn’t resolve “toggle”. Now we can do this by Right-Click on the selected button.
You now have two versions, so you have an option to choose the one that suits you best.