From 94650a9f1afbf980489cd923b82875a0395f6b8f Mon Sep 17 00:00:00 2001 From: Pierre Baillargeon Date: Mon, 2 Dec 2024 14:19:31 -0500 Subject: [PATCH] Fix AE extra attribute section. A previous change broke which attributes are added to the extra attributes section. That is because the default function to create an attribute UI returns None and was interpreted as no UI being created. This is a unfortunate consequence of the design: the return value is interpreted as sucsess or failure of creating a UI and then, on success, custom callbacks are connected to that UI. But for the default fallback, those callbacks must not be added, so it returns None, which was interpreted as failure. Given that it is the final fallback, that had no consequences, but a code change made registering the attribute as being handled was no longer done properly. Restore the old code, which was adding the attribute to teh list of known, handled attributes. Also, don't add supressed attributes in the extra attribute section. --- lib/mayaUsd/resources/ae/usdschemabase/ae_template.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mayaUsd/resources/ae/usdschemabase/ae_template.py b/lib/mayaUsd/resources/ae/usdschemabase/ae_template.py index 43a92a4f3..54e4f389d 100644 --- a/lib/mayaUsd/resources/ae/usdschemabase/ae_template.py +++ b/lib/mayaUsd/resources/ae/usdschemabase/ae_template.py @@ -331,11 +331,11 @@ def addControls(self, attrNames): createdControl = controlCreator(self, attrName) if createdControl: self.defineCustom(createdControl, attrName) - self.addedAttrs.add(attrName) break except Exception as ex: # Do not let one custom control failure affect others. print('Failed to create control %s: %s' % (attrName, ex)) + self.addedAttrs.add(attrName) def suppress(self, attrName): cmds.editorTemplate(suppress=attrName) @@ -491,7 +491,7 @@ def createCustomExtraAttrs(self, sectionName, attrs, collapse): # long as the suppressed attributes are suppressed by suppress(self, control). # This function will keep all suppressed attributes into a list which will be use # by addControls(). So any suppressed attributes in extraAttrs will be ignored later. - extraAttrs = [attr for attr in self.attrS.attributeNames if attr not in self.addedAttrs] + extraAttrs = [attr for attr in self.attrS.attributeNames if attr not in self.addedAttrs and attr not in self.suppressedAttrs] sectionName = mel.eval("uiRes(\"s_TPStemplateStrings.rExtraAttributes\");") self.createSection(sectionName, extraAttrs, collapse)