ynput / ayon-nuke

Nuke addon for AYON
Apache License 2.0
2 stars 6 forks source link

Fix write node creation while broken project Anatomy. #12

Closed robin-ynput closed 4 weeks ago

robin-ynput commented 1 month ago

Changelog Description

Address #9

I Implemented the solution suggested by @BigRoy on the associated issue which makes perfect sense:

Testing notes:

  1. Set broken Anatomy preset for something irrelevant to the Write node creation (note additional ] after variant) image

  2. Open Nuke and create a Write node from AYON -> Create

  3. Ensure a write node get properly created despite part of the Anatomy being wrong

moonyuet commented 1 month ago

It's good for the merge. One more thing to add, it contributes to other draft PR which is associated to this. (I also tested along with that PR) It is still not quite working in terms of formatting data for the publish if adding {variant]} if the users use their own custom template to publish the render. It's not related to this PR but you can just mark it as a note. image

DEBUG: prerenderKey01 is missing reference to staging directory. Will try to get it from representation.
DEBUG: Looking for matching profile for: hosts: "nuke" | product_types: "prerender" | task_names: "compositing" | task_types: "Compositing"
DEBUG: "nuke" not found in "hosts": ['standalonepublisher']
DEBUG: "nuke" not found in "hosts": ['maya']
DEBUG: "nuke" not found in "hosts": ['traypublisher']
DEBUG: "nuke" not found in "hosts": ['max']
DEBUG: Profile selected: {'product_types': ['review', 'render', 'prerender'], 'hosts': [], 'task_types': [], 'task_names': [], 'template_name': 'test'}
DEBUG: Product: prerenderKey01
DEBUG: Resetting dropped connection: localhost
DEBUG: http://localhost:5000 "POST /graphql HTTP/1.1" 200 407
DEBUG: Response <RestApiResponse [200]>
DEBUG: Prepared product: prerenderKey01
DEBUG: http://localhost:5000 "POST /graphql HTTP/1.1" 200 105
DEBUG: Response <RestApiResponse [200]>
DEBUG: Source: {root[work]}/interior_lenny/lenny_bedroom/asset/work/compositing/il_asset_compositing_v004.nk
DEBUG: Creating new version ...
DEBUG: Prepared version: v007
DEBUG: http://localhost:5000 "POST /graphql HTTP/1.1" 200 112
DEBUG: Response <RestApiResponse [200]>
DEBUG: Anatomy template name: test
CRITICAL: Error when registering
Traceback (most recent call last):
  File "D:\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 158, in process
    self.register(instance, file_transactions, filtered_repres)
  File "D:\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 246, in register
    prepared = self.prepare_representation(
  File "D:\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 731, in prepare_representation
    template_filled = path_template_obj.format_strict(
  File "D:\ayon-core\client\ayon_core\lib\path_templates.py", line 140, in format_strict
    result.validate()
  File "D:\ayon-core\client\ayon_core\pipeline\anatomy\templates.py", line 39, in validate
    raise AnatomyTemplateUnsolved(
ayon_core.pipeline.anatomy.exceptions.AnatomyTemplateUnsolved: Anatomy template "{root[work]}/{project[name]}/{hierarchy}/{folder[name]}/source/{variant]}/v{version:0>3}/{project[code]}_{folder[name]}_{product[name]}_v{version:0>3}<_{output}><.{frame:0>4}><.{udim}>.{ext}" is unsolved. Missing keys: "variant]".

Traceback (most recent call last):
  File "C:\Users\Kayla\AppData\Local\Ynput\AYON\dependency_packages\ayon_2402141620_windows.zip\dependencies\pyblish\plugin.py", line 527, in __explicit_process
    runner(*args)
  File "D:\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 170, in process
    raise exc
  File "D:\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 158, in process
    self.register(instance, file_transactions, filtered_repres)
  File "D:\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 246, in register
    prepared = self.prepare_representation(
  File "D:\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 731, in prepare_representation
    template_filled = path_template_obj.format_strict(
  File "D:\ayon-core\client\ayon_core\lib\path_templates.py", line 140, in format_strict
    result.validate()
  File "D:\ayon-core\client\ayon_core\pipeline\anatomy\templates.py", line 39, in validate
    raise AnatomyTemplateUnsolved(
ayon_core.pipeline.anatomy.exceptions.AnatomyTemplateUnsolved: Anatomy template "{root[work]}/{project[name]}/{hierarchy}/{folder[name]}/source/{variant]}/v{version:0>3}/{project[code]}_{folder[name]}_{product[name]}_v{version:0>3}<_{output}><.{frame:0>4}><.{udim}>.{ext}" is unsolved. Missing keys: "variant]".

DEBUG: Establishing staging directory @ D:\sh_boss_proj\interior_lenny\lenny_bedroom\asset\work\compositing\renders\nuke\renderCompositingMain
DEBUG: Looking for matching profile for: hosts: "nuke" | product_types: "render" | task_names: "compositing" | task_types: "Compositing"
DEBUG: "nuke" not found in "hosts": ['standalonepublisher']
DEBUG: "nuke" not found in "hosts": ['maya']
DEBUG: "nuke" not found in "hosts": ['traypublisher']
DEBUG: "nuke" not found in "hosts": ['max']
DEBUG: Profile selected: {'product_types': ['review', 'render', 'prerender'], 'hosts': [], 'task_types': [], 'task_names': [], 'template_name': 'test'}
DEBUG: Product: renderCompositingMain
DEBUG: http://localhost:5000 "POST /graphql HTTP/1.1" 200 433
DEBUG: Response <RestApiResponse [200]>
DEBUG: Prepared product: renderCompositingMain
DEBUG: http://localhost:5000 "POST /graphql HTTP/1.1" 200 105
DEBUG: Response <RestApiResponse [200]>
DEBUG: Source: {root[work]}/interior_lenny/lenny_bedroom/asset/work/compositing/il_asset_compositing_v004.nk
DEBUG: Creating new version ...
DEBUG: Prepared version: v005
DEBUG: http://localhost:5000 "POST /graphql HTTP/1.1" 200 112
DEBUG: Response <RestApiResponse [200]>
DEBUG: Anatomy template name: test
CRITICAL: Error when registering
Traceback (most recent call last):
  File "D:\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 158, in process
    self.register(instance, file_transactions, filtered_repres)
  File "D:\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 246, in register
    prepared = self.prepare_representation(
  File "D:\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 731, in prepare_representation
    template_filled = path_template_obj.format_strict(
  File "D:\ayon-core\client\ayon_core\lib\path_templates.py", line 140, in format_strict
    result.validate()
  File "D:\ayon-core\client\ayon_core\pipeline\anatomy\templates.py", line 39, in validate
    raise AnatomyTemplateUnsolved(
ayon_core.pipeline.anatomy.exceptions.AnatomyTemplateUnsolved: Anatomy template "{root[work]}/{project[name]}/{hierarchy}/{folder[name]}/source/{variant]}/v{version:0>3}/{project[code]}_{folder[name]}_{product[name]}_v{version:0>3}<_{output}><.{frame:0>4}><.{udim}>.{ext}" is unsolved. Missing keys: "variant]".

Traceback (most recent call last):
  File "C:\Users\Kayla\AppData\Local\Ynput\AYON\dependency_packages\ayon_2402141620_windows.zip\dependencies\pyblish\plugin.py", line 527, in __explicit_process
    runner(*args)
  File "D:\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 170, in process
    raise exc
  File "D:\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 158, in process
    self.register(instance, file_transactions, filtered_repres)
  File "D:\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 246, in register
    prepared = self.prepare_representation(
  File "D:\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 731, in prepare_representation
    template_filled = path_template_obj.format_strict(
  File "D:\ayon-core\client\ayon_core\lib\path_templates.py", line 140, in format_strict
    result.validate()
  File "D:\ayon-core\client\ayon_core\pipeline\anatomy\templates.py", line 39, in validate
    raise AnatomyTemplateUnsolved(
ayon_core.pipeline.anatomy.exceptions.AnatomyTemplateUnsolved: Anatomy template "{root[work]}/{project[name]}/{hierarchy}/{folder[name]}/source/{variant]}/v{version:0>3}/{project[code]}_{folder[name]}_{product[name]}_v{version:0>3}<_{output}><.{frame:0>4}><.{udim}>.{ext}" is unsolved. Missing keys: "variant]".