Cleanup: replace BKE_id_copy_ex by BKE_id_copy where possible.
That way it is obvious when we are using default ID copy behaviour, and when we are using advanced/specialized ones.
This commit is contained in:
		@@ -163,7 +163,7 @@ void BKE_action_copy_data(Main *UNUSED(bmain), bAction *act_dst, const bAction *
 | 
			
		||||
bAction *BKE_action_copy(Main *bmain, const bAction *act_src)
 | 
			
		||||
{
 | 
			
		||||
	bAction *act_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &act_src->id, (ID **)&act_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &act_src->id, (ID **)&act_copy);
 | 
			
		||||
	return act_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -284,8 +284,8 @@ AnimData *BKE_animdata_copy(Main *bmain, AnimData *adt, const int flag)
 | 
			
		||||
	/* make a copy of action - at worst, user has to delete copies... */
 | 
			
		||||
	if (do_action) {
 | 
			
		||||
		BLI_assert(bmain != NULL);
 | 
			
		||||
		BKE_id_copy_ex(bmain, (ID *)dadt->action, (ID **)&dadt->action, 0);
 | 
			
		||||
		BKE_id_copy_ex(bmain, (ID *)dadt->tmpact, (ID **)&dadt->tmpact, 0);
 | 
			
		||||
		BKE_id_copy(bmain, (ID *)dadt->action, (ID **)&dadt->action);
 | 
			
		||||
		BKE_id_copy(bmain, (ID *)dadt->tmpact, (ID **)&dadt->tmpact);
 | 
			
		||||
	}
 | 
			
		||||
	else if (do_id_user) {
 | 
			
		||||
		id_us_plus((ID *)dadt->action);
 | 
			
		||||
 
 | 
			
		||||
@@ -201,7 +201,7 @@ void BKE_armature_copy_data(Main *UNUSED(bmain), bArmature *arm_dst, const bArma
 | 
			
		||||
bArmature *BKE_armature_copy(Main *bmain, const bArmature *arm)
 | 
			
		||||
{
 | 
			
		||||
	bArmature *arm_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &arm->id, (ID **)&arm_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &arm->id, (ID **)&arm_copy);
 | 
			
		||||
	return arm_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -590,7 +590,7 @@ void BKE_brush_copy_data(Main *UNUSED(bmain), Brush *brush_dst, const Brush *bru
 | 
			
		||||
Brush *BKE_brush_copy(Main *bmain, const Brush *brush)
 | 
			
		||||
{
 | 
			
		||||
	Brush *brush_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &brush->id, (ID **)&brush_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &brush->id, (ID **)&brush_copy);
 | 
			
		||||
	return brush_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -126,7 +126,7 @@ void BKE_cachefile_copy_data(
 | 
			
		||||
CacheFile *BKE_cachefile_copy(Main *bmain, const CacheFile *cache_file)
 | 
			
		||||
{
 | 
			
		||||
	CacheFile *cache_file_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &cache_file->id, (ID **)&cache_file_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &cache_file->id, (ID **)&cache_file_copy);
 | 
			
		||||
	return cache_file_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -103,7 +103,7 @@ void BKE_camera_copy_data(Main *UNUSED(bmain), Camera *cam_dst, const Camera *ca
 | 
			
		||||
Camera *BKE_camera_copy(Main *bmain, const Camera *cam)
 | 
			
		||||
{
 | 
			
		||||
	Camera *cam_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &cam->id, (ID **)&cam_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &cam->id, (ID **)&cam_copy);
 | 
			
		||||
	return cam_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -224,7 +224,7 @@ Collection *BKE_collection_copy(Main *bmain, Collection *parent, Collection *col
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	Collection *collection_new;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &collection->id, (ID **)&collection_new, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &collection->id, (ID **)&collection_new);
 | 
			
		||||
	id_us_min(&collection_new->id);  /* Copying add one user by default, need to get rid of that one. */
 | 
			
		||||
 | 
			
		||||
	/* Optionally add to parent. */
 | 
			
		||||
 
 | 
			
		||||
@@ -216,7 +216,7 @@ void BKE_curve_copy_data(Main *bmain, Curve *cu_dst, const Curve *cu_src, const
 | 
			
		||||
Curve *BKE_curve_copy(Main *bmain, const Curve *cu)
 | 
			
		||||
{
 | 
			
		||||
	Curve *cu_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &cu->id, (ID **)&cu_copy, LIB_ID_COPY_SHAPEKEY);
 | 
			
		||||
	BKE_id_copy(bmain, &cu->id, (ID **)&cu_copy);
 | 
			
		||||
	return cu_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -637,7 +637,7 @@ void BKE_gpencil_copy_data(bGPdata *gpd_dst, const bGPdata *gpd_src, const int U
 | 
			
		||||
bGPdata *BKE_gpencil_copy(Main *bmain, const bGPdata *gpd)
 | 
			
		||||
{
 | 
			
		||||
	bGPdata *gpd_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &gpd->id, (ID **)&gpd_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &gpd->id, (ID **)&gpd_copy);
 | 
			
		||||
	return gpd_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -662,7 +662,7 @@ bGPdata *BKE_gpencil_data_duplicate(Main *bmain, const bGPdata *gpd_src, bool in
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		BLI_assert(bmain != NULL);
 | 
			
		||||
		BKE_id_copy_ex(bmain, &gpd_src->id, (ID **)&gpd_dst, 0);
 | 
			
		||||
		BKE_id_copy(bmain, &gpd_src->id, (ID **)&gpd_dst);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Copy internal data (layers, etc.) */
 | 
			
		||||
 
 | 
			
		||||
@@ -420,7 +420,7 @@ void BKE_image_copy_data(Main *UNUSED(bmain), Image *ima_dst, const Image *ima_s
 | 
			
		||||
Image *BKE_image_copy(Main *bmain, const Image *ima)
 | 
			
		||||
{
 | 
			
		||||
	Image *ima_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &ima->id, (ID **)&ima_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &ima->id, (ID **)&ima_copy);
 | 
			
		||||
	return ima_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -179,7 +179,7 @@ void BKE_key_copy_data(Main *UNUSED(bmain), Key *key_dst, const Key *key_src, co
 | 
			
		||||
Key *BKE_key_copy(Main *bmain, const Key *key)
 | 
			
		||||
{
 | 
			
		||||
	Key *key_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &key->id, (ID **)&key_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &key->id, (ID **)&key_copy);
 | 
			
		||||
	return key_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -124,7 +124,7 @@ void BKE_lamp_copy_data(Main *bmain, Lamp *la_dst, const Lamp *la_src, const int
 | 
			
		||||
Lamp *BKE_lamp_copy(Main *bmain, const Lamp *la)
 | 
			
		||||
{
 | 
			
		||||
	Lamp *la_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &la->id, (ID **)&la_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &la->id, (ID **)&la_copy);
 | 
			
		||||
	return la_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -292,7 +292,7 @@ void BKE_lattice_copy_data(Main *bmain, Lattice *lt_dst, const Lattice *lt_src,
 | 
			
		||||
Lattice *BKE_lattice_copy(Main *bmain, const Lattice *lt)
 | 
			
		||||
{
 | 
			
		||||
	Lattice *lt_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, <->id, (ID **)<_copy, LIB_ID_COPY_SHAPEKEY);
 | 
			
		||||
	BKE_id_copy(bmain, <->id, (ID **)<_copy);
 | 
			
		||||
	return lt_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -76,7 +76,7 @@ void BKE_lightprobe_copy_data(
 | 
			
		||||
LightProbe *BKE_lightprobe_copy(Main *bmain, const LightProbe *probe)
 | 
			
		||||
{
 | 
			
		||||
	LightProbe *probe_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &probe->id, (ID **)&probe_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &probe->id, (ID **)&probe_copy);
 | 
			
		||||
	return probe_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -195,7 +195,7 @@ void BKE_linestyle_copy_data(
 | 
			
		||||
FreestyleLineStyle *BKE_linestyle_copy(struct Main *bmain, const FreestyleLineStyle *linestyle)
 | 
			
		||||
{
 | 
			
		||||
	FreestyleLineStyle *linestyle_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &linestyle->id, (ID **)&linestyle_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &linestyle->id, (ID **)&linestyle_copy);
 | 
			
		||||
	return linestyle_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -863,7 +863,7 @@ void BKE_mask_copy_data(Main *UNUSED(bmain), Mask *mask_dst, const Mask *mask_sr
 | 
			
		||||
Mask *BKE_mask_copy(Main *bmain, const Mask *mask)
 | 
			
		||||
{
 | 
			
		||||
	Mask *mask_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &mask->id, (ID **)&mask_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &mask->id, (ID **)&mask_copy);
 | 
			
		||||
	return mask_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -210,7 +210,7 @@ void BKE_material_copy_data(Main *bmain, Material *ma_dst, const Material *ma_sr
 | 
			
		||||
Material *BKE_material_copy(Main *bmain, const Material *ma)
 | 
			
		||||
{
 | 
			
		||||
	Material *ma_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &ma->id, (ID **)&ma_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &ma->id, (ID **)&ma_copy);
 | 
			
		||||
	return ma_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -116,7 +116,7 @@ void BKE_mball_copy_data(Main *UNUSED(bmain), MetaBall *mb_dst, const MetaBall *
 | 
			
		||||
MetaBall *BKE_mball_copy(Main *bmain, const MetaBall *mb)
 | 
			
		||||
{
 | 
			
		||||
	MetaBall *mb_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &mb->id, (ID **)&mb_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &mb->id, (ID **)&mb_copy);
 | 
			
		||||
	return mb_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -703,7 +703,7 @@ Mesh *BKE_mesh_copy_for_eval(struct Mesh *source, bool reference)
 | 
			
		||||
Mesh *BKE_mesh_copy(Main *bmain, const Mesh *me)
 | 
			
		||||
{
 | 
			
		||||
	Mesh *me_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &me->id, (ID **)&me_copy, LIB_ID_COPY_SHAPEKEY);
 | 
			
		||||
	BKE_id_copy(bmain, &me->id, (ID **)&me_copy);
 | 
			
		||||
	return me_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -969,7 +969,7 @@ Mesh *BKE_mesh_new_from_object(
 | 
			
		||||
		case OB_MESH:
 | 
			
		||||
			/* copies object and modifiers (but not the data) */
 | 
			
		||||
			if (cage) {
 | 
			
		||||
				/* copies the data */
 | 
			
		||||
				/* copies the data (but *not* the shapekeys). */
 | 
			
		||||
				Mesh *mesh = ob->data;
 | 
			
		||||
				BKE_id_copy_ex(bmain, &mesh->id, (ID **)&tmpmesh, 0);
 | 
			
		||||
				/* XXX BKE_mesh_copy() already handles materials usercount. */
 | 
			
		||||
 
 | 
			
		||||
@@ -1525,7 +1525,7 @@ void BKE_movieclip_copy_data(Main *UNUSED(bmain), MovieClip *clip_dst, const Mov
 | 
			
		||||
MovieClip *BKE_movieclip_copy(Main *bmain, const MovieClip *clip)
 | 
			
		||||
{
 | 
			
		||||
	MovieClip *clip_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &clip->id, (ID **)&clip_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &clip->id, (ID **)&clip_copy);
 | 
			
		||||
	return clip_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1425,7 +1425,7 @@ void BKE_object_copy_data(Main *bmain, Object *ob_dst, const Object *ob_src, con
 | 
			
		||||
Object *BKE_object_copy(Main *bmain, const Object *ob)
 | 
			
		||||
{
 | 
			
		||||
	Object *ob_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &ob->id, (ID **)&ob_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &ob->id, (ID **)&ob_copy);
 | 
			
		||||
 | 
			
		||||
	/* We increase object user count when linking to Collections. */
 | 
			
		||||
	id_us_min(&ob_copy->id);
 | 
			
		||||
 
 | 
			
		||||
@@ -445,7 +445,7 @@ void BKE_paint_curve_copy_data(Main *UNUSED(bmain), PaintCurve *pc_dst, const Pa
 | 
			
		||||
PaintCurve *BKE_paint_curve_copy(Main *bmain, const PaintCurve *pc)
 | 
			
		||||
{
 | 
			
		||||
	PaintCurve *pc_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &pc->id, (ID **)&pc_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &pc->id, (ID **)&pc_copy);
 | 
			
		||||
	return pc_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -526,7 +526,7 @@ void BKE_palette_copy_data(Main *UNUSED(bmain), Palette *palette_dst, const Pale
 | 
			
		||||
Palette *BKE_palette_copy(Main *bmain, const Palette *palette)
 | 
			
		||||
{
 | 
			
		||||
	Palette *palette_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &palette->id, (ID **)&palette_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &palette->id, (ID **)&palette_copy);
 | 
			
		||||
	return palette_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3326,7 +3326,7 @@ void BKE_particlesettings_copy_data(
 | 
			
		||||
ParticleSettings *BKE_particlesettings_copy(Main *bmain, const ParticleSettings *part)
 | 
			
		||||
{
 | 
			
		||||
	ParticleSettings *part_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &part->id, (ID **)&part_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &part->id, (ID **)&part_copy);
 | 
			
		||||
	return part_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4186,7 +4186,6 @@ static int hair_needs_recalc(ParticleSystem *psys)
 | 
			
		||||
static ParticleSettings *particle_settings_localize(ParticleSettings *particle_settings)
 | 
			
		||||
{
 | 
			
		||||
	ParticleSettings *particle_settings_local;
 | 
			
		||||
	/* TODO(sergey): Consider making this a  */
 | 
			
		||||
	BKE_id_copy_ex(NULL,
 | 
			
		||||
	               (ID *)&particle_settings->id,
 | 
			
		||||
	               (ID **)&particle_settings_local,
 | 
			
		||||
 
 | 
			
		||||
@@ -399,8 +399,8 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
 | 
			
		||||
				for (FreestyleLineSet *lineset = view_layer_dst->freestyle_config.linesets.first; lineset; lineset = lineset->next) {
 | 
			
		||||
					if (lineset->linestyle) {
 | 
			
		||||
						id_us_min(&lineset->linestyle->id);
 | 
			
		||||
						/* XXX Not copying anim/actions here? */
 | 
			
		||||
						BKE_id_copy_ex(bmain, (ID *)lineset->linestyle, (ID **)&lineset->linestyle, 0);
 | 
			
		||||
						/* XXX Not copying actions here? */
 | 
			
		||||
						BKE_id_copy(bmain, (ID *)lineset->linestyle, (ID **)&lineset->linestyle);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
@@ -415,10 +415,10 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
 | 
			
		||||
			BKE_collection_copy_full(bmain, sce_copy->master_collection);
 | 
			
		||||
 | 
			
		||||
			/* Full copy of GreasePencil. */
 | 
			
		||||
			/* XXX Not copying anim/actions here? */
 | 
			
		||||
			/* XXX Not copying actions here? */
 | 
			
		||||
			if (sce_copy->gpd) {
 | 
			
		||||
				id_us_min(&sce_copy->gpd->id);
 | 
			
		||||
				BKE_id_copy_ex(bmain, (ID *)sce_copy->gpd, (ID **)&sce_copy->gpd, 0);
 | 
			
		||||
				BKE_id_copy(bmain, (ID *)sce_copy->gpd, (ID **)&sce_copy->gpd);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
 
 | 
			
		||||
@@ -75,7 +75,7 @@ void BKE_speaker_copy_data(Main *UNUSED(bmain), Speaker *UNUSED(spk_dst), const
 | 
			
		||||
Speaker *BKE_speaker_copy(Main *bmain, const Speaker *spk)
 | 
			
		||||
{
 | 
			
		||||
	Speaker *spk_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &spk->id, (ID **)&spk_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &spk->id, (ID **)&spk_copy);
 | 
			
		||||
	return spk_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -496,7 +496,7 @@ void BKE_text_copy_data(Main *UNUSED(bmain), Text *ta_dst, const Text *ta_src, c
 | 
			
		||||
Text *BKE_text_copy(Main *bmain, const Text *ta)
 | 
			
		||||
{
 | 
			
		||||
	Text *ta_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &ta->id, (ID **)&ta_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &ta->id, (ID **)&ta_copy);
 | 
			
		||||
	return ta_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -446,7 +446,7 @@ void BKE_texture_copy_data(Main *bmain, Tex *tex_dst, const Tex *tex_src, const
 | 
			
		||||
Tex *BKE_texture_copy(Main *bmain, const Tex *tex)
 | 
			
		||||
{
 | 
			
		||||
	Tex *tex_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &tex->id, (ID **)&tex_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &tex->id, (ID **)&tex_copy);
 | 
			
		||||
	return tex_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -125,7 +125,7 @@ void BKE_world_copy_data(Main *bmain, World *wrld_dst, const World *wrld_src, co
 | 
			
		||||
World *BKE_world_copy(Main *bmain, const World *wrld)
 | 
			
		||||
{
 | 
			
		||||
	World *wrld_copy;
 | 
			
		||||
	BKE_id_copy_ex(bmain, &wrld->id, (ID **)&wrld_copy, 0);
 | 
			
		||||
	BKE_id_copy(bmain, &wrld->id, (ID **)&wrld_copy);
 | 
			
		||||
	return wrld_copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user