Max script Global variable buttons help

Max script Global variable buttons help

gibzie90
Participant Participant
720 Views
3 Replies
Message 1 of 4

Max script Global variable buttons help

gibzie90
Participant
Participant

I have script 1 that adds button 1 to an attribute holder on object 1,

And I have script 2 that adds button 2 to an attribute holder on object 2.

 

When button 1 is pressed I need button 2 to match the state of button 1.

 

Can anyone give me an example of how to do this? Im trying to use a global variable, but I don't know how to make button 2 check button 1.

 

0 Likes
Accepted solutions (1)
721 Views
3 Replies
Replies (3)
Message 2 of 4

denisT.MaxDoctor
Advisor
Advisor
Accepted solution

When one UI knows something about another UI, it's a very specific case.

The more general case when one property is bound to another... In 3DS MAX there is the paramWire interface.

This is a built-in mechanism, and you should try to stick to it.

delete objects
gc()

MyCA = attributes MyCA attribid:#(171717, 717171) 
(
	parameters params rollout:params
	(
		shared_state type:#boolean ui:ui_shared_state
	)
	rollout params "Parameters" 
	(
		checkbox ui_shared_state "State" align:#center
	)		
)

a = box name:#one pos:[20, 0, 0] wirecolor:green
b = box name:#two pos:[-20, 0, 0] wirecolor:orange

custattributes.add a MyCA
custattributes.add b MyCA 

paramWire.connect2way a.MyCA[#shared_state] b.MyCA[#shared_state] "shared_state" "shared_state"

/* or one way

paramWire.connect a.MyCA[#shared_state] b.MyCA[#shared_state] "shared_state"

*/
 
Message 3 of 4

denisT.MaxDoctor
Advisor
Advisor

... binding UI controls is not impossible and might make sense in a specific case. But this is a different and much more difficult task.

0 Likes
Message 4 of 4

gibzie90
Participant
Participant
Thankyou very much, I don't know why but I hadn't even considered using wire params. Very helpful, thankyou once again
0 Likes