Toggling LUT on and off for the render region


Here’s a simple self-installing plugin that adds a “Toggle LUT” command to the viewport Display menu. You can use this hide/show gamma correction in the render region while you’re working on the lighting of your scene (eg for film work, to toggle between the linear display and the “print space” lut).

To install this plugin, copy the code and save it in a .py file in the Application\Plugins folder of the User location or a workgroup. Then either restart Softimage or use the Plugin Manager to load the new plugin. After the plugin is loaded, you can use File > Keyboard Mapping to assign a shortcut key to the ToggleLut command.

# ToggleLUT
# Initial code generated by Softimage SDK Wizard
# Executed Wed Jun 15 05:51:55 EDT 2011 by blairs
import win32com.client
from win32com.client import constants

null = None
false = 0
true = 1

def XSILoadPlugin( in_reg ):
	in_reg.Author = "blairs"
	in_reg.Name = "ToggleLUT"
	in_reg.Major = 1
	in_reg.Minor = 0

	in_reg.RegisterCommand("ToggleLUT","ToggleLUT")
#	in_reg.RegisterMenu(constants.siMenuVMCameraID,"Camera_Toggle_LUT",false,false)
	in_reg.RegisterMenu(constants.siMenuVMDisplayID,"Display_Toggle_LUT",false,false)
	#RegistrationInsertionPoint - do not remove this line

	return true

def XSIUnloadPlugin( in_reg ):
	strPluginName = in_reg.Name
	return true

def ToggleLUT_Init( in_ctxt ):
	oCmd = in_ctxt.Source
	oCmd.Description = ""
	oCmd.ReturnValue = true

	return true

def ToggleLUT_Execute(  ):

	rr = Application.Preferences.GetPreferenceValue("Display.color_management_render_region")
	Application.Preferences.SetPreferenceValue("Display.color_management_render_region", not(rr) )

	return true

def Display_Toggle_LUT_Init( in_ctxt ):
	oMenu = in_ctxt.Source
	oMenu.AddCommandItem("ToggleLUT","ToggleLUT")
	return true

1 thought on “Toggling LUT on and off for the render region

  1. Toggling the script on, renders anything in the render region completely black, compared to a default render region render which at least renders things non-linear.

    Softimage doesn’t have any options to load a custom LUT from what I can see in the color management options in the preferences, unless I’m misunderstanding what this script actually does, which is render anything in the render region as a linear image rather that a non-linear image ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s