Skip to content

Commit eca9738

Browse files
committed
fix GrillAttributeClearMenuItem for USD-21.11
Signed-off-by: Christian López Barrón <chris.gfz@gmail.com>
1 parent 98e396d commit eca9738

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

grill/views/usdview.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,17 @@ def RunCommand(self):
259259

260260
def IsEnabled(self):
261261
# Usd.Attribute.Clear operates only on specs with an existing authored default value at the current edit target
262+
try:
263+
# USD>=24.11
264+
spec_getter = Usd.EditTarget.GetAttributeSpecForScenePath
265+
except AttributeError:
266+
# USD<24.11
267+
# Usd.EditTarget.GetSpecForScenePath did not work on earlier usd versions. It was fixed in 24.11.
268+
def spec_getter(edit_target, path):
269+
return edit_target.GetLayer().GetAttributeAtPath(edit_target.MapToSpecPath(path))
270+
262271
return super().IsEnabled() and any(
263-
(spec := attr.GetStage().GetEditTarget().GetAttributeSpecForScenePath(attr.GetPath())) and spec.default
272+
(spec := spec_getter(attr.GetStage().GetEditTarget(), attr.GetPath())) and spec.default
264273
for attr in self._attributes
265274
)
266275

0 commit comments

Comments
 (0)