Skip to content

Commit 9f96133

Browse files
author
Shona Gillard
committed
REMIX-4793: Auto expanding tree when a Stage Manager filter is used
1 parent 45be2e8 commit 9f96133

File tree

10 files changed

+71
-4
lines changed

10 files changed

+71
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3131
- REMIX-4792: Added a badge to the Additional Filters button to show the number of modified filters
3232
- REMIX-4813: Added Logic Graph sidebar button for quick layout switching with dedicated Logic Graph layout
3333
- REMIX-4807: Added Escape key support to close Stage Prim Picker dropdown
34+
- REMIX-4793: Added a function to check if tree items need to be expanded in the Stage Manager
3435

3536
### Changed
3637
- Update hdremix and omni_core_materials to ext-822f7b6-main

source/extensions/lightspeed.trex.stage_manager.plugin.filter.usd/config/extension.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
# Semantic Versionning is used: https://semver.org/
3-
version = "2.1.0"
3+
version = "2.1.1"
44

55
# Lists people or organizations that are considered the "authors" of the package.
66
authors = ["Pierre-Olivier Trottier <[email protected]>"]

source/extensions/lightspeed.trex.stage_manager.plugin.filter.usd/docs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Changelog
22
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
33

4+
## [2.1.1]
5+
### Changed
6+
- Updated is_logic_graph filter plugin to have a public field for the current filter type
7+
48
## [2.1.0]
59
### Added
610
- Added filter plugin remix logic graphs

source/extensions/lightspeed.trex.stage_manager.plugin.filter.usd/lightspeed/trex/stage_manager/plugin/filter/usd/is_logic_graph.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class RemixLogicPrimsFilterPlugin(StageManagerUSDFilterPlugin):
3838
_COMBO_BOX_WIDTH: int = PrivateAttr(default=130)
3939
_filter_combobox: ui.ComboBox | None = PrivateAttr(default=None)
4040
_current_index: int = PrivateAttr(default=0)
41+
current_filter_type: str = Field(default="No Filter", description="The type of logic to filter by")
4142

4243
def filter_predicate(self, item: StageManagerItem) -> bool:
4344
match self._current_index:
@@ -65,4 +66,5 @@ def build_ui(self) -> None:
6566
def _on_filter_changed(self, model: "StageManagerTreeModel", _: "StageManagerTreeItem") -> None:
6667
selected_index = model.get_item_value_model().get_value_as_int()
6768
self._current_index = selected_index
69+
self.current_filter_type = _filter_types[selected_index]
6870
self._filter_items_changed()

source/extensions/omni.flux.stage_manager.plugin.filter.usd/config/extension.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
# Semantic Versionning is used: https://semver.org/
3-
version = "2.4.0"
3+
version = "2.4.1"
44

55
# Lists people or organizations that are considered the "authors" of the package.
66
authors = ["Pierre-Olivier Trottier <[email protected]>"]

source/extensions/omni.flux.stage_manager.plugin.filter.usd/docs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Changelog
22
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
33

4+
## [2.4.1]
5+
### Changed
6+
- Changed default value for SearchFilterPlugin
7+
48
## [2.4.0]
59
### Added
610
- Added a badge to the Additional Filters button to show the number of modified filters

source/extensions/omni.flux.stage_manager.plugin.filter.usd/omni/flux/stage_manager/plugin/filter/usd/search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class SearchFilterPlugin(_StageManagerUSDFilterPlugin):
3030

3131
display_name: str = Field(default="Search", exclude=True)
3232
tooltip: str = Field(default="Search through the list of prims", exclude=True)
33-
search_term: str = Field(default="", exclude=True)
33+
search_term: str = Field(default="", exclude=False)
3434

3535
_end_edit_sub: _EventSubscription | None = PrivateAttr(default=None)
3636

source/extensions/omni.flux.stage_manager.plugin.interaction.usd/config/extension.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
# Semantic Versionning is used: https://semver.org/
3-
version = "2.6.0"
3+
version = "2.7.0"
44

55
# Lists people or organizations that are considered the "authors" of the package.
66
authors = ["Pierre-Olivier Trottier <[email protected]>"]

source/extensions/omni.flux.stage_manager.plugin.interaction.usd/docs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Changelog
22
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
33

4+
## [2.7.0]
5+
### Added
6+
- Added a function to check if tree items need to be expanded
7+
48
## [2.6.0]
59
### Added
610
- Added `LogicGraphWidgetPlugin` to the interactions plugins

source/extensions/omni.flux.stage_manager.plugin.interaction.usd/omni/flux/stage_manager/plugin/interaction/usd/base/usd_base.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,57 @@ def _evaluate_filtering_rules(self, prim_path: Sdf.Path) -> bool:
285285
return True
286286
return False
287287

288+
def _expand_filtered_items(self):
289+
"""
290+
Expand all items that are currently visible after filtering.
291+
"""
292+
# Only expand if filters are active
293+
if not any(f.enabled for f in self.filters):
294+
return
295+
296+
def is_filter_modified(filter_obj):
297+
"""Check if any field in the filter has been modified from its default value."""
298+
for field_name, field_info in filter_obj.model_fields.items():
299+
# Skip standard or excluded fields
300+
if (
301+
field_name in ["display_name", "tooltip", "enabled"]
302+
or field_name.startswith("_")
303+
or field_info.exclude is True
304+
):
305+
continue
306+
307+
current_value = getattr(filter_obj, field_name, None)
308+
default_value = (
309+
field_info.default_factory() if field_info.default_factory is not None else field_info.default
310+
)
311+
312+
# Skip filter_active if it's False, since that is the default state
313+
if field_name == "filter_active" and current_value is False:
314+
continue
315+
316+
if (field_name == "filter_active" and current_value is True) or (current_value != default_value):
317+
return True
318+
return False
319+
320+
if not any(is_filter_modified(f) for f in self.filters) and not any(
321+
is_filter_modified(f) for f in self.additional_filters
322+
):
323+
return
324+
325+
def expand_items(items):
326+
for item in items:
327+
if not item or not item.data:
328+
continue
329+
self._item_expansion_states[hash(item)] = True
330+
331+
# Directly expand in the widget
332+
if self._tree_widget:
333+
self._tree_widget.set_expanded(item, True, False)
334+
335+
expand_items(self.tree.model.get_item_children(item))
336+
337+
expand_items(self.tree.model.get_item_children(None))
338+
288339
def _on_item_changed(self, model, item):
289340
# Convert `_on_item_changed` to an async method since `_update_context_items` is also async
290341
if self._items_changed_task:
@@ -302,3 +353,4 @@ async def _on_item_changed_async(self, model, item):
302353
# Wait for the updated items to be rendered
303354
await omni.kit.app.get_app().next_update_async()
304355
self._update_tree_selection()
356+
self._expand_filtered_items()

0 commit comments

Comments
 (0)