From f6b76435e7cb12f69047fc2d6c8a48f7b144391e Mon Sep 17 00:00:00 2001 From: Pierre Baillargeon Date: Tue, 7 Jan 2025 14:27:33 -0500 Subject: [PATCH] EMSUSD-1996 Fix expression UI - The expression data changed callback was calling non-existing function on text string. - Made label Python constants be all uppercase. - Fix that clearing all include/exclude would not update the remove button. --- .../collection/expressionRulesMenu.py | 9 +++++---- .../usdSharedComponents/collection/expressionWidget.py | 4 +--- .../collection/includeExcludeWidget.py | 1 + 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/collection/expressionRulesMenu.py b/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/collection/expressionRulesMenu.py index 896551099..ec9fc7761 100644 --- a/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/collection/expressionRulesMenu.py +++ b/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/collection/expressionRulesMenu.py @@ -12,8 +12,9 @@ EXPAND_PRIMS_MENU_OPTION = "Expand Prims" EXPAND_PRIMS_PROPERTIES_MENU_OPTION = "Expand Prims and Properties" EXPLICIT_ONLY_MENU_OPTION = "Explicit Only" -kIncludeExcludeLabel = "Include/Exclude" -kRemoveAllLabel = "Remove All" +INCLUDE_EXCLUDE_LABEL = "Include/Exclude" +REMOVE_ALL_LABEL = "Remove All" + class ExpressionMenu(QMenu): def __init__(self, data: CollectionData, parent: QWidget): @@ -23,8 +24,8 @@ def __init__(self, data: CollectionData, parent: QWidget): # Note: this is necessary to avoid the separator not show up. self.setSeparatorsCollapsible(False) - self._incExSeparator = self.addSection(kIncludeExcludeLabel) - self._removeAllAction = QAction(kRemoveAllLabel, self) + self._incExSeparator = self.addSection(INCLUDE_EXCLUDE_LABEL) + self._removeAllAction = QAction(REMOVE_ALL_LABEL, self) self.addActions([self._incExSeparator, self._removeAllAction]) self._removeAllAction.triggered.connect(self._onRemoveAll) diff --git a/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/collection/expressionWidget.py b/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/collection/expressionWidget.py index 79b2fcfa8..0961af022 100644 --- a/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/collection/expressionWidget.py +++ b/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/collection/expressionWidget.py @@ -10,8 +10,6 @@ from PySide2.QtCore import QEvent, Qt # type: ignore from PySide2.QtWidgets import QSizePolicy, QTextEdit, QWidget, QVBoxLayout, QHBoxLayout # type: ignore -from pxr import Usd, Sdf - class ExpressionWidget(QWidget): def __init__(self, data: CollectionData, parent: QWidget, expressionChangedCallback): super(ExpressionWidget, self).__init__(parent) @@ -54,7 +52,7 @@ def __init__(self, data: CollectionData, parent: QWidget, expressionChangedCallb def _onDataChanged(self): usdExpressionAttr = self._collData.getMembershipExpression() if usdExpressionAttr != None: - self._expressionText.setPlainText(usdExpressionAttr.GetText()) + self._expressionText.setPlainText(usdExpressionAttr) def submitExpression(self): self._collData.setMembershipExpression(self._expressionText.toPlainText()) diff --git a/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/collection/includeExcludeWidget.py b/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/collection/includeExcludeWidget.py index 5aa8f3a13..8f31743cf 100644 --- a/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/collection/includeExcludeWidget.py +++ b/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/collection/includeExcludeWidget.py @@ -127,6 +127,7 @@ def _onDataChanged(self): incAll = self._collData.includesAll() if incAll != self._include.cbIncludeAll.isChecked(): self._include.cbIncludeAll.setChecked(incAll) + self.onListSelectionChanged() def onAddToIncludePrimClicked(self): stage = self._collData.getStage()