diff options
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 5 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 49 |
2 files changed, 53 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 005e2c62b85..275d14dbca3 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3546,7 +3546,7 @@ static void lib_link_pose(FileData *fd, Main *bmain, Object *ob, bPose *pose) bool rebuild = false; if (fd->memfile == NULL) { - if (ob->proxy || (ob->id.lib==NULL && arm->id.lib)) { + if (ob->proxy || ob->id.lib != arm->id.lib) { rebuild = true; } } @@ -3628,6 +3628,9 @@ static void direct_link_bones(FileData *fd, Bone *bone) bone->prop = newdataadr(fd, bone->prop); IDP_DirectLinkGroup_OrFree(&bone->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); + bone->bbone_next = newdataadr(fd, bone->bbone_next); + bone->bbone_prev = newdataadr(fd, bone->bbone_prev); + bone->flag &= ~BONE_DRAW_ACTIVE; link_list(fd, &bone->childbase); diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 1e2ae48ccb1..5392e1dd4e8 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -60,7 +60,9 @@ #include "DNA_workspace_types.h" #include "DNA_key_types.h" #include "DNA_curve_types.h" +#include "DNA_armature_types.h" +#include "BKE_action.h" #include "BKE_collection.h" #include "BKE_constraint.h" #include "BKE_customdata.h" @@ -87,6 +89,8 @@ #include "BKE_key.h" #include "BKE_unit.h" +#include "DEG_depsgraph.h" + #include "BLT_translation.h" #include "BLO_readfile.h" @@ -860,6 +864,51 @@ void do_versions_after_linking_280(Main *bmain) } } } + + /* Move B-Bone custom handle settings from bPoseChannel to Bone. */ + if (!MAIN_VERSION_ATLEAST(bmain, 280, 25)) { + for (Object *ob = bmain->object.first; ob; ob = ob->id.next) { + bArmature *arm = ob->data; + + /* If it is an armature from the same file. */ + if (ob->pose && arm && arm->id.lib == ob->id.lib) { + bool rebuild = false; + + for (bPoseChannel *pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { + /* If the 2.7 flag is enabled, processing is needed. */ + if (pchan->bone && (pchan->bboneflag & PCHAN_BBONE_CUSTOM_HANDLES)) { + /* If the settings in the Bone are not set, copy. */ + if (pchan->bone->bbone_prev_type == BBONE_HANDLE_AUTO && + pchan->bone->bbone_next_type == BBONE_HANDLE_AUTO && + pchan->bone->bbone_prev == NULL && pchan->bone->bbone_next == NULL) + { + pchan->bone->bbone_prev_type = (pchan->bboneflag & PCHAN_BBONE_CUSTOM_START_REL) ? BBONE_HANDLE_RELATIVE : BBONE_HANDLE_ABSOLUTE; + pchan->bone->bbone_next_type = (pchan->bboneflag & PCHAN_BBONE_CUSTOM_END_REL) ? BBONE_HANDLE_RELATIVE : BBONE_HANDLE_ABSOLUTE; + + if (pchan->bbone_prev) { + pchan->bone->bbone_prev = pchan->bbone_prev->bone; + } + if (pchan->bbone_next) { + pchan->bone->bbone_next = pchan->bbone_next->bone; + } + } + + rebuild = true; + pchan->bboneflag = 0; + } + } + + /* Tag pose rebuild for all objects that use this armature. */ + if (rebuild) { + for (Object *ob2 = bmain->object.first; ob2; ob2 = ob2->id.next) { + if (ob2->pose && ob2->data == arm) { + ob2->pose->flag |= POSE_RECALC; + } + } + } + } + } + } } /* NOTE: this version patch is intended for versions < 2.52.2, but was initially introduced in 2.27 already. |