Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetMembershipEdits summary #5920

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 )
Loading