Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/render/render_opengl.c
| Show First 20 Lines • Show All 873 Lines • ▼ Show 20 Lines | #ifdef DEBUG_TIME | ||||
| oglrender->time_start = PIL_check_seconds_timer(); | oglrender->time_start = PIL_check_seconds_timer(); | ||||
| #endif | #endif | ||||
| return true; | return true; | ||||
| } | } | ||||
| static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) | static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | |||||
| Scene *scene = oglrender->scene; | Scene *scene = oglrender->scene; | ||||
| int i; | int i; | ||||
| if (oglrender->is_animation) { | if (oglrender->is_animation) { | ||||
| /* Trickery part for movie output: | /* Trickery part for movie output: | ||||
| * | * | ||||
| * We MUST write frames in an exact order, so we only let background | * We MUST write frames in an exact order, so we only let background | ||||
| * thread to work on that, and main thread is simply waits for that | * thread to work on that, and main thread is simply waits for that | ||||
| Show All 33 Lines | if (oglrender->mh) { | ||||
| if (oglrender->movie_ctx_arr) { | if (oglrender->movie_ctx_arr) { | ||||
| MEM_freeN(oglrender->movie_ctx_arr); | MEM_freeN(oglrender->movie_ctx_arr); | ||||
| } | } | ||||
| } | } | ||||
| if (oglrender->timer) { /* exec will not have a timer */ | if (oglrender->timer) { /* exec will not have a timer */ | ||||
| Depsgraph *depsgraph = oglrender->depsgraph; | Depsgraph *depsgraph = oglrender->depsgraph; | ||||
| scene->r.cfra = oglrender->cfrao; | scene->r.cfra = oglrender->cfrao; | ||||
| BKE_scene_graph_update_for_newframe(depsgraph, bmain); | BKE_scene_graph_update_for_newframe(depsgraph); | ||||
| WM_event_remove_timer(oglrender->wm, oglrender->win, oglrender->timer); | WM_event_remove_timer(oglrender->wm, oglrender->win, oglrender->timer); | ||||
| } | } | ||||
| WM_cursor_modal_restore(oglrender->win); | WM_cursor_modal_restore(oglrender->win); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, oglrender->scene); | WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, oglrender->scene); | ||||
| ▲ Show 20 Lines • Show All 173 Lines • ▼ Show 20 Lines | static bool schedule_write_result(OGLRender *oglrender, RenderResult *rr) | ||||
| } | } | ||||
| BLI_mutex_unlock(&oglrender->task_mutex); | BLI_mutex_unlock(&oglrender->task_mutex); | ||||
| BLI_task_pool_push(oglrender->task_pool, write_result_func, task_data, true, NULL); | BLI_task_pool_push(oglrender->task_pool, write_result_func, task_data, true, NULL); | ||||
| return true; | return true; | ||||
| } | } | ||||
| static bool screen_opengl_render_anim_step(bContext *C, wmOperator *op) | static bool screen_opengl_render_anim_step(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | |||||
| OGLRender *oglrender = op->customdata; | OGLRender *oglrender = op->customdata; | ||||
| Scene *scene = oglrender->scene; | Scene *scene = oglrender->scene; | ||||
| Depsgraph *depsgraph = oglrender->depsgraph; | Depsgraph *depsgraph = oglrender->depsgraph; | ||||
| char name[FILE_MAX]; | char name[FILE_MAX]; | ||||
| bool ok = false; | bool ok = false; | ||||
| const bool view_context = (oglrender->v3d != NULL); | const bool view_context = (oglrender->v3d != NULL); | ||||
| bool is_movie; | bool is_movie; | ||||
| RenderResult *rr; | RenderResult *rr; | ||||
| /* go to next frame */ | /* go to next frame */ | ||||
| if (CFRA < oglrender->nfra) { | if (CFRA < oglrender->nfra) { | ||||
| CFRA++; | CFRA++; | ||||
| } | } | ||||
| while (CFRA < oglrender->nfra) { | while (CFRA < oglrender->nfra) { | ||||
| BKE_scene_graph_update_for_newframe(depsgraph, bmain); | BKE_scene_graph_update_for_newframe(depsgraph); | ||||
| CFRA++; | CFRA++; | ||||
| } | } | ||||
| is_movie = BKE_imtype_is_movie(scene->r.im_format.imtype); | is_movie = BKE_imtype_is_movie(scene->r.im_format.imtype); | ||||
| if (!is_movie) { | if (!is_movie) { | ||||
| BKE_image_path_from_imformat(name, | BKE_image_path_from_imformat(name, | ||||
| scene->r.pic, | scene->r.pic, | ||||
| Show All 10 Lines | if ((scene->r.mode & R_NO_OVERWRITE) && BLI_exists(name)) { | ||||
| BLI_spin_unlock(&oglrender->reports_lock); | BLI_spin_unlock(&oglrender->reports_lock); | ||||
| ok = true; | ok = true; | ||||
| goto finally; | goto finally; | ||||
| } | } | ||||
| } | } | ||||
| WM_cursor_time(oglrender->win, scene->r.cfra); | WM_cursor_time(oglrender->win, scene->r.cfra); | ||||
| BKE_scene_graph_update_for_newframe(depsgraph, bmain); | BKE_scene_graph_update_for_newframe(depsgraph); | ||||
| if (view_context) { | if (view_context) { | ||||
| if (oglrender->rv3d->persp == RV3D_CAMOB && oglrender->v3d->camera && | if (oglrender->rv3d->persp == RV3D_CAMOB && oglrender->v3d->camera && | ||||
| oglrender->v3d->scenelock) { | oglrender->v3d->scenelock) { | ||||
| /* since BKE_scene_graph_update_for_newframe() is used rather | /* since BKE_scene_graph_update_for_newframe() is used rather | ||||
| * then ED_update_for_newframe() the camera needs to be set */ | * then ED_update_for_newframe() the camera needs to be set */ | ||||
| if (BKE_scene_camera_switch_update(scene)) { | if (BKE_scene_camera_switch_update(scene)) { | ||||
| oglrender->v3d->camera = scene->camera; | oglrender->v3d->camera = scene->camera; | ||||
| ▲ Show 20 Lines • Show All 204 Lines • Show Last 20 Lines | |||||