Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_convert_graph.c
| Show First 20 Lines • Show All 193 Lines • ▼ Show 20 Lines | if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) { | ||||
| td->dist = td->rdist = min_ff(td->dist, fabs(td_iter->center[0] - td->center[0])); | td->dist = td->rdist = min_ff(td->dist, fabs(td_iter->center[0] - td->center[0])); | ||||
| } | } | ||||
| td_iter += 3; | td_iter += 3; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| 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; | SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first; | ||||
| Scene *scene = t->scene; | Scene *scene = t->scene; | ||||
| ARegion *region = t->region; | ARegion *region = t->region; | ||||
| View2D *v2d = ®ion->v2d; | View2D *v2d = ®ion->v2d; | ||||
| TransData *td = NULL; | TransData *td = NULL; | ||||
| TransData2D *td2d = NULL; | TransData2D *td2d = NULL; | ||||
| ▲ Show 20 Lines • Show All 670 Lines • ▼ Show 20 Lines | if (fcu->bezt) { | ||||
| sort_time_fcurve(fcu); | sort_time_fcurve(fcu); | ||||
| /* make sure handles are all set correctly */ | /* make sure handles are all set correctly */ | ||||
| testhandles_fcurve(fcu, BEZT_FLAG_TEMP_TAG, use_handle); | testhandles_fcurve(fcu, BEZT_FLAG_TEMP_TAG, use_handle); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void recalcData_graphedit(TransInfo *t) | static void recalcData_graphedit(TransInfo *t) | ||||
| { | { | ||||
| SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first; | SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first; | ||||
| ViewLayer *view_layer = t->view_layer; | ViewLayer *view_layer = t->view_layer; | ||||
| ListBase anim_data = {NULL, NULL}; | ListBase anim_data = {NULL, NULL}; | ||||
| bAnimContext ac = {NULL}; | bAnimContext ac = {NULL}; | ||||
| int filter; | int filter; | ||||
| ▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Special After Transform Graph | /** \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; | SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first; | ||||
| bAnimContext ac; | bAnimContext ac; | ||||
| const bool use_handle = (sipo->flag & SIPO_NOHANDLES) == 0; | const bool use_handle = (sipo->flag & SIPO_NOHANDLES) == 0; | ||||
| const bool canceled = (t->state == TRANS_CANCEL); | const bool canceled = (t->state == TRANS_CANCEL); | ||||
| const bool duplicate = (t->mode == TFM_TIME_DUPLICATE); | const bool duplicate = (t->mode == TFM_TIME_DUPLICATE); | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | static void special_aftertrans_update__graph(bContext *C, TransInfo *t) | ||||
| * has to be added to not update handle types (see bug 22289). | * has to be added to not update handle types (see bug 22289). | ||||
| */ | */ | ||||
| if (!canceled) { | if (!canceled) { | ||||
| ANIM_editkeyframes_refresh(&ac); | ANIM_editkeyframes_refresh(&ac); | ||||
| } | } | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| TransConvertTypeInfo TransConvertType_Graph = { | |||||
| /* flags */ (T_POINTS | T_2D_EDIT), | |||||
| /* createTransData */ createTransGraphEditData, | |||||
| /* recalcData */ recalcData_graphedit, | |||||
| /* special_aftertrans_update */ special_aftertrans_update__graph, | |||||
| }; | |||||