Skip to content

Commit

Permalink
Merge pull request #6140 from johnhaddon/viewAppOCIOFix
Browse files Browse the repository at this point in the history
OpenColorIOConfigPlugUI : Fix connection to scriptless apps
  • Loading branch information
ericmehl authored Nov 11, 2024
2 parents f4b1316 + ac54e01 commit f48e544
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
4 changes: 4 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ Fixes
- GafferUITest : Fixed `assertNodeUIsHaveExpectedLifetime()` test for invisible nodes.
- OpDialogue : Fixed `postExecuteBehaviour` handling.
- LocalDispatcher : Fixed job status update when a job was killed _immediately_ after being launched.
- `gaffer view` : Fixed default OpenColorIO display transform.

API
---

- Int64VectorDataPlug : Added new plug type for passing vectors of int64.
- OpenColorIOConfigPlugUI :
- Added `connectToApplication()` function.
- Deprecated `connect()` function. Use `connectToApplication()` instead.

1.5.0.1 (relative to 1.5.0.0)
=======
Expand Down
24 changes: 18 additions & 6 deletions python/GafferImageUI/OpenColorIOConfigPlugUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,20 +287,32 @@ def __setToDefault( self, *unused ) :
for plug in self.getPlugs() :
self.getPlug().setValue( "__default__" )

# Connection between default script config and Widget and View display transforms.
# Calling `connect()` from an application startup file is what makes the UI OpenColorIO-aware.
# Connection between application script configs and Widget and View display
# transforms. Calling `connectToApplication()` from an application startup file
# is what makes the UI OpenColorIO-aware.
def connectToApplication( application ) :

GafferUI.View.DisplayTransform.registerDisplayTransform(
"__default__", __defaultViewDisplayTransformCreator
)

application.root()["scripts"].childAddedSignal().connect( __scriptAdded )

## \deprecated. Use `connectToApplication()` instead.
def connect( script ) :

GafferUI.View.DisplayTransform.registerDisplayTransform(
"__default__", __defaultViewDisplayTransformCreator
)
__scriptAdded( script.parent(), script )

def __scriptAdded( container, script ) :

hadPlug = GafferImage.OpenColorIOConfigPlug.acquireDefaultConfigPlug( script, createIfNecessary = False )
plug = GafferImage.OpenColorIOConfigPlug.acquireDefaultConfigPlug( script )
if not hadPlug :
Gaffer.NodeAlgo.applyUserDefaults( plug )

GafferUI.View.DisplayTransform.registerDisplayTransform(
"__default__", __defaultViewDisplayTransformCreator
)

script.plugDirtiedSignal().connect( __scriptPlugDirtied )
__scriptPlugDirtied( plug )

Expand Down
6 changes: 1 addition & 5 deletions startup/gui/ocio.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@
# Make sure every script has a config plug added to it, and that we update
# the View and Widget display transforms appropriately when the config is changed.

def __scriptAdded( container, script ) :

GafferImageUI.OpenColorIOConfigPlugUI.connect( script )

application.root()["scripts"].childAddedSignal().connect( __scriptAdded )
GafferImageUI.OpenColorIOConfigPlugUI.connectToApplication( application )

Gaffer.Metadata.registerValue( GafferUI.View, "displayTransform.name", "plugValueWidget:type", "GafferImageUI.OpenColorIOConfigPlugUI.DisplayTransformPlugValueWidget" )
Gaffer.Metadata.registerValue( GafferUI.View, "displayTransform.name", "layout:minimumWidth", 150 )
Expand Down

0 comments on commit f48e544

Please sign in to comment.