Notifications
Clear all

[Closed] scripted helper rollout updates

Hi there!

I’m having a very annoying problem with rollouts:
In a scripted plugin (helper) a rollout’s “open” event is triggered several times, even when changing a parameter in a rollout. When I remove a rollout in the load/create/postLoad/postCreate event, it’s again added directly when the events have finishe because of those reloads. It’s only possible to remove a rollout inside an rollout’s open event but like I said: it’s triggered very often…

Anyone else having this issues or/and a fix for that? :curious:

Thanks!

4 Replies

I use the Open event in many scripts without issue. Could you provide a code sample that reproduces the problem?

the code sample will help for sure.

and…

all mxs plugin developers have an issue of multiple unnecessary interval calls and notifications (ui updates, on set/get events, etc.).

Hi,

thanks for your replies. I’m doing MaxScript for MANY years now and can’t remember having issues like these before, too.

I will try to create an example.

Best regards!

Okay, I cleaned the code and here is the example:

plugin Helper extHelpDummy extends:Dummy name:"extHelpDummy" classid:#(0x3ea54562, 0x77c8beeb) category:"test"
(

	local params, rolloutONE, rolloutTWO
	local removeCheck
	
	parameters main rollout:params
	(
		sliderParam type:#float ui:sliderController animatable:true
	)
	
	fn buildDisplayMesh =
	(
		volumeDummy = createInstance Editable_Mesh()
		volumeHeightDummy  = Box length:1000 width:1000 height:1000 lengthsegs:1 widthsegs:1 mapCoords:false
		meshop.attach volumeDummy (convertToMesh volumeHeightDummy)
	)
	
	rollout params "Parameters"
	(
		group "group"
		(
			Slider sliderController "slider" range:[0.0000,1.0000,0.0000] scale:0.0001 type:#float ticks:10
			
			Button btn_param1 "1" width:138
			Button btn_param2 "2" width:138
			Button btn_param3 "3" width:138
			Button btn_param4 "4" width:138
		)
		
		on btn_param1 pressed do ()
		on btn_param2 pressed do ()
		on btn_param3 pressed do ()
		on btn_param4 pressed do ()
		
		on params open do
		(
			print "open params"
		)
		
	)
	
	rollout rolloutONE "ONE"
	(
		group "group ONE"
		(
			Button btn_rolloutONE1 "1" width:138
			Button btn_rolloutONE2 "2" width:138
			Button btn_rolloutONE3 "3" width:138
			Button btn_rolloutONE4 "4" width:138
		)
		
		on btn_rolloutONE1 pressed do ()
		on btn_rolloutONE2 pressed do ()
		on btn_rolloutONE3 pressed do ()
		on btn_rolloutONE4 pressed do ()
		
		on rolloutONE open do
		(
			print "open rolloutONE"
			-- removing TWO doesn't work here
			--removeCheck()
			removeRollout rolloutTWO
		)		
	)
	
	rollout rolloutTWO "TWO"
	(
		group "group TWO"
		(
			Button btn_rolloutTWO1 "1" width:138
			Button btn_rolloutTWO2 "2" width:138
			Button btn_rolloutTWO3 "3" width:138
			Button btn_rolloutTWO4 "4" width:138
		)
		
		on btn_rolloutTWO1 pressed do ()
		on btn_rolloutTWO2 pressed do ()
		on btn_rolloutTWO3 pressed do ()
		on btn_rolloutTWO4 pressed do ()
		
		on rolloutTWO open do
		(
			print "open rolloutTWO"
			-- removing ONE does work here, because it's the last rollour (I think...)
			--removeCheck()
			--removeRollout rolloutONE
		)
	)
	
	fn check=
	(
		-- for testing return true or false
		true
	)
	
	fn startPlugin=
	(	
		print ("function check returns " + check() as string)
		-- do stuff
	)
	
	on create do startPlugin()
	on load do startPlugin()
	on clone orig do buildDisplayMesh()		
	on useWireColor do return false
	
	fn removeCheck=
	(
		-- it seems to work but when selecting the dummy, the rollout is created again
		print "remove check!"
		if check() == false then
		(
			print ("removing rolloutONE ("+ rolloutONE as string + ")")
			removeRollout rolloutONE
		)
		else
		(
			print ("removing rolloutTWO ("+ rolloutTWO as string + ")")
			removeRollout rolloutTWO
		)
	)
	
	on postCreate do
	(	
		print "post create!"
		removeCheck()
	)
	
	on postLoad do
	(
		print "post load!"		
		removeCheck()
	)
)

It seems I have found an answer to one problem:
if you put the removeRollout stuff inside the very last rollout’s “open” event you can remove rollouts. Every “open” event (or rollout creation) seems to refresh/rebuild every other rollout… wtf

In the above example I couldn’t recreate the problem of UI refreshing while parameter changes… very strange.