Fix paint initialization, incorrect pointer checks
This commit is contained in:
parent
6e24dd9a1e
commit
a740cc53ea
Notes:
blender-bot
2023-02-14 10:54:29 +01:00
Referenced by issue #58126, Blender 2.8 crash when switch to sculpting Referenced by issue #58112, Error loading file ( rigid body / soft body / hair dynamics )
|
@ -664,11 +664,13 @@ bool BKE_paint_ensure(const ToolSettings *ts, struct Paint **r_paint)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (ELEM(*r_paint, &ts->vpaint->paint, &ts->wpaint->paint)) {
|
||||
if (((VPaint **)r_paint == &ts->vpaint) ||
|
||||
((VPaint **)r_paint == &ts->wpaint))
|
||||
{
|
||||
VPaint *data = MEM_callocN(sizeof(*data), __func__);
|
||||
paint = &data->paint;
|
||||
}
|
||||
else if (*r_paint == &ts->sculpt->paint) {
|
||||
else if ((Sculpt **)r_paint == &ts->sculpt) {
|
||||
Sculpt *data = MEM_callocN(sizeof(*data), __func__);
|
||||
paint = &data->paint;
|
||||
|
||||
|
@ -678,11 +680,11 @@ bool BKE_paint_ensure(const ToolSettings *ts, struct Paint **r_paint)
|
|||
/* Make sure at least dyntopo subdivision is enabled */
|
||||
data->flags |= SCULPT_DYNTOPO_SUBDIVIDE | SCULPT_DYNTOPO_COLLAPSE;
|
||||
}
|
||||
else if (*r_paint == &ts->gp_paint->paint) {
|
||||
else if ((GpPaint **)r_paint == &ts->gp_paint) {
|
||||
GpPaint *data = MEM_callocN(sizeof(*data), __func__);
|
||||
paint = &data->paint;
|
||||
}
|
||||
else if (*r_paint == &ts->uvsculpt->paint) {
|
||||
else if ((UvSculpt **)r_paint == &ts->uvsculpt) {
|
||||
UvSculpt *data = MEM_callocN(sizeof(*data), __func__);
|
||||
paint = &data->paint;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue