Notifications
Clear all

[Closed] HELP NEED IT! Resizing Rollout based on Subrollout RolledUp state

Hello Guys, im working on a personal project Im trying to create a rollout with some subrollouts the idea is to resize the mainrollout based on the “RolledUp” state of the subrullouts and move the available buttons, but i ran into some issues:

  1. By using MainRollOut.height += subrollout2.height is increasing the Mainrollout size when opening the Mainrollout

  2. When changing the position of the buttons in the mainrollout, the buttons stop working, (like if they are behind and click is not available anymore

.
ANY IDEA IN HOW TO MANGE THAT?

I will really appreciate any help or feedback

—————————– Script ———————————

try(DestroyDialog MainRollOut)catch()
rollout MainRollOut "Test Rollout" width:325 height:180
(	
	subRollout SubrolloutMain height:125 align:#center
	button btnMainrollout1 "Button 1" align:#left width:100 offset:[45, 0]
	button btnMainrollout2 "Button 2" align:#left width:100 offset:[150, -26]
)
rollout subrollout1 "Test Rollout" width:325 height:300 
(
	button btnsubrollout1 "Button 1" align:#center 
)

rollout subrollout2 "Test Rollout" width:325 height:300
(	

	button btnsubrollout2 "Button 1" align:#center	 

	on subrollout2 rolledup bState do  <---------------------------------------- HERE
	(
		if (bState == true) then
		(
			MainRollOut.height += subrollout2.height
			MainRollOut.height += 1
		)
		else
		(
			MainRollOut.height -= subrollout2.height
			MainRollOut.height -= 1)
)
createDialog MainRollOut pos:[1400,100]
addSubRollOut MainRollOut.SubrolloutMain subrollout1
addSubRollOut MainRollOut.SubrolloutMain subrollout2

11 Replies
try(DestroyDialog MainRollOut)catch()
rollout MainRollOut "Test Rollout" width:325 height:170
(	
	local opened = if opened != undefined then opened else off
		
	subRollout SubrolloutMain height:120 align:#center offset:[0,4]
	
	---label emp_lb offset:[0,10]
	
	button btnMainrollout1 "Button 1" align:#center width:100 offset:[0, 0] across:2
	button btnMainrollout2 "Button 2" align:#center width:100 offset:[0, 0]
	
	local ui = #(btnMainrollout1, btnMainrollout2)
)

rollout subrollout1 "Rollout A" width:325 height:300 
(
	local main_ui = MainRollOut.ui
	
	button btnsubrollout1 "Button A" align:#center 

	on subrollout1 rolledup state do if MainRollOut.opened do
	(
		subrol = subrollout1
		vshift = subrol.height + 1
		
		if state then
		(
			MainRollOut.height += vshift
			MainRollOut.SubrolloutMain.height += vshift
			
			main_ui.pos.y += vshift
		)
		else
		(
			MainRollOut.height -= vshift
			MainRollOut.SubrolloutMain.height -= vshift
			
			main_ui.pos.y -= vshift
		)
	)
)

rollout subrollout2 "Rollout B" width:325 height:300
(	
	local main_ui = MainRollOut.ui
	
	button btnsubrollout2 "Button B" align:#center	 
	
	on subrollout2 rolledup state do if MainRollOut.opened do
	(
		subrol = subrollout2
		vshift = subrol.height + 1
		
		if state then
		(
			MainRollOut.height += vshift
			MainRollOut.SubrolloutMain.height += vshift
			
			main_ui.pos.y += vshift
		)
		else
		(
			MainRollOut.height -= vshift
			MainRollOut.SubrolloutMain.height -= vshift
			
			main_ui.pos.y -= vshift
		)
	)
)

createDialog MainRollOut pos:[1400,100]
addSubRollOut MainRollOut.SubrolloutMain subrollout1
addSubRollOut MainRollOut.SubrolloutMain subrollout2
MainRollOut.opened = on

here is just a version that works. … as an idea

this is the same as above, but cleaned up to suit my scripting style:

try (DestroyDialog MainRollout) catch()
rollout MainRollout "Main Rollout" width:325 height:200
(	
	local updating = if updating != undefined then updating else on
		
	subRollout main_subrol height:150 align:#center offset:[0,4]
	
	button button1_bt "Button 1" align:#center width:100 offset:[0, 0] across:2
	button button2_bt "Button 2" align:#center width:100 offset:[0, 0]
	
	local vsize_ui = #(MainRollout, main_subrol)
	local shift_ui = #(button1_bt, button2_bt)
	
	fn updateRolloutSize vshift = if not MainRollout.updating do
	(
		vsize_ui.height += vshift
		shift_ui.pos.y += vshift
	)
	
	on MainRollout close do ()
	on MainRollout open do ()
)

rollout SubRolloutA "Rollout A" width:325 height:300 
(
	local main_rol = MainRollout 
	
	button buttonA_bt "Button A" align:#center 

	on SubRolloutA rolledup state do 
	(
		vshift = (if state then 1 else -1) * SubRolloutA.height
		main_rol.updateRolloutSize vshift
	)
)

rollout SubRolloutB "Rollout B" width:325 height:300
(	
	local main_rol = MainRollout 
	
	button buttonB_bt "Button B" align:#center	 
	button buttonC_bt "Button C" align:#center	 
	
	on SubRolloutB rolledup state do 
	(
		vshift = (if state then 1 else -1) * SubRolloutB.height
		main_rol.updateRolloutSize vshift
	)
)

createDialog MainRollout pos:[1400,100]
addSubRollout MainRollout.main_subrol SubRolloutA
addSubRollout MainRollout.main_subrol SubRolloutB
MainRollout.updating = off

technically I only added (changed) two things:
#1 we also need to resize the subrollout control
#2 we need to start using resizing after the the dialog interface is built

Rollout B Closed
image

Rollout A and B Closed
image

THANK YOU SO MUCH For your replay, really helpful, good news and bad news, the buttons issues is resolved which is great, but there are resizing issues when resizing the second subrollout, then half of the Mainrollout is gone and once you do it again the whole rollout is gone, also in on the first subrollout rolledUp the second subrollout it had also a wrong size and you cannot see the button.

I will try to debug and let you know, but if you have some idea i will be great,

Thanks again.

Rollout A Closed
image

show me the code you are using …
if you are using exactly my code it could be a 4K monitor issue or a custom font size (other than 100%) on your side.

try to increase the initial heights of main dialog and main subrollout

Yes, I just copy and paste the first code you sent, then tried with the second one…

OHHH ok that could be the case, man these 4k monitors bring more problems than actually benefits i also think my font has a different size bcz of that… ok then i have to find how to work around on that… i will check if there is any solution and post it here. Thanks,

I will try by changing the Monitor resolution and see what can i get.

Cheers

Changing the Resolution of the monitor to 2k (1920 x1080) everything works just fine… Man, this is so frustrating Autodesk should already writing their software 4k compatible.

Thanks Again. I guess i will just use 1920px for 3ds max from now on.

Hello again DenisT,

Sorry for bothering again, i found a really interesting issue when open 3ds max for the first time,

– Unknown property: “SubRollout2” in Rollout:MainRollOut

It seems like that when trying to create the “local ui = #(MainRollOut.SubRollout2” variable, local ui = MainRollOut is still undefined due to the fact that the rollout hasn’t been created yet, I try to find a solution but the only one that worked out was to delete that line or start the Manrollout first then run the code. 🙁

If you have any idea i will really appreciate it THANKS

1 Reply
(@denist)
Joined: 10 months ago

Posts: 0

I don’t know what code you are using… There is no SubRollout2 in my last code example.

Page 1 / 2