Not sure if this is an issue with the way I’m creating the modifier or this is how it is supposed to work in max.
I have some objects obj1 and obj2.
I assign my modifier to both obj1 and obj2 (script below)
I can access the text field directly using method 1
obj1.modifiers[#Test_Attributes].sP_txt
obj2.modifiers[#Test_Attributes].sP_txt
I can also access those variables through the rollout and UI using method 2
obj1.modifiers[#Test_Attributes].test_ro.sP_txt.text
obj2.modifiers[#Test_Attributes].test_ro.sP_txt.text
However when using method 2 no matter which object is specified I get the result of the last selected object.
This is not a big issue, the real trouble comes when I try to set the property of the modifier through another script. So running setProperty will set the property of the last selected object no matter which object is specified
-- if obj2 was last selected, this will set the property of obj2 not obj1
setproperty obj1.modifiers[#Test_Attributes] #random_btn true
I’m not sure if this is how it’s supposed to be since the scripted plugin doesn’t store the state of the modifier panel and subsequently the script UI.
Modifier Script:
plugin modifier TestAttributes
name:"Test Attributes"
classID:#(685321,452287)
extends:EmptyModifier
replaceUI:true
(
local test_ro
parameters main rollout:test_ro
(
sP_txt type:#string animatable:false ui:sp_txt default:"[10,-70,5]"
random_btn type:#boolean animatable:false ui:random_btn default:false
on random_btn set val do
(
if val == true then
(
test_ro.sP_txt.text = "[" + (random 0 1000) as string + "," + (random 0 1000) as string + "," + (random 0 1000) as string + "]"
random_btn = false
)
)
)
rollout test_ro "Test Rollout"
(
checkbutton random_btn " Random " checked:false
edittext sP_txt "sP" text:"[10000,-7000,5500]"
)
)