Add enable grouping to scene inventory#1519
Open
FuzzkingCool wants to merge 5 commits intoynput:developfrom
Open
Add enable grouping to scene inventory#1519FuzzkingCool wants to merge 5 commits intoynput:developfrom
FuzzkingCool wants to merge 5 commits intoynput:developfrom
Conversation
- Introduced a new grouping feature in the InventoryModel to allow items to be organized by product group. - Added a method `set_enable_grouping` to toggle grouping on and off. - Updated the SceneInventoryView to include a checkbox for enabling grouping. - Modified the SceneInventoryWindow to include the grouping checkbox and its state change handling.
- Removed unnecessary loops for checking group items and hero items. - Simplified the collection of outdated container IDs from the full hierarchy. - Added filtering to exclude None values from the returned list of outdated item IDs.
…ub.com/FuzzkingCool/ayon-core into add_enable_grouping_to_scene_inventory
iLLiCiTiT
reviewed
Oct 31, 2025
| is_hero = False | ||
| status_name = None | ||
| else: | ||
| # Flat structure (original behavior) |
Member
There was a problem hiding this comment.
This else really deserves a separate method.
Member
There was a problem hiding this comment.
Another question, how much are those 2 different? Isn't it that one just adds one more parent? Wouldn't be easier to handle that in single method instead of having 2 huge methods with most of the code duplicated?
iLLiCiTiT
reviewed
Oct 31, 2025
| item_by_repre_id_by_project | ||
| [project_name] | ||
| [representation_id] | ||
| item_by_repre_id_by_project[project_name][representation_id] |
Member
There was a problem hiding this comment.
Suggested change
| item_by_repre_id_by_project[project_name][representation_id] | |
| item_by_repre_id_by_project | |
| [project_name] | |
| [representation_id] |
iLLiCiTiT
reviewed
Oct 31, 2025
Comment on lines
434
to
457
| def collect_outdated_from_item(parent_item): | ||
| """Recursively collect outdated container item IDs.""" | ||
| for row in range(parent_item.rowCount()): | ||
| item = parent_item.child(row) | ||
|
|
||
| # Check if this is an actual container item | ||
| is_container = item.data(IS_CONTAINER_ITEM_ROLE) | ||
|
|
||
| if is_container: | ||
| # This is a container - check if it's outdated | ||
| is_latest = item.data(VERSION_IS_LATEST_ROLE) | ||
| is_hero = item.data(VERSION_IS_HERO_ROLE) | ||
|
|
||
| for idx in range(group_item.rowCount()): | ||
| item = group_item.child(idx) | ||
| outdated_item_ids.append(item.data(ITEM_ID_ROLE)) | ||
| return outdated_item_ids | ||
| if not is_latest and not (ignore_hero and is_hero): | ||
| item_id = item.data(ITEM_ID_ROLE) | ||
| if item_id: | ||
| outdated_item_ids.append(item_id) | ||
| else: | ||
| # This is a group item - recurse into its children | ||
| collect_outdated_from_item(item) | ||
|
|
||
| root_item = self.invisibleRootItem() | ||
| # Collect outdated container ids from the full hierarchy | ||
| collect_outdated_from_item(root_item) |
Member
There was a problem hiding this comment.
Suggested change
| def collect_outdated_from_item(parent_item): | |
| """Recursively collect outdated container item IDs.""" | |
| for row in range(parent_item.rowCount()): | |
| item = parent_item.child(row) | |
| # Check if this is an actual container item | |
| is_container = item.data(IS_CONTAINER_ITEM_ROLE) | |
| if is_container: | |
| # This is a container - check if it's outdated | |
| is_latest = item.data(VERSION_IS_LATEST_ROLE) | |
| is_hero = item.data(VERSION_IS_HERO_ROLE) | |
| for idx in range(group_item.rowCount()): | |
| item = group_item.child(idx) | |
| outdated_item_ids.append(item.data(ITEM_ID_ROLE)) | |
| return outdated_item_ids | |
| if not is_latest and not (ignore_hero and is_hero): | |
| item_id = item.data(ITEM_ID_ROLE) | |
| if item_id: | |
| outdated_item_ids.append(item_id) | |
| else: | |
| # This is a group item - recurse into its children | |
| collect_outdated_from_item(item) | |
| root_item = self.invisibleRootItem() | |
| # Collect outdated container ids from the full hierarchy | |
| collect_outdated_from_item(root_item) | |
| root_item = self.invisibleRootItem() | |
| parent_queue = collections.deque() | |
| parent_queue.append(root_item) | |
| while parent_queue: | |
| parent_item = parent_queue.popleft() | |
| for row in range(parent_item.rowCount()): | |
| item = parent_item.child(row) | |
| # Check if this is an actual container item | |
| is_container = item.data(IS_CONTAINER_ITEM_ROLE) | |
| if not is_container: | |
| parent_queue.append(item) | |
| continue | |
| # This is a container - check if it's outdated | |
| if ( | |
| item.data(VERSION_IS_LATEST_ROLE) | |
| or item.data(VERSION_IS_HERO_ROLE) | |
| ): | |
| continue | |
| item_id = item.data(ITEM_ID_ROLE) | |
| if item_id: | |
| outdated_item_ids.append(item_id) |
iLLiCiTiT
reviewed
Oct 31, 2025
| # Collect outdated container ids from the full hierarchy | ||
| collect_outdated_from_item(root_item) | ||
| # Filter out any None values (e.g. from non-container rows) | ||
| return [item_id for item_id in outdated_item_ids if item_id] |
Member
There was a problem hiding this comment.
Check for item id already happens to be appended to outdated_item_ids.
Suggested change
| return [item_id for item_id in outdated_item_ids if item_id] | |
| return outdated_item_ids |
iLLiCiTiT
reviewed
Oct 31, 2025
Comment on lines
+485
to
+491
| icon = get_qt_icon( | ||
| { | ||
| "type": "material-symbols", | ||
| "name": status_item.icon, | ||
| "color": status_item.color, | ||
| } | ||
| ) |
Member
There was a problem hiding this comment.
Suggested change
| icon = get_qt_icon( | |
| { | |
| "type": "material-symbols", | |
| "name": status_item.icon, | |
| "color": status_item.color, | |
| } | |
| ) | |
| icon = get_qt_icon({ | |
| "type": "material-symbols", | |
| "name": status_item.icon, | |
| "color": status_item.color, | |
| }) |
- Added support for version locking in container items. - Included product group name and icon data for representation items. - Updated item data handling to improve organization and display in the scene inventory.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog Description
This pull request introduces a new feature to the Scene Inventory tool: the ability to group items by product group, improving organization and usability. It adds a UI checkbox to enable or disable grouping, updates the model and view logic to support both grouped and flat item structures, and refactors related methods for batch update.
Feature: Grouping by Product Group
grouping_checkboxto the UI inwindow.py, allowing users to toggle grouping of items by product group. This includes connecting its state change to the appropriate handler and updating the layout. [1] [2] [3] [4]_grouping_enabledstate, aset_enable_groupingmethod, and a_create_grouped_itemshelper to build the grouped item hierarchy. The model'srefreshmethod now supports both grouped and flat structures based on the grouping setting. [1] [2] [3]Additional info
Integration with View
set_enable_groupingto the view class to propagate the grouping state from the UI to the model.Refactoring and Bug Fixes
model.pyfor clarity and consistency, including dictionary initializations, item construction, and data assignments to ensure correct behavior in both grouped and flat modes. [1] [2] [3] [4] [5] [6]Refactored Item Detection considering groups possibility
get_outdated_item_idsto recursively traverse the model hierarchy, ensuring outdated items are correctly identified in both grouped and flat structures. [1] [2]Testing notes: