Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sound/sound_ops.c
| Show First 20 Lines • Show All 300 Lines • ▼ Show 20 Lines | static void SOUND_OT_update_animation_flags(wmOperatorType *ot) | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER; | ot->flag = OPTYPE_REGISTER; | ||||
| } | } | ||||
| /* ******************************************************* */ | /* ******************************************************* */ | ||||
| static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op)) | static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | |||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| /* NOTE: We will be forcefully evaluating dependency graph at every frame, so no need to ensure | /* NOTE: We will be forcefully evaluating dependency graph at every frame, so no need to ensure | ||||
| * current scene state is evaluated as it will be lost anyway. */ | * current scene state is evaluated as it will be lost anyway. */ | ||||
| struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | ||||
| int oldfra = scene->r.cfra; | int oldfra = scene->r.cfra; | ||||
| int cfra; | int cfra; | ||||
| sound_update_animation_flags_exec(C, NULL); | sound_update_animation_flags_exec(C, NULL); | ||||
| for (cfra = (scene->r.sfra > 0) ? (scene->r.sfra - 1) : 0; cfra <= scene->r.efra + 1; cfra++) { | for (cfra = (scene->r.sfra > 0) ? (scene->r.sfra - 1) : 0; cfra <= scene->r.efra + 1; cfra++) { | ||||
| scene->r.cfra = cfra; | scene->r.cfra = cfra; | ||||
| BKE_scene_graph_update_for_newframe(depsgraph, bmain); | BKE_scene_graph_update_for_newframe(depsgraph); | ||||
| } | } | ||||
| scene->r.cfra = oldfra; | scene->r.cfra = oldfra; | ||||
| BKE_scene_graph_update_for_newframe(depsgraph, bmain); | BKE_scene_graph_update_for_newframe(depsgraph); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static void SOUND_OT_bake_animation(wmOperatorType *ot) | static void SOUND_OT_bake_animation(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Update Animation Cache"; | ot->name = "Update Animation Cache"; | ||||
| ▲ Show 20 Lines • Show All 560 Lines • Show Last 20 Lines | |||||