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 authored and johnhaddon committed Jul 9, 2024
1 parent f963611 commit 990bf2f
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 @@ -16,6 +16,7 @@ Improvements
- The following parameters can now be made visible in the GraphEditor :
- The `flake_layers` parameter of the `car_paint` shader.
- The `data_seed`, `proc_seed`, `obj_seed`, and `face_seed` parameters of the `color_jitter` shader.
- EditScope : Added summaries of set membership edits in the NodeEditor.

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 990bf2f

Please sign in to comment.