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 Cavalcante <mano-wii>2022-07-22 05:44:39 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2022-07-22 16:01:27 +0300
commit98bf714b37c1f1b05a162b6ffdaca367b312de1f (patch)
treed4d1d70efa67275ab3bd77c28040db8607cbe851 /source/blender/editors/transform/transform_convert_graph.c
parent185eeeaaac01bf24930f7e8b25c96f9fa9503073 (diff)
Refactor: arrange transform convert functions in 'TransConvertTypeInfo'
Simplify the transform code by bundling the TransData creation, Data recalculation, and special updates into a single struct. So similar functions and parameters can be accessed without special type checks. Differential Revision: https://developer.blender.org/D15494
Diffstat (limited to 'source/blender/editors/transform/transform_convert_graph.c')
-rw-r--r--source/blender/editors/transform/transform_convert_graph.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/source/blender/editors/transform/transform_convert_graph.c b/source/blender/editors/transform/transform_convert_graph.c
index b57f5b78939..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;
@@ -886,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;
@@ -960,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;
@@ -1021,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,
+};