Cleanup: BKE_library: rename id_copy to BKE_id_copy.

Time to follow conventions for that one as well.
This commit is contained in:
Bastien Montagne 2019-02-04 16:22:28 +01:00
parent 7636e9785d
commit 6a686b0bfb
34 changed files with 41 additions and 41 deletions

@ -163,7 +163,7 @@ void BKE_id_make_local_generic(struct Main *bmain, struct ID *id, const bool id_
bool id_make_local(struct Main *bmain, struct ID *id, const bool test, const bool force_local);
bool id_single_user(struct bContext *C, struct ID *id, struct PointerRNA *ptr, struct PropertyRNA *prop);
bool BKE_id_copy_is_allowed(const struct ID *id);
bool id_copy(struct Main *bmain, const struct ID *id, struct ID **newid);
bool BKE_id_copy(struct Main *bmain, const struct ID *id, struct ID **newid);
bool BKE_id_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, const int flag);
void BKE_id_swap(struct Main *bmain, struct ID *id_a, struct ID *id_b);
void id_sort_by_name(struct ListBase *lb, struct ID *id);

@ -117,7 +117,7 @@ void BKE_action_free(bAction *act)
/**
* Only copy internal data of Action ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -168,7 +168,7 @@ static void copy_bonechildren(
/**
* Only copy internal data of Armature ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -556,7 +556,7 @@ struct Brush *BKE_brush_first_search(struct Main *bmain, const eObjectMode ob_mo
/**
* Only copy internal data of Brush ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -104,7 +104,7 @@ void BKE_cachefile_free(CacheFile *cache_file)
/**
* Only copy internal data of CacheFile ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -89,7 +89,7 @@ void *BKE_camera_add(Main *bmain, const char *name)
/**
* Only copy internal data of Camera ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -177,7 +177,7 @@ bool BKE_collection_delete(Main *bmain, Collection *collection, bool hierarchy)
/**
* Only copy internal data of Collection ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -186,7 +186,7 @@ Curve *BKE_curve_add(Main *bmain, const char *name, int type)
/**
* Only copy internal data of Curve ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -610,7 +610,7 @@ bGPDlayer *BKE_gpencil_layer_duplicate(const bGPDlayer *gpl_src)
/**
* Only copy internal data of GreasePencil ID from source to already allocated/initialized destination.
* You probably never want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -378,7 +378,7 @@ static void copy_image_packedfiles(ListBase *lb_dst, const ListBase *lb_src)
/**
* Only copy internal data of Image ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -152,7 +152,7 @@ Key *BKE_key_add(Main *bmain, ID *id) /* common function */
/**
* Only copy internal data of ShapeKey ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -97,7 +97,7 @@ Lamp *BKE_lamp_add(Main *bmain, const char *name)
/**
* Only copy internal data of Lamp ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -266,7 +266,7 @@ Lattice *BKE_lattice_add(Main *bmain, const char *name)
/**
* Only copy internal data of Lattice ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -340,8 +340,8 @@ void BKE_id_make_local_generic(Main *bmain, ID *id, const bool id_in_mainlist, c
else {
ID *id_new;
/* Should not fail in expected usecases, but id_copy does not copy Scene e.g. */
if (id_copy(bmain, id, &id_new)) {
/* Should not fail in expected usecases, but a few ID types cannot be copied (LIB, WM, SCR...). */
if (BKE_id_copy(bmain, id, &id_new)) {
id_new->us = 0;
/* setting newid is mandatory for complex make_lib_local logic... */
@ -713,7 +713,7 @@ bool BKE_id_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag)
* Invokes the appropriate copy method for the block and returns the result in
* newid, unless test. Returns true if the block can be copied.
*/
bool id_copy(Main *bmain, const ID *id, ID **newid)
bool BKE_id_copy(Main *bmain, const ID *id, ID **newid)
{
return BKE_id_copy_ex(bmain, id, newid, LIB_ID_COPY_SHAPEKEY);
}
@ -797,7 +797,7 @@ bool id_single_user(bContext *C, ID *id, PointerRNA *ptr, PropertyRNA *prop)
/* if property isn't editable, we're going to have an extra block hanging around until we save */
if (RNA_property_editable(ptr, prop)) {
Main *bmain = CTX_data_main(C);
if (id_copy(bmain, id, &newid) && newid) {
if (BKE_id_copy(bmain, id, &newid) && newid) {
/* copy animation actions too */
BKE_animdata_copy_id_action(bmain, id, false);
/* us is 1 by convention with new IDs, but RNA_property_pointer_set

@ -164,7 +164,7 @@ static ID *override_static_create_from(Main *bmain, ID *reference_id)
{
ID *local_id;
if (!id_copy(bmain, reference_id, (ID **)&local_id)) {
if (!BKE_id_copy(bmain, reference_id, (ID **)&local_id)) {
return NULL;
}
id_us_min(local_id);
@ -621,7 +621,7 @@ void BKE_override_static_update(Main *bmain, ID *local)
* a (performances) issue here. */
ID *tmp_id;
id_copy(bmain, local->override_static->reference, &tmp_id);
BKE_id_copy(bmain, local->override_static->reference, &tmp_id);
if (tmp_id == NULL) {
return;
@ -727,7 +727,7 @@ ID *BKE_override_static_operations_store_start(Main *bmain, OverrideStaticStorag
/* This would imply change in handling of usercout all over RNA (and possibly all over Blender code).
* Not impossible to do, but would rather see first is extra useless usual user handling is actually
* a (performances) issue here, before doing it. */
id_copy((Main *)override_storage, local, &storage_id);
BKE_id_copy((Main *)override_storage, local, &storage_id);
if (storage_id != NULL) {
PointerRNA rnaptr_reference, rnaptr_final, rnaptr_storage;

@ -61,7 +61,7 @@ void *BKE_lightprobe_add(Main *bmain, const char *name)
/**
* Only copy internal data of LightProbe ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -148,7 +148,7 @@ void BKE_linestyle_free(FreestyleLineStyle *linestyle)
/**
* Only copy internal data of Linestyle ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -844,7 +844,7 @@ Mask *BKE_mask_copy_nolib(Mask *mask)
/**
* Only copy internal data of Mask ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -173,7 +173,7 @@ Material *BKE_material_add_gpencil(Main *bmain, const char *name)
/**
* Only copy internal data of Material ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -96,7 +96,7 @@ MetaBall *BKE_mball_add(Main *bmain, const char *name)
/**
* Only copy internal data of MetaBall ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -518,7 +518,7 @@ Mesh *BKE_mesh_add(Main *bmain, const char *name)
/**
* Only copy internal data of Mesh ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -1502,7 +1502,7 @@ void BKE_movieclip_free(MovieClip *clip)
/**
* Only copy internal data of MovieClip ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -1291,7 +1291,7 @@ bNodeTree *ntreeAddTree(Main *bmain, const char *name, const char *idname)
/**
* Only copy internal data of NodeTree ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -1313,7 +1313,7 @@ void BKE_object_transform_copy(Object *ob_tar, const Object *ob_src)
/**
* Only copy internal data of Object ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -429,7 +429,7 @@ PaintCurve *BKE_paint_curve_add(Main *bmain, const char *name)
/**
* Only copy internal data of PaintCurve ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@ -512,7 +512,7 @@ Palette *BKE_palette_add(Main *bmain, const char *name)
/**
* Only copy internal data of Palette ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -3288,7 +3288,7 @@ void BKE_particlesettings_twist_curve_init(ParticleSettings *part)
/**
* Only copy internal data of ParticleSettings ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -227,7 +227,7 @@ void BKE_toolsettings_free(ToolSettings *toolsettings)
/**
* Only copy internal data of Scene ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -147,7 +147,7 @@ void BKE_sound_free(bSound *sound)
/**
* Only copy internal data of Sound ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -61,7 +61,7 @@ void *BKE_speaker_add(Main *bmain, const char *name)
/**
* Only copy internal data of Speaker ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -459,7 +459,7 @@ Text *BKE_text_load(Main *bmain, const char *file, const char *relpath)
/**
* Only copy internal data of Text ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -411,7 +411,7 @@ MTex *BKE_texture_mtex_add_id(ID *id, int slot)
/**
* Only copy internal data of Texture ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -97,7 +97,7 @@ World *BKE_world_add(Main *bmain, const char *name)
/**
* Only copy internal data of World ID from source to already allocated/initialized destination.
* You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
* You probably nerver want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*

@ -275,7 +275,7 @@ struct ValidateData {
bool is_valid;
};
/* Similar to generic id_copy() but does not require main and assumes pointer
/* Similar to generic BKE_id_copy() but does not require main and assumes pointer
* is already allocated,
*/
bool id_copy_inplace_no_main(const ID *id, ID *newid)
@ -702,7 +702,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
* - We don't want heap-allocations here.
* - We don't want bmain's content to be freed when main is freed. */
bool done = false;
/* First we handle special cases which are not covered by id_copy() yet.
/* First we handle special cases which are not covered by BKE_id_copy() yet.
* or cases where we want to do something smarter than simple datablock
* copy. */
const ID_Type id_type = GS(id_orig->name);

@ -363,7 +363,7 @@ static ID *rna_ID_copy(ID *id, Main *bmain)
{
ID *newid;
if (id_copy(bmain, id, &newid)) {
if (BKE_id_copy(bmain, id, &newid)) {
if (newid != NULL) {
id_us_min(newid);
}