[Bf-blender-cvs] [dd45a4bc6e4] temp_bmesh_multires: Merge branch 'master' into temp_bmesh_multires
Joseph Eagar
noreply at git.blender.org
Mon Mar 1 02:05:55 CET 2021
Commit: dd45a4bc6e417e7ff7e1cf34909b54434d5ccfbf
Author: Joseph Eagar
Date: Sun Feb 28 04:59:03 2021 -0800
Branches: temp_bmesh_multires
https://developer.blender.org/rBdd45a4bc6e417e7ff7e1cf34909b54434d5ccfbf
Merge branch 'master' into temp_bmesh_multires
===================================================================
===================================================================
diff --cc release/scripts/addons
index dd01ddbe345,37af7e130b9..8adb0dce852
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit dd01ddbe34518b8eeec5596c593c3f1d12fa0337
-Subproject commit 37af7e130b99865575f1fa2315ef806f815b0f42
++Subproject commit 8adb0dce852d84bfe1f9e81399681fa615b5aa8e
diff --cc source/blender/bmesh/bmesh_class.h
index 124bde70515,c83fc0645c4..f61921cd61c
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@@ -16,14 -16,13 +16,15 @@@
#pragma once
+#include "DNA_modifier_types.h"
+
/** \file
* \ingroup bmesh
+ *
+ * #BMesh data structures, used for mesh editing operations
+ * that benefit from accessing connectivity information.
*/
- /* bmesh data structures */
-
/* disable holes for now,
* these are ifdef'd because they use more memory and cant be saved in DNA currently */
// #define USE_BMESH_HOLES
@@@ -262,17 -355,30 +357,33 @@@ typedef struct BMesh
int totflags;
ListBase selected;
+ /**
+ * The active face.
+ * This is kept even when unselected, mainly so UV editing can keep showing the
+ * active faces image while the selection is being modified in the 3D viewport.
+ *
+ * Without this the active image in the UV editor would flicker in a distracting way
+ * while changing selection in the 3D viewport.
+ */
BMFace *act_face;
+ /** List of #BMOpError, used for operator error handling. */
ListBase errorstack;
+ /**
+ * Keep a single reference to the Python instance of this #BMesh (if any exists).
+ *
+ * This allows save invalidation of a #BMesh when it's freed,
+ * so the Python object will report it as having been removed,
+ * instead of crashing on invalid memory access.
+ */
void *py_handle;
+ MultiresModifierData multires; //copy of multires settings
+ bool haveMultiResSettings;
+ int multiresSpace;
} BMesh;
- /* BMHeader->htype (char) */
+ /** #BMHeader.htype (char) */
enum {
BM_VERT = 1,
BM_EDGE = 2,
diff --cc source/blender/editors/sculpt_paint/sculpt.c
index 8a461cf4925,3a18d7a10de..5deb13885ed
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@@ -1401,30 -1103,28 +1403,32 @@@ void SCULPT_floodfill_add_initial(Sculp
BLI_gsqueue_push(flood->queue, &index);
}
-void SCULPT_floodfill_add_initial_with_symmetry(
- Sculpt *sd, Object *ob, SculptSession *ss, SculptFloodFill *flood, int index, float radius)
+void SCULPT_floodfill_add_initial_with_symmetry(Sculpt *sd,
+ Object *ob,
+ SculptSession *ss,
+ SculptFloodFill *flood,
- SculptVertRef index,
++ SculptVertRef vertex,
+ float radius)
{
/* Add active vertex and symmetric vertices to the queue. */
const char symm = SCULPT_mesh_symmetry_xyz_get(ob);
for (char i = 0; i <= symm; ++i) {
- if (SCULPT_is_symmetry_iteration_valid(i, symm)) {
- SculptVertRef v = BKE_pbvh_make_vref(-1);
- if (i == 0) {
- v = index;
- }
- else if (radius > 0.0f) {
- float radius_squared = (radius == FLT_MAX) ? FLT_MAX : radius * radius;
- float location[3];
- flip_v3_v3(location, SCULPT_vertex_co_get(ss, index), i);
- v = SCULPT_nearest_vertex_get(sd, ob, location, radius_squared, false);
- }
- if (v.i != -1) {
- SCULPT_floodfill_add_initial(flood, v);
- }
+ if (!SCULPT_is_symmetry_iteration_valid(i, symm)) {
+ continue;
+ }
- int v = -1;
++ SculptVertRef v = {-1};
+ if (i == 0) {
- v = index;
++ v = vertex;
+ }
+ else if (radius > 0.0f) {
+ float radius_squared = (radius == FLT_MAX) ? FLT_MAX : radius * radius;
+ float location[3];
- flip_v3_v3(location, SCULPT_vertex_co_get(ss, index), i);
++ flip_v3_v3(location, SCULPT_vertex_co_get(ss, vertex), i);
+ v = SCULPT_nearest_vertex_get(sd, ob, location, radius_squared, false);
+ }
+
- if (v != -1) {
++ if (v.i != -1) {
+ SCULPT_floodfill_add_initial(flood, v);
}
}
}
@@@ -1435,20 -1135,22 +1439,24 @@@ void SCULPT_floodfill_add_active
/* Add active vertex and symmetric vertices to the queue. */
const char symm = SCULPT_mesh_symmetry_xyz_get(ob);
for (char i = 0; i <= symm; ++i) {
- if (SCULPT_is_symmetry_iteration_valid(i, symm)) {
- SculptVertRef v = BKE_pbvh_make_vref(-1);
- if (i == 0) {
- v = SCULPT_active_vertex_get(ss);
- }
- else if (radius > 0.0f) {
- float radius_squared = (radius == FLT_MAX) ? FLT_MAX : radius * radius;
- float location[3];
- flip_v3_v3(location, SCULPT_active_vertex_co_get(ss), i);
- v = SCULPT_nearest_vertex_get(sd, ob, location, radius_squared, false);
- }
- if (v.i != -1) {
- SCULPT_floodfill_add_initial(flood, v);
- }
+ if (!SCULPT_is_symmetry_iteration_valid(i, symm)) {
+ continue;
+ }
- int v = -1;
++
++ SculptVertRef v = {-1};
++
+ if (i == 0) {
+ v = SCULPT_active_vertex_get(ss);
+ }
+ else if (radius > 0.0f) {
+ float radius_squared = (radius == FLT_MAX) ? FLT_MAX : radius * radius;
+ float location[3];
+ flip_v3_v3(location, SCULPT_active_vertex_co_get(ss), i);
+ v = SCULPT_nearest_vertex_get(sd, ob, location, radius_squared, false);
+ }
+
- if (v != -1) {
++ if (v.i != -1) {
+ SCULPT_floodfill_add_initial(flood, v);
}
}
}
@@@ -1467,16 -1166,20 +1475,21 @@@ void SCULPT_floodfill_execute(SculptSes
BLI_gsqueue_pop(flood->queue, &from_v);
SculptVertexNeighborIter ni;
SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN (ss, from_v, ni) {
- const int to_v = ni.index;
+ const SculptVertRef to_v = ni.vertex;
- const int to_v_i = ni.index;
++ const int to_index = BKE_pbvh_vertex_index_to_table(ss->pbvh, to_v);
- if (!BLI_BITMAP_TEST(flood->visited_vertices, to_v_i) &&
- SCULPT_vertex_visible_get(ss, to_v)) {
- BLI_BITMAP_ENABLE(flood->visited_vertices, to_v_i);
- if (BLI_BITMAP_TEST(flood->visited_vertices, to_v)) {
++ if (BLI_BITMAP_TEST(flood->visited_vertices, to_index)) {
+ continue;
+ }
- if (func(ss, from_v, to_v, ni.is_duplicate, userdata)) {
- BLI_gsqueue_push(flood->queue, &to_v);
- }
+ if (!SCULPT_vertex_visible_get(ss, to_v)) {
+ continue;
+ }
+
- BLI_BITMAP_ENABLE(flood->visited_vertices, to_v);
++ BLI_BITMAP_ENABLE(flood->visited_vertices, to_index);
+
+ if (func(ss, from_v, to_v, ni.is_duplicate, userdata)) {
+ BLI_gsqueue_push(flood->queue, &to_v);
}
}
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
@@@ -1800,43 -1476,45 +1813,45 @@@ static void paint_mesh_restore_co_task_
unode = SCULPT_undo_push_node(data->ob, data->nodes[n], type);
}
else {
- unode = SCULPT_undo_get_node(data->nodes[n]);
+ unode = SCULPT_undo_get_node(data->nodes[n], type);
}
- if (unode) {
- PBVHVertexIter vd;
- SculptOrigVertData orig_data;
+ if (!unode) {
+ return;
+ }
- SCULPT_orig_vert_data_unode_init(&orig_data, data->ob, unode);
+ PBVHVertexIter vd;
+ SculptOrigVertData orig_data;
- BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
- {
- SCULPT_orig_vert_data_update(&orig_data, &vd);
+ SCULPT_orig_vert_data_unode_init(&orig_data, data->ob, unode);
- if (orig_data.unode->type == SCULPT_UNDO_COORDS) {
- copy_v3_v3(vd.co, orig_data.co);
- if (vd.no) {
- copy_v3_v3_short(vd.no, orig_data.no);
- }
- else {
- normal_short_to_float_v3(vd.fno, orig_data.no);
- }
- }
- else if (orig_data.unode->type == SCULPT_UNDO_MASK) {
- *vd.mask = orig_data.mask;
- }
- else if (orig_data.unode->type == SCULPT_UNDO_COLOR) {
- copy_v4_v4(vd.col, orig_data.col);
- }
+ BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
+ SCULPT_orig_vert_data_update(&orig_data, &vd);
- if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ if (orig_data.unode->type == SCULPT_UNDO_COORDS) {
+ copy_v3_v3(vd.co, orig_data.co);
+ if (vd.no) {
+ copy_v3_v3_short(vd.no, orig_data.no);
+ }
+ else {
+ normal_short_to_float_v3(vd.fno, orig_data.no);
}
}
- BKE_pbvh_vertex_iter_end;
+ else if (orig_data.unode->type == SCULPT_UNDO_MASK) {
+ *vd.mask = orig_data.mask;
+ }
+ else if (orig_data.unode->type == SCULPT_UNDO_COLOR) {
+ copy_v4_v4(vd.col, orig_data.col);
+ }
- BKE_pbvh_node_mark_update(data->nodes[n]);
+ if (vd.mvert) {
+ vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ }
}
+ BKE_pbvh_vertex_iter_end;
+
+ BKE_pbvh_node_mark_update(data->nodes[n]);
}
static void paint_mesh_restore_co(Sculpt *sd, Object *ob)
@@@ -3235,26 -2924,27 +3267,27 @@@ static void do_topology_rake_bmesh_task
PBVHVertexIter vd;
BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
{
- if (sculpt_brush_test_sq_fn(&test, vd.co)) {
- const float fade =
- bstrength *
- SCULPT_brush_strength_factor(
- ss, brush, vd.co, sqrtf(test.dist), vd.no, vd.fno, *vd.mask, vd.vertex, thread_id) *
- ss->cache->pressure;
+ if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
+ continue;
+ }
+ const float fade =
+ bstrength *
+ SCULPT_brush_strength_factor(
- ss, brush, vd.co, sqrtf(test.dist), vd.no, vd.fno, *vd.mask, vd.index, thread_id) *
++ ss, brush, vd.co, sqrtf(test.dist), vd.no, vd.fno, *vd.mask, vd.vertex, thread_id) *
+ ss->cache->pressure;
- float
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list