Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blender: Use transform cache to handle alembic camera updates #497

Conversation

simonebarbieri
Copy link
Contributor

Changelog Description

Use transform cache constraints to update alembic cameras.
Before, the camera was deleted and recreated. Now it updates the cache file.

Additional info

This PR should be compatible with existing alembic cameras loaded in the scene. When updating, it will create a new transform cache, if it doesn't find one.
To assign the right object path, it has been necessary a workaround to force Blender to evaluate the cache file loaded. This is because the list of object paths in the cache file is not available immediately when the file has been loaded (https://devtalk.blender.org/t/alembic-cachefile-list-of-object-paths-not-available-at-creation/21573).

Testing notes:

  1. Try loading alembic cameras. They should have a Transform Cache in the object constraints.
  2. Make changes to the camera (for instance, change field of view). The changes should be kept after updating the camera.
  3. Try updating an alembic that has been loaded before this PR. When updating it, it should create the Transform Cache and keep all the changes.

@simonebarbieri simonebarbieri added host: Blender type: bug Something isn't working sponsored This is directly sponsored by a client or community member labels May 9, 2024
@simonebarbieri simonebarbieri self-assigned this May 9, 2024
@ynbot
Copy link
Contributor

ynbot commented May 9, 2024

@ynbot ynbot added the size/XS label May 9, 2024
Copy link
Member

@moonyuet moonyuet left a comment

Choose a reason for hiding this comment

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

When loading alembic camera, the transform cache modifiers added into the camera as expected.
But there is some issues on updating camera, of which the camera doesn't get updated correctly through scene inventory manager.

2024-05-10.15-48-59.mp4

@simonebarbieri
Copy link
Contributor Author

@moonyuet Could you check if there is any error in the console?

@moonyuet moonyuet self-requested a review May 10, 2024 10:59
Copy link
Member

@moonyuet moonyuet left a comment

Choose a reason for hiding this comment

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

My bad, I loaded the published alembic from the folder where I performed delete old version before. (I realize after looking at the console)

Running callback: <bound method AssetLoader._load of []>
Alembic import of 'D:\sh_boss_proj\interior_lenny\lenny_bedroom\asset\publish\camera\cameraMain\v006\il_asset_cameraMain_v006.abc' took 0.6 ms
Done
Initialising WM_OT_avalon_manager...
Traceback (most recent call last):
  File "D:\ayon-core\client\ayon_core\tools\sceneinventory\view.py", line 279, in <lambda>
    lambda: self._show_version_dialog(items))
  File "D:\ayon-core\client\ayon_core\tools\sceneinventory\view.py", line 695, in _show_version_dialog
    self._update_containers(items, version)
  File "D:\ayon-core\client\ayon_core\tools\sceneinventory\view.py", line 822, in _update_containers
    update_container(item, item_version)
  File "D:\ayon-core\client\ayon_core\pipeline\load\utils.py", line 514, in update_container
    raise ValueError("Path {} doesn't exist".format(path))
ValueError: Path D:/sh_boss_proj\interior_lenny\lenny_bedroom\asset\publish\camera\cameraMain\v005\il_asset_cameraMain_v005.abc doesn't exist

I tested with the published alembic from other tasks, Looks good for me now!

@simonebarbieri
Copy link
Contributor Author

@moonyuet ah not a problem 😄 Thanks for the review!

@simonebarbieri simonebarbieri merged commit 428cc99 into develop May 10, 2024
10 of 11 checks passed
@simonebarbieri simonebarbieri deleted the bugfix/AY-1068_Blender-camera-type-not-kept-after-version-update branch May 10, 2024 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XS sponsored This is directly sponsored by a client or community member type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants