Fix #108517: Mesh split edges can give invalid indices #108826

Merged
Hans Goudey merged 3 commits from HooglyBoogly/blender:fix-split-edges-bad-indices into blender-v3.6-release 2023-06-13 14:10:18 +02:00
Member

The split edges code had a complex method of merging duplicate edges,
going backwards to avoid shifting elements in a vector. Sometimes it
could result in incorrect corner edge indices though, if it moved an
index that matched one of the local variables (I think! I've been trying
to understand this all day and still struggling). Instead, replace it
with a VectorSet that handles the deduplication by itself, and
avoid creating the new edges until the end of the algorithm.

I think this code could still be simpler if we tried to reduce the
amount of things happening at the same time, making more code
deal with the input or final state rather than an in-between one.
But to avoid making the change too complicated I stopped here.

The split edges code had a complex method of merging duplicate edges, going backwards to avoid shifting elements in a vector. Sometimes it could result in incorrect corner edge indices though, if it moved an index that matched one of the local variables (I think! I've been trying to understand this all day and still struggling). Instead, replace it with a `VectorSet` that handles the deduplication by itself, and avoid creating the new edges until the end of the algorithm. I think this code could still be simpler if we tried to reduce the amount of things happening at the same time, making more code deal with the input or final state rather than an in-between one. But to avoid making the change too complicated I stopped here.
Hans Goudey requested review from Jacques Lucke 2023-06-09 23:14:17 +02:00
Hans Goudey force-pushed fix-split-edges-bad-indices from 8ffdce0c53 to 733a0c48f0 2023-06-09 23:24:07 +02:00 Compare
Hans Goudey changed title from Fix #108517: Mesh split edges can give invalid indices to Fix #108517: Mesh split edges can give invalid indices 2023-06-09 23:24:20 +02:00
HooglyBoogly changed target branch from main to blender-v3.6-release 2023-06-09 23:24:22 +02:00
Hans Goudey added this to the 3.6 LTS milestone 2023-06-09 23:26:36 +02:00
Author
Member

Hey @JacquesLucke, sorry to pull you in here, this code is no fun! But maybe it's a bit better now.

The loose_edges IndexMask works better in main BTW, it's a bit ugly here in 3.6.

Hey @JacquesLucke, sorry to pull you in here, this code is no fun! But maybe it's a bit better now. The `loose_edges` `IndexMask` works better in `main` BTW, it's a bit ugly here in 3.6.
Author
Member

@blender-bot build

@blender-bot build
Jacques Lucke approved these changes 2023-06-13 09:54:18 +02:00
@ -0,0 +36,4 @@
return (this->v_low << 8) ^ this->v_high;
}
uint64_t hash2() const
Member

Looks like this can be removed.

Looks like this can be removed.
@ -318,7 +318,7 @@ set(SRC
BLI_noise.h
BLI_noise.hh
BLI_offset_indices.hh
BLI_parameter_pack_utils.hh
Member

Why remove this line?

Why remove this line?
Hans Goudey added 2 commits 2023-06-13 14:09:25 +02:00
Hans Goudey merged commit 8a11f0f3a2 into blender-v3.6-release 2023-06-13 14:10:18 +02:00
Hans Goudey deleted branch fix-split-edges-bad-indices 2023-06-13 14:10:22 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
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, Assets & 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
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
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
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
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
2 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#108826
No description provided.