ynput / ayon-blender

Blender addon for AYON
Apache License 2.0
7 stars 2 forks source link

Pointcache - "Manage > Set Version" and "Update to latest" action fails with error #40

Open LiborBatek opened 1 month ago

LiborBatek commented 1 month ago

Is there an existing issue for this?

Current Behavior:

When having loaded pointcache product in workfile and trying to perform Manage > Set Version it throws an error and not perform the action.

Traceback (most recent call last):

  File "C:\Users\lbate\AppData\Local\Ynput\AYON\addons\blender_0.2.4-dev.1\ayon_blender\api\ops.py", line 128, in execute
    result = callback(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Users\lbate\AppData\Local\Ynput\AYON\addons\blender_0.2.4-dev.1\ayon_blender\plugins\load\load_cache.py", line 276, in exec_update
    libpath = self._update_transform_cache_path(asset_group, libpath, prev_filename)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Users\lbate\AppData\Local\Ynput\AYON\addons\blender_0.2.4-dev.1\ayon_blender\plugins\load\load_cache.py", line 58, in _update_transform_cache_path
    modifier.cache_file = bpy.data.cache_files[-1]
    ^^^^^^^^^^^^^^^^^^^

AttributeError: 'NoneType' object has no attribute 'cache_file'

Expected Behavior:

Manage action must work on any product.

Version

1.0.0

What platform you are running on?

Windows

Steps To Reproduce:

  1. Load some pointcache product
  2. Try perform AYON > Manage> Set Version
  3. Will crash and not perform the action

Are there any labels you wish to add?

Relevant log output:

No response

Additional context:

No response

BigRoy commented 1 month ago

Updating works for me in Blender 4.2 LTS.

The filter to outdated toggle does not work, but is a known ayon-core issue here.

So this may be something specific on your end with the product you're loading?

It's odd that it gets a None type as modifier because here just the line before it creates a new one. Are you able to pinpoint when exactly this occurs? If not, then this may be best to delve deeper with your specific scenes or files.

BigRoy commented 1 month ago

So - yes, this is broken for any updates between versions that have MeshSequenceCache applied (any pointcaches that have vertex deformations, e.g. skinned characters).

But the issue is much bigger than that:

  1. The error here is on updating the MeshSequenceCache modifiers on meshes: image

The error is that it's trying to add the modifier also to e.g. Empties - but there the modifier can't be created and returns None. We can skip that to "fix" the error, but that doesn't solve the updating of pointcaches.

  1. We're not applying/removing TransformCache connections on updates: image

  2. We're not updating transforms or shapes for NON-animated meshes on updates. Those do not have the modifiers nor the constraints so are not updated through a 'live link' - meaning that those are NOT updated if the transforms or meshes have changed since last version update. We should.

  3. (Nice-to-have): Likely we'll want to make sure when adding/updating modifiers/constraints that we preserve them in the modifier/constraint stack so any local changes aside of that are maintained.

  4. We're not adding/removing empties or meshes that are removed or added between pointcache versions - hence, we're not updating those correctly either.

So basically we're not correctly updating all the data that may change between pointcache versions.

LiborBatek commented 1 month ago

Is there a way to fix the bare minimum atm (e.g. to not care about those non deformed meshes and empties but the deformed only)

I can imagine it might work in 85% scenarios and if not user could swipe the version present and bring fresh new instead.

LiborBatek commented 1 month ago

@moonyuet or maybe you could be involved in this as well :)

moonyuet commented 1 month ago

@moonyuet or maybe you could be involved in this as well :)

I tested in my side just now, I can't really replicate the issue you mentioned but rather updating the object path issue. Guess the short-term fix can be checking on the bpy.data.cache_file issue first and get the correct file. But we definitely need some long-term solution.