Skip to content

Commit

Permalink
big roy's comment - code tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
moonyuet committed Nov 22, 2024
1 parent 77e5317 commit e625901
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions client/ayon_core/tools/sceneinventory/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def refresh(self, selected=None):
# for debugging or testing, injecting items from outside
container_items = self._controller.get_container_items()
self._clear_items()
repre_id = set()
repre_ids = set()
repre_ids_by_project = collections.defaultdict(set)
version_items_by_product_id = collections.defaultdict(dict)
repre_info_by_id_by_project = collections.defaultdict(dict)
Expand All @@ -146,7 +146,7 @@ def refresh(self, selected=None):
# continue
project_name = container_item.project_name
representation_id = container_item.representation_id
repre_id.add(representation_id)
repre_ids.add(representation_id)
repre_ids_by_project[project_name].add(representation_id)
item_by_repre_id_by_project_id[project_name][representation_id].add(container_item)

Expand All @@ -168,7 +168,7 @@ def refresh(self, selected=None):

# SiteSync addon information
progress_by_id = self._controller.get_representations_site_progress(
repre_id
repre_ids
)
sites_info = self._controller.get_sites_information()
site_icons = {
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/tools/sceneinventory/models/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,9 @@ def _update_cache(self):
containers_by_id = {}
container_items_by_id = {}
invalid_ids_mapping = {}
current_project_name = self._controller.get_current_project_name()
for container in containers:
try:
current_project_name = self._controller.get_current_project_name()
item = ContainerItem.from_container_data(current_project_name, container)
repre_id = item.representation_id
try:
Expand Down
10 changes: 5 additions & 5 deletions client/ayon_core/tools/sceneinventory/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ def _show_version_dialog(self, item_ids, active_repre_id):
project_name = container_item.project_name
repre_ids_by_project[project_name].add(repre_id)

versions = set()
version_ids = set()
repre_info_by_project = collections.defaultdict(dict)
version_items_by_product_id_by_project = collections.defaultdict(dict)
for project_name, repre_ids in repre_ids_by_project.items():
Expand Down Expand Up @@ -784,8 +784,8 @@ def _show_version_dialog(self, item_ids, active_repre_id):
version_items = list(
version_items_by_product_id_by_project[project_name][active_product_id].values()
)
all_versions = {version_item.version for version_item in version_items}
versions.update(all_versions)
version_ids.update(version_item.version for version_item in version_items)

product_ids_by_version = collections.defaultdict(set)
for version_items_by_product_id in version_items_by_product_id_by_project.values():
for version_items_by_id in version_items_by_product_id.values():
Expand All @@ -797,9 +797,9 @@ def _show_version_dialog(self, item_ids, active_repre_id):
product_ids_by_version[_prod_version].add(
version_item.product_id
)
if version in versions:
if version in version_ids:
continue
versions.add(version)
version_ids.add(version)
version_items.append(version_item)

def version_sorter(item):
Expand Down

0 comments on commit e625901

Please sign in to comment.