PBVH: update mesh data pointers stored in pbvh #106271
No reviewers
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#106271
Loading…
Reference in New Issue
No description provided.
Delete Branch "JacquesLucke/blender:pbvh-update-pointers"
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?
This is necessary for #106228. Without this,
PBVH
might contain pointers to data that either does not exist anymore or that must not be edited (because it is shared).The file below shows a simple way to reproduce the issue. When only #106228 is applied, weight painting does not work correctly and also crashes in an ASAN build.
ASAN report: https://hastebin.com/share/goziwepawi.yaml
WIP: Sculpt: update mesh data pointers stored in pbvhto PBVH: update mesh data pointers stored in pbvh@blender-bot build
Jacques Lucke referenced this pull request2023-04-07 13:26:21 +02:00
I left some comments about potential improvements inline, but on the whole I think this makes sense as one step on a path to a saner ownership model here. It looks good to me.
@ -2204,3 +2183,4 @@
BKE_pbvh_build_mesh(pbvh, me);
const bool is_deformed = check_sculpt_object_deformed(ob, true);
if (is_deformed && me_eval_deform != nullptr) {
I wonder if it would make sense to check this before
BKE_pbvh_build_mesh
and giveBKE_pbvh_build_mesh
an optional argument for positions not owned by the mesh. That would go a long way to help clarify whetherPBVH
should reuse the arrays for the mesh's looptris and normals too, which is the biggest remaining pain point in this area IMO.Something similar would apply to
sculpt_update_object
, where the chunks of code currently callingBKE_pbvh_vert_coords_apply
could be moved to happen beforeBKE_sculpt_object_pbvh_ensure
(which would also get a new non-mesh positions argument).Not sure if you'd consider this related (feel free to disregard it). If not, I'll probably look into this in the near future.
@ -840,0 +834,4 @@
pbvh->polys = mesh->polys();
pbvh->corner_verts = mesh->corner_verts().data();
if (!pbvh->deformed) {
/* If it was deformed, a new array is allocated. */
This comment is a bit confusing. I think a more correct phrasing would be
Deformed positions not matching the original mesh are owned directly by the PBVH, and are set separately by #BKE_pbvh_vert_coords_apply
(though I do suggest tweaking that a bit below).@ -2204,3 +2183,4 @@
BKE_pbvh_build_mesh(pbvh, me);
const bool is_deformed = check_sculpt_object_deformed(ob, true);
if (is_deformed && me_eval_deform != nullptr) {
Yeah that would probably improve the code even more, but won't integrate it into this patch.