glTF-Blender-IO icon indicating copy to clipboard operation
glTF-Blender-IO copied to clipboard

Export: write custom attribute arrays for non-skinning vgroups

Open canadaduane opened this issue 2 years ago • 7 comments

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

canadaduane avatar Dec 22 '21 05:12 canadaduane

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 avatar Dec 22 '21 08:12 julienduroure

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.

canadaduane avatar Dec 23 '21 15:12 canadaduane

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 https://github.com/KhronosGroup/glTF-Blender-IO/issues/1232#issuecomment-705290610.

scurest avatar Dec 23 '21 23:12 scurest

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.

julienduroure avatar Dec 24 '21 07:12 julienduroure

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.

scurest avatar Dec 24 '21 08:12 scurest

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

iuriiiurevich avatar Mar 28 '22 17:03 iuriiiurevich

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!

iuriiiurevich avatar Mar 30 '22 10:03 iuriiiurevich