Page MenuHome

Cleanup: Remove DerivedMesh use in UV unwrapping
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Nov 13 2022, 11:39 PM.

Details

Summary

Previously the UV unwrapping handling for subsurf modifiers used DerivedMesh
to implement the subdivision. Since we're trying to remove DerivedMesh in general,
and since this just made use of the Mesh data anyway, it's relatively simple to
remove it here. Combined with D15939, this makes it possible to remove more
DerivedMesh code.

Diff Detail

Repository
rB Blender

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Nov 13 2022, 11:39 PM
Hans Goudey (HooglyBoogly) created this revision.
This revision is now accepted and ready to land.Nov 14 2022, 1:49 AM
Sergey Sharybin (sergey) requested changes to this revision.Nov 14 2022, 12:14 PM

From code side mainly seems good. There is a note about possibly uninitiaized options.is_adaptive which needs a look.

Wondering whether it will be beneficial to have some API to make subdiv_mesh_settings_init and BKE_subsurf_modifier_runtime_init mode accessible and reusable. Kinda feels good to hide all those smd->subdivType checks and take care of such possibly uninitialized fields.

On a design level -- less derived meshes we have is better!

source/blender/editors/uvedit/uvedit_unwrap_ops.c
583–585

Would it be more clear if we do if (smd->levels < 1) return me_from_em; above? Took me a bit to understand what this magical constant of 3 is..

586–593

The settings.is_adaptive seems to be left uninitialized.

This revision now requires changes to proceed.Nov 14 2022, 12:14 PM
Hans Goudey (HooglyBoogly) marked 2 inline comments as done.
  • Deduplicate subdiv settings creation
  • Fix uninitialized subdiv option
source/blender/editors/uvedit/uvedit_unwrap_ops.c
583–585

If you search mesh_settings.resolution < 3, it comes up in a few other places, I was just copying that. Agreed though!

586–593

Thanks for catching that

Thanks for the update. Is looking good now!

source/blender/editors/uvedit/uvedit_unwrap_ops.c
583–585

Not impossible. If there are ways to make it more clear in those places feel free to do so!

This revision is now accepted and ready to land.Nov 15 2022, 9:45 AM