[Bf-blender-cvs] [0b9350bb51f] temp-eeveelightcache: Eevee: LightCache: Add free operator.
Clément Foucault
noreply at git.blender.org
Mon Jul 9 23:03:41 CEST 2018
Commit: 0b9350bb51f7a813f869ea1c8e51adfcc9664995
Author: Clément Foucault
Date: Mon Jul 9 15:46:57 2018 +0200
Branches: temp-eeveelightcache
https://developer.blender.org/rB0b9350bb51f7a813f869ea1c8e51adfcc9664995
Eevee: LightCache: Add free operator.
===================================================================
M release/scripts/startup/bl_ui/properties_render.py
M source/blender/editors/render/render_intern.h
M source/blender/editors/render/render_ops.c
M source/blender/editors/render/render_shading.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index 3d4993697af..23fa6676cb5 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -719,6 +719,7 @@ class RENDER_PT_eevee_indirect_lighting(RenderButtonsPanel, Panel):
col = layout.column()
col.operator("scene.light_cache_bake", text="Bake Indirect Lighting", icon='RENDER_STILL')
col.operator("scene.light_cache_bake", text="Bake Cubemap Only", icon='LIGHTPROBE_CUBEMAP').subset = "CUBEMAPS"
+ col.operator("scene.light_cache_free", text="Free Lighting Cache")
col.prop(props, "gi_auto_bake")
col.prop(props, "gi_diffuse_bounces")
diff --git a/source/blender/editors/render/render_intern.h b/source/blender/editors/render/render_intern.h
index cea2b23f552..585a7999290 100644
--- a/source/blender/editors/render/render_intern.h
+++ b/source/blender/editors/render/render_intern.h
@@ -57,6 +57,7 @@ void SCENE_OT_view_layer_add(struct wmOperatorType *ot);
void SCENE_OT_view_layer_remove(struct wmOperatorType *ot);
void SCENE_OT_light_cache_bake(struct wmOperatorType *ot);
+void SCENE_OT_light_cache_free(struct wmOperatorType *ot);
void SCENE_OT_render_view_add(struct wmOperatorType *ot);
void SCENE_OT_render_view_remove(struct wmOperatorType *ot);
diff --git a/source/blender/editors/render/render_ops.c b/source/blender/editors/render/render_ops.c
index 3051795ee76..7961ea27fdc 100644
--- a/source/blender/editors/render/render_ops.c
+++ b/source/blender/editors/render/render_ops.c
@@ -63,6 +63,7 @@ void ED_operatortypes_render(void)
WM_operatortype_append(SCENE_OT_render_view_remove);
WM_operatortype_append(SCENE_OT_light_cache_bake);
+ WM_operatortype_append(SCENE_OT_light_cache_free);
#ifdef WITH_FREESTYLE
WM_operatortype_append(SCENE_OT_freestyle_module_add);
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index dc2250f5105..e0dde9b862b 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -816,6 +816,43 @@ void SCENE_OT_light_cache_bake(wmOperatorType *ot)
RNA_def_property_flag(ot->prop, PROP_SKIP_SAVE);
}
+static bool light_cache_free_poll(bContext *C)
+{
+ Scene *scene = CTX_data_scene(C);
+
+ return scene->eevee.light_cache;
+}
+
+static int light_cache_free_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Scene *scene = CTX_data_scene(C);
+
+ if (!scene->eevee.light_cache) {
+ return OPERATOR_CANCELLED;
+ }
+
+ EEVEE_lightcache_free(scene->eevee.light_cache);
+ scene->eevee.light_cache = NULL;
+
+ DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE);
+
+ WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
+
+ return OPERATOR_FINISHED;
+}
+
+void SCENE_OT_light_cache_free(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Free Light Cache";
+ ot->idname = "SCENE_OT_light_cache_free";
+ ot->description = "Free cached indirect lighting";
+
+ /* api callbacks */
+ ot->exec = light_cache_free_exec;
+ ot->poll = light_cache_free_poll;
+}
+
/********************** render view operators *********************/
static bool render_view_remove_poll(bContext *C)
More information about the Bf-blender-cvs
mailing list