Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/library_remap.c
| Show First 20 Lines • Show All 357 Lines • ▼ Show 20 Lines | if (new_ob == NULL) { /* We need to remove NULL-ified groupobjects... */ | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| new_ob->flag |= OB_FROMGROUP; | new_ob->flag |= OB_FROMGROUP; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void libblock_remap_data_postprocess_object_fromcollection_update(Main *bmain, Object *old_ob, Object *new_ob) | |||||
| { | |||||
| if (new_ob == NULL) { | |||||
| for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) { | |||||
| BKE_collections_object_remove(scene, old_ob); | |||||
| } | |||||
| } | |||||
| } | |||||
| static void libblock_remap_data_postprocess_group_scene_unlink(Main *UNUSED(bmain), Scene *sce, ID *old_id) | static void libblock_remap_data_postprocess_group_scene_unlink(Main *UNUSED(bmain), Scene *sce, ID *old_id) | ||||
| { | { | ||||
| /* Note that here we assume no object has no base (i.e. all objects are assumed instanced | /* Note that here we assume no object has no base (i.e. all objects are assumed instanced | ||||
| * in one scene...). */ | * in one scene...). */ | ||||
| for (Base *base = sce->base.first; base; base = base->next) { | for (Base *base = sce->base.first; base; base = base->next) { | ||||
| if (base->flag & OB_FROMGROUP) { | if (base->flag & OB_FROMGROUP) { | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| ▲ Show 20 Lines • Show All 193 Lines • ▼ Show 20 Lines | void BKE_libblock_remap_locked( | ||||
| } | } | ||||
| /* Some after-process updates. | /* Some after-process updates. | ||||
| * This is a bit ugly, but cannot see a way to avoid it. Maybe we should do a per-ID callback for this instead? | * This is a bit ugly, but cannot see a way to avoid it. Maybe we should do a per-ID callback for this instead? | ||||
| */ | */ | ||||
| switch (GS(old_id->name)) { | switch (GS(old_id->name)) { | ||||
| case ID_OB: | case ID_OB: | ||||
| libblock_remap_data_postprocess_object_fromgroup_update(bmain, (Object *)old_id, (Object *)new_id); | libblock_remap_data_postprocess_object_fromgroup_update(bmain, (Object *)old_id, (Object *)new_id); | ||||
| libblock_remap_data_postprocess_object_fromcollection_update(bmain, (Object *)old_id, (Object *)new_id); | |||||
| break; | break; | ||||
| case ID_GR: | case ID_GR: | ||||
| if (!new_id) { /* Only affects us in case group was unlinked. */ | if (!new_id) { /* Only affects us in case group was unlinked. */ | ||||
| for (Scene *sce = bmain->scene.first; sce; sce = sce->id.next) { | for (Scene *sce = bmain->scene.first; sce; sce = sce->id.next) { | ||||
| libblock_remap_data_postprocess_group_scene_unlink(bmain, sce, old_id); | libblock_remap_data_postprocess_group_scene_unlink(bmain, sce, old_id); | ||||
| } | } | ||||
| } | } | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 395 Lines • Show Last 20 Lines | |||||