Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/lib_override.c
| Show First 20 Lines • Show All 696 Lines • ▼ Show 20 Lines | switch (GS(id_root->name)) { | ||||
| if (ob_reference != NULL) { | if (ob_reference != NULL) { | ||||
| Base *base = BKE_view_layer_base_find(view_layer, ob_new); | Base *base = BKE_view_layer_base_find(view_layer, ob_new); | ||||
| if (!lib_override_library_create_post_process_object_is_instantiated( | if (!lib_override_library_create_post_process_object_is_instantiated( | ||||
| view_layer, ob_new, is_resync)) { | view_layer, ob_new, is_resync)) { | ||||
| BKE_collection_object_add_from(bmain, scene, ob_reference, ob_new); | BKE_collection_object_add_from(bmain, scene, ob_reference, ob_new); | ||||
| base = BKE_view_layer_base_find(view_layer, ob_new); | base = BKE_view_layer_base_find(view_layer, ob_new); | ||||
| DEG_id_tag_update_ex( | DEG_id_tag_update_ex( | ||||
| bmain, &ob_new->id, ID_RECALC_TRANSFORM | ID_RECALC_BASE_FLAGS); | bmain, &ob_new->id, ID_RECALC_TRANSFORM | ID_RECALC_BASE_FLAGS); | ||||
| if (is_resync) { | |||||
| ob_new->id.flag |= LIB_LIB_OVERRIDE_RESYNC_LEFTOVER; | |||||
| } | |||||
| } | } | ||||
| if (ob_new == (Object *)ob_reference->id.newid && base != NULL) { | if (ob_new == (Object *)ob_reference->id.newid && base != NULL) { | ||||
| /* TODO: is setting active needed? */ | /* TODO: is setting active needed? */ | ||||
| BKE_view_layer_base_select_and_set_active(view_layer, base); | BKE_view_layer_base_select_and_set_active(view_layer, base); | ||||
| } | } | ||||
| } | } | ||||
| else if (!lib_override_library_create_post_process_object_is_instantiated( | else if (!lib_override_library_create_post_process_object_is_instantiated( | ||||
| view_layer, ob_new, is_resync)) { | view_layer, ob_new, is_resync)) { | ||||
| BKE_collection_object_add(bmain, collection_new, ob_new); | BKE_collection_object_add(bmain, collection_new, ob_new); | ||||
| DEG_id_tag_update_ex(bmain, &ob_new->id, ID_RECALC_TRANSFORM | ID_RECALC_BASE_FLAGS); | DEG_id_tag_update_ex(bmain, &ob_new->id, ID_RECALC_TRANSFORM | ID_RECALC_BASE_FLAGS); | ||||
| if (is_resync) { | |||||
| ob_new->id.flag |= LIB_LIB_OVERRIDE_RESYNC_LEFTOVER; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| FOREACH_COLLECTION_OBJECT_RECURSIVE_END; | FOREACH_COLLECTION_OBJECT_RECURSIVE_END; | ||||
| break; | break; | ||||
| } | } | ||||
| case ID_OB: { | case ID_OB: { | ||||
| Object *ob_new = (Object *)id_root->newid; | Object *ob_new = (Object *)id_root->newid; | ||||
| if (!lib_override_library_create_post_process_object_is_instantiated( | if (!lib_override_library_create_post_process_object_is_instantiated( | ||||
| view_layer, ob_new, is_resync)) { | view_layer, ob_new, is_resync)) { | ||||
| if (is_resync && residual_storage != NULL) { | if (is_resync && residual_storage != NULL) { | ||||
| BKE_collection_object_add(bmain, residual_storage, ob_new); | BKE_collection_object_add(bmain, residual_storage, ob_new); | ||||
| } | } | ||||
| else { | else { | ||||
| BKE_collection_object_add_from(bmain, scene, (Object *)id_root, ob_new); | BKE_collection_object_add_from(bmain, scene, (Object *)id_root, ob_new); | ||||
| } | } | ||||
| if (is_resync) { | |||||
| ob_new->id.flag |= LIB_LIB_OVERRIDE_RESYNC_LEFTOVER; | |||||
| } | |||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| default: | default: | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 342 Lines • ▼ Show 20 Lines | else if (id->tag & LIB_TAG_MISSING && !ID_IS_LINKED(id)) { | ||||
| id->tag |= LIB_TAG_DOIT; | id->tag |= LIB_TAG_DOIT; | ||||
| id->tag &= ~LIB_TAG_MISSING; | id->tag &= ~LIB_TAG_MISSING; | ||||
| CLOG_INFO(&LOG, 2, "Old override %s is being deleted", id->name); | CLOG_INFO(&LOG, 2, "Old override %s is being deleted", id->name); | ||||
| } | } | ||||
| else { | else { | ||||
| /* Otherwise, keep them, user needs to decide whether what to do with them. */ | /* Otherwise, keep them, user needs to decide whether what to do with them. */ | ||||
| BLI_assert((id->tag & LIB_TAG_DOIT) == 0); | BLI_assert((id->tag & LIB_TAG_DOIT) == 0); | ||||
| id_fake_user_set(id); | id_fake_user_set(id); | ||||
| id->flag |= LIB_LIB_OVERRIDE_RESYNC_LEFTOVER; | |||||
| CLOG_INFO(&LOG, 2, "Old override %s is being kept around as it was user-edited", id->name); | CLOG_INFO(&LOG, 2, "Old override %s is being kept around as it was user-edited", id->name); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| FOREACH_MAIN_ID_END; | FOREACH_MAIN_ID_END; | ||||
| BKE_id_multi_tagged_delete(bmain); | BKE_id_multi_tagged_delete(bmain); | ||||
| /* At this point, `id_root` has very likely been deleted, we need to update it to its new | /* At this point, `id_root` has very likely been deleted, we need to update it to its new | ||||
| ▲ Show 20 Lines • Show All 1,356 Lines • Show Last 20 Lines | |||||