From 568c8a88b0d5e7f5bb7c18002e27ac790d6b8ef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=B3pez=20Barr=C3=B3n?= Date: Thu, 2 Jan 2025 21:24:48 +1100 Subject: [PATCH] minor word updates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian López Barrón --- grill/views/description.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/grill/views/description.py b/grill/views/description.py index 85606681..3b90a4e7 100644 --- a/grill/views/description.py +++ b/grill/views/description.py @@ -381,9 +381,10 @@ def _connect_search(self, options, index, model): class PrimComposition(QtWidgets.QDialog): _HAS_SPECS_COLUMN_KEY = "Has Specs" + _LAYER_COLUMN_KEY = "Layer" # TODO: See if columns need to be updated from dict to tuple[_core.Column] _COLUMNS = { - "Layer": lambda idx, node: _layer_label(node.layerStack.layerTree.layer), + _LAYER_COLUMN_KEY: lambda idx, node: _layer_label(node.layerStack.layerTree.layer), "Arc Type": lambda idx, node: node.arcType.displayName, "Node #": lambda idx, node: idx, "Path": lambda idx, node: node.path, @@ -557,7 +558,7 @@ def walk_composition(node): yield from walk_composition(child) root_node = prim_index.rootNode - node_items_by_site = dict() + parents_by_site = dict() arcs_counter = Counter() def _find_parent_for_display(_node): @@ -567,6 +568,8 @@ def _find_parent_for_display(_node): return _find_parent_for_display(_parent) return _parent + parent_column_index = list(self._COLUMNS).index(self._LAYER_COLUMN_KEY) + for node_index, target_node in enumerate(walk_composition(root_node)): arc_type = target_node.arcType arcs_counter[arc_type] += 1 @@ -575,10 +578,10 @@ def _find_parent_for_display(_node): if is_inert and not include_inert_nodes: continue - parent = node_items_by_site[str(parent.site)] if (parent := _find_parent_for_display(target_node)) else root_item + parent = parents_by_site[str(parent.site)] if (parent := _find_parent_for_display(target_node)) else root_item target_id = str(target_node.site) - column_values = {column_key: getter(node_index, target_node) for column_key, getter in self._COLUMNS.items()} + row_values = {key: getter(node_index, target_node) for key, getter in self._COLUMNS.items()} target_path = target_node.path target_layer = target_node.layerStack.identifier.rootLayer @@ -592,20 +595,21 @@ def _find_parent_for_display(_node): for each in sublayers: if each == target_layer: # we're the root layer of the target node's stack - arc_items = [QtGui.QStandardItem(str(s)) for s in column_values.values()] - node_items_by_site[target_id] = arc_items[0] + row_items = [QtGui.QStandardItem(str(s)) for s in row_values.values()] + parents_by_site[target_id] = row_items[parent_column_index] else: - sublayer_values = ChainMap({}, column_values) - sublayer_values[self._HAS_SPECS_COLUMN_KEY] = bool(each.GetObjectAtPath(target_path)) - arc_items = [QtGui.QStandardItem(str(s)) for s in sublayer_values.values()] + row_items = [QtGui.QStandardItem(str(s)) for s in ChainMap({ + self._LAYER_COLUMN_KEY: _layer_label(each), + self._HAS_SPECS_COLUMN_KEY: bool(each.GetObjectAtPath(target_path)), + }, row_values).values()] edit_target = Usd.EditTarget(each, target_node) - for item in arc_items: + for item in row_items: item.setData((stage, edit_target, target_path), QtCore.Qt.UserRole) if highlight_color: item.setData(highlight_color, QtCore.Qt.ForegroundRole) - parent.appendRow(arc_items) + parent.appendRow(row_items) arc_statistics_colors = ChainMap({Pcp.ArcTypeRoot.displayName: _HIGHLIGHT_COLORS['boolean']}, _HIGHLIGHT_COLORS) arcs_stats = ' | '.join(f'{arc_type.displayName}: {arcs_counter.get(arc_type, 0)}' for arc_type in chain([Pcp.ArcTypeRoot], _ARCS_LEGEND))