-
Notifications
You must be signed in to change notification settings - Fork 36
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
Maya: Load published workfile as template #330
Maya: Load published workfile as template #330
Conversation
When I checked out this PR. I can no longer see
|
Thanks, it seemed # Error: cannot import name 'TypedDict' from 'typing' (C:\Program Files\Autodesk\Maya2022\Python37\lib\typing.py)
# Traceback (most recent call last):
# File "<maya console>", line 1, in <module>
# ImportError: cannot import name 'TypedDict' from 'typing' (C:\Program Files\Autodesk\Maya2022\Python37\lib\typing.py) # Just so you're aware. Note that the startup issues for these usually are reported in the "Output Window" of Maya since it's the console output before the Maya UI is initialized. As such, I suspect you should've seen an error somewhat similar to the error I posted here in the Maya Output Window: For completeness sake, Maya 2022 is Python 3.7.7 and |
@BigRoy seems like nice feature! quick question...so in theory if using that published workfile via action |
It opens + builds similar to regular workfile templates but without the need to having it set up in settings as a workfile template for a particular task. Basically we have a project where we have a few templates the artists can pick from, they go to the "templates" asset on the project and then pick the workfile template product that fits their need and use that as their starting point. So it's basically exactly like workfile templates- but building from a published product instead of a hardcoded filepath in the project settings. |
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.
client/ayon_core/pipeline/workfile/workfile_template_builder.py
Outdated
Show resolved
Hide resolved
client/ayon_core/pipeline/workfile/workfile_template_builder.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
Thanks @iLLiCiTiT - submitted your review suggestions. |
@iLLiCiTiT I redid the testing after those commits and all working fine, can be merged... |
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.
@MustafaJafar 1) yes its correct...it resolves the asset name by the namespace (each asset have its own)
The point 2) and its functionality as it is now, if any changes should be made then in separate PR, not related to this one IMHO |
As @LiborBatek correctly pointed out. That is indeed the correct behavior - if any of those should change it's outside of the scope of this PR - it's the way the Workfile Templates functionality was designed. Should be ready to merge? |
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.
Couple of errors when building the template, which is technically not related to this PR but hard to test without fixing it.
# ==================
# Maya command error
# ==================
# Traceback (most recent call last):
# File "C:\Users\tokejepsen\ayon-core\client\ayon_core\pipeline\workfile\workfile_template_builder.py", line 722, in populate_scene_placeholders
# placeholder_plugin.populate_placeholder(placeholder)
# File "C:\Users\tokejepsen\ayon-core\client\ayon_core\hosts\maya\api\workfile_template_builder.py", line 246, in populate_placeholder
# self.populate_load_placeholder(placeholder)
# File "C:\Users\tokejepsen\ayon-core\client\ayon_core\pipeline\workfile\workfile_template_builder.py", line 1650, in populate_load_placeholder
# self.load_succeed(placeholder, container)
# File "C:\Users\tokejepsen\ayon-core\client\ayon_core\hosts\maya\api\workfile_template_builder.py", line 275, in load_succeed
# self._parent_in_hierarchy(placeholder, container)
# File "C:\Users\tokejepsen\ayon-core\client\ayon_core\hosts\maya\api\workfile_template_builder.py", line 334, in _parent_in_hierarchy
# cmds.parent(node, world=True)
RuntimeError: Maya command error
# # *** WRN: >>> { <ayon_core.hosts.maya.api.workfile_template_builder.MayaTemplateBuilder object at 0x0000020A1BA750A0> }: [ Failed to process placeholder |Context_model_folder with plugin MayaPlaceholderLoadPlugin ]
# ========
# 'subset'
# ========
# Traceback (most recent call last):
# File "C:\Users\tokejepsen\ayon-core\client\ayon_core\pipeline\workfile\workfile_template_builder.py", line 722, in populate_scene_placeholders
# placeholder_plugin.populate_placeholder(placeholder)
# File "C:\Users\tokejepsen\ayon-core\client\ayon_core\hosts\maya\api\workfile_template_builder.py", line 246, in populate_placeholder
# self.populate_load_placeholder(placeholder)
# File "C:\Users\tokejepsen\ayon-core\client\ayon_core\pipeline\workfile\workfile_template_builder.py", line 1601, in populate_load_placeholder
# for representation in self._reduce_last_version_repre_entities(
# File "C:\Users\tokejepsen\ayon-core\client\ayon_core\pipeline\workfile\workfile_template_builder.py", line 1553, in _reduce_last_version_repre_entities
# product_name = repre_context["subset"]
KeyError: 'subset'
Co-authored-by: Toke Jepsen <tokejepsen@gmail.com>
@tokejepsen Would you like me to include a fix for this in this PR? It does look to be a bug that's present outside of this PR so might be best suited for another PR? |
Yeah, lets get it in here so we can test in context. |
…ancement/maya_load_published_workfile_as_template
So this error is resolved by parenting your placeholders to a group (making sure they are not top level locators). This is a limitation of the workfile templates in Maya which should be solved in a separate PR (and I have a fix for as well which is in ynput/OpenPype#327 which I still need to separate in smaller PRs.
This one I can't seem to reproduce. When printing the representation entity, I get for example this: {
"attrib": {
"fps": null,
"template": "{root[work]}/{project[name]}/{hierarchy}/{folder[name]}/publish/{product[type]}/{product[name]}/v{version:0>3}/{project[code]}_{folder[name]}_{product[name]}_v{version:0>3}<_{output}><.{frame:0>4}><_{udim}>.{ext}",
"resolutionWidth": null,
"pixelAspect": null,
"frameEnd": null,
"clipOut": null,
"clipIn": null,
"frameStart": null,
"extension": null,
"path": "C:\\projects\\ayontest\\asset\\char_hero\\publish\\pointcache\\pointcacheMain\\v005\\ynts_char_hero_pointcacheMain_v005.abc",
"description": null,
"resolutionHeight": null,
"handleStart": null,
"handleEnd": null
},
"versionId": "73bfe327f76211eebb65b4969159e74e",
"active": true,
"createdAt": "2024-04-10T17:47:51.815979+00:00",
"files": [
{
"hash": "ynts_char_hero_pointcacheMain_v005,abc|1712771271,0777626|3302",
"id": "73d84350f76211ee95ccb4969159e74e",
"name": "ynts_char_hero_pointcacheMain_v005.abc",
"size": 3302,
"path": "{root[work]}/ayontest/asset/char_hero/publish/pointcache/pointcacheMain/v005/ynts_char_hero_pointcacheMain_v005.abc"
}
],
"id": "73cb720ef76211ee8c12b4969159e74e",
"context": {
"ext": "abc",
"root": {
"work": "C:/projects"
},
"task": {
"name": "modeling",
"type": "Modeling",
"short": "mdl"
},
"user": "admin",
"asset": "char_hero",
"family": "pointcache",
"folder": {
"name": "char_hero"
},
"subset": "pointcacheMain",
"product": {
"name": "pointcacheMain",
"type": "pointcache"
},
"project": {
"code": "ynts",
"name": "ayontest"
},
"version": 5,
"username": "admin",
"hierarchy": "asset",
"representation": "abc"
},
"data": {
"context": {
"ext": "abc",
"root": {
"work": "C:/projects"
},
"task": {
"name": "modeling",
"type": "Modeling",
"short": "mdl"
},
"user": "admin",
"asset": "char_hero",
"family": "pointcache",
"folder": {
"name": "char_hero"
},
"subset": "pointcacheMain",
"product": {
"name": "pointcacheMain",
"type": "pointcache"
},
"project": {
"code": "ynts",
"name": "ayontest"
},
"version": 5,
"username": "admin",
"hierarchy": "asset",
"representation": "abc"
}
},
"name": "abc"
} Which interestingly enough also contains the backwards compatible keys in context - I can update it to The question is. Why does it fail for you @tokejepsen ? @iLLiCiTiT any preference? |
@BigRoy are you suggesting to wait for ynput/OpenPype#327 (or a smaller PR that fixes this issue) to be merged? |
I'm suggesting to test now with a parent group, because that's how it currently only works in all maya workfile templates. The bug is - afaik - unrelated to this PR. So, if that's the only issue - then merge this PR and solve that in another; no need to wait. |
speaking of future enhancements... how about populating the template file with |
Think its better to support not being parent to anything. Its small bugfix which will come in future PRs eventually. |
@BigRoy not sure why its not failing for anyone else. This is a freshly published workfile. Here is the the representation;
|
Yeah I get your point and fully agree...I was more refering to pre create the Publish instances too...in Template file. as I did test it now, it seems working sort of. I have test it with One more issue being with The good thing is if any So its almost functional in terms of prepopulating the Here is my scene builded from the template containing even publish instances (builded automatically when using particular template file) @BigRoy do you have something to add to that? |
I understand your reasoning @tokejepsen - I was just hoping to avoid now also implementing that fix 'separately' that's already implemented in the other PR ynput/OpenPype#327 currently since it comes with a bit more refactoring/fixes. Fixing that now separately just means that that fix would still get superseded by those changes down the line. Anyway, will take a look at how much code is involved to incorporate in this PR.
That doesn't seem like a published workfile, if it's extension @LiborBatek there's definitely good merit in having a workfile template come with good publish instances by default, etc. - however I'd say that's maya workfile template system issue if currently hard to do or not possible and should be unrelated to this particular PR. As such, I think your question merits an issue of its own if it's currently incapable of working the way you want it to work. I know that e.g. Nuke also has "Creator" placeholders or whatever to create placeholders for publishing instances. I suppose it'd be someting similar on the maya side then. |
Fixed with e75f44f Unfortunately I can't reproduce the @iLLiCiTiT preference on a fix for that? I suppose we should somehow support existing workfile templates and publishes that may not have folder name, etc. as context keys? The issue also isn't necessarily related to this PR since I'd expect it also exists outside of this PR. So we might be best fixing that in a separate PR anyway. |
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.
Tested successfully in Maya 2023.
Changelog Description
Allows to load a published maya workfile and use it as a workfile template.
This way, someone can create a workfile template using the Create Template Placeholders:
Then publish their workfile:
And another artist can use that published workfile as a starting template from the loader:
Additional info
This is basically a 'simple implementation' of this OpenPype issue: #742
Includes a fix for incorrect usage of
placeholder.data["family"]
that existed in the code which should have beenplaceholder.data["product_type"]
. There are some other bugs with the placeholder logic - but those should be fixed by ynput/OpenPype#327Anyway, please report anything you find during testing.
Testing notes: