Skip to content

Commit

Permalink
ImageStats : Switch from postCreate to user defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldresser-ie committed Jan 3, 2024
1 parent 793bda3 commit 136396d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
14 changes: 2 additions & 12 deletions python/GafferImageUI/ImageStatsUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@
import GafferImage
import GafferImageUI

## A function suitable as the postCreator in a NodeMenu.append() call. It
# sets the region of interest for the node to cover the entire format.
def postCreate( node, menu ) :

with node.scriptNode().context() :
if node["in"].getInput() :
format = node["in"]["format"].getValue()
else:
format = GafferImage.FormatPlug.getDefaultFormat( node.scriptNode().context() )

node["area"].setValue( format.getDisplayWindow() )

Gaffer.Metadata.registerNode(

GafferImage.ImageStats,
Expand Down Expand Up @@ -117,6 +105,7 @@ def postCreate( node, menu ) :

"nodule:type", "",
"plugValueWidget:type", "GafferUI.PresetsPlugValueWidget",
"userDefault", GafferImage.ImageStats.AreaSource.DisplayWindow,

],

Expand All @@ -129,6 +118,7 @@ def postCreate( node, menu ) :
""",

"layout:activator", "areaSourceIsArea",
"userDefault", lambda plug : GafferImage.FormatPlug.getDefaultFormat( Gaffer.Context.current() ).getDisplayWindow()

],

Expand Down
2 changes: 1 addition & 1 deletion startup/gui/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def __lightCreator( nodeName, shaderName, shape ) :
nodeMenu.append( "/Image/Utility/Metadata", GafferImage.ImageMetadata, searchText = "ImageMetadata" )
nodeMenu.append( "/Image/Utility/Delete Metadata", GafferImage.DeleteImageMetadata, searchText = "DeleteImageMetadata" )
nodeMenu.append( "/Image/Utility/Copy Metadata", GafferImage.CopyImageMetadata, searchText = "CopyImageMetadata" )
nodeMenu.append( "/Image/Utility/Stats", GafferImage.ImageStats, searchText = "ImageStats", postCreator = GafferImageUI.ImageStatsUI.postCreate )
nodeMenu.append( "/Image/Utility/Stats", GafferImage.ImageStats, searchText = "ImageStats" )
nodeMenu.append( "/Image/Utility/Sampler", GafferImage.ImageSampler, searchText = "ImageSampler" )
nodeMenu.append( "/Image/Utility/Catalogue", GafferImage.Catalogue )
nodeMenu.append( "/Image/Utility/Catalogue Select", GafferImage.CatalogueSelect )
Expand Down

0 comments on commit 136396d

Please sign in to comment.