[Bf-blender-cvs] [f464cac55a6] master: Cleanup: redundant update calls adding objects

Campbell Barton noreply at git.blender.org
Thu Aug 26 05:54:53 CEST 2021


Commit: f464cac55a683387ae3511c76d08c8cca0a216c1
Author: Campbell Barton
Date:   Thu Aug 26 13:53:15 2021 +1000
Branches: master
https://developer.blender.org/rBf464cac55a683387ae3511c76d08c8cca0a216c1

Cleanup: redundant update calls adding objects

These update calls are already performed by
ED_object_add_type_with_obdata.

===================================================================

M	source/blender/editors/object/object_add.c

===================================================================

diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 34400462d38..2e34284f46e 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -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;
 }



More information about the Bf-blender-cvs mailing list