Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermano <germano.costa@ig.com.br>2017-12-05 16:19:47 +0300
committerGermano <germano.costa@ig.com.br>2017-12-05 16:19:47 +0300
commit6734bb1faf3a4c5c2446ecc4d2261f0d2ea9a39b (patch)
tree6cc83f565c6cff4e27ee4d3a46a0d57ecbe083e9
parentdeaeee8e4d92cfd43e641db6a86273e70a4dae7d (diff)
parent70c2d8a1a2b8b1e8c1f60f30451dbad88fba7188 (diff)
Merge branch 'master' into blender2.8
# Conflicts: # source/blender/editors/mesh/editmesh_select.c
-rw-r--r--release/scripts/startup/bl_ui/properties_data_bone.py8
-rw-r--r--source/blender/blenkernel/BKE_animsys.h8
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c77
-rw-r--r--source/blender/blenloader/intern/versioning_270.c70
-rw-r--r--source/blender/editors/mesh/editmesh_select.c8
-rw-r--r--source/blender/makesrna/intern/rna_armature.c4
6 files changed, 161 insertions, 14 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py b/release/scripts/startup/bl_ui/properties_data_bone.py
index e0e46e4a266..f0ef0032059 100644
--- a/release/scripts/startup/bl_ui/properties_data_bone.py
+++ b/release/scripts/startup/bl_ui/properties_data_bone.py
@@ -188,13 +188,13 @@ class BONE_PT_curved(BoneButtonsPanel, Panel):
row = col.row()
sub = row.column(align=True)
sub.label(text="Scale:")
- sub.prop(bbone, "bbone_scalein", text="Scale In")
- sub.prop(bbone, "bbone_scaleout", text="Scale Out")
+ sub.prop(bbone, "bbone_scalein", text="In")
+ sub.prop(bbone, "bbone_scaleout", text="Out")
sub = row.column(align=True)
sub.label("Easing:")
- sub.prop(bbone, "bbone_easein", text="Ease In")
- sub.prop(bbone, "bbone_easeout", text="Ease Out")
+ sub.prop(bbone, "bbone_easein", text="In")
+ sub.prop(bbone, "bbone_easeout", text="Out")
if pchan:
layout.separator()
diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h
index 622767baa10..cd64cdce2b8 100644
--- a/source/blender/blenkernel/BKE_animsys.h
+++ b/source/blender/blenkernel/BKE_animsys.h
@@ -152,9 +152,15 @@ char *BKE_animdata_driver_path_hack(struct bContext *C, struct PointerRNA *ptr,
/* Define for callback looper used in BKE_animdata_main_cb */
typedef void (*ID_AnimData_Edit_Callback)(struct ID *id, struct AnimData *adt, void *user_data);
+/* Define for callback looper used in BKE_fcurves_main_cb */
+typedef void (*ID_FCurve_Edit_Callback)(struct ID *id, struct FCurve *fcu, void *user_data);
+
/* Loop over all datablocks applying callback */
-void BKE_animdata_main_cb(struct Main *main, ID_AnimData_Edit_Callback func, void *user_data);
+void BKE_animdata_main_cb(struct Main *bmain, ID_AnimData_Edit_Callback func, void *user_data);
+
+/* Loop over all datablocks applying callback to all its F-Curves */
+void BKE_fcurves_main_cb(struct Main *bmain, ID_FCurve_Edit_Callback func, void *user_data);
/* ************************************* */
// TODO: overrides, remapping, and path-finding api's
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 5b7947df9dd..07de2ad6342 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -800,8 +800,7 @@ static void nlastrips_path_rename_fix(ID *owner_id, const char *prefix, const ch
}
}
-/* ----------------------- */
-
+/* Rename Sub-ID Entities in RNA Paths ----------------------- */
/* Fix up the given RNA-Path
*
@@ -947,8 +946,7 @@ void BKE_animdata_fix_paths_rename(ID *owner_id, AnimData *adt, ID *ref_id, cons
MEM_freeN(newN);
}
-/* *************************** */
-/* remove of individual paths */
+/* Remove FCurves with Prefix -------------------------------------- */
/* Check RNA-Paths for a list of F-Curves */
static void fcurves_path_remove_fix(const char *prefix, ListBase *curves)
@@ -976,7 +974,6 @@ static void nlastrips_path_remove_fix(const char *prefix, ListBase *strips)
/* recursively check strips, fixing only actions... */
for (strip = strips->first; strip; strip = strip->next) {
-
/* fix strip's action */
if (strip->act)
fcurves_path_remove_fix(prefix, &strip->act->curves);
@@ -999,7 +996,6 @@ void BKE_animdata_fix_paths_remove(ID *id, const char *prefix)
/* check if there's any AnimData to start with */
if (adt) {
-
/* free fcurves */
if (adt->action)
fcurves_path_remove_fix(prefix, &adt->action->curves);
@@ -1017,6 +1013,75 @@ void BKE_animdata_fix_paths_remove(ID *id, const char *prefix)
}
}
+
+/* Apply Op to All FCurves in Database --------------------------- */
+
+/* "User-Data" wrapper used by BKE_fcurves_main_cb() */
+typedef struct AllFCurvesCbWrapper {
+ ID_FCurve_Edit_Callback func; /* Operation to apply on F-Curve */
+ void *user_data; /* Custom data for that operation */
+} AllFCurvesCbWrapper;
+
+/* Helper for adt_apply_all_fcurves_cb() - Apply wrapped operator to list of F-Curves */
+static void fcurves_apply_cb(ID *id, ListBase *fcurves, ID_FCurve_Edit_Callback func, void *user_data)
+{
+ FCurve *fcu;
+
+ for (fcu = fcurves->first; fcu; fcu = fcu->next) {
+ func(id, fcu, user_data);
+ }
+}
+
+/* Helper for adt_apply_all_fcurves_cb() - Recursively go through each NLA strip */
+static void nlastrips_apply_all_curves_cb(ID *id, ListBase *strips, AllFCurvesCbWrapper *wrapper)
+{
+ NlaStrip *strip;
+
+ for (strip = strips->first; strip; strip = strip->next) {
+ /* fix strip's action */
+ if (strip->act) {
+ fcurves_apply_cb(id, &strip->act->curves, wrapper->func, wrapper->user_data);
+ }
+
+ /* check sub-strips (if metas) */
+ nlastrips_apply_all_curves_cb(id, &strip->strips, wrapper);
+ }
+}
+
+/* Helper for BKE_fcurves_main_cb() - Dispatch wrapped operator to all F-Curves */
+static void adt_apply_all_fcurves_cb(ID *id, AnimData *adt, void *wrapper_data)
+{
+ AllFCurvesCbWrapper *wrapper = wrapper_data;
+ NlaTrack *nlt;
+
+ if (adt->action) {
+ fcurves_apply_cb(id, &adt->action->curves, wrapper->func, wrapper->user_data);
+ }
+
+ if (adt->tmpact) {
+ fcurves_apply_cb(id, &adt->tmpact->curves, wrapper->func, wrapper->user_data);
+ }
+
+ /* free drivers - stored as a list of F-Curves */
+ fcurves_apply_cb(id, &adt->drivers, wrapper->func, wrapper->user_data);
+
+ /* NLA Data - Animation Data for Strips */
+ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
+ nlastrips_apply_all_curves_cb(id, &nlt->strips, wrapper);
+ }
+}
+
+/* apply the given callback function on all F-Curves attached to data in main database */
+void BKE_fcurves_main_cb(Main *mainptr, ID_FCurve_Edit_Callback func, void *user_data)
+{
+ /* Wrap F-Curve operation stuff to pass to the general AnimData-level func */
+ AllFCurvesCbWrapper wrapper = {func, user_data};
+
+ /* Use the AnimData-based function so that we don't have to reimplement all that stuff */
+ BKE_animdata_main_cb(mainptr, adt_apply_all_fcurves_cb, &wrapper);
+}
+
+
/* Whole Database Ops -------------------------------------------- */
/* apply the given callback function on all data in main database */
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);
+ }
}
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index a075ed657d1..3e0afd3095e 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -640,9 +640,17 @@ BMEdge *EDBM_edge_find_nearest_ex(
unsigned int index;
BMEdge *eed;
+ /* Make sure that the edges also are considered to find nearest.
+ * TODO: cleanup: add `selectmode` as a parameter */
+ const short ts_selectmode = vc->scene->toolsettings->selectmode;
+ vc->scene->toolsettings->selectmode |= SCE_SELECT_EDGE;
+
/* No afterqueue (yet), so we check it now, otherwise the bm_xxxofs indices are bad. */
ED_view3d_backbuf_validate(eval_ctx, vc);
+ /* restore `selectmode` */
+ vc->scene->toolsettings->selectmode = ts_selectmode;
+
index = ED_view3d_backbuf_sample_rect(eval_ctx, vc, vc->mval, dist_px, bm_solidoffs, bm_wireoffs, &dist_test);
eed = index ? BM_edge_at_index_find_or_table(bm, index - 1) : NULL;
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index f8a492c3cee..1ec0fd92a67 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -549,14 +549,14 @@ void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone)
RNA_def_property_float_sdna(prop, NULL, "ease1");
RNA_def_property_range(prop, -5.0f, 5.0f);
RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "B-Bone Ease In", "Length of first Bezier Handle (for B-Bones only)");
+ RNA_def_property_ui_text(prop, "Ease In", "Length of first Bezier Handle (for B-Bones only)");
RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
prop = RNA_def_property(srna, "bbone_easeout", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "ease2");
RNA_def_property_range(prop, -5.0f, 5.0f);
RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "B-Bone Ease Out", "Length of second Bezier Handle (for B-Bones only)");
+ RNA_def_property_ui_text(prop, "Ease Out", "Length of second Bezier Handle (for B-Bones only)");
RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
/* Scale In/Out */