Mesh: Move edges to a generic attribute #106638
No reviewers
Labels
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
FBX
Interest
Freestyle
Interest
Geometry Nodes
Interest
glTF
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#106638
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "HooglyBoogly/blender:refactor-mesh-edges-generic"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements #95966, as the final step of #95965.
This commit changes the storage of mesh edge vertex indices from the
MEdge
type to a new genericint2
attribute type. This follows thegeneral design for geometry and the attribute system, where the data
storage type and the usage semantics are separated.
The main benefit of the change is reduced memory usage-- the
requirements of storing mesh edges is reduced by 1/3. For example,
this saves 8MB on a 1 million vertex grid. This also gives performance
benefits to any memory bound mesh processing algorithm that uses edges.
Another smaller benefit is that all of the edge's vertex indices are
contiguous. In a few cases, it's helpful to process all of them as
Span<int>
rather thanSpan<int2>
. Similarly, the type is morelikely to match a generic format used by a library, or code that
shouldn't know about specific Blender
Mesh
types.Various Notes:
.edge_verts
name is used to reflect a mapping between domains,similar to
.corner_verts
, etc. The period means that it the datashouldn't change arbitrarily by the user or procedural operations.
edge[0]
is now used instead ofedge.v1
of signed-ness, which can be error prone.
MVert
,MEdge
,MLoop
,MPoly
are now deprecated. Only generic types are used).vec2i
DNA type is used in the few C files where necessary.@blender-bot build
@blender-bot build windows
duplicate_elements_mesh_edges.blend
test in a debug build.CD_PROP_INT2
separately. Although we have to be a bit careful with the naming and might have to adjust some names (currently it looks like it's using the same name pattern that's used byCD_PROP_INT8
orCD_PROP_INT32
, but it is not). Maybe something likeCD_PROP_INT32_2D
could work? Same thing ineSpreadsheetColumnValueType
.MEdge
also be put intoDNA_DEPRECATED_ALLOW
?I might be second-guessing what I told you about using
int2
everywhere. It's mostly fine but it does seem like it's reducing code readibility in a few places. I think storing it asint2
is still perfectly reasonable, but maybe it would be could to have another term for working with it... Something likestruct EdgeVerts { int a, b; }
. I'm not entirely convinced by either approach yet.I do like the approach of using
int2
directly when working with edges actually. In practice, the change is mostly using[0]
and[1]
instead of.v1
and.v2
. It also places a bit more importance on variable names, but that's good anyway IMO. It helps to make the data-oriented design clear, and there are some benefits from using aVecBase
type as well.There is a crash loading from an auto-saved file (
MEdge
is NULL when loading/tmp/quit.blend
for e.g.).Otherwise this works well in my tests (accepting, no need for an extra review iteration).