SDK :: How can I know that rollut is open?


I accidentally found that I can’t tell if a particular Rollout is currently rolled up or not (open or closed) via the SDK.
I can tell it when the Rollout is in a Rollout Floater…
Or I can check Command Panel as IRollupWindow and find my rollout…

But I can’t check the open/closed state using only rollout’s properties, flags, or methods.

Did I miss anything? :face_with_raised_eyebrow:


does this not work ?

IRollupWindow::IsPanelOpen ( int index )


Yes, as I said above, it works. But You have to get IRollupWindow which is different every time and depends on Command mode…
I try to get #open state from Rollout side


MXS Rollout has #open property…
it doesn’t always work right, but at least they try to give it some meaning. Why? How? Where does this state come from?


so what’s the class you’re starting from ?


it is handled inside maxscrpt.dll in rollout::get_property


I assumed some kind of dirty trick of this kind - a certain flag in the body of the code … by the way, as I said, this is not always true


ok… I found it:

def_visible_primitive(isRolloutOpen, "isRolloutOpen");
Value* isRolloutOpen_cf(Value** arg_list, int count)
	check_arg_count_with_keys(isRolloutOpen, 1, count);
	auto val = arg_list[0];
	if is_rollout(val)
		return bool_value(IsRollupPanelOpen(((Rollout*)val)->page));


… but it’s still not exactly what I’m looking for.
I’ll try to make a snippet to show the problem… but it’s too late for today :wink:

ui_ca = attributes ui_ca attribid:#(0xee11, 0x11ee)
	parameters controls rollout:controls
	rollout controls "Controls" rolledup:off --autoLayoutOnResize:off --category:10 
		group "Data: "
			button one_bt "One" width:136 align:#left offset:[0,0]
			button two_bt "Two" width:136 align:#right offset:[0,0]
		on controls rolledup val do
			format "controls >> ROLL ... val:%\t open:%\n" val
		on controls open do
			format "controls >> OPEN ... val:%\t\t open:%\n" ok
	rollout settings "Settings" rolledup:on --autoLayoutOnResize:off --category:11 
		group "Info: "
			button this_bt "This" width:66 align:#left offset:[0,0] across:2
			button that_bt "That" width:66 align:#right offset:[0,0]
		on settings rolledup val do
			format "settings >> ROLL ... val:%\t open:%\n" val
		on settings open do
			format "settings >> OPEN ... val:%\t\t open:%\n" ok

undo off, redraw off
	--try(deletereference (getclassinstances ui_ca)) catch()

	max create mode

	delete objects

	p = point name:#test isselected:on
	custattributes.add p ui_ca

	max modify mode


This snippet demonstrates the issue… more specifically - incorrect UI resizing with 4K monitors, or with UI scaling factor not 1.0.
I don’t want to resize at all! I want to keep both rollouts in the original design.
If someone can do this please show me how.
What I have, when I close/open rollouts, change the command panel, select/deselect the node, the UI gets messed up in some situations.

Also, if you check the print in the listener, you’ll see that sometimes it says the rollout is open when it’s actually closed, and says it’s closed when it’s open.