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/transform/transform_convert_graph.c')
-rw-r--r--source/blender/editors/transform/transform_convert_graph.c47
1 files changed, 33 insertions, 14 deletions
diff --git a/source/blender/editors/transform/transform_convert_graph.c b/source/blender/editors/transform/transform_convert_graph.c
index 2039daee386..aca2439d5fb 100644
--- a/source/blender/editors/transform/transform_convert_graph.c
+++ b/source/blender/editors/transform/transform_convert_graph.c
@@ -199,7 +199,16 @@ static void graph_key_shortest_dist(
}
}
-void createTransGraphEditData(bContext *C, TransInfo *t)
+/**
+ * It is important to note that this doesn't always act on the selection (like it's usually done),
+ * it acts on a subset of it. E.g. the selection code may leave a hint that we just dragged on a
+ * left or right handle (SIPO_RUNTIME_FLAG_TWEAK_HANDLES_LEFT/RIGHT) and then we only transform the
+ * selected left or right handles accordingly.
+ * The points to be transformed are tagged with BEZT_FLAG_TEMP_TAG; some lower level curve
+ * functions may need to be made aware of this. It's ugly that these act based on selection state
+ * anyway.
+ */
+static void createTransGraphEditData(bContext *C, TransInfo *t)
{
SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first;
Scene *scene = t->scene;
@@ -232,13 +241,14 @@ void createTransGraphEditData(bContext *C, TransInfo *t)
anim_map_flag |= ANIM_get_normalization_flags(&ac);
/* filter data */
- filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE |
+ ANIMFILTER_FCURVESONLY);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* which side of the current frame should be allowed */
/* XXX we still want this mode, but how to get this using standard transform too? */
if (t->mode == TFM_TIME_EXTEND) {
- t->frame_side = transform_convert_frame_side_dir_get(t, (float)CFRA);
+ t->frame_side = transform_convert_frame_side_dir_get(t, (float)scene->r.cfra);
}
else {
/* normal transform - both sides of current frame are considered */
@@ -263,10 +273,10 @@ void createTransGraphEditData(bContext *C, TransInfo *t)
* higher scaling ratios, but is faster than converting all points)
*/
if (adt) {
- cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
+ cfra = BKE_nla_tweakedit_remap(adt, (float)scene->r.cfra, NLATIME_CONVERT_UNMAP);
}
else {
- cfra = (float)CFRA;
+ cfra = (float)scene->r.cfra;
}
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
@@ -369,10 +379,10 @@ void createTransGraphEditData(bContext *C, TransInfo *t)
* higher scaling ratios, but is faster than converting all points)
*/
if (adt) {
- cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
+ cfra = BKE_nla_tweakedit_remap(adt, (float)scene->r.cfra, NLATIME_CONVERT_UNMAP);
}
else {
- cfra = (float)CFRA;
+ cfra = (float)scene->r.cfra;
}
unit_scale = ANIM_unit_mapping_get_factor(
@@ -560,10 +570,10 @@ void createTransGraphEditData(bContext *C, TransInfo *t)
* higher scaling ratios, but is faster than converting all points)
*/
if (adt) {
- cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
+ cfra = BKE_nla_tweakedit_remap(adt, (float)scene->r.cfra, NLATIME_CONVERT_UNMAP);
}
else {
- cfra = (float)CFRA;
+ cfra = (float)scene->r.cfra;
}
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
@@ -885,7 +895,7 @@ static void remake_graph_transdata(TransInfo *t, ListBase *anim_data)
}
}
-void recalcData_graphedit(TransInfo *t)
+static void recalcData_graphedit(TransInfo *t)
{
SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first;
ViewLayer *view_layer = t->view_layer;
@@ -915,7 +925,8 @@ void recalcData_graphedit(TransInfo *t)
flushTransGraphData(t);
/* get curves to check if a re-sort is needed */
- filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE |
+ ANIMFILTER_FCURVESONLY);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* now test if there is a need to re-sort */
@@ -932,7 +943,7 @@ void recalcData_graphedit(TransInfo *t)
dosort++;
}
else {
- calchandles_fcurve_ex(fcu, BEZT_FLAG_TEMP_TAG);
+ BKE_fcurve_handles_recalc_ex(fcu, BEZT_FLAG_TEMP_TAG);
}
/* set refresh tags for objects using this animation,
@@ -958,7 +969,7 @@ void recalcData_graphedit(TransInfo *t)
/** \name Special After Transform Graph
* \{ */
-void special_aftertrans_update__graph(bContext *C, TransInfo *t)
+static void special_aftertrans_update__graph(bContext *C, TransInfo *t)
{
SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first;
bAnimContext ac;
@@ -975,7 +986,8 @@ void special_aftertrans_update__graph(bContext *C, TransInfo *t)
if (ac.datatype) {
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
- short filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
+ short filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE |
+ ANIMFILTER_FCURVESONLY);
/* get channels to work on */
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
@@ -1018,3 +1030,10 @@ void special_aftertrans_update__graph(bContext *C, TransInfo *t)
}
/** \} */
+
+TransConvertTypeInfo TransConvertType_Graph = {
+ /* flags */ (T_POINTS | T_2D_EDIT),
+ /* createTransData */ createTransGraphEditData,
+ /* recalcData */ recalcData_graphedit,
+ /* special_aftertrans_update */ special_aftertrans_update__graph,
+};