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:
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r--source/blender/editors/animation/CMakeLists.txt4
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c40
-rw-r--r--source/blender/editors/animation/anim_filter.c14
-rw-r--r--source/blender/editors/animation/anim_ops.c2
-rw-r--r--source/blender/editors/animation/keyframes_edit.c55
5 files changed, 84 insertions, 31 deletions
diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt
index 6fa4d94df3a..0baac40660d 100644
--- a/source/blender/editors/animation/CMakeLists.txt
+++ b/source/blender/editors/animation/CMakeLists.txt
@@ -60,10 +60,6 @@ set(LIB
bf_blenlib
)
-if(WITH_INTERNATIONAL)
- add_definitions(-DWITH_INTERNATIONAL)
-endif()
-
if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 2eaa42ee578..a697fd2fc96 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -35,8 +35,8 @@
#include "DNA_armature_types.h"
#include "DNA_cachefile_types.h"
#include "DNA_camera_types.h"
+#include "DNA_curves_types.h"
#include "DNA_gpencil_types.h"
-#include "DNA_hair_types.h"
#include "DNA_key_types.h"
#include "DNA_lattice_types.h"
#include "DNA_light_types.h"
@@ -700,8 +700,8 @@ static int acf_object_icon(bAnimListElem *ale)
return ICON_OUTLINER_OB_FONT;
case OB_SURF:
return ICON_OUTLINER_OB_SURFACE;
- case OB_HAIR:
- return ICON_OUTLINER_OB_HAIR;
+ case OB_CURVES:
+ return ICON_OUTLINER_OB_CURVES;
case OB_POINTCLOUD:
return ICON_OUTLINER_OB_POINTCLOUD;
case OB_VOLUME:
@@ -2813,15 +2813,15 @@ static bAnimChannelType ACF_DSSPK = {
/* Hair Expander ------------------------------------------- */
/* TODO: just get this from RNA? */
-static int acf_dshair_icon(bAnimListElem *UNUSED(ale))
+static int acf_dscurves_icon(bAnimListElem *UNUSED(ale))
{
- return ICON_HAIR_DATA;
+ return ICON_CURVES_DATA;
}
/* Get the appropriate flag(s) for the setting when it is valid. */
-static int acf_dshair_setting_flag(bAnimContext *UNUSED(ac),
- eAnimChannel_Settings setting,
- bool *neg)
+static int acf_dscurves_setting_flag(bAnimContext *UNUSED(ac),
+ eAnimChannel_Settings setting,
+ bool *neg)
{
/* clear extra return data first */
*neg = false;
@@ -2846,22 +2846,24 @@ static int acf_dshair_setting_flag(bAnimContext *UNUSED(ac),
}
/* get pointer to the setting */
-static void *acf_dshair_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
+static void *acf_dscurves_setting_ptr(bAnimListElem *ale,
+ eAnimChannel_Settings setting,
+ short *type)
{
- Hair *hair = (Hair *)ale->data;
+ Curves *curves = (Curves *)ale->data;
/* clear extra return data first */
*type = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- return GET_ACF_FLAG_PTR(hair->flag, type);
+ return GET_ACF_FLAG_PTR(curves->flag, type);
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
- if (hair->adt) {
- return GET_ACF_FLAG_PTR(hair->adt->flag, type);
+ if (curves->adt) {
+ return GET_ACF_FLAG_PTR(curves->adt->flag, type);
}
return NULL;
@@ -2870,9 +2872,9 @@ static void *acf_dshair_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings se
}
}
-/* hair expander type define */
+/* Curves expander type define */
static bAnimChannelType ACF_DSHAIR = {
- "Hair Expander", /* type name */
+ "Curves Expander", /* type name */
ACHANNEL_ROLE_EXPANDER, /* role */
acf_generic_dataexpand_color, /* backdrop color */
@@ -2882,11 +2884,11 @@ static bAnimChannelType ACF_DSHAIR = {
acf_generic_idblock_name, /* name */
acf_generic_idblock_name_prop, /* name prop */
- acf_dshair_icon, /* icon */
+ acf_dscurves_icon, /* icon */
acf_generic_dataexpand_setting_valid, /* has setting */
- acf_dshair_setting_flag, /* flag for setting */
- acf_dshair_setting_ptr /* pointer for setting */
+ acf_dscurves_setting_flag, /* flag for setting */
+ acf_dscurves_setting_ptr /* pointer for setting */
};
/* PointCloud Expander ------------------------------------------- */
@@ -3418,7 +3420,7 @@ static void acf_gpd_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale),
/* TODO: just get this from RNA? */
static int acf_gpd_icon(bAnimListElem *UNUSED(ale))
{
- return ICON_GREASEPENCIL;
+ return ICON_OUTLINER_OB_GREASEPENCIL;
}
/* check if some setting exists for this channel */
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index c1a09b9d21f..3307385b84a 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -47,8 +47,8 @@
#include "DNA_brush_types.h"
#include "DNA_cachefile_types.h"
#include "DNA_camera_types.h"
+#include "DNA_curves_types.h"
#include "DNA_gpencil_types.h"
-#include "DNA_hair_types.h"
#include "DNA_key_types.h"
#include "DNA_lattice_types.h"
#include "DNA_layer_types.h"
@@ -791,10 +791,10 @@ static bAnimListElem *make_new_animlistelem(void *data,
break;
}
case ANIMTYPE_DSHAIR: {
- Hair *hair = (Hair *)data;
- AnimData *adt = hair->adt;
+ Curves *curves = (Curves *)data;
+ AnimData *adt = curves->adt;
- ale->flag = FILTER_HAIR_OBJD(hair);
+ ale->flag = FILTER_CURVES_OBJD(curves);
ale->key_data = (adt) ? adt->action : NULL;
ale->datatype = ALE_ACT;
@@ -2616,16 +2616,16 @@ static size_t animdata_filter_ds_obdata(
expanded = FILTER_SPK_OBJD(spk);
break;
}
- case OB_HAIR: /* ---------- Hair ----------- */
+ case OB_CURVES: /* ---------- Curves ----------- */
{
- Hair *hair = (Hair *)ob->data;
+ Curves *curves = (Curves *)ob->data;
if (ads->filterflag2 & ADS_FILTER_NOHAIR) {
return 0;
}
type = ANIMTYPE_DSHAIR;
- expanded = FILTER_HAIR_OBJD(hair);
+ expanded = FILTER_CURVES_OBJD(curves);
break;
}
case OB_POINTCLOUD: /* ---------- PointCloud ----------- */
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 1e60a129535..8c52480b89a 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -169,7 +169,7 @@ static void change_frame_apply(bContext *C, wmOperator *op)
FRAMENUMBER_MIN_CLAMP(CFRA);
/* do updates */
- DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK);
+ DEG_id_tag_update(&scene->id, ID_RECALC_FRAME_CHANGE);
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
}
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 145d67b7810..dfe6566df67 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -1283,6 +1283,61 @@ static short set_bezt_sine(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
return 0;
}
+static void handle_flatten(float vec[3][3], const int idx, const float direction[2])
+{
+ BLI_assert_msg(idx == 0 || idx == 2, "handle_flatten() expects a handle index");
+
+ add_v2_v2v2(vec[idx], vec[1], direction);
+}
+
+static void handle_set_length(float vec[3][3], const int idx, const float handle_length)
+{
+ BLI_assert_msg(idx == 0 || idx == 2, "handle_set_length() expects a handle index");
+
+ float handle_direction[2];
+ sub_v2_v2v2(handle_direction, vec[idx], vec[1]);
+ normalize_v2_length(handle_direction, handle_length);
+ add_v2_v2v2(vec[idx], vec[1], handle_direction);
+}
+
+void ANIM_fcurve_equalize_keyframes_loop(FCurve *fcu,
+ const eEditKeyframes_Equalize mode,
+ const float handle_length,
+ const bool flatten)
+{
+ uint i;
+ BezTriple *bezt;
+ const float flat_direction_left[2] = {-handle_length, 0.f};
+ const float flat_direction_right[2] = {handle_length, 0.f};
+
+ /* Loop through an F-Curves keyframes. */
+ for (bezt = fcu->bezt, i = 0; i < fcu->totvert; bezt++, i++) {
+ if ((bezt->f2 & SELECT) == 0) {
+ continue;
+ }
+
+ /* Perform handle equalization if mode is 'Both' or 'Left'. */
+ if (mode & EQUALIZE_HANDLES_LEFT) {
+ if (flatten) {
+ handle_flatten(bezt->vec, 0, flat_direction_left);
+ }
+ else {
+ handle_set_length(bezt->vec, 0, handle_length);
+ }
+ }
+
+ /* Perform handle equalization if mode is 'Both' or 'Right'. */
+ if (mode & EQUALIZE_HANDLES_RIGHT) {
+ if (flatten) {
+ handle_flatten(bezt->vec, 2, flat_direction_right);
+ }
+ else {
+ handle_set_length(bezt->vec, 2, handle_length);
+ }
+ }
+ }
+}
+
KeyframeEditFunc ANIM_editkeyframes_ipo(short mode)
{
switch (mode) {