Skip to content

Commit

Permalink
EditScopeUI : Add summary for SetMembershipEdits
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmehl committed Jun 24, 2024
1 parent e352897 commit ffcd961
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Improvements
- Added support for `{plug}` value substitutions in node annotations.
- Added <kbd>Ctrl</kbd> + <kbd>Enter</kbd> keyboard shortcut to annotation dialogue. This applies the annotation and closes the dialogue.
- LightEditor : Added support for Arnold light blockers and barndoor, gobo and decay light filters.
- EditScope : Added summary of `SetMembershipEdits` processors.

Fixes
-----
Expand Down
28 changes: 28 additions & 0 deletions python/GafferSceneUI/EditScopeUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,3 +303,31 @@ def _summary( processor, linkCreator ) :


GafferUI.EditScopeUI.ProcessorWidget.registerProcessorWidget( "RenderPassOptionEdits", __RenderPassOptionEditsWidget )

class __SetMembershipEditsWidget( GafferUI.EditScopeUI.SimpleProcessorWidget ) :

@staticmethod
def _summary( processor, linkCreator ) :

enabledSetCount = 0
disabledSetCount = 0
for r in processor["edits"] :
if r.getName() == "default" :
continue
if r["enabled"].getValue() :
enabledSetCount += 1
else :
disabledSetCount += 1

summaries = []
if enabledSetCount > 0 :
summaries.append( "edits to {} set{}".format( enabledSetCount, "s" if enabledSetCount > 1 else "" ) )
if disabledSetCount > 0 :
summaries.append( "disabled edits to {} set{}".format( disabledSetCount, "s" if disabledSetCount > 1 else "" ) )

if not summaries :
return None
summaries[0] = summaries[0][0].upper() + summaries[0][1:]
return " and ".join( summaries )

GafferUI.EditScopeUI.ProcessorWidget.registerProcessorWidget( "SetMembershipEdits", __SetMembershipEditsWidget )

0 comments on commit ffcd961

Please sign in to comment.