Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_graph/graph_view.c
| Show First 20 Lines • Show All 207 Lines • ▼ Show 20 Lines | static int graphkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| } | } | ||||
| if (ac.scene == NULL) { | if (ac.scene == NULL) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| scene = ac.scene; | scene = ac.scene; | ||||
| /* Set the range directly. */ | /* Set the range directly. */ | ||||
| get_graph_keyframe_extents(&ac, &min, &max, NULL, NULL, false, false); | get_graph_keyframe_extents(&ac, &min, &max, NULL, NULL, true, false); | ||||
| scene->r.flag |= SCER_PRV_RANGE; | scene->r.flag |= SCER_PRV_RANGE; | ||||
| scene->r.psfra = round_fl_to_int(min); | scene->r.psfra = round_fl_to_int(min); | ||||
| scene->r.pefra = round_fl_to_int(max); | scene->r.pefra = round_fl_to_int(max); | ||||
| /* Set notifier that things have changed. */ | /* Set notifier that things have changed. */ | ||||
| /* XXX: Err... there's nothing for frame ranges yet, but this should do fine too. */ | /* XXX: Err... there's nothing for frame ranges yet, but this should do fine too. */ | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_FRAME, ac.scene); | WM_event_add_notifier(C, NC_SCENE | ND_FRAME, ac.scene); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void GRAPH_OT_previewrange_set(wmOperatorType *ot) | void GRAPH_OT_previewrange_set(wmOperatorType *ot) | ||||
| { | { | ||||
| /* Identifiers */ | /* Identifiers */ | ||||
| ot->name = "Auto-Set Preview Range"; | ot->name = "Set Preview Range to Selected"; | ||||
| ot->idname = "GRAPH_OT_previewrange_set"; | ot->idname = "GRAPH_OT_previewrange_set"; | ||||
| ot->description = "Automatically set Preview Range based on range of keyframes"; | ot->description = "Set Preview Range based on range of selected keyframes"; | ||||
| /* API callbacks */ | /* API callbacks */ | ||||
| ot->exec = graphkeys_previewrange_exec; | ot->exec = graphkeys_previewrange_exec; | ||||
| /* XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier. */ | /* XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier. */ | ||||
| ot->poll = ED_operator_graphedit_active; | ot->poll = ED_operator_graphedit_active; | ||||
| /* Flags */ | /* Flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| ▲ Show 20 Lines • Show All 295 Lines • Show Last 20 Lines | |||||