Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Maya: Build workfile by template #3315

Merged
merged 222 commits into from
Jul 27, 2022
Merged

Maya: Build workfile by template #3315

merged 222 commits into from
Jul 27, 2022

Conversation

ClementHector
Copy link
Contributor

Brief description

Following discussion #2013 and resumption of work from ellipsanime #2202

Templated Build Workfile

Building a workfile using a template designed by users. Helping to assert homogeneous subsets hierarchy and imports. Template stored as file easy to define, change and customize for production needs.

1. Make a template

Make your template. Add families and everything needed for your tasks. Here is an example template for the modeling task using a placeholder to import a gauge.

maya-workfile-outliner

If needed, you can add placeholders when the template needs to load some assets. OpenPype > Template Builder > Create Placeholder

maya-create_placeholder

  • Configure placeholders

Fill in the necessary fields (the optional fields are regex filters)

maya-placeholder_new

- Builder type: Wether the the placeholder should load current asset representations or linked assets representations

- Representation: Representation that will be loaded (ex: ma, abc, png, etc...)

- Family: Family of the representation to load (main, look, image, etc ...)

- Loader: Placeholder loader name that will be used to load corresponding representations

- Order: Priority for current placeholder loader (priority is lowest first, highet last)
  • Save your template

2. Configure Template

  • Go to Studio settings > Project > Your DCC > Templated Build Settings
  • Add a profile for your task and enter path to your template

template_build_workfile

3. Build your workfile

  • Open maya

  • Build your workfile

maya-build_workfile_from_template

@antirotor antirotor added the type: feature Larger, user affecting changes and completely new things label Jun 10, 2022
@tokejepsen
Copy link
Member

Exciting stuff!

Should we have a task name regex for the profile, so we can be flexible with tasks of the same type but different names?

@ClementHector
Copy link
Contributor Author

Should we have a task name regex for the profile, so we can be flexible with tasks of the same type but different names?

Do we have to put a taks list like for the orignal build ?

@tokejepsen
Copy link
Member

Should we have a task name regex for the profile, so we can be flexible with tasks of the same type but different names?

Do we have to put a taks list like for the orignal build ?

Have only skimmed this PR, so ignore my thought if it requires more work.

@ClementHector
Copy link
Contributor Author

Don't worry, i will do it!

@@ -0,0 +1,61 @@
from openpype.pipeline import registered_host
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this to openpype.pipeline? We're in process of reducing pipeline related functions from openpype.lib to avoid cross imports.

Copy link
Member

@iLLiCiTiT iLLiCiTiT Jun 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a package of workfile template build. So maybe a folder with this file, abstract_template_loader.py and build_template_exceptions.py?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I put the file build_template.py, abstract_template_loader.py and build_template_exceptions.py
in openpype/lib/build_workfile or openpype/build_workfile?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iLLiCiTiT Can you tell me which folder please.

Copy link
Member

@iLLiCiTiT iLLiCiTiT Jul 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry for late response, just ./openpype/pipeline/workfiles. There will be moved more workfiles related code over time.

Also keep updated changes in avalon_context.py most of those functions were changed or removed over time.

return output


@with_pipeline_io
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function does not need the decorator.

Suggested change
@with_pipeline_io

Copy link
Member

@m-u-r-p-h-y m-u-r-p-h-y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a big feature and a massive code change. I tested just the basic functionality

  • creating templates
  • modifying project settings
  • the initial building of a scene

this is working good so far-

during further testing, I encountered a couple of issues

when running Update Workfile from a template (after the initial build of the scene with no asset loaded)

# Error: ValueError: file D:\REPO\OpenPype\openpype\hosts\maya\api\template_loader.py line 83: No object matches name: AVALON_CONTAINERS #

another issue is with Update Placeholder.
when you run it, it will open a window. If you close it without doing any change, it will remove custom attributes from the placeholder

image

Copy link
Member

@m-u-r-p-h-y m-u-r-p-h-y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the two small things were fixed and it seems quite stable now.
we should let it go to production for a real-world test :)

thanks!

Copy link
Member

@iLLiCiTiT iLLiCiTiT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move "context specific" functionality from openpype.lib to openpype.pipeline. Function collect_last_version_repres changed code over time so please update the code from latest develop. And get_loaders_by_name should be moved into openpype.pipeline.load.utils.py.

@mkolar mkolar changed the base branch from develop to feature/maya-build-from-template July 27, 2022 07:51
@mkolar mkolar dismissed iLLiCiTiT’s stale review July 27, 2022 07:52

We will fix this on our end in an intermediate branch.

@mkolar mkolar force-pushed the feature/maya-build-from-template branch from 091feec to 9756b1f Compare July 27, 2022 08:01
@mkolar mkolar merged commit ac3a8f1 into ynput:feature/maya-build-from-template Jul 27, 2022
@iLLiCiTiT iLLiCiTiT mentioned this pull request Jul 27, 2022
2 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
host: Maya type: feature Larger, user affecting changes and completely new things
Projects
None yet
Development

Successfully merging this pull request may close these issues.