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

Maya: reference loaders could store placeholder in referenced url #3264

Merged

Conversation

kalisp
Copy link
Member

@kalisp kalisp commented May 30, 2022

Brief description

All reference loaders in Maya now could instead of real published folder use environment variable placholder. This would allow to use this workfile in different locations (remote artist computer, studio etc.)

Description

OPENPYPE_PROJECT_ROOT_WORK is calculated for values in Anatomy or overridden values from Local Setting.
This placeholder is physically stored in workfile, each value is resolved when workfile is opened.
This allows remote artists to reference assets in a workfile and publish it. Same workfile will then work everywhere (studio, different artist) if they have Anatomy or Local Setting configured to existing folder on their machine.

This limits opening workfiles without Openpype, this could be remedied by adding used environment variable to artist environment. (By adding to theirs mel script??)

Additional info

Flag to trigger this behavior is hardcoded to True for testing. Placement of this toggle in Settings need to be decided.
Easiest option is to add it as a plugin variable, this would mean add/modify this behavior on each plugin separately. Usage of
environment variable could be also widened to not only Maya. It could be used in any host which stores full path of referenced files in its workfile metadata. In that case, more general location to enable/disable this behavior should be chosen.

Testing notes:

  1. Open Maya
  2. Use Reference Loader to pull in any asset
  3. Save workfile
  4. Check content of workfile, ${} placeholder should be used instead of real physical root.

…variable.

Useful for remote workflows where Site Sync is being used.
When Load reference is used, real root value (c:/project) is replaced with ${OPENPYPE_ROOT_WORK}.
All inheriting plugins implementing shared method.
Flag 'use_env_var_as_root' set to True for testing temporarily, proper location in Setting should be decided.
@kalisp kalisp added type: enhancement Enhancements to existing functionality host: Maya module: Sitesync labels May 30, 2022
@kalisp kalisp self-assigned this May 30, 2022
@ynbot
Copy link
Contributor

ynbot commented May 30, 2022

Task linked: OP-3277 Maya environment variables loader

Comment on lines +54 to +56
file_url = self.prepare_root_value(self.fname,
context["project"]["code"])
nodes = cmds.file(file_url,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Somehow it looks to me like this particular change - if applicable to all references should actually happen in the ReferenceLoader class in load and potentially just do self.fname = self.prepare_root_value(self.fname).

Just so the logic is encapsulated to that area only?

We should be able to make that change ONLY in the ReferenceLoader class and have that work for all implementations already, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Imho no, each inheriting class of ReferenceLoader could calculate file url differently (or at least some existing loaders do). Plus we sometimes need it in update logic.

Configured via Maya/Maya-dirmap to use in all Loaders
kalisp and others added 2 commits May 31, 2022 18:58
…ect_maya.json

Co-authored-by: Milan Kolar <mkolar@users.noreply.github.com>
…ect_maya.json

Co-authored-by: Milan Kolar <mkolar@users.noreply.github.com>
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.

works as expected.

image

will the path be resolved correctly when published to render farm?

@kalisp
Copy link
Member Author

kalisp commented Jun 1, 2022

It is working on a farm too.

@kalisp kalisp merged commit a5bf790 into develop Jun 1, 2022
@kalisp kalisp deleted the enhancement/OP-3277_Maya-environment-variables-loader branch June 1, 2022 11:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
host: Maya module: Sitesync type: enhancement Enhancements to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants