Skip to content

Commit

Permalink
improve UX with Clear by enabling it only when it'd perform an action
Browse files Browse the repository at this point in the history
Signed-off-by: Christian López Barrón <[email protected]>
  • Loading branch information
chrizzFTD committed Nov 6, 2024
1 parent b8e27c0 commit 77ff7d2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion grill/views/usdview.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,11 @@ def RunCommand(self):
assert attribute.Clear()

def IsEnabled(self):
return super().IsEnabled() and any(attr.HasAuthoredValue() for attr in self._attributes)
# Usd.Attribute.Clear operates only on specs with an existing authored default value at the current edit target
return super().IsEnabled() and any(
(spec := attr.GetStage().GetEditTarget().GetAttributeSpecForScenePath(attr.GetPath())) and spec.default
for attr in self._attributes
)


class GrillAttributeBlockMenuItem(_GrillAttributeViewContextMenuItem):
Expand Down

0 comments on commit 77ff7d2

Please sign in to comment.