-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Hero representation of version is not synchronized. #4191
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,10 @@ | |
get_representations, | ||
get_representation_by_id, | ||
) | ||
from openpype.client.entities import ( | ||
get_hero_version_by_subset_id, | ||
get_representation_parents, | ||
) | ||
from openpype.modules import OpenPypeModule, ITrayModule | ||
from openpype.settings import ( | ||
get_project_settings, | ||
|
@@ -1792,11 +1796,32 @@ def _update_site(self, project_name, representation_id, | |
|
||
Used for refactoring ugly reset_provider_for_file | ||
""" | ||
query = { | ||
"_id": ObjectId(representation_id) | ||
} | ||
representation_ids = [ObjectId(representation_id)] | ||
|
||
self.connection.database[project_name].update_one( | ||
# Add hero version | ||
representation = get_representation_by_id( | ||
project_name, representation_id | ||
) | ||
representation_parents = get_representation_parents( | ||
project_name, representation | ||
) | ||
hero_version = get_hero_version_by_subset_id( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should check if hero version matches the version doc. repre_doc = get_representation_by_id(
project_name, representation_id, fields=["_id", "parent"]
)
representation_ids = [repre_doc["_id"]]
version_doc = get_version_by_id(repre_doc["parent"])
if version_doc["type"] != "hero_version":
hero_version = get_hero_version_by_subset_id(
project_name, version_doc["parent"], fields=["_id", "version_id"]
)
if hero_version and hero_version["version_id"] == version_doc["_id"]:
hero_repre_doc = get_representation_by_name(
project_name,
repre_doc["name"],
hero_version["_id"]
)
representation_ids.append(hero_repre_doc["_id"])
query = {"_id": {"$in": representation_ids}}
... |
||
project_name, representation_parents[1]["_id"], fields=["_id"] | ||
) | ||
if hero_version: | ||
representations = get_representations( | ||
project_name, | ||
version_ids=[hero_version["_id"]], | ||
fields=["_id"], | ||
context_filters={"ext": [representation["context"]["ext"]]}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it should be filtrered by extension in context but by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so, I have representations which have name 'thumbnail'. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So it should be filtered by representation name instead of extension. Extension on context can be not unique (there can be more then one representation with extension |
||
) | ||
representation_ids.extend( | ||
[repre["_id"] for repre in representations] | ||
) | ||
|
||
query = {"_id": {"$in": representation_ids}} | ||
|
||
self.connection.database[project_name].update_many( | ||
query, | ||
update, | ||
upsert=True, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need all parents but only version. Or? It looks like all you need is