diff options
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_add.c | 18 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 31 |
2 files changed, 26 insertions, 23 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 55acc8a567d..96f13578513 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -2099,7 +2099,8 @@ static void make_object_duplilist_real(bContext *C, for (dob = lb_duplis->first; dob; dob = dob->next) { Object *ob_src = DEG_get_original_object(dob->ob); - Object *ob_dst = ID_NEW_SET(ob_src, BKE_object_copy(bmain, ob_src)); + Object *ob_dst = ID_NEW_SET(ob_src, BKE_id_copy(bmain, &ob_src->id)); + id_us_min(&ob_dst->id); Base *base_dst; /* font duplis can have a totcol without material, we get them from parent @@ -2431,7 +2432,8 @@ static Base *duplibase_for_convert( ob = base->object; } - obn = BKE_object_copy(bmain, ob); + obn = (Object *)BKE_id_copy(bmain, &ob->id); + id_us_min(&obn->id); DEG_id_tag_update(&obn->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION); BKE_collection_object_add_from(bmain, scene, ob, obn); @@ -2595,7 +2597,7 @@ static int object_convert_exec(bContext *C, wmOperator *op) id_us_min(&me->id); /* make a new copy of the mesh */ - newob->data = BKE_mesh_copy(bmain, me); + newob->data = BKE_id_copy(bmain, &me->id); } else { newob = ob; @@ -2669,7 +2671,7 @@ static int object_convert_exec(bContext *C, wmOperator *op) id_us_min(&me->id); /* make a new copy of the mesh */ - newob->data = BKE_mesh_copy(bmain, me); + newob->data = BKE_id_copy(bmain, &me->id); } else { newob = ob; @@ -2694,7 +2696,7 @@ static int object_convert_exec(bContext *C, wmOperator *op) id_us_min(&me->id); /* make a new copy of the mesh */ - newob->data = BKE_mesh_copy(bmain, me); + newob->data = BKE_id_copy(bmain, &me->id); } else { newob = ob; @@ -2723,7 +2725,7 @@ static int object_convert_exec(bContext *C, wmOperator *op) id_us_min(&((Curve *)newob->data)->id); /* make a new copy of the curve */ - newob->data = BKE_curve_copy(bmain, ob->data); + newob->data = BKE_id_copy(bmain, ob->data); } else { newob = ob; @@ -2794,7 +2796,7 @@ static int object_convert_exec(bContext *C, wmOperator *op) id_us_min(&((Curve *)newob->data)->id); /* make a new copy of the curve */ - newob->data = BKE_curve_copy(bmain, ob->data); + newob->data = BKE_id_copy(bmain, ob->data); } else { newob = ob; @@ -2879,7 +2881,7 @@ static int object_convert_exec(bContext *C, wmOperator *op) id_us_min(&pointcloud->id); /* make a new copy of the pointcloud */ - newob->data = BKE_pointcloud_copy(bmain, pointcloud); + newob->data = BKE_id_copy(bmain, &pointcloud->id); } else { newob = ob; diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 1cc762dfb65..80b521b2af3 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1830,7 +1830,8 @@ static Collection *single_object_users_collection(Main *bmain, /* an object may be in more than one collection */ if ((ob->id.newid == NULL) && ((ob->flag & flag) == flag)) { if (!ID_IS_LINKED(ob) && BKE_object_scenes_users_get(bmain, ob) > 1) { - ID_NEW_SET(ob, BKE_object_copy(bmain, ob)); + ID_NEW_SET(ob, BKE_id_copy(bmain, &ob->id)); + id_us_min(ob->id.newid); } } } @@ -1922,26 +1923,26 @@ static void single_obdata_users( switch (ob->type) { case OB_LAMP: - ob->data = la = ID_NEW_SET(ob->data, BKE_light_copy(bmain, ob->data)); + ob->data = la = ID_NEW_SET(ob->data, BKE_id_copy(bmain, ob->data)); break; case OB_CAMERA: - cam = ob->data = ID_NEW_SET(ob->data, BKE_camera_copy(bmain, ob->data)); + cam = ob->data = ID_NEW_SET(ob->data, BKE_id_copy(bmain, ob->data)); ID_NEW_REMAP(cam->dof.focus_object); break; case OB_MESH: /* Needed to remap texcomesh below. */ - me = ob->data = ID_NEW_SET(ob->data, BKE_mesh_copy(bmain, ob->data)); + me = ob->data = ID_NEW_SET(ob->data, BKE_id_copy(bmain, ob->data)); if (me->key) { /* We do not need to set me->key->id.newid here... */ BKE_animdata_copy_id_action(bmain, (ID *)me->key); } break; case OB_MBALL: - ob->data = ID_NEW_SET(ob->data, BKE_mball_copy(bmain, ob->data)); + ob->data = ID_NEW_SET(ob->data, BKE_id_copy(bmain, ob->data)); break; case OB_CURVE: case OB_SURF: case OB_FONT: - ob->data = cu = ID_NEW_SET(ob->data, BKE_curve_copy(bmain, ob->data)); + ob->data = cu = ID_NEW_SET(ob->data, BKE_id_copy(bmain, ob->data)); ID_NEW_REMAP(cu->bevobj); ID_NEW_REMAP(cu->taperobj); if (cu->key) { /* We do not need to set cu->key->id.newid here... */ @@ -1949,33 +1950,33 @@ static void single_obdata_users( } break; case OB_LATTICE: - ob->data = lat = ID_NEW_SET(ob->data, BKE_lattice_copy(bmain, ob->data)); + ob->data = lat = ID_NEW_SET(ob->data, BKE_id_copy(bmain, ob->data)); if (lat->key) { /* We do not need to set lat->key->id.newid here... */ BKE_animdata_copy_id_action(bmain, (ID *)lat->key); } break; case OB_ARMATURE: DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); - ob->data = ID_NEW_SET(ob->data, BKE_armature_copy(bmain, ob->data)); + ob->data = ID_NEW_SET(ob->data, BKE_id_copy(bmain, ob->data)); BKE_pose_rebuild(bmain, ob, ob->data, true); break; case OB_SPEAKER: - ob->data = ID_NEW_SET(ob->data, BKE_speaker_copy(bmain, ob->data)); + ob->data = ID_NEW_SET(ob->data, BKE_id_copy(bmain, ob->data)); break; case OB_LIGHTPROBE: - ob->data = ID_NEW_SET(ob->data, BKE_lightprobe_copy(bmain, ob->data)); + ob->data = ID_NEW_SET(ob->data, BKE_id_copy(bmain, ob->data)); break; case OB_GPENCIL: - ob->data = ID_NEW_SET(ob->data, BKE_gpencil_copy(bmain, ob->data)); + ob->data = ID_NEW_SET(ob->data, BKE_id_copy(bmain, ob->data)); break; case OB_HAIR: - ob->data = ID_NEW_SET(ob->data, BKE_hair_copy(bmain, ob->data)); + ob->data = ID_NEW_SET(ob->data, BKE_id_copy(bmain, ob->data)); break; case OB_POINTCLOUD: - ob->data = ID_NEW_SET(ob->data, BKE_pointcloud_copy(bmain, ob->data)); + ob->data = ID_NEW_SET(ob->data, BKE_id_copy(bmain, ob->data)); break; case OB_VOLUME: - ob->data = ID_NEW_SET(ob->data, BKE_volume_copy(bmain, ob->data)); + ob->data = ID_NEW_SET(ob->data, BKE_id_copy(bmain, ob->data)); break; default: printf("ERROR %s: can't copy %s\n", __func__, id->name); @@ -2033,7 +2034,7 @@ static void single_mat_users( * this functions guaranteed delivers single_users! */ if (ma->id.us > 1) { - man = BKE_material_copy(bmain, ma); + man = (Material *)BKE_id_copy(bmain, &ma->id); BKE_animdata_copy_id_action(bmain, &man->id); man->id.us = 0; |