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

Export: write custom attribute arrays for non-skinning vgroups #1515

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

canadaduane
Copy link

@canadaduane canadaduane commented Dec 22, 2021

I've combined the facemap exports and vertex group exports from @scurest's work last year, and tested that this works on 3.0.0.

I haven't followed all of the changes and improvements since Nov 2020, however, so I'm not sure if this is still the ideal way to do things.

There are also a couple of places where a line of code has been commented out (e.g. gltf2_blender_gather_nodes.py has #vertex_groups = None in a couple of places). We should probably decide what we want to happen--either remove it, or improve it?

#1232

@julienduroure
Copy link
Collaborator

julienduroure commented Dec 22, 2021

There are also a couple of places where a line of code has been commented out (e.g. gltf2_blender_gather_nodes.py has #vertex_groups = None in a couple of places). We should probably decide what we want to happen--either remove it, or improve it?

We can't remove it, it will lead to miss cache in some situation
The solution is to use a custom cache, as I started to implement (based in scurest suggestion) in vtree branch.
This will be nedded also for other requests (see #900 #747 #1245)

@julienduroure julienduroure self-requested a review December 22, 2021 08:06
Comment on lines +345 to +350
#vertex_groups = None
modifiers = None
else:
# Check if there is an armature modidier
if len([mod for mod in blender_object.modifiers if mod.type == "ARMATURE"]) == 0:
vertex_groups = None # Not needed if no armature, avoid a cache miss
#vertex_groups = None # Not needed if no armature, avoid a cache miss
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can lead to miss cache

@canadaduane
Copy link
Author

Ok, cool, so this PR should wait until your work there on custom caches is done? If I understand #1245 is the ticket to watch.

@scurest
Copy link
Contributor

scurest commented Dec 23, 2021

It does not require a custom cache. It will also not cause a cache miss: if there are non-skinning vgroups, this branch always exports them, so since the vgroups are always used, it is correct that they are always part of the cache key. But I don't think it is good that they are always exported. If it's desirable to merge these features into mainline, I think they should be behind an export option, cf #1232 (comment).

@julienduroure
Copy link
Collaborator

julienduroure commented Dec 24, 2021

BTW, some other custom attribute can be exported, as requested by some blender devs. See #1505

Anyway, now that vertex groups are stored on mesh, no more on object, all this code needs (probably) to be refactored.

@scurest
Copy link
Contributor

scurest commented Dec 24, 2021

Anyway, now that vertex groups are stored on mesh, no more on object, all this code needs (probably) to be refactored.

Oh, that's right. vertex_groups = None is always unnecessary now, since two instances of the same mesh always have the same vertex groups. It still has to be passed down though since there's no API for getting it off the mesh.

@iuriiiurevich
Copy link

iuriiiurevich commented Mar 28, 2022

Plus one to the idea of adding this feature to the official exporter (as an export option)!

@iuriiiurevich
Copy link

Plus one to the idea of adding this feature to the official exporter (as an export option)!

@julienduroure Are there any plans to do so?
By the way, thanks for your amazing work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants