[Bf-blender-cvs] [959dfc9d886] sculpt-dev: Sculpt-dev: redo last commit to be a bit better
Joseph Eagar
noreply at git.blender.org
Mon Jan 17 06:25:17 CET 2022
Commit: 959dfc9d886498cd2ba598641e4b74443416a5fd
Author: Joseph Eagar
Date: Sun Jan 16 21:23:57 2022 -0800
Branches: sculpt-dev
https://developer.blender.org/rB959dfc9d886498cd2ba598641e4b74443416a5fd
Sculpt-dev: redo last commit to be
a bit better
===================================================================
M source/blender/blenkernel/BKE_paint.h
M source/blender/blenkernel/intern/paint.c
M source/blender/editors/sculpt_paint/sculpt_brush_types.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 6243f304662..c5295f1308a 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -670,6 +670,7 @@ typedef struct SculptCustomLayer {
bool from_bmesh; // note that layers can be fixed arrays but still from a bmesh, e.g. filter
// laplacian smooth
bool released;
+ bool ready;
} SculptCustomLayer;
/* These custom attributes have references
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 98b31337501..de222892fb8 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -3095,6 +3095,7 @@ static bool sculpt_attr_get_layer(SculptSession *ss,
out->domain = domain;
out->proptype = proptype;
out->elemsize = elemsize;
+ out->ready = true;
/*grids cannot store normal customdata layers, and thus
we cannot rely on the customdata api to keep track of
@@ -3130,6 +3131,7 @@ static bool sculpt_attr_get_layer(SculptSession *ss,
out->from_bmesh = true;
if (!ss->bm) {
+ out->ready = false;
return false;
}
@@ -3141,6 +3143,7 @@ static bool sculpt_attr_get_layer(SculptSession *ss,
cdata = &ss->bm->pdata;
break;
default:
+ out->ready = false;
return false;
}
@@ -3148,6 +3151,7 @@ static bool sculpt_attr_get_layer(SculptSession *ss,
if (idx < 0) {
if (!autocreate) {
+ out->ready = false;
return false;
}
@@ -3192,6 +3196,7 @@ static bool sculpt_attr_get_layer(SculptSession *ss,
cdata = ss->pdata;
break;
default:
+ out->ready = false;
return false;
}
@@ -3199,6 +3204,7 @@ static bool sculpt_attr_get_layer(SculptSession *ss,
if (idx < 0) {
if (!autocreate) {
+ out->ready = false;
return false;
}
@@ -3234,6 +3240,7 @@ static bool sculpt_attr_get_layer(SculptSession *ss,
totelem = ss->totfaces;
cdata = &ss->temp_pdata;
default:
+ out->ready = false;
return false;
}
@@ -3241,6 +3248,7 @@ static bool sculpt_attr_get_layer(SculptSession *ss,
if (idx < 0) {
if (!autocreate) {
+ out->ready = false;
return false;
}
@@ -3270,6 +3278,8 @@ static bool sculpt_attr_get_layer(SculptSession *ss,
}
}
+ out->ready = true;
+
return true;
}
@@ -3316,7 +3326,11 @@ void BKE_sculptsession_update_attr_refs(Object *ob)
for (int j = 0; j < SCULPT_SCL_LAYER_MAX; j++) {
SculptCustomLayer *scl = ss->custom_layers[j];
- if (scl && !scl->released && !scl->params.simple_array) {
+ if (!scl || !scl->ready) {
+ continue;
+ }
+
+ if (!scl->released && !scl->params.simple_array) {
sculpt_attr_get_layer(
ss, ob, scl->domain, scl->proptype, scl->name, scl, true, &scl->params);
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_brush_types.c b/source/blender/editors/sculpt_paint/sculpt_brush_types.c
index 2e1fe3af290..d8d6efd86f7 100644
--- a/source/blender/editors/sculpt_paint/sculpt_brush_types.c
+++ b/source/blender/editors/sculpt_paint/sculpt_brush_types.c
@@ -3486,6 +3486,10 @@ void SCULPT_do_fairing_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
ss->custom_layers[SCULPT_SCL_FAIRING_MASK] = MEM_callocN(sizeof(SculptCustomLayer),
"ss->Cache->fairing_mask");
+ ss->custom_layers[SCULPT_SCL_FAIRING_FADE] = MEM_callocN(sizeof(SculptCustomLayer),
+ "ss->Cache->fairing_fade");
+ ss->custom_layers[SCULPT_SCL_PREFAIRING_CO] = MEM_callocN(sizeof(SculptCustomLayer),
+ "ss->Cache->prefairing_co");
SculptLayerParams params = {.permanent = false, .simple_array = true};
@@ -3497,8 +3501,6 @@ void SCULPT_do_fairing_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
ss->custom_layers[SCULPT_SCL_FAIRING_MASK],
¶ms);
- ss->custom_layers[SCULPT_SCL_FAIRING_FADE] = MEM_callocN(sizeof(SculptCustomLayer),
- "ss->Cache->fairing_fade");
SCULPT_attr_get_layer(ss,
ob,
ATTR_DOMAIN_POINT,
@@ -3507,8 +3509,6 @@ void SCULPT_do_fairing_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
ss->custom_layers[SCULPT_SCL_FAIRING_FADE],
¶ms);
- ss->custom_layers[SCULPT_SCL_PREFAIRING_CO] = MEM_callocN(sizeof(SculptCustomLayer),
- "ss->Cache->prefairing_co");
SCULPT_attr_get_layer(ss,
ob,
ATTR_DOMAIN_POINT,
More information about the Bf-blender-cvs
mailing list