Use new generic BKE_id_expand_local() for make_local() for object.

This commit is contained in:
Bastien Montagne
2016-07-11 20:56:28 +02:00
parent 3c8f22a528
commit 5b2bc1d713

View File

@@ -1186,21 +1186,6 @@ Object *BKE_object_copy(Main *bmain, Object *ob)
return BKE_object_copy_ex(bmain, ob, false);
}
static int extern_local_object_callback(
void *UNUSED(user_data), struct ID *UNUSED(id_self), struct ID **id_pointer, int cd_flag)
{
/* We only tag usercounted ID usages as extern... Why? */
if ((cd_flag & IDWALK_USER) && *id_pointer) {
id_lib_extern(*id_pointer);
}
return IDWALK_RET_NOP;
}
static void extern_local_object(Object *ob)
{
BKE_library_foreach_ID_link(&ob->id, extern_local_object_callback, NULL, 0);
}
void BKE_object_make_local(Main *bmain, Object *ob)
{
bool is_local = false, is_lib = false;
@@ -1219,7 +1204,7 @@ void BKE_object_make_local(Main *bmain, Object *ob)
if (is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &ob->id);
extern_local_object(ob);
BKE_id_expand_local(&ob->id, false);
}
else {
Object *ob_new = BKE_object_copy(bmain, ob);