-
Notifications
You must be signed in to change notification settings - Fork 129
Refactor Integrate Asset #2898
Refactor Integrate Asset #2898
Conversation
Notable changesWanted to mark these changes specifically since they were obvious changes that I felt could break things. So naming them here to keep an eye out. But the refactor is so massive that it's likely a ton more. Removed Slate exception: # exception for slate workflow
if index_frame_start and "slate" in instance.data["families"]:
index_frame_start -= 1 This "fix" should be moved to outside of the integrator itself. Removed this logic for 'single file' processing for representations. template_data["representation"] = repre['ext'] I believe this behavior actually was a bug because other areas of the code believed it was actually using |
|
||
def register_subset(self, instance): | ||
# todo: rely less on self.prepare_anatomy to create this value | ||
asset = instance.data.get("assetEntity") # <- from prepare_anatomy :( |
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.
I'm actually quite amazed that after all of this refactoring on this very early draft this is really the only nitpick the hound has this time. 🥇
…e Transaction logic
destination_indexes = list(src_collection.indexes) | ||
destination_padding = len(get_first_frame_padded(src_collection)) | ||
if repre.get("frameStart") is not None: | ||
index_frame_start = int(repre.get("frameStart")) | ||
|
||
# TODO use frame padding from right template group |
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.
@mkolar do you happen to know what the "right template group" would be? :) This is an old to do comment and I'm wondering if I could easily resolve this as I go.
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.
At the moment it's always getting frame_padding
from render
template. However different families can use their own templates for the publishing, hence there is a chance for this to be wrong. In practice, we never saw it happen though. Usually, studios use the same padding across the board.
For completeness, this is where you can choose what template will be used for publishing in various situations project_settings/global/publish/IntegrateAssetNew/template_name_profiles
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.
Hmm - I can see the entries there - and I also see the Templates in Anatomy however it's not clear how using a custom template name I'd overwrite the frame padding value instead? I'll leave the todo for now.
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.
Hmm. I think we planned to allow defining custom padding in each template category, but eventually removed it to reduce complexity. Looks like it would be safe to remove this TODO
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 can use anatomy.templates[template_name]["frame_padding"]
.
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 can use
anatomy.templates[template_name]["frame_padding"]
.
Not tested yet, but implemented with 3e095bc
"parent": version["_id"], | ||
"name": repre['name'], | ||
"data": data, | ||
"dependencies": instance.data.get("dependencies", "").split(), |
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.
Can someone confirm for me that this dependencies is unused/deprecated?
I believe it originated from the RigLoader in Maya which stored 'dependencies' on load. Oddly enough it's storing just the representation id of the actual rig that was loaded (which seems odd) - the value also didn't get updated on updates of the rigs.
It seems extra weird that the value on the instance wasn't just a list to begin with but expecting a concatenated string?
Anyway, with 'input dependencies' the source rig representation for a published alembic would already be retrievable and thus also more reliable than this old unused logic. @mkolar Correct?
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.
Yes I believe this is is not used anywhere anymore
…as before (rudimentary tested only)
The current refactored state as of 56bcd8c now can actually integrate e.g. a simple Maya Look (with a texture) and a Maya Pointcache. So it's somewhat functional as before. Likely Hero Versions are broken. Likely Reviews as well. Likely site sync functionality isn't completely functional either. Also haven't tested what happens if a publish actually fails and whether the file transaction rolls back correctly. But separate "tests" can be implemented to define our expected behavior explicitly and adapt the FileTransaction class to behave as we'd want. Nonetheless would love input at this stage @mkolar @iLLiCiTiT @m-u-r-p-h-y as to what I should continue to do from here. I've noticed however that if representations fails that the Subset and Version are registered nonetheless. Would be extra nice if we could somehow even merge those transactions together so that we can write all of those even closer together in the code. |
# Conflicts: # openpype/plugins/publish/integrate_new.py
… in CollectAnatomyContextData and CollectAnatomyInstanceData. This currently was duplicated logic and should not be handled in the Integrator
…oser to where it's used
…families variable
With the current state being "barebones functional and highly untested" with "more than likely broken in major areas" I do feel it's a good moment to digest what the integrator currently does (and why - if I can) and note some of the changes made (and why). What did the Integrator do that I have removed or have moved into its own
What does the Integrator currently do?It runs per instance and for each instance it does this:
Why still the complexity?The complexity comes mostly from the fact that:
Is the Hound failing to run or how come I'm not making mistakes? I'm a bit worried the dog is sleeping and bites me later. 🔥 |
Few questions!
|
dst_collection.indexes.update(set(destination_indexes)) | ||
dst_collection.padding = destination_padding | ||
assert len(src_collection.indexes) == \ | ||
len(dst_collection.indexes), "This is a bug" |
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.
YAY! The hound works - and I was expecting is to bark about this line! 🐕🦺 ❤️
Just noting that this will need a merge of develop, that is removing avalon-core and some magic to make it compliant with that PR. Unfortunately the last step interfered with this. |
# Conflicts: # openpype/plugins/publish/integrate_new.py
@mkolar Should be fixed. Please let me know what you need on this PR from my end to make this testable by OP team. |
I'll try to test it this week per battle plan. I'll let you know what happened :) |
Looking forward to hearing about the test runs! |
So far so good! I've tested:Maya 2022
Blender 3.0
Houdini 19
|
Nice! We should actually add the following to testing too: Preferably each should be tested for publishes with a single file, multiple files, sequences and publishes with resources like Maya lookdev
|
Would you be so kind to split it in separate integrator so we can slowly add hosts there for better testing? Because I have a feeling that for Maya, this can be used right away (for example). |
# todo: some code actually expects the dict itself and others doesn't | ||
# question: what should it be? | ||
intent = context.data.get("intent") | ||
if intent and isinstance(intent, dict): | ||
intent = intent.get("value") | ||
if intent: | ||
context_data["intent"] = intent | ||
|
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.
Intent should be a dictionary with "value" and "label", to be able tell if you want use value or label of the intent in templates.
# todo: some code actually expects the dict itself and others doesn't | |
# question: what should it be? | |
intent = context.data.get("intent") | |
if intent and isinstance(intent, dict): | |
intent = intent.get("value") | |
if intent: | |
context_data["intent"] = intent |
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.
Removed with recent commit. However, this logic with the if statement still feels like we should somehow correct other logic elsewhere so that we know it's always a dict
to begin with.
@BigRoy could you please separate the integrator into another file? that way we could actually merge it and start moving host by host to it. I've tested quite a bit in maya and the chances are if it works there it's good in other places, However, to be able to deply it into production I think we should expose the family lists of both the existing and the re-worked integrator to the settings temporarily. That way if something goes wrong with the new one, we can easily reassign a family to the old one and unblock production situation. |
Sorry, I've been so busy with day to day production that this keeps slipping through. Beginning of new day now, let's start! :) On it. |
# Conflicts: # openpype/plugins/publish/integrate_new.py
@iLLiCiTiT says: Intent should be a dictionary with "value" and "label", to be able tell if you want use value or label of the intent in templates.
@mkolar Could you check if I missed anything crucial? |
Thx. gonna try now |
@BigRoy This should probably still be addressed #2898 (comment)
|
Brief description
Draft attempt at refactoring/rewriting some logic of the Integrator. My first step was to try and figure out the pieces that are currently putting it together to really figure out all logic that's there and clean up what really was redundant.
Note: The current state it not tested and 100% sure won't work as is. It's a WIP to initiate first discussion - and I'd be happy to revamp a lot more. But I hope to find some time tomorrow to improve readability of the code further so it's easier to understand what we are actually altering. A lot of it might also be "commenting" specific areas of the code.
Related topics