Merge branch 'master' into blender2.8
[blender.git] / source / blender / editors / object / object_add.c
index d9ba12d..d75d5de 100644 (file)
@@ -82,6 +82,7 @@
 #include "BKE_material.h"
 #include "BKE_mball.h"
 #include "BKE_mesh.h"
+#include "BKE_mesh_runtime.h"
 #include "BKE_nla.h"
 #include "BKE_object.h"
 #include "BKE_particle.h"
@@ -1055,13 +1056,13 @@ static int collection_instance_add_exec(bContext *C, wmOperator *op)
        Collection *collection;
        unsigned int layer;
        float loc[3], rot[3];
-       
+
        if (RNA_struct_property_is_set(op->ptr, "name")) {
                char name[MAX_ID_NAME - 2];
-               
+
                RNA_string_get(op->ptr, "name", name);
                collection = (Collection *)BKE_libblock_find_name(bmain, ID_GR, name);
-               
+
                if (0 == RNA_struct_property_is_set(op->ptr, "location")) {
                        const wmEvent *event = CTX_wm_window(C)->eventstate;
                        ARegion *ar = CTX_wm_region(C);
@@ -1216,7 +1217,7 @@ static int object_delete_exec(bContext *C, wmOperator *op)
        const bool use_global = RNA_boolean_get(op->ptr, "use_global");
        bool changed = false;
 
-       if (CTX_data_edit_object(C)) 
+       if (CTX_data_edit_object(C))
                return OPERATOR_CANCELLED;
 
        CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
@@ -1290,7 +1291,7 @@ static int object_delete_exec(bContext *C, wmOperator *op)
 
                if (scene->id.tag & LIB_TAG_DOIT) {
                        scene->id.tag &= ~LIB_TAG_DOIT;
-                       
+
                        DEG_relations_tag_update(bmain);
 
                        WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
@@ -1634,10 +1635,10 @@ static void convert_ensure_curve_cache(Depsgraph *depsgraph, Scene *scene, Objec
        }
 }
 
-static void curvetomesh(Depsgraph *depsgraph, Scene *scene, Object *ob)
+static void curvetomesh(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
 {
        convert_ensure_curve_cache(depsgraph, scene, ob);
-       BKE_mesh_from_nurbs(ob); /* also does users */
+       BKE_mesh_from_nurbs(bmain, ob); /* also does users */
 
        if (ob->type == OB_MESH) {
                BKE_object_free_modifiers(ob, 0);
@@ -1784,7 +1785,7 @@ static int convert_exec(bContext *C, wmOperator *op)
                                newob = ob;
                        }
 
-                       BKE_mesh_to_curve(depsgraph, scene, newob);
+                       BKE_mesh_to_curve(bmain, depsgraph, scene, newob);
 
                        if (newob->type == OB_CURVE) {
                                BKE_object_free_modifiers(newob, 0);   /* after derivedmesh calls! */
@@ -1845,7 +1846,7 @@ static int convert_exec(bContext *C, wmOperator *op)
                         *               datablock, but for until we've got granular update
                         *               lets take care by selves.
                         */
-                       BKE_vfont_to_curve(bmain, newob, FO_EDIT);
+                       BKE_vfont_to_curve(newob, FO_EDIT);
 
                        newob->type = OB_CURVE;
                        cu->type = OB_CURVE;
@@ -1886,7 +1887,7 @@ static int convert_exec(bContext *C, wmOperator *op)
                        BKE_curve_curve_dimension_update(cu);
 
                        if (target == OB_MESH) {
-                               curvetomesh(depsgraph, scene, newob);
+                               curvetomesh(bmain, depsgraph, scene, newob);
 
                                /* meshes doesn't use displist */
                                BKE_object_free_curve_cache(newob);
@@ -1910,7 +1911,7 @@ static int convert_exec(bContext *C, wmOperator *op)
                                        newob = ob;
                                }
 
-                               curvetomesh(depsgraph, scene, newob);
+                               curvetomesh(bmain, depsgraph, scene, newob);
 
                                /* meshes doesn't use displist */
                                BKE_object_free_curve_cache(newob);
@@ -2046,7 +2047,7 @@ void OBJECT_OT_convert(wmOperatorType *ot)
 
 /**************************** Duplicate ************************/
 
-/* 
+/*
  * dupflag: a flag made from constants declared in DNA_userdef_types.h
  * The flag tells adduplicate() whether to copy data linked to the object, or to reference the existing data.
  * U.dupflag for default operations or you can construct a flag as python does
@@ -2097,7 +2098,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer
 
                /* duplicates using userflags */
                if (dupflag & USER_DUP_ACT) {
-                       BKE_animdata_copy_id_action(&obn->id, true);
+                       BKE_animdata_copy_id_action(bmain, &obn->id, true);
                }
 
                if (dupflag & USER_DUP_MAT) {
@@ -2111,7 +2112,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer
                                        id_us_min(id);
 
                                        if (dupflag & USER_DUP_ACT) {
-                                               BKE_animdata_copy_id_action(&obn->mat[a]->id, true);
+                                               BKE_animdata_copy_id_action(bmain, &obn->mat[a]->id, true);
                                        }
                                }
                        }
@@ -2127,7 +2128,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer
                                        }
 
                                        if (dupflag & USER_DUP_ACT) {
-                                               BKE_animdata_copy_id_action(&psys->part->id, true);
+                                               BKE_animdata_copy_id_action(bmain, &psys->part->id, true);
                                        }
 
                                        id_us_min(id);
@@ -2255,9 +2256,9 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer
                        }
 
                        if (dupflag & USER_DUP_ACT) {
-                               BKE_animdata_copy_id_action((ID *)obn->data, true);
+                               BKE_animdata_copy_id_action(bmain, (ID *)obn->data, true);
                                if (key) {
-                                       BKE_animdata_copy_id_action((ID *)key, true);
+                                       BKE_animdata_copy_id_action(bmain, (ID *)key, true);
                                }
                        }
 
@@ -2424,7 +2425,7 @@ static int add_named_exec(bContext *C, wmOperator *op)
                ED_object_location_from_view(C, basen->object->loc);
                ED_view3d_cursor3d_position(C, basen->object->loc, mval);
        }
-       
+
        ED_object_base_select(basen, BA_SELECT);
        ED_object_base_activate(C, basen);