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

Load Alembic cache and manage as datablock #57

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

BigRoy
Copy link
Contributor

@BigRoy BigRoy commented Oct 11, 2024

Changelog Description

Load an Alembic and manage the datablock instead of containerizing the root object.

Additional info

This simplifies the loading logic a lot since we do not need to take care of the hierarchy of the objects and keep track of which are children, etc.

Also, on load I enable that it ALWAYS add a cache reader using always_add_cache_reader=True. This may be less performant (so beware) but it massively simplifies code and improves reliability to what the user may expect when "updating" the cache. It means that even if object transforms of mesh vertex caches didn't animate at first, but do animate (or have moved) in the updated alembic they actually follow along. This also fixes that on update non-animated objects will get their transforms updated if they (even though static) have moved between the alembic versions.

This PR is solely to test the concept - and discuss good things about this; and of course I'm looking forward to all the issues one may have with this. So, feedback is welcome!

Thanks to Pete Addington from The Line for derailing me to start fiddling with this.

Testing notes:

  1. Use Load Cache Data loader for Alembics.
  2. Play with it, update it, manage it, remove it.

Resolves #60

@BigRoy BigRoy added the type: enhancement Improvement of existing functionality or minor addition label Oct 11, 2024
@BigRoy BigRoy requested review from moonyuet and LiborBatek October 11, 2024 23:46
@BigRoy BigRoy self-assigned this Oct 11, 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.

I tested with some files sent by Libor
It works, only thing which is not working is the switch function but I dont think we need to have that for the load alembic cache.
I believe we can remove the load_cache and load_camera_abc and simply use this loader to load camera and cache?
https://github.com/user-attachments/assets/58ef022c-6f4b-499c-adf3-3734d6a0d021

@BigRoy
Copy link
Contributor Author

BigRoy commented Oct 14, 2024

I tested with some files sent by Libor It works, only thing which is not working is the switch function but I dont think we need to have that for the load alembic cache. I believe we can remove the load_cache and load_camera_abc and simply use this loader to load camera and cache? https://github.com/user-attachments/assets/58ef022c-6f4b-499c-adf3-3734d6a0d021

I'll need to test that switching. Did it actually error? or just fail to show any changes to the scene? I suspect the "old" objects stop moving? (because their object paths are not found in the new alembic, likely objects are named differently in the other file?) And the new geometry does not get loaded? If so, then yes - new geometry does not get 'created' currently on update or switch. It should be doable, I'm just not sure how trivial and sensible it would be. As in, I'm not sure if it'd be 100% reliable and if sometimes it'd then start creating objects that maybe the user deleted on purpose. :D

@moonyuet
Copy link
Member

moonyuet commented Oct 14, 2024

I tested with some files sent by Libor It works, only thing which is not working is the switch function but I dont think we need to have that for the load alembic cache. I believe we can remove the load_cache and load_camera_abc and simply use this loader to load camera and cache? https://github.com/user-attachments/assets/58ef022c-6f4b-499c-adf3-3734d6a0d021

I'll need to test that switching. Did it actually error? or just fail to show any changes to the scene? I suspect the "old" objects stop moving? (because their object paths are not found in the new alembic, likely objects are named differently in the other file?) And the new geometry does not get loaded? If so, then yes - new geometry does not get 'created' currently on update or switch. It should be doable, I'm just not sure how trivial and sensible it would be. As in, I'm not sure if it'd be 100% reliable and if sometimes it'd then start creating objects that maybe the user deleted on purpose. :D

It doesn't error and it does switch but the object in the scene does not get correctly updated. And it is supposed to be working for that switch function since the update function of the filepath works as expected.

cache_file.filepath = self.filepath_from_context(context)

@m-u-r-p-h-y m-u-r-p-h-y added the sponsored This is directly sponsored by a client or community member label Oct 14, 2024
@LiborBatek
Copy link
Member

I have tested Load cache Data and it works...

Also my finding is that every node within Alembic gets transform cache constraint which then prevents from any tweaks of the transforms by user (solution is to set Influence of the transform to zero) - this doesnt mean its an issue, but something which is not normally happening aka no any transform constraints added when using Load cache (Abc)

image

Once overriden by turning the influence to zero, it holds the transforms user edit even when performing Manage>Set Version etc. which is good.

@BigRoy
Copy link
Contributor Author

BigRoy commented Oct 15, 2024

I have tested Load cache Data and it works...

Also my finding is that every node within Alembic gets transform cache constraint which then prevents from any tweaks of the transforms by user (solution is to set Influence of the transform to zero) - this doesnt mean its an issue, but something which is not normally happening aka no any transform constraints added when using Load cache (Abc)

image

Once overriden by turning the influence to zero, it holds the transforms user edit even when performing Manage>Set Version etc. which is good.

Thanks - yes.

I actually wanted to do potentially do a few more things:

  • Add a parent group by default (however, since we're not tracking any objects/hierarchies... I'm not sure what should happen to the group on "remove" because we technically do not reliably know about that group itself). But the parent group would at least allow you to move the asset without load non-destructively
  • Add a 'namespace' or other prefix to the loaded objects - so that the naming is clearer as to what was loaded. Which may be a customizable "preset" defined from settings.

@LiborBatek
Copy link
Member

LiborBatek commented Oct 15, 2024

I got your points...sounds reasonable!

One note tho: we are facing opposite issue with super long names which got unneccessary loong once asset got loaded - something which should be taken care of - this been issue mostly when going for nested scenes as the names got clipped off.

So aiming for short and clear naming been the top priority speaking of blender integration... I will give some more info/ example of those issue connected asap.

Also unnecessary grouping (via locators/ empties) occurs a lot making lot of cluttering in the outliner...

@BigRoy
Copy link
Contributor Author

BigRoy commented Oct 15, 2024

So aiming for short and clear naming been the top priority speaking of blender integration... I will give some more info/ example of those issue connected asap.

Also unnecessary grouping (via locators/ empties) occurs a lot making lot of cluttering in the outliner...

Both valid points - then I'd be happy to keep it as barebones as is if there is no actual need in production for more uniqueness?

@LiborBatek
Copy link
Member

Even tho its a bit off topic I will share it here...u can blame me later for sure :D

For e.g creating blendScene publish instance is resulting into this naming of blender Collection (acting as a product set in maya way)

Screenshot 2024-10-15 163529

its quite long as it uses folder productType and Variant ...maybe its just that blendScene type is tad long imho and could be something like blndScn or such.

This start to be an issue when loading such asset into animation scene and publishing layout from there using those loaded assets which can quickly result into massive long names when loaded into lighting scene similar to this:

Screenshot 2024-10-15 163725

So imho just optimizing it a bit could help a lot as this can be quite painful to navigate in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sponsored This is directly sponsored by a client or community member type: enhancement Improvement of existing functionality or minor addition
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AY-6949_Blender: Load Alembic as datablock
4 participants