Cleanup: redundant update calls adding objects

These update calls are already performed by
ED_object_add_type_with_obdata.
This commit is contained in:
Campbell Barton 2021-08-26 13:53:15 +10:00
parent 2fb57685e3
commit f464cac55a

@ -766,8 +766,6 @@ static int lightprobe_add_exec(bContext *C, wmOperator *op)
BKE_lightprobe_type_set(probe, type);
DEG_relations_tag_update(CTX_data_main(C));
return OPERATOR_FINISHED;
}
@ -884,8 +882,6 @@ static int effector_add_exec(bContext *C, wmOperator *op)
ob->pd = BKE_partdeflect_new(type);
DEG_relations_tag_update(CTX_data_main(C));
return OPERATOR_FINISHED;
}
@ -1015,8 +1011,10 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op)
if (newob && !enter_editmode) {
ED_object_editmode_exit_ex(bmain, scene, obedit, EM_FREEDATA);
}
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
else {
/* Only needed in edit-mode (#ED_object_add_type normally handles this). */
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
}
return OPERATOR_FINISHED;
}
@ -1067,8 +1065,6 @@ static int object_add_text_exec(bContext *C, wmOperator *op)
obedit = ED_object_add_type(C, OB_FONT, NULL, loc, rot, enter_editmode, local_view_bits);
BKE_object_obdata_size_init(obedit, RNA_float_get(op->ptr, "radius"));
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
return OPERATOR_FINISHED;
}
@ -1138,8 +1134,6 @@ static int object_armature_add_exec(bContext *C, wmOperator *op)
ED_object_editmode_exit_ex(bmain, scene, obedit, EM_FREEDATA);
}
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
return OPERATOR_FINISHED;
}
@ -1670,7 +1664,6 @@ static int collection_instance_add_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
/* Avoid dependency cycles. */
@ -1686,12 +1679,6 @@ static int collection_instance_add_exec(bContext *C, wmOperator *op)
ob->transflag |= OB_DUPLICOLLECTION;
id_us_plus(&collection->id);
/* works without this except if you try render right after, see: 22027 */
DEG_relations_tag_update(bmain);
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
return OPERATOR_FINISHED;
}
@ -1784,17 +1771,9 @@ static int object_data_instance_add_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
Scene *scene = CTX_data_scene(C);
ED_object_add_type_with_obdata(
C, object_type, id->name + 2, loc, rot, false, local_view_bits, id);
/* Works without this except if you try render right after, see: T22027. */
DEG_relations_tag_update(bmain);
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
return OPERATOR_FINISHED;
}