Skip to content

Commit

Permalink
OpenColorIOContext : Use OptionalValuePlug
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhaddon committed Jul 18, 2023
1 parent 331b5aa commit bad4cb7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 27 deletions.
2 changes: 2 additions & 0 deletions include/GafferImage/OpenColorIOContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class GAFFERIMAGE_API OpenColorIOContext : public Gaffer::ContextProcessor
explicit OpenColorIOContext( const std::string &name=GraphComponent::defaultName<OpenColorIOContext>() );
~OpenColorIOContext() override;

/// \todo Return OptionalValuePlug, and remove `configEnabledPlug()` and
/// `configValuePlug()` methods. Do the same for `workingSpace` plugs.
Gaffer::ValuePlug *configPlug();
const Gaffer::ValuePlug *configPlug() const;

Expand Down
18 changes: 0 additions & 18 deletions python/GafferImageUI/OpenColorIOContextUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@
""",

"nodule:type", "",
"plugValueWidget:type", "GafferUI.LayoutPlugValueWidget",
"layoutPlugValueWidget:orientation", "horizontal",

],

Expand All @@ -93,10 +91,6 @@
to be specified.
""",

"nodule:type", "",
"boolPlugValueWidget:displayMode", "switch",
"label", "",

],

"config.value" : [
Expand All @@ -106,9 +100,6 @@
Specifies the OpenColorIO config to be used.
""",

"nodule:type", "",
"label", "",
"layout:activator", lambda plug : plug.parent()["enabled"].getValue(),
"plugValueWidget:type", "GafferUI.PresetsPlugValueWidget",
"presetsPlugValueWidget:allowCustom", True,

Expand All @@ -127,8 +118,6 @@
""",

"nodule:type", "",
"plugValueWidget:type", "GafferUI.LayoutPlugValueWidget",
"layoutPlugValueWidget:orientation", "horizontal",

],

Expand All @@ -140,10 +129,6 @@
to be specified.
""",

"nodule:type", "",
"boolPlugValueWidget:displayMode", "switch",
"label", "",

],

"workingSpace.value" : [
Expand All @@ -153,9 +138,6 @@
Specifies the working color space to be used.
""",

"nodule:type", "",
"label", "",
"layout:activator", lambda plug : plug.parent()["enabled"].getValue(),
"plugValueWidget:type", "GafferUI.PresetsPlugValueWidget",
"presetNames", GafferImageUI.OpenColorIOTransformUI.colorSpacePresetNames,
"presetValues", GafferImageUI.OpenColorIOTransformUI.colorSpacePresetValues,
Expand Down
12 changes: 3 additions & 9 deletions src/GafferImage/OpenColorIOContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "GafferImage/OpenColorIOContext.h"

#include "Gaffer/Context.h"
#include "Gaffer/OptionalValuePlug.h"

#include "OpenColorIO/OpenColorIO.h"

Expand All @@ -54,15 +55,8 @@ OpenColorIOContext::OpenColorIOContext( const std::string &name )
{
storeIndexOfNextChild( g_firstPlugIndex );

/// \todo Would it be useful to have an OptionalPlug type,
/// like NameValuePlug, but without the name?
addChild( new ValuePlug( "config" ) );
configPlug()->addChild( new BoolPlug( "enabled", Plug::In, false ) );
configPlug()->addChild( new StringPlug( "value" ) );

addChild( new ValuePlug( "workingSpace" ) );
workingSpacePlug()->addChild( new BoolPlug( "enabled", Plug::In, false ) );
workingSpacePlug()->addChild( new StringPlug( "value", Plug::In, OCIO_NAMESPACE::ROLE_SCENE_LINEAR ) );
addChild( new OptionalValuePlug( "config", new StringPlug( "value" ) ) );
addChild( new OptionalValuePlug( "workingSpace", new StringPlug( "value", Plug::In, OCIO_NAMESPACE::ROLE_SCENE_LINEAR ) ) );

addChild( new ValuePlug( "variables" ) );
addChild( new AtomicCompoundDataPlug( "extraVariables", Plug::In, new IECore::CompoundData ) );
Expand Down

0 comments on commit bad4cb7

Please sign in to comment.