Skip to content

Commit

Permalink
Merge branch 'develop' into enhancement/OP-8103_thumbnail_subset_filt…
Browse files Browse the repository at this point in the history
…ering
  • Loading branch information
antirotor committed Feb 5, 2024
2 parents f5c38eb + fc844f6 commit 3118b61
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 41 deletions.
46 changes: 34 additions & 12 deletions openpype/tools/ayon_sceneinventory/switch_dialog/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -1212,12 +1212,12 @@ def _trigger_switch(self, loader=None):
))

version_ids = set()
version_docs_by_parent_id = {}
version_docs_by_parent_id_and_name = collections.defaultdict(dict)
for version_doc in version_docs:
parent_id = version_doc["parent"]
if parent_id not in version_docs_by_parent_id:
version_ids.add(version_doc["_id"])
version_docs_by_parent_id[parent_id] = version_doc
version_ids.add(version_doc["_id"])
product_id = version_doc["parent"]
name = version_doc["name"]
version_docs_by_parent_id_and_name[product_id][name] = version_doc

hero_version_docs_by_parent_id = {}
for hero_version_doc in hero_version_docs:
Expand All @@ -1242,7 +1242,7 @@ def _trigger_switch(self, loader=None):
selected_product_name,
selected_representation,
product_docs_by_parent_and_name,
version_docs_by_parent_id,
version_docs_by_parent_id_and_name,
hero_version_docs_by_parent_id,
repre_docs_by_parent_id_by_name,
)
Expand All @@ -1256,10 +1256,10 @@ def _switch_container(
container,
loader,
selected_folder_id,
product_name,
selected_product_name,
selected_representation,
product_docs_by_parent_and_name,
version_docs_by_parent_id,
version_docs_by_parent_id_and_name,
hero_version_docs_by_parent_id,
repre_docs_by_parent_id_by_name,
):
Expand All @@ -1272,15 +1272,18 @@ def _switch_container(

container_product_id = container_version["parent"]
container_product = self._product_docs_by_id[container_product_id]
container_product_name = container_product["name"]

container_folder_id = container_product["parent"]

if selected_folder_id:
folder_id = selected_folder_id
else:
folder_id = container_product["parent"]
folder_id = container_folder_id

products_by_name = product_docs_by_parent_and_name[folder_id]
if product_name:
product_doc = products_by_name[product_name]
if selected_product_name:
product_doc = products_by_name[selected_product_name]
else:
product_doc = products_by_name[container_product["name"]]

Expand All @@ -1300,7 +1303,26 @@ def _switch_container(
repre_doc = _repres.get(container_repre_name)

if not repre_doc:
version_doc = version_docs_by_parent_id[product_id]
version_docs_by_name = (
version_docs_by_parent_id_and_name[product_id]
)
# If asset or subset are selected for switching, we use latest
# version else we try to keep the current container version.
version_name = None
if (
selected_folder_id in (None, container_folder_id)
and selected_product_name in (None, container_product_name)
):
version_name = container_version.get("name")

version_doc = None
if version_name is not None:
version_doc = version_docs_by_name.get(version_name)

if version_doc is None:
version_name = max(version_docs_by_name)
version_doc = version_docs_by_name[version_name]

version_id = version_doc["_id"]
repres_by_name = repre_docs_by_parent_id_by_name[version_id]
if selected_representation:
Expand Down
16 changes: 11 additions & 5 deletions openpype/tools/sceneinventory/switch_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -1299,15 +1299,21 @@ def _trigger_switch(self, loader=None):

# If asset or subset are selected for switching, we use latest
# version else we try to keep the current container version.
version_name = None
if (
selected_asset not in (None, container_asset_name)
or selected_subset not in (None, container_subset_name)
selected_asset in (None, container_asset_name)
and selected_subset in (None, container_subset_name)
):
version_name = container_version.get("name")

version_doc = None
if version_name is not None:
version_doc = version_docs_by_name.get(version_name)

if version_doc is None:
version_name = max(version_docs_by_name)
else:
version_name = container_version["name"]
version_doc = version_docs_by_name[version_name]

version_doc = version_docs_by_name[version_name]
version_id = version_doc["_id"]
repres_docs_by_name = repre_docs_by_parent_id_by_name[
version_id
Expand Down
24 changes: 0 additions & 24 deletions server_addon/applications/server/applications.json
Original file line number Diff line number Diff line change
Expand Up @@ -1175,30 +1175,6 @@
}
]
},
"djvview": {
"enabled": true,
"label": "DJV View",
"icon": "{}/app_icons/djvView.png",
"host_name": "",
"environment": "{}",
"variants": [
{
"name": "1-1",
"label": "1.1",
"executables": {
"windows": [],
"darwin": [],
"linux": []
},
"arguments": {
"windows": [],
"darwin": [],
"linux": []
},
"environment": "{}"
}
]
},
"wrap": {
"enabled": true,
"label": "Wrap",
Expand Down

0 comments on commit 3118b61

Please sign in to comment.