User Guide Cancel

display | Substance 3D Painter Python API

display

display module

This module exposes functions that change how the model of a project is presented in the viewports. They correspond to settings available in the “Display Settings” window.

The Environment Map used to light the scene can be retrieved with get_environment_resource(), or set with set_environment_resource(). The look up table (LUT) used as a Color Profile can be retrieved with get_color_lut_resource(), or set with set_color_lut_resource().

Example

import substance_painter.display 
 
# Show the currently used color profile: 
color_lut = substance_painter.display.get_color_lut_resource() 
if (color_lut != None): 
    print(color_lut.url()) 
else: 
    print("No color profile is used.") 
 
# Set a different color profile: 
new_color_lut = substance_painter.resource.ResourceID(context="starter_assets", 
                                                      name="sepia") 
substance_painter.display.set_color_lut_resource(new_color_lut)# Show the currently used environment map: 
envmap = substance_painter.display.get_environment_resource() 
print(envmap.url()) 
 
# Set a different environment map: 
new_envmap = substance_painter.resource.ResourceID(context="starter_assets", 
                                                   name="Bonifacio Street") 
substance_painter.display.set_environment_resource(new_envmap)# Show the currently active tone mapping operator: 
try: 
    tone_mapping = substance_painter.display.get_tone_mapping() 
    print(tone_mapping) 
except RuntimeError: 
    print("The project is color managed; tone mapping is not available") 
 
# Set a different tone mapping: 
try: 
    new_tone_mapping = substance_painter.display.ToneMappingFunction.ACES 
    substance_painter.display.set_tone_mapping(new_tone_mapping) 
except RuntimeError: 
    print("The project is color managed; tone mapping is not available") 
  • Step text

  • Step text

  • Step text

  • Step text

  • Step text

substance_painter.display.

get_environment_resource

get_environment_resource() → Optional[ResourceID]

Get the environment map resource of the active project.

Returns

The environment map resource or None.

Return type

ResourceID

Raises
substance_painter.display.

set_environment_resource

set_environment_resource(new_env_map: ResourceID) → None

Set the environment map resource of the active project.

Parameters

new_env_map (ResourceID) – The new environment map resource.

Raises
substance_painter.display.

get_color_lut_resource

get_color_lut_resource() → Optional[ResourceID]

Get the color profile LUT resource of the active project.

Returns

The color profile LUT resource or None.

Return type

ResourceID

Raises
substance_painter.display.

set_color_lut_resource

set_color_lut_resource(new_color_lut: ResourceID) → None

Set the color profile LUT resource of the active project.

Parameters

new_color_lut (ResourceID) – The new color profile LUT.

Raises
substance_painter.display.

get_tone_mapping

get_tone_mapping() → ToneMappingFunction

Get the tone mapping operator used to display the current project.

Note

The tone mapping function is disabled when color management is enabled. In that case trying to call get_tone_mapping will throw a RuntimeError.

Returns

The tone mapping function currently used by

the project.

Return type

ToneMappingFunction

Raises
  • RuntimeError – If the project is color managed.
  • ProjectError – If no project is opened.
  • ServiceNotFoundError – If Substance 3D Painter has not started all its services yet.
substance_painter.display.

set_tone_mapping

set_tone_mapping(new_tone_mapping: ToneMappingFunction) → None

Set the tone mapping operator to display the current project.

Note

The tone mapping function is disabled when color management is enabled. In that case trying to call set_tone_mapping will throw a RuntimeError.

Parameters

new_tone_mapping (ToneMappingFunction) – The new tone mapping function to use in the project.

Raises
  • TypeError – If new_tone_mapping is not a ToneMappingFunction.
  • RuntimeError – If the project is color managed.
  • ProjectError – If no project is opened.
  • ServiceNotFoundError – If Substance 3D Painter has not started all its services yet.

 Adobe

Get help faster and easier

New user?