Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/lib_remap.c
| Show First 20 Lines • Show All 238 Lines • ▼ Show 20 Lines | |||||
| static void libblock_remap_data_preprocess(IDRemap *r_id_remap_data) | static void libblock_remap_data_preprocess(IDRemap *r_id_remap_data) | ||||
| { | { | ||||
| switch (GS(r_id_remap_data->id_owner->name)) { | switch (GS(r_id_remap_data->id_owner->name)) { | ||||
| case ID_OB: { | case ID_OB: { | ||||
| ID *old_id = r_id_remap_data->old_id; | ID *old_id = r_id_remap_data->old_id; | ||||
| if (!old_id || GS(old_id->name) == ID_AR) { | if (!old_id || GS(old_id->name) == ID_AR) { | ||||
| Object *ob = (Object *)r_id_remap_data->id_owner; | Object *ob = (Object *)r_id_remap_data->id_owner; | ||||
| /* Object's pose holds reference to armature bones... sic */ | /* Object's pose holds reference to armature bones. sic */ | ||||
| /* Note that in theory, we should have to bother about | /* Note that in theory, we should have to bother about linked/non-linked/never-null/etc. | ||||
| * linked/non-linked/never-null/etc. flags/states. | * flags/states. | ||||
| * Fortunately, this is just a tag, so we can accept to 'over-tag' a bit for pose recalc, | * Fortunately, this is just a tag, so we can accept to 'over-tag' a bit for pose recalc, | ||||
| * and avoid another complex and risky condition nightmare like the one we have in | * and avoid another complex and risky condition nightmare like the one we have in | ||||
| * foreach_libblock_remap_callback()... */ | * foreach_libblock_remap_callback(). */ | ||||
| if (ob->pose && (!old_id || ob->data == old_id)) { | if (ob->pose && (!old_id || ob->data == old_id)) { | ||||
| BLI_assert(ob->type == OB_ARMATURE); | BLI_assert(ob->type == OB_ARMATURE); | ||||
| ob->pose->flag |= POSE_RECALC; | ob->pose->flag |= POSE_RECALC; | ||||
| /* We need to clear pose bone pointers immediately, things like undo writefile may be | /* We need to clear pose bone pointers immediately, some code may access those before | ||||
| * called before pose is actually recomputed, can lead to segfault... */ | * pose is actually recomputed, which can lead to segfault. */ | ||||
| BKE_pose_clear_pointers(ob->pose); | BKE_pose_clear_pointers(ob->pose); | ||||
| } | } | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| default: | default: | ||||
| break; | break; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 429 Lines • Show Last 20 Lines | |||||