diff --git a/include/GafferImage/OpenColorIOContext.h b/include/GafferImage/OpenColorIOContext.h index b83678c954e..7788982664a 100644 --- a/include/GafferImage/OpenColorIOContext.h +++ b/include/GafferImage/OpenColorIOContext.h @@ -56,6 +56,8 @@ class GAFFERIMAGE_API OpenColorIOContext : public Gaffer::ContextProcessor explicit OpenColorIOContext( const std::string &name=GraphComponent::defaultName() ); ~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; diff --git a/python/GafferImageUI/OpenColorIOContextUI.py b/python/GafferImageUI/OpenColorIOContextUI.py index b12cbfb2bae..6b7b0f9ef49 100644 --- a/python/GafferImageUI/OpenColorIOContextUI.py +++ b/python/GafferImageUI/OpenColorIOContextUI.py @@ -80,8 +80,6 @@ """, "nodule:type", "", - "plugValueWidget:type", "GafferUI.LayoutPlugValueWidget", - "layoutPlugValueWidget:orientation", "horizontal", ], @@ -93,10 +91,6 @@ to be specified. """, - "nodule:type", "", - "boolPlugValueWidget:displayMode", "switch", - "label", "", - ], "config.value" : [ @@ -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, @@ -127,8 +118,6 @@ """, "nodule:type", "", - "plugValueWidget:type", "GafferUI.LayoutPlugValueWidget", - "layoutPlugValueWidget:orientation", "horizontal", ], @@ -140,10 +129,6 @@ to be specified. """, - "nodule:type", "", - "boolPlugValueWidget:displayMode", "switch", - "label", "", - ], "workingSpace.value" : [ @@ -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, diff --git a/src/GafferImage/OpenColorIOContext.cpp b/src/GafferImage/OpenColorIOContext.cpp index f82ce75b4ab..5f9c2fafc01 100644 --- a/src/GafferImage/OpenColorIOContext.cpp +++ b/src/GafferImage/OpenColorIOContext.cpp @@ -37,6 +37,7 @@ #include "GafferImage/OpenColorIOContext.h" #include "Gaffer/Context.h" +#include "Gaffer/OptionalValuePlug.h" #include "OpenColorIO/OpenColorIO.h" @@ -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 ) );