Skip to content

Commit

Permalink
StandardOptions : Add render:defaultRenderer option
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhaddon committed Mar 15, 2024
1 parent 47c09eb commit 992d11e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Features
--------

- Render, InteractiveRender : Added new nodes capable of rendering to any supported renderer, and using the`render:defaultRenderer` option to determine which to use by default.
- StandardOptions : Added `render:defaultRenderer` option, allowing the scene globals to specify which renderer is used by the Render and InteractiveRender nodes.

1.3.13.1 (relative to 1.3.13.0)
========
Expand Down
35 changes: 34 additions & 1 deletion python/GafferSceneUI/StandardOptionsUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import Gaffer
import GafferUI
import GafferScene
import GafferSceneUI

from GafferUI.PlugValueWidget import sole

Expand Down Expand Up @@ -77,6 +78,13 @@ def __cameraSummary( plug ) :

return ", ".join( info )

def __rendererSummary( plug ) :

if plug["defaultRenderer"]["enabled"].getValue() :
return plug["defaultRenderer"]["value"].getValue()

return ""

def __renderSetSummary( plug ) :

info = []
Expand Down Expand Up @@ -123,6 +131,7 @@ def __statisticsSummary( plug ) :
"options" : [

"layout:section:Camera:summary", __cameraSummary,
"layout:section:Renderer:summary", __rendererSummary,
"layout:section:Render Set:summary", __renderSetSummary,
"layout:section:Motion Blur:summary", __motionBlurSummary,
"layout:section:Statistics:summary", __statisticsSummary,
Expand Down Expand Up @@ -340,7 +349,31 @@ def __statisticsSummary( plug ) :
"layout:section", "Camera",
],

# Purpose
# Renderer

"options.defaultRenderer" : [

"description",
"""
Specifies the default renderer to be used by the Render and
InteractiveRender nodes.
""",

"label", "Default Renderer",
"layout:section", "Renderer",

],

"options.defaultRenderer.value" : [

"plugValueWidget:type", "GafferUI.PresetsPlugValueWidget",
"preset:None", "",
"presetNames", GafferSceneUI.RenderUI.rendererPresetNames,
"presetValues", GafferSceneUI.RenderUI.rendererPresetNames,

],

# Render Set

"options.includedPurposes" : [

Expand Down
2 changes: 1 addition & 1 deletion python/GafferSceneUI/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
from . import OptionsUI
from . import OpenGLAttributesUI
from . import SceneWriterUI
from . import RenderUI
from . import StandardOptionsUI
from . import StandardAttributesUI
from . import ShaderUI
Expand Down Expand Up @@ -125,7 +126,6 @@
from . import AttributeVisualiserUI
from . import FilterProcessorUI
from . import MeshToPointsUI
from . import RenderUI
from . import ShaderBallUI
from . import ShaderTweaksUI
from . import CameraTweaksUI
Expand Down
4 changes: 4 additions & 0 deletions src/GafferScene/StandardOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ StandardOptions::StandardOptions( const std::string &name )
options->addChild( new Gaffer::NameValuePlug( "render:overscanRight", new FloatPlug( "value", Plug::In, 0.1f, 0.0f, 1.0f ), false, "overscanRight" ) );
options->addChild( new Gaffer::NameValuePlug( "render:depthOfField", new IECore::BoolData( false ), false, "depthOfField" ) );

// Renderer

options->addChild( new Gaffer::NameValuePlug( "render:defaultRenderer", new IECore::StringData(), false, "defaultRenderer" ) );

// Render set

options->addChild( new Gaffer::NameValuePlug( "render:includedPurposes", new IECore::StringVectorData( { "default", "render" } ), false, "includedPurposes" ) );
Expand Down

0 comments on commit 992d11e

Please sign in to comment.