Commit: c350d1eb1387e763ca156f065305a0bce666ceb9
Author: Campbell Barton
Date:   Mon Sep 7 14:09:50 2020 +1000
Branches: master
https://developer.blender.org/rBc350d1eb1387e763ca156f065305a0bce666ceb9

Cleanup: remove redundant scene argument in BKE_object_add

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

M       source/blender/blenkernel/BKE_object.h
M       source/blender/blenkernel/intern/object.c
M       source/blender/editors/curve/editfont.c
M       source/blender/editors/include/ED_object.h
M       source/blender/editors/object/object_add.c
M       source/blender/editors/object/object_constraint.c
M       source/blender/editors/object/object_hook.c
M       source/blender/editors/object/object_modifier.c
M       
source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp

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

diff --git a/source/blender/blenkernel/BKE_object.h 
b/source/blender/blenkernel/BKE_object.h
index ca548e21a85..143955e4930 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -112,10 +112,9 @@ int BKE_object_visibility(const struct Object *ob, const 
int dag_eval_mode);
 struct Object *BKE_object_add_only_object(struct Main *bmain, int type, const 
char *name)
     ATTR_NONNULL(1) ATTR_RETURNS_NONNULL;
 struct Object *BKE_object_add(struct Main *bmain,
-                              struct Scene *scene,
                               struct ViewLayer *view_layer,
                               int type,
-                              const char *name) ATTR_NONNULL(1, 2, 3) 
ATTR_RETURNS_NONNULL;
+                              const char *name) ATTR_NONNULL(1, 2) 
ATTR_RETURNS_NONNULL;
 struct Object *BKE_object_add_from(struct Main *bmain,
                                    struct Scene *scene,
                                    struct ViewLayer *view_layer,
diff --git a/source/blender/blenkernel/intern/object.c 
b/source/blender/blenkernel/intern/object.c
index 1fcc10f13a9..5afad6a294b 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1352,8 +1352,7 @@ static Object *object_add_common(Main *bmain, ViewLayer 
*view_layer, int type, c
  * If there is no linked collection to the active ViewLayer we create a new 
one.
  */
 /* creates minimum required data, but without vertices etc. */
-Object *BKE_object_add(
-    Main *bmain, Scene *UNUSED(scene), ViewLayer *view_layer, int type, const 
char *name)
+Object *BKE_object_add(Main *bmain, ViewLayer *view_layer, int type, const 
char *name)
 {
   Object *ob;
   Base *base;
diff --git a/source/blender/editors/curve/editfont.c 
b/source/blender/editors/curve/editfont.c
index 4147bb190e2..551916ec57d 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -650,7 +650,7 @@ static void txt_add_object(bContext *C, TextLine 
*firstline, int totline, const
   int a;
   const float rot[3] = {0.f, 0.f, 0.f};
 
-  obedit = BKE_object_add(bmain, scene, view_layer, OB_FONT, NULL);
+  obedit = BKE_object_add(bmain, view_layer, OB_FONT, NULL);
   base = view_layer->basact;
 
   /* seems to assume view align ? TODO - look into this, could be an operator 
option */
diff --git a/source/blender/editors/include/ED_object.h 
b/source/blender/editors/include/ED_object.h
index ed5cbd43cb3..8aa9cd8184b 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -397,7 +397,6 @@ bool ED_object_modifier_move_to_index(struct ReportList 
*reports,
 bool ED_object_modifier_convert(struct ReportList *reports,
                                 struct Main *bmain,
                                 struct Depsgraph *depsgraph,
-                                struct Scene *scene,
                                 struct ViewLayer *view_layer,
                                 struct Object *ob,
                                 struct ModifierData *md);
diff --git a/source/blender/editors/object/object_add.c 
b/source/blender/editors/object/object_add.c
index 2d7f903ccd0..59c784658e8 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -544,7 +544,7 @@ Object *ED_object_add_type_with_obdata(bContext *C,
     }
   }
   else {
-    ob = BKE_object_add(bmain, scene, view_layer, type, name);
+    ob = BKE_object_add(bmain, view_layer, type, name);
   }
   BASACT(view_layer)->local_view_bits = local_view_bits;
   /* editor level activate, notifiers */
diff --git a/source/blender/editors/object/object_constraint.c 
b/source/blender/editors/object/object_constraint.c
index bdd5094a9ef..2cca3045aee 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -1970,13 +1970,12 @@ static bool get_new_constraint_target(
   /* if still not found, add a new empty to act as a target (if allowed) */
   if ((found == false) && (add)) {
     Main *bmain = CTX_data_main(C);
-    Scene *scene = CTX_data_scene(C);
     ViewLayer *view_layer = CTX_data_view_layer(C);
     Base *base = BASACT(view_layer);
     Object *obt;
 
     /* add new target object */
-    obt = BKE_object_add(bmain, scene, view_layer, OB_EMPTY, NULL);
+    obt = BKE_object_add(bmain, view_layer, OB_EMPTY, NULL);
 
     /* transform cent to global coords for loc */
     if (pchanact) {
diff --git a/source/blender/editors/object/object_hook.c 
b/source/blender/editors/object/object_hook.c
index aaf76ff649e..5cfe02dbc59 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -496,13 +496,12 @@ static bool hook_op_edit_poll(bContext *C)
   return false;
 }
 
-static Object *add_hook_object_new(
-    Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, Object 
*obedit)
+static Object *add_hook_object_new(Main *bmain, ViewLayer *view_layer, View3D 
*v3d, Object *obedit)
 {
   Base *basedit;
   Object *ob;
 
-  ob = BKE_object_add(bmain, scene, view_layer, OB_EMPTY, NULL);
+  ob = BKE_object_add(bmain, view_layer, OB_EMPTY, NULL);
 
   basedit = BKE_view_layer_base_find(view_layer, obedit);
   BLI_assert(view_layer->basact->object == ob);
@@ -545,7 +544,7 @@ static int add_hook_object(const bContext *C,
 
   if (mode == OBJECT_ADDHOOK_NEWOB && !ob) {
 
-    ob = add_hook_object_new(bmain, scene, view_layer, v3d, obedit);
+    ob = add_hook_object_new(bmain, view_layer, v3d, obedit);
 
     /* transform cent to global coords for loc */
     mul_v3_m4v3(ob->loc, obedit->obmat, cent);
diff --git a/source/blender/editors/object/object_modifier.c 
b/source/blender/editors/object/object_modifier.c
index 692a445fe9c..74d6a48c4bf 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -516,7 +516,6 @@ bool ED_object_modifier_move_to_index(ReportList *reports,
 bool ED_object_modifier_convert(ReportList *UNUSED(reports),
                                 Main *bmain,
                                 Depsgraph *depsgraph,
-                                Scene *scene,
                                 ViewLayer *view_layer,
                                 Object *ob,
                                 ModifierData *md)
@@ -583,7 +582,7 @@ bool ED_object_modifier_convert(ReportList *UNUSED(reports),
   }
 
   /* add new mesh */
-  obn = BKE_object_add(bmain, scene, view_layer, OB_MESH, NULL);
+  obn = BKE_object_add(bmain, view_layer, OB_MESH, NULL);
   me = obn->data;
 
   me->totvert = totvert;
@@ -642,7 +641,6 @@ bool ED_object_modifier_convert(ReportList *UNUSED(reports),
 
 /* Gets mesh for the modifier which corresponds to an evaluated state. */
 static Mesh *modifier_apply_create_mesh_for_modifier(Depsgraph *depsgraph,
-                                                     Scene *UNUSED(scene),
                                                      Object *object,
                                                      ModifierData *md_eval,
                                                      bool 
build_shapekey_layers)
@@ -690,7 +688,7 @@ static int modifier_apply_shape(Main *bmain,
       return 0;
     }
 
-    mesh_applied = modifier_apply_create_mesh_for_modifier(depsgraph, scene, 
ob, md_eval, false);
+    mesh_applied = modifier_apply_create_mesh_for_modifier(depsgraph, ob, 
md_eval, false);
     if (!mesh_applied) {
       BKE_report(reports, RPT_ERROR, "Modifier is disabled or returned error, 
skipping apply");
       return 0;
@@ -750,7 +748,7 @@ static int modifier_apply_obdata(
       }
     }
     else {
-      mesh_applied = modifier_apply_create_mesh_for_modifier(depsgraph, scene, 
ob, md_eval, true);
+      mesh_applied = modifier_apply_create_mesh_for_modifier(depsgraph, ob, 
md_eval, true);
       if (!mesh_applied) {
         BKE_report(reports, RPT_ERROR, "Modifier returned error, skipping 
apply");
         return 0;
@@ -1509,13 +1507,11 @@ static int modifier_convert_exec(bContext *C, 
wmOperator *op)
 {
   Main *bmain = CTX_data_main(C);
   Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
-  Scene *scene = CTX_data_scene(C);
   ViewLayer *view_layer = CTX_data_view_layer(C);
   Object *ob = ED_object_active_context(C);
   ModifierData *md = edit_modifier_property_get(op, ob, 0);
 
-  if (!md ||
-      !ED_object_modifier_convert(op->reports, bmain, depsgraph, scene, 
view_layer, ob, md)) {
+  if (!md || !ED_object_modifier_convert(op->reports, bmain, depsgraph, 
view_layer, ob, md)) {
     return OPERATOR_CANCELLED;
   }
 
@@ -2336,10 +2332,7 @@ static void skin_armature_bone_create(Object *skin_ob,
   }
 }
 
-static Object *modifier_skin_armature_create(Depsgraph *depsgraph,
-                                             Main *bmain,
-                                             Scene *scene,
-                                             Object *skin_ob)
+static Object *modifier_skin_armature_create(Depsgraph *depsgraph, Main 
*bmain, Object *skin_ob)
 {
   BLI_bitmap *edges_visited;
   Mesh *me_eval_deform;
@@ -2362,7 +2355,7 @@ static Object *modifier_skin_armature_create(Depsgraph 
*depsgraph,
   CustomData_add_layer(&me->vdata, CD_MDEFORMVERT, CD_CALLOC, NULL, 
me->totvert);
 
   ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
-  arm_ob = BKE_object_add(bmain, scene, view_layer, OB_ARMATURE, NULL);
+  arm_ob = BKE_object_add(bmain, view_layer, OB_ARMATURE, NULL);
   BKE_object_transform_copy(arm_ob, skin_ob);
   arm = arm_ob->data;
   arm->layer = 1;
@@ -2414,7 +2407,6 @@ static int skin_armature_create_exec(bContext *C, 
wmOperator *op)
 {
   Main *bmain = CTX_data_main(C);
   Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
-  Scene *scene = CTX_data_scene(C);
   Object *ob = CTX_data_active_object(C), *arm_ob;
   Mesh *me = ob->data;
   ModifierData *skin_md;
@@ -2426,7 +2418,7 @@ static int skin_armature_create_exec(bContext *C, 
wmOperator *op)
   }
 
   /* create new armature */
-  arm_ob = modifier_skin_armature_create(depsgraph, bmain, scene, ob);
+  arm_ob = modifier_skin_armature_create(depsgraph, bmain, ob);
 
   /* add a

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to