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

AYON: Use folder path as unique identifier#5817

Merged
iLLiCiTiT merged 114 commits intodevelopfrom
feature/OP-7176_Use-folder-path-as-unique-identifier
Nov 21, 2023
Merged

AYON: Use folder path as unique identifier#5817
iLLiCiTiT merged 114 commits intodevelopfrom
feature/OP-7176_Use-folder-path-as-unique-identifier

Conversation

@iLLiCiTiT
Copy link
Copy Markdown
Member

@iLLiCiTiT iLLiCiTiT commented Oct 25, 2023

Changelog Description

Use folder path instead of asset name as unique identifier, with OpenPype compatibility.

Additional info

Goal of this PR is to support duplicated folder names in a project for AYON mode. How it works? All places that have asset name as "unique identifier" and not as "name" value are using folder path now. Some places do/did use the value for other purposes, all of those places must use different approach.

What it affects

IMPORTANT FOR DEVELOPERS

  • get_current_asset_name returns path in AYON mode
  • os.environ["AVALON_ASSET"] and legacy_io.Session["AVALON_ASSET"] contains path in AYON mode
  • during publishing context.data["asset"] and instance.data["asset"] contains path in AYON mode
  • all pipeline functions that expect asset name as unique identifier (e.g. get_template_data_with_names) expect path instead of name in AYON mode
  • creators (except legacy creators) should use "folderPath" instead of "asset"
  • openpype.client functions expecting asset name are can handle folder path in AYON mode > the functions still can find by name
    • get_assets
    • get_archived_assets
    • get_asset_by_name
    • get_last_version_by_subset_name

TODOs

  • folder path will start with slash in future version of AYON server, so that must be changed acordingly
  • editorial publishing was not modified at all (I'm not capable of doing that)
    • hiero
    • flame
    • resolve
    • traypublisher
  • revisit Harmony openpype/hosts/harmony/plugins/load/load_template.py line 55 > There is passed asset name but I don't know what for
  • revisit ExtractUnrealSkeletalMeshFbx plugin in Maya which is using asset name and not sure for what
  • 3dsmax has some mismatched data in CollectRender plugin (different PR to resolve [In progress])
  • houdini CreateHDA has one occation where it cannot work with current implementation
  • unreal has at multiple places mismatch with OpenPype asset name and Unreal asset name
  • host integrations without publisher (using legacy create tool) are not converted
    • blender
    • harmony

Testing notes:

Folder path have to start with slash in on AYON server

Allow to create duplicated names on WebUI

Testing

  1. Have AYON project which allows duplicated names.
    • To allow this you have to modify database on running AYON docker stack
      a) Go to your ayon-docker repository.
      b) Run ./manage.ps1 dbshell or make dbshell
      c) Execute DROP INDEX project_{project name}.folder_unique_name; where {project name} is replaced by name of your project
  2. Create duplicated names in the project hierarchy
  3. Run DCCs on a folder with duplicated name
  • Try to use all creators and publish them, and validate the output ended up at correct places.

    • Make sure the template of {asset} or {folder[name]} is NOT filled with path.
  • Validate all tools > visual aspects.

  • Report any issues (check if the issue was reported first).

  • open scene with created instances before this PR -> what happens in Publisher

Hosts

@ynbot
Copy link
Copy Markdown
Contributor

ynbot commented Oct 25, 2023

1 similar comment
@ynbot
Copy link
Copy Markdown
Contributor

ynbot commented Oct 25, 2023

@ynbot ynbot added type: feature Larger, user affecting changes and completely new things size/M Denotes a PR changes 500-999 lines, ignoring general files host: After Effects host: CelAction CelAction 2d animation package host: Flame Autodesk Flame integration host: Fusion host: Hiero labels Oct 25, 2023
@simonebarbieri
Copy link
Copy Markdown
Contributor

Creators don't work in Blender after last merge.

Need to change this:

name = asset_name(instance_data["asset"], subset_name)

to:

name = asset_name(instance_data["folderPath"], subset_name)

@mkolar
Copy link
Copy Markdown
Member

mkolar commented Nov 15, 2023

Minor issue with the menu in nuke 14.1
image

Write creators are expeting asset in the data which is not being satisfied, hence Render, Image and Prerender createor fail

Creator: Render (write) (create_write_render)

Error: 'asset'

Traceback (most recent call last):
  File "/Users/milan/code/OpenPype/openpype/pipeline/create/context.py", line 2053, in _create_with_unified_error
    result = creator.create(*args, **kwargs)
  File "/Users/milan/code/OpenPype/openpype/hosts/nuke/plugins/create/create_write_render.py", line 93, in create
    instance_node = self.create_instance_node(
  File "/Users/milan/code/OpenPype/openpype/hosts/nuke/plugins/create/create_write_render.py", line 62, in create_instance_node
    created_node = napi.create_write_node(
  File "/Users/milan/code/OpenPype/openpype/hosts/nuke/api/lib.py", line 1292, in create_write_node
    anatomy_filled = format_anatomy(data)
  File "/Users/milan/code/OpenPype/openpype/hosts/nuke/api/lib.py", line 1129, in format_anatomy
    asset_name = data["asset"]
KeyError: 'asset'

@iLLiCiTiT
Copy link
Copy Markdown
Member Author

iLLiCiTiT commented Nov 16, 2023

Minor issue with the menu in nuke 14.1

Should be fixed with this PR #5887

Write creators are expeting asset in the data which is not being satisfied, hence Render, Image and Prerender createor fail

Should be fixed.

Need to change this:

There is a function called asset_name? Fixed.

@simonebarbieri
Copy link
Copy Markdown
Contributor

In Blender, I'm getting this error when loading a layout with a rig:

Traceback (most recent call last):
  File "C:\Dev\Ynput\OpenPype\openpype\hosts\blender\api\ops.py", line 113, in execute
    result = callback(*args, **kwargs)
  File "C:\Dev\Ynput\OpenPype\openpype\hosts\blender\api\plugin.py", line 476, in _load
    nodes = self.process_asset(
  File "C:\Dev\Ynput\OpenPype\openpype\hosts\blender\plugins\load\load_blend.py", line 149, in process_asset
    self._post_process_layout(container, asset, representation)
  File "C:\Dev\Ynput\OpenPype\openpype\hosts\blender\plugins\load\load_blend.py", line 69, in _post_process_layout
    create_context.create(
  File "C:\Dev\Ynput\OpenPype\openpype\pipeline\create\context.py", line 2029, in create
    return creator.create(
  File "C:\Dev\Ynput\OpenPype\openpype\hosts\blender\plugins\create\create_animation.py", line 18, in create
    collection = super().create(
  File "C:\Dev\Ynput\OpenPype\openpype\hosts\blender\api\plugin.py", line 229, in create
    asset_name = instance_data["folderPath"]
KeyError: 'folderPath'

It happens because when loading a layout with a rig, it will create an animation instance for each rig:

        # Create animation instances for each rig
        creator_identifier = "io.openpype.creators.blender.animation"
        host = registered_host()
        create_context = CreateContext(host)

        for rig in rigs:
            create_context.create(
                creator_identifier=creator_identifier,
                variant=rig.name.split(':')[-1],
                pre_create_data={
                    "use_selection": False,
                    "asset_group": rig
                }
            )

But when using the create from CreateContext, instance_data is defined as:

instance_data = {
"asset": asset_doc["name"],
"task": task_name,
"family": creator.family,
"variant": variant
}

It's missing folderPath if AYON_SERVER_ENABLED.

@iLLiCiTiT
Copy link
Copy Markdown
Member Author

In Blender, I'm getting this error when loading a layout with a rig:

Fixed.

@simonebarbieri
Copy link
Copy Markdown
Contributor

After latest fix, everything seems to be working fine in Blender :)

@LiborBatek LiborBatek self-requested a review November 20, 2023 15:17
Copy link
Copy Markdown
Member

@LiborBatek LiborBatek left a comment

Choose a reason for hiding this comment

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

I have made tests in SubstancePainter and all working fine with paths as unique identifier.

All good.

iLLiCiTiT and others added 7 commits November 20, 2023 18:28
* hiero: adding folderPath to creator

- some minor typos fixes
- modules sorting

* Hiero: adding asset_name and processing folderPath

- refactor labels

* fixing extract hierarchy to ayon

* hound

* Update openpype/hosts/hiero/api/plugin.py

Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>

* simplify expression

---------

Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
…th-as-identifier-in-traypublisher-editorial

TrayPublisher: editorial with folder path
…s-identifier-Resolve-editorial

AYON | Resolve: support for folder path
…ial' into feature/OP-7176_Use-folder-path-as-unique-identifier
@iLLiCiTiT iLLiCiTiT requested a review from mkolar November 21, 2023 17:26
@mkolar mkolar dismissed jakubjezek001’s stale review November 21, 2023 17:29

Comments were addressed

@iLLiCiTiT iLLiCiTiT merged commit 5721227 into develop Nov 21, 2023
@iLLiCiTiT iLLiCiTiT deleted the feature/OP-7176_Use-folder-path-as-unique-identifier branch November 21, 2023 17:30
@ynbot ynbot added this to the next-patch milestone Nov 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

host: After Effects host: CelAction CelAction 2d animation package host: Flame Autodesk Flame integration host: Fusion host: Hiero host: Houdini host: Maya host: Photoshop host: Resolve host: Substance Painter host: TrayPublisher host: TV Paint host: UE size/M Denotes a PR changes 500-999 lines, ignoring general files type: feature Larger, user affecting changes and completely new things

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.