Fix several undefined-behaviour-sanitizer warnings
Reviewers: brecht Reviewed By: brecht Differential Revision: https://developer.blender.org/D4222
This commit is contained in:
parent
77d7cc9ba7
commit
ea3690e329
|
@ -67,11 +67,16 @@ void BKE_paint_toolslots_init_from_main(struct Main *bmain)
|
|||
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
paint_toolslots_init(bmain, &ts->imapaint.paint);
|
||||
paint_toolslots_init(bmain, &ts->sculpt->paint);
|
||||
paint_toolslots_init(bmain, &ts->vpaint->paint);
|
||||
paint_toolslots_init(bmain, &ts->wpaint->paint);
|
||||
paint_toolslots_init(bmain, &ts->uvsculpt->paint);
|
||||
paint_toolslots_init(bmain, &ts->gp_paint->paint);
|
||||
if (ts->sculpt)
|
||||
paint_toolslots_init(bmain, &ts->sculpt->paint);
|
||||
if (ts->vpaint)
|
||||
paint_toolslots_init(bmain, &ts->vpaint->paint);
|
||||
if (ts->wpaint)
|
||||
paint_toolslots_init(bmain, &ts->wpaint->paint);
|
||||
if (ts->uvsculpt)
|
||||
paint_toolslots_init(bmain, &ts->uvsculpt->paint);
|
||||
if (ts->gp_paint)
|
||||
paint_toolslots_init(bmain, &ts->gp_paint->paint);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6413,12 +6413,17 @@ static void lib_link_scene(FileData *fd, Main *main)
|
|||
sce->set = newlibadr(fd, sce->id.lib, sce->set);
|
||||
sce->gpd = newlibadr_us(fd, sce->id.lib, sce->gpd);
|
||||
|
||||
link_paint(fd, sce, &sce->toolsettings->sculpt->paint);
|
||||
link_paint(fd, sce, &sce->toolsettings->vpaint->paint);
|
||||
link_paint(fd, sce, &sce->toolsettings->wpaint->paint);
|
||||
link_paint(fd, sce, &sce->toolsettings->imapaint.paint);
|
||||
link_paint(fd, sce, &sce->toolsettings->uvsculpt->paint);
|
||||
link_paint(fd, sce, &sce->toolsettings->gp_paint->paint);
|
||||
if (sce->toolsettings->sculpt)
|
||||
link_paint(fd, sce, &sce->toolsettings->sculpt->paint);
|
||||
if (sce->toolsettings->vpaint)
|
||||
link_paint(fd, sce, &sce->toolsettings->vpaint->paint);
|
||||
if (sce->toolsettings->wpaint)
|
||||
link_paint(fd, sce, &sce->toolsettings->wpaint->paint);
|
||||
if (sce->toolsettings->uvsculpt)
|
||||
link_paint(fd, sce, &sce->toolsettings->uvsculpt->paint);
|
||||
if (sce->toolsettings->gp_paint)
|
||||
link_paint(fd, sce, &sce->toolsettings->gp_paint->paint);
|
||||
|
||||
if (sce->toolsettings->sculpt) {
|
||||
sce->toolsettings->sculpt->gravity_object = newlibadr(
|
||||
|
|
|
@ -325,25 +325,31 @@ void deg_graph_id_tag_legacy_compat(
|
|||
* tagging here. */
|
||||
case ID_ME: {
|
||||
Mesh *mesh = (Mesh *)id;
|
||||
ID *key_id = &mesh->key->id;
|
||||
if (key_id != NULL) {
|
||||
graph_id_tag_update(bmain, depsgraph, key_id, 0, update_source);
|
||||
if (mesh->key != NULL) {
|
||||
ID *key_id = &mesh->key->id;
|
||||
if (key_id != NULL) {
|
||||
graph_id_tag_update(bmain, depsgraph, key_id, 0, update_source);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ID_LT: {
|
||||
Lattice *lattice = (Lattice *)id;
|
||||
ID *key_id = &lattice->key->id;
|
||||
if (key_id != NULL) {
|
||||
graph_id_tag_update(bmain, depsgraph, key_id, 0, update_source);
|
||||
if (lattice->key != NULL) {
|
||||
ID *key_id = &lattice->key->id;
|
||||
if (key_id != NULL) {
|
||||
graph_id_tag_update(bmain, depsgraph, key_id, 0, update_source);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ID_CU: {
|
||||
Curve *curve = (Curve *)id;
|
||||
ID *key_id = &curve->key->id;
|
||||
if (key_id != NULL) {
|
||||
graph_id_tag_update(bmain, depsgraph, key_id, 0, update_source);
|
||||
if (curve->key != NULL) {
|
||||
ID *key_id = &curve->key->id;
|
||||
if (key_id != NULL) {
|
||||
graph_id_tag_update(bmain, depsgraph, key_id, 0, update_source);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -81,9 +81,15 @@ static bool gp_stroke_paintmode_poll_with_tool(bContext *C, const char gpencil_t
|
|||
{
|
||||
/* TODO: limit this to mode, but review 2D editors */
|
||||
bGPdata *gpd = CTX_data_gpencil_data(C);
|
||||
if (!gpd)
|
||||
return false;
|
||||
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
if (!ts || !ts->gp_paint)
|
||||
return false;
|
||||
|
||||
Brush *brush = BKE_paint_brush(&ts->gp_paint->paint);
|
||||
return ((gpd) && (gpd->flag & GP_DATA_STROKE_PAINTMODE) && (brush && brush->gpencil_settings) &&
|
||||
return ((gpd->flag & GP_DATA_STROKE_PAINTMODE) && (brush && brush->gpencil_settings) &&
|
||||
WM_toolsystem_active_tool_is_brush(C) && (brush->gpencil_tool == gpencil_tool));
|
||||
}
|
||||
|
||||
|
|
|
@ -254,7 +254,8 @@ static int text_context(const bContext *C, const char *member, bContextDataResul
|
|||
return 1;
|
||||
}
|
||||
else if (CTX_data_equals(member, "edit_text")) {
|
||||
CTX_data_id_pointer_set(result, &st->text->id);
|
||||
if (st->text)
|
||||
CTX_data_id_pointer_set(result, &st->text->id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue