Cleanup: Object: remove unused BKE API.

This commit is contained in:
Bastien Montagne
2020-03-06 11:18:14 +01:00
parent af5d2e38f7
commit c25f6e998b
4 changed files with 23 additions and 60 deletions

View File

@@ -64,7 +64,6 @@ void BKE_object_free_particlesystems(struct Object *ob);
void BKE_object_free_softbody(struct Object *ob);
void BKE_object_free_curve_cache(struct Object *ob);
void BKE_object_free(struct Object *ob);
void BKE_object_free_derived_caches(struct Object *ob);
void BKE_object_free_caches(struct Object *object);
@@ -111,7 +110,6 @@ typedef enum eObjectVisibilityResult {
int BKE_object_visibility(const struct Object *ob, const int dag_eval_mode);
void BKE_object_init(struct Object *ob, const short ob_type);
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,
@@ -135,12 +133,7 @@ struct Object *BKE_object_add_for_data(struct Main *bmain,
void *BKE_object_obdata_add_from_type(struct Main *bmain, int type, const char *name)
ATTR_NONNULL(1);
void BKE_object_copy_data(struct Main *bmain,
struct Object *ob_dst,
const struct Object *ob_src,
const int flag);
struct Object *BKE_object_copy(struct Main *bmain, const struct Object *ob);
void BKE_object_make_local(struct Main *bmain, struct Object *ob, const int flags);
bool BKE_object_is_libdata(const struct Object *ob);
bool BKE_object_obdata_is_libdata(const struct Object *ob);

View File

@@ -470,9 +470,7 @@ bool BKE_lib_id_make_local(Main *bmain, ID *id, const bool test, const int flags
BLI_assert(0);
return true;
case ID_OB:
if (!test) {
BKE_object_make_local(bmain, (Object *)id, flags);
}
BLI_assert(0);
return true;
case ID_ME:
if (!test) {
@@ -731,7 +729,7 @@ bool BKE_id_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag)
BLI_assert(0);
break;
case ID_OB:
BKE_object_copy_data(bmain, (Object *)*r_newid, (Object *)id, flag);
BLI_assert(0);
break;
case ID_ME:
BKE_mesh_copy_data(bmain, (Mesh *)*r_newid, (Mesh *)id, flag);
@@ -1351,11 +1349,9 @@ void BKE_libblock_init_empty(ID *id)
case ID_LI:
/* Nothing to do. */
break;
case ID_OB: {
Object *ob = (Object *)id;
BKE_object_init(ob, OB_EMPTY);
case ID_OB:
BLI_assert(0);
break;
}
case ID_ME:
BKE_mesh_init((Mesh *)id);
break;
@@ -2417,7 +2413,7 @@ void BKE_library_make_local(Main *bmain,
else {
/* we can switch the proxy'ing from the linked-in to the made-local proxy.
* BKE_object_make_proxy() shouldn't be used here, as it allocates memory that
* was already allocated by BKE_object_make_local() (which called BKE_object_copy). */
* was already allocated by object_make_local() (which called BKE_object_copy). */
ob_new->proxy = ob->proxy;
ob_new->proxy_group = ob->proxy_group;
ob_new->proxy_from = ob->proxy_from;

View File

@@ -143,7 +143,7 @@ void BKE_libblock_free_datablock(ID *id, const int UNUSED(flag))
BKE_library_free((Library *)id);
break;
case ID_OB:
BKE_object_free((Object *)id);
BLI_assert(0);
break;
case ID_ME:
BKE_mesh_free((Mesh *)id);

View File

@@ -782,12 +782,6 @@ void BKE_object_free_caches(Object *object)
}
}
/** Free (or release) any data used by this object (does not free the object itself). */
void BKE_object_free(Object *ob)
{
object_free_data(&ob->id);
}
/* actual check for internal data, not context or flags */
bool BKE_object_is_in_editmode(const Object *ob)
{
@@ -1026,6 +1020,22 @@ static const char *get_obdata_defname(int type)
}
}
static void object_init(Object *ob, const short ob_type)
{
object_init_data(&ob->id);
ob->type = ob_type;
if (ob->type != OB_EMPTY) {
zero_v2(ob->ima_ofs);
}
if (ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_SPEAKER)) {
ob->trackflag = OB_NEGZ;
ob->upflag = OB_POSY;
}
}
void *BKE_object_obdata_add_from_type(Main *bmain, int type, const char *name)
{
if (name == NULL) {
@@ -1065,22 +1075,6 @@ void *BKE_object_obdata_add_from_type(Main *bmain, int type, const char *name)
}
}
void BKE_object_init(Object *ob, const short ob_type)
{
object_init_data(&ob->id);
ob->type = ob_type;
if (ob->type != OB_EMPTY) {
zero_v2(ob->ima_ofs);
}
if (ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_SPEAKER)) {
ob->trackflag = OB_NEGZ;
ob->upflag = OB_POSY;
}
}
/* more general add: creates minimum required data, but without vertices etc. */
Object *BKE_object_add_only_object(Main *bmain, int type, const char *name)
{
@@ -1096,7 +1090,7 @@ Object *BKE_object_add_only_object(Main *bmain, int type, const char *name)
id_us_min(&ob->id);
/* default object vars */
BKE_object_init(ob, type);
object_init(ob, type);
return ob;
}
@@ -1537,21 +1531,6 @@ void BKE_object_transform_copy(Object *ob_tar, const Object *ob_src)
copy_v3_v3(ob_tar->scale, ob_src->scale);
}
/**
* Only copy internal data of Object ID from source
* to already allocated/initialized destination.
* 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!
*
* \param flag: Copying options (see BKE_lib_id.h's LIB_ID_COPY_... flags for more).
*/
void BKE_object_copy_data(Main *bmain, Object *ob_dst, const Object *ob_src, const int flag)
{
object_copy_data(bmain, &ob_dst->id, &ob_src->id, flag);
}
/* copy objects, will re-initialize cached simulation data */
Object *BKE_object_copy(Main *bmain, const Object *ob)
{
@@ -1829,11 +1808,6 @@ Object *BKE_object_duplicate(Main *bmain, const Object *ob, const int dupflag)
return obn;
}
void BKE_object_make_local(Main *bmain, Object *ob, const int flags)
{
object_make_local(bmain, &ob->id, flags);
}
/* Returns true if the Object is from an external blend file (libdata) */
bool BKE_object_is_libdata(const Object *ob)
{