Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/render/render_internal.c
| Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_blender_undo.h" | #include "BKE_blender_undo.h" | ||||
| #include "BKE_blender_version.h" | #include "BKE_blender_version.h" | ||||
| #include "BKE_camera.h" | #include "BKE_camera.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_colortools.h" | #include "BKE_colortools.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_image.h" | #include "BKE_image.h" | ||||
| #include "BKE_layer.h" | |||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_node.h" | #include "BKE_node.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_report.h" | #include "BKE_report.h" | ||||
| #include "BKE_sequencer.h" | #include "BKE_sequencer.h" | ||||
| #include "BKE_screen.h" | #include "BKE_screen.h" | ||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "BKE_workspace.h" | |||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "ED_object.h" | #include "ED_object.h" | ||||
| #include "ED_render.h" | #include "ED_render.h" | ||||
| ▲ Show 20 Lines • Show All 707 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| wmWindowManager *wm = CTX_wm_manager(C); | wmWindowManager *wm = CTX_wm_manager(C); | ||||
| Scene *scene = (Scene *) op->customdata; | Scene *scene = (Scene *) op->customdata; | ||||
| /* kill on cancel, because job is using op->reports */ | /* kill on cancel, because job is using op->reports */ | ||||
| WM_jobs_kill_type(wm, scene, WM_JOB_TYPE_RENDER); | WM_jobs_kill_type(wm, scene, WM_JOB_TYPE_RENDER); | ||||
| } | } | ||||
| static void clean_viewport_memory_base(Base *base) | |||||
| { | |||||
| if ((base->flag & BASE_VISIBLED) == 0) { | |||||
| return; | |||||
| } | |||||
| Object *object = base->object; | |||||
| if (object->id.tag & LIB_TAG_DOIT) { | |||||
| return; | |||||
| } | |||||
| object->id.tag &= ~LIB_TAG_DOIT; | |||||
| if (RE_allow_render_generic_object(object)) { | |||||
| BKE_object_free_derived_caches(object); | |||||
| } | |||||
| } | |||||
| static void clean_viewport_memory(Main *bmain, Scene *scene) | static void clean_viewport_memory(Main *bmain, Scene *scene) | ||||
| { | { | ||||
| Object *object; | |||||
| Scene *sce_iter; | Scene *sce_iter; | ||||
| Base *base; | Base *base; | ||||
| for (object = bmain->object.first; object; object = object->id.next) { | /* Tag all the available objects. */ | ||||
| object->id.tag |= LIB_TAG_DOIT; | BKE_main_id_tag_listbase(&bmain->object, LIB_TAG_DOIT, true); | ||||
| } | |||||
| for (SETLOOPER(scene, sce_iter, base)) { | /* Go over all the visible objects. */ | ||||
| if ((base->flag & BASE_VISIBLED) == 0) { | for (wmWindowManager *wm = bmain->wm.first; wm; wm = wm->id.next) { | ||||
| continue; | for (wmWindow *win = wm->windows.first; win; win = win->next) { | ||||
| } | WorkSpace *workspace = BKE_workspace_active_get(win->workspace_hook); | ||||
| if (RE_allow_render_generic_object(base->object)) { | SceneLayer *scene_layer = BKE_scene_layer_from_workspace_get(scene, workspace); | ||||
| base->object->id.tag &= ~LIB_TAG_DOIT; | |||||
| for (base = scene_layer->object_bases.first; base; base = base->next) { | |||||
| clean_viewport_memory_base(base); | |||||
| } | } | ||||
| } | } | ||||
| for (SETLOOPER(scene, sce_iter, base)) { | |||||
| object = base->object; | |||||
| if ((object->id.tag & LIB_TAG_DOIT) == 0) { | |||||
| continue; | |||||
| } | } | ||||
| object->id.tag &= ~LIB_TAG_DOIT; | |||||
| BKE_object_free_derived_caches(object); | for (SETLOOPER_SET_ONLY(scene, sce_iter, base)) { | ||||
| clean_viewport_memory_base(base); | |||||
| } | } | ||||
| } | } | ||||
| /* using context, starts job */ | /* using context, starts job */ | ||||
| static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *event) | static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| { | { | ||||
| /* new render clears all callbacks */ | /* new render clears all callbacks */ | ||||
| Main *mainp; | Main *mainp; | ||||
| ▲ Show 20 Lines • Show All 875 Lines • Show Last 20 Lines | |||||