USD: skip exporting deform group attributes #111894

Open
Michael Kowalski wants to merge 1 commits from makowalski/blender:usd_no_defgroup_attr_export into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

No longer exporting mesh attributes that correspond to deform
groups.

This is to avoid potential name collisions when importing the
USD back into Blender, as described in #111747.

This preemptively addresses an issue which will arise when
exporting armatures to USD is supported, because the deform group
attributes and the UsdSkel mesh skinning data will be redundant.

In the future we might consider refining this behavior with a USD
export option to allow exporting some vertex group attributes but
not others.

Testing

To test, export a Blender scene containing a mesh with an armature
modifier to USD and verify that there are no primvars corresponding
to the deform groups on the USD mesh. For example, export test scene
tests/animation/CtrlObject.blend to USDA, open the exported file in a text
editor and verify that attributes Top, Left and Right are not be saved as
primvars on the mesh.

No longer exporting mesh attributes that correspond to deform groups. This is to avoid potential name collisions when importing the USD back into Blender, as described in https://projects.blender.org/blender/blender/pulls/111747. This preemptively addresses an issue which will arise when exporting armatures to USD is supported, because the deform group attributes and the UsdSkel mesh skinning data will be redundant. In the future we might consider refining this behavior with a USD export option to allow exporting some vertex group attributes but not others. ### Testing To test, export a Blender scene containing a mesh with an armature modifier to USD and verify that there are no `primvars` corresponding to the deform groups on the USD mesh. For example, export test scene `tests/animation/CtrlObject.blend` to USDA, open the exported file in a text editor and verify that attributes `Top`, `Left` and `Right` are not be saved as `primvars` on the mesh.
Michael Kowalski added 1 commit 2023-09-03 19:40:12 +02:00
USD: skip exporting deform group attributes.
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
5455c483b7
No longer exporting mesh attributes that correspond to deform
groups.

This is to avoid potential name collisions when importing the
USD back into Blender, as described in

#111747

This preemptively addresses an issue which will arise when
exporting armatures to USD is supported, because the deform group
attributes and the UsdSkel mesh skinning data will be redundant.

In the future we might consider refining this behavior with a USD
export option to allow exporting some vertex group attributes but
not others.
Michael Kowalski added the
Interest
USD
Interest
Pipeline & IO
labels 2023-09-03 19:40:43 +02:00
Michael Kowalski added this to the USD project 2023-09-03 19:40:52 +02:00
Michael Kowalski requested review from Hans Goudey 2023-09-03 19:52:08 +02:00
Author
Member

@blender-bot build

@blender-bot build
Hans Goudey changed title from USD: skip exporting deform group attributes. to USD: skip exporting deform group attributes 2023-09-05 04:30:16 +02:00
Hans Goudey approved these changes 2023-09-05 04:31:50 +02:00
@ -103,6 +104,10 @@ void USDGenericMeshWriter::write_custom_data(const Mesh *mesh, pxr::UsdGeomMesh
return true;
}
if (BKE_id_defgroup_name_find(&mesh->id, attribute_id.name().data(), nullptr, nullptr)) {
Member

Would be nice to reference something like the function name that gives the reader somewhere to look for where vertex groups are handled separately.

Would be nice to reference something like the function name that gives the reader somewhere to look for where vertex groups are handled separately.
Bastien Montagne reviewed 2023-09-06 11:19:01 +02:00
Bastien Montagne left a comment
Owner

Shouldn't the skipping of exporting vgroups as generic attributes be conditioned to the fact they they are actually exported as part of binding data for a usdSkel?

Shouldn't the skipping of exporting vgroups as generic attributes be conditioned to the fact they they are actually exported as part of binding data for a usdSkel?
Author
Member

Shouldn't the skipping of exporting vgroups as generic attributes be conditioned to the fact they they are actually exported as part of binding data for a usdSkel?

That's a good point and occurred to me as well, though I was a little unsure if we wanted to postpone supporting IO of vertex group attributes at the moment.

I could change the implementation to selectively remove conflicting attributes when the UsdSkel bindings are created. It In that case, this should probably be part of the UsdSkel export pull request #111931, since main doesn't currently export the UsdSkel bindings at all.

Does this sound reasonable?

> Shouldn't the skipping of exporting vgroups as generic attributes be conditioned to the fact they they are actually exported as part of binding data for a usdSkel? That's a good point and occurred to me as well, though I was a little unsure if we wanted to postpone supporting IO of vertex group attributes at the moment. I could change the implementation to selectively remove conflicting attributes when the `UsdSkel` bindings are created. It In that case, this should probably be part of the `UsdSkel` export pull request https://projects.blender.org/blender/blender/pulls/111931, since main doesn't currently export the `UsdSkel` bindings at all. Does this sound reasonable?
Member

I could change the implementation to selectively remove conflicting attributes when the UsdSkel bindings are created.

Sounds good, but I think it would be better to not export the vertex group attributes that would be redundant in the first place. I guess that requires some communication between the UsdSkel export and attribute export. Delaying this PR until #111931 lands seems like the right approach.

I was a little unsure if we wanted to postpone supporting IO of vertex group attributes at the moment.

That also sounds okay to me. Reasonable since Blender is still resolving this difference between vertex group storage and attribute storage itself. But like I mentioned before, then we would just have the problem again when the storage is unified, so doing it preemptively like you mentioned above seems better to me.

>I could change the implementation to selectively remove conflicting attributes when the UsdSkel bindings are created. Sounds good, but I think it would be better to not export the vertex group attributes that would be redundant in the first place. I guess that requires some communication between the `UsdSkel` export and attribute export. Delaying this PR until #111931 lands seems like the right approach. >I was a little unsure if we wanted to postpone supporting IO of vertex group attributes at the moment. That also sounds _okay_ to me. Reasonable since Blender is still resolving this difference between vertex group storage and attribute storage itself. But like I mentioned before, then we would just have the problem again when the storage is unified, so doing it preemptively like you mentioned above seems better to me.

I could change the implementation to selectively remove conflicting attributes when the UsdSkel bindings are created. It In that case, this should probably be part of the UsdSkel export pull request #111931, since main doesn't currently export the UsdSkel bindings at all.

Does this sound reasonable?

yes also sounds good to me.

> I could change the implementation to selectively remove conflicting attributes when the `UsdSkel` bindings are created. It In that case, this should probably be part of the `UsdSkel` export pull request https://projects.blender.org/blender/blender/pulls/111931, since main doesn't currently export the `UsdSkel` bindings at all. > > Does this sound reasonable? yes also sounds good to me.
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
This pull request has changes conflicting with the target branch.
  • source/blender/io/usd/intern/usd_writer_mesh.cc

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u usd_no_defgroup_attr_export:makowalski-usd_no_defgroup_attr_export
git checkout makowalski-usd_no_defgroup_attr_export
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#111894
No description provided.