ScriptSpot

Forum topic · Scripts Wanted

Edit Render Region-button

By Haider of Sweden · 2016-10-12

Description

Currently, there is an Edit Render Region button available that can be added to the toolbar.

I made a custom one like this:


	on execute do if keyboard.shiftpressed then
 	(
		macros.run "Haider" "RenderRegion_GUI_02"
	)
	
 	else 
	
	(
		actionMan.executeAction 0 "59241" -- Edit Render Region
	)

I need your help to make this script behave so that it is pressed when the Edit Render Region mode is on, and unpressed when it is off, like the original button.

Also, I am not sure if

actionMan.executeAction 0 "59241"

is the proper code. I got it from the listener.

Comments (2)

--

Haider of Sweden · 2016-10-14

Thanks Miauu, this did the trick.

Here is the result


on execute do 
	if keyboard.shiftPressed then
		(
			macros.run "Haider" "RenderRegion_GUI_02"
		)
	
	else if keyboard.controlPressed then
		(
			setRenderType #view
		)

	else if EditRenderRegion.IsEditable then
		(
			setRenderType #view
		)
			
	else
		(
			 EditRenderRegion.EditRegion()
		)
		
		on isChecked return EditRenderRegion.IsEditing

The next issue I am struggling with is to set

setRenderType #view

if

EditRenderRegion.IsEditable

. But it ends up that I need to click twice to get the effect I need.

.

miauu · 2016-10-12

Open MaxScript Help file and search for this:

Interface: EditRenderRegion

Then, to make the toolbar button to stay pressed search for this:

on isChecked do