diff options
author | Germano <germano.costa@ig.com.br> | 2017-12-05 16:19:47 +0300 |
---|---|---|
committer | Germano <germano.costa@ig.com.br> | 2017-12-05 16:19:47 +0300 |
commit | 6734bb1faf3a4c5c2446ecc4d2261f0d2ea9a39b (patch) | |
tree | 6cc83f565c6cff4e27ee4d3a46a0d57ecbe083e9 /source/blender/blenloader/intern/versioning_270.c | |
parent | deaeee8e4d92cfd43e641db6a86273e70a4dae7d (diff) | |
parent | 70c2d8a1a2b8b1e8c1f60f30451dbad88fba7188 (diff) |
Merge branch 'master' into blender2.8
# Conflicts:
# source/blender/editors/mesh/editmesh_select.c
Diffstat (limited to 'source/blender/blenloader/intern/versioning_270.c')
-rw-r--r-- | source/blender/blenloader/intern/versioning_270.c | 70 |
1 files changed, 69 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index b945f5bdcd3..bf2d5c8e326 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -62,6 +62,8 @@ #include "BKE_animsys.h" #include "BKE_brush.h" #include "BKE_colortools.h" +#include "BKE_fcurve.h" +#include "BKE_gpencil.h" #include "BKE_library.h" #include "BKE_main.h" #include "BKE_mask.h" @@ -71,7 +73,6 @@ #include "BKE_sequencer.h" #include "BKE_screen.h" #include "BKE_tracking.h" -#include "BKE_gpencil.h" #include "BLI_math.h" #include "BLI_listbase.h" @@ -285,6 +286,67 @@ static void do_versions_compositor_render_passes(bNodeTree *ntree) } } + +static char *replace_bbone_easing_rnapath(char *old_path) +{ + char *new_path = NULL; + + /* NOTE: This will break paths for any bones/custom-properties + * which happen be named after the bbone property id's + */ + if (strstr(old_path, "bbone_in")) + new_path = BLI_str_replaceN(old_path, "bbone_in", "bbone_easein"); + else if (strstr(old_path, "bbone_out")) + new_path = BLI_str_replaceN(old_path, "bbone_out", "bbone_easeout"); + + if (new_path) { + MEM_freeN(old_path); + return new_path; + } + else { + return old_path; + } +} + +static void do_version_bbone_easing_fcurve_fix(ID *UNUSED(id), FCurve *fcu, void *UNUSED(user_data)) +{ + /* F-Curve's path (for bbone_in/out) */ + if (fcu->rna_path) { + fcu->rna_path = replace_bbone_easing_rnapath(fcu->rna_path); + } + + /* Driver -> Driver Vars (for bbone_in/out) */ + if (fcu->driver) { + for (DriverVar *dvar = fcu->driver->variables.first; dvar; dvar = dvar->next) { + DRIVER_TARGETS_LOOPER(dvar) + { + if (dtar->rna_path) { + dtar->rna_path = replace_bbone_easing_rnapath(dtar->rna_path); + } + } + DRIVER_TARGETS_LOOPER_END; + } + } + + /* FModifiers -> Stepped (for frame_start/end) */ + if (fcu->modifiers.first) { + for (FModifier *fcm = fcu->modifiers.first; fcm; fcm = fcm->next) { + if (fcm->type == FMODIFIER_TYPE_STEPPED) { + FMod_Stepped *data = fcm->data; + + /* Modifier doesn't work if the modifier's copy of start/end frame are both 0 + * as those were only getting written to the fcm->data copy (T52009) + */ + if ((fcm->sfra == fcm->efra) && (fcm->sfra == 0)) { + fcm->sfra = data->start_frame; + fcm->efra = data->end_frame; + } + } + } + } +} + + void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) { if (!MAIN_VERSION_ATLEAST(main, 270, 0)) { @@ -1742,4 +1804,10 @@ void do_versions_after_linking_270(Main *main) } } FOREACH_NODETREE_END } + + if (!MAIN_VERSION_ATLEAST(main, 279, 2)) { + /* B-Bones (bbone_in/out -> bbone_easein/out) + Stepped FMod Frame Start/End fix */ + /* if (!DNA_struct_elem_find(fd->filesdna, "Bone", "float", "bbone_easein")) */ + BKE_fcurves_main_cb(main, do_version_bbone_easing_fcurve_fix, NULL); + } } |