[Bf-blender-cvs] [c174ad09f9b] cycles_texture_cache: Cycles: Moved Texture caching options to their own subsection in the UI.

Stefan Werner noreply at git.blender.org
Fri Sep 21 16:23:48 CEST 2018


Commit: c174ad09f9b94dd0a217d625a5c0e1015ca7de28
Author: Stefan Werner
Date:   Wed Sep 19 14:50:51 2018 +0200
Branches: cycles_texture_cache
https://developer.blender.org/rBc174ad09f9b94dd0a217d625a5c0e1015ca7de28

Cycles: Moved Texture caching options to their own subsection in the UI.

===================================================================

M	intern/cycles/blender/addon/properties.py
M	intern/cycles/blender/addon/ui.py
M	intern/cycles/blender/blender_sync.cpp
M	intern/cycles/render/scene.h
M	intern/cycles/render/shader.cpp

===================================================================

diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 4b32a8c6fa2..b5416201761 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -658,6 +658,12 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
             items=enum_texture_limit
         )
 
+        cls.use_texture_cache = BoolProperty(
+            name="Use Texture Cache",
+            default=True,
+            description="Enables out-of-core texturing to save RAM"
+        )
+
         cls.texture_cache_size = IntProperty(
             name="Texture Cache Size (MB)",
             default=0,
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index e863c4f306b..b55992a25cc 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -421,18 +421,6 @@ class CYCLES_RENDER_PT_performance(CyclesButtonsPanel, Panel):
                 subsub.active = False
         subsub.prop(cscene, "use_progressive_refine")
 
-        sub.separator()
-        sub.label(text="Texture Cache:")
-        sub.prop(cscene, "texture_cache_size")
-        sub.prop(cscene, "texture_auto_convert")
-        sub.prop(cscene, "texture_accept_unmipped")
-        sub.prop(cscene, "texture_accept_untiled")
-        sub.prop(cscene, "texture_auto_mip")
-        sub.prop(cscene, "texture_auto_tile")
-        sub.prop(cscene, "texture_tile_size")
-        sub.prop(cscene, "texture_blur_diffuse")
-        sub.prop(cscene, "texture_blur_glossy")
-
         col = split.column()
 
         col.label(text="Final Render:")
@@ -455,6 +443,36 @@ class CYCLES_RENDER_PT_performance(CyclesButtonsPanel, Panel):
         split.prop(rd, "preview_pixel_size", text="")
         split.prop(cscene, "preview_start_resolution")
 
+class CYCLES_RENDER_PT_texture_cache(CyclesButtonsPanel, Panel):
+    bl_label = "Texture Cache"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    def draw_header(self, context):
+        cscene = context.scene.cycles
+
+        self.layout.prop(cscene, "use_texture_cache", text="")
+
+    def draw(self, context):
+        layout = self.layout
+
+        scene = context.scene
+        cscene = scene.cycles
+        rd = scene.render
+        layout.active = cscene.use_texture_cache
+
+        col = layout.column()
+        split = col.split()
+        col = split.column()
+        col.prop(cscene, "texture_auto_convert")
+        col.prop(cscene, "texture_accept_unmipped")
+        col.prop(cscene, "texture_accept_untiled")
+        col.prop(cscene, "texture_auto_mip")
+        col.prop(cscene, "texture_auto_tile")
+        col = split.column()
+        col.prop(cscene, "texture_cache_size")
+        col.prop(cscene, "texture_tile_size")
+        col.prop(cscene, "texture_blur_diffuse")
+        col.prop(cscene, "texture_blur_glossy")
 
 class CYCLES_RENDER_PT_layer_options(CyclesButtonsPanel, Panel):
     bl_label = "Layer"
@@ -1857,6 +1875,7 @@ classes = (
     CYCLES_RENDER_PT_motion_blur,
     CYCLES_RENDER_PT_film,
     CYCLES_RENDER_PT_performance,
+    CYCLES_RENDER_PT_texture_cache,
     CYCLES_RENDER_PT_layer_options,
     CYCLES_RENDER_PT_layer_passes,
     CYCLES_RENDER_PT_views,
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index 6332d2b2c4f..a5c3de71195 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -689,6 +689,7 @@ SceneParams BlenderSync::get_scene_params(BL::Scene& b_scene,
 		params.bvh_layout = DebugFlags().cpu.bvh_layout;
 	}
 
+	params.texture.use_cache  = RNA_boolean_get(&cscene, "use_texture_cache");
 	params.texture.cache_size = RNA_int_get(&cscene, "texture_cache_size");
 	params.texture.auto_convert = RNA_boolean_get(&cscene, "texture_auto_convert");
 	params.texture.accept_unmipped = RNA_boolean_get(&cscene, "texture_accept_unmipped");
diff --git a/intern/cycles/render/scene.h b/intern/cycles/render/scene.h
index a2492d56a3f..b56e53bac72 100644
--- a/intern/cycles/render/scene.h
+++ b/intern/cycles/render/scene.h
@@ -131,13 +131,14 @@ public:
 /* Texture Cache Params */
 class TextureCacheParams {
 public:
-	TextureCacheParams() : cache_size(1024), tile_size(64), diffuse_blur(1.0f/64.f),
+	TextureCacheParams() : use_cache(false), cache_size(1024), tile_size(64), diffuse_blur(1.0f/64.f),
 	glossy_blur(0.0f), auto_convert(true), accept_unmipped(true), accept_untiled(true),
 	auto_tile(true), auto_mip(true) { }
 	
 	bool modified(const TextureCacheParams& params)
 	{
-		return !(cache_size == params.cache_size
+		return !(use_cache == use_cache
+		         && cache_size == params.cache_size
 				 && tile_size == params.tile_size
 				 && diffuse_blur == params.diffuse_blur
 				 && glossy_blur == params.glossy_blur
@@ -147,7 +148,8 @@ public:
 				 && auto_tile == params.auto_tile
 				 && auto_mip == params.auto_mip);
 	}
-	
+
+	bool use_cache;
 	int cache_size;
 	int tile_size;
 	float diffuse_blur;
diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp
index 5213b79a49a..b20af57daa2 100644
--- a/intern/cycles/render/shader.cpp
+++ b/intern/cycles/render/shader.cpp
@@ -483,7 +483,7 @@ void ShaderManager::device_update_common(Device *device,
 	if(scene->shaders.size() == 0)
 		return;
 	
-	if(device->info.type == DEVICE_CPU && (scene->params.shadingsystem == SHADINGSYSTEM_OSL || scene->params.texture.cache_size > 0)) {
+	if(device->info.type == DEVICE_CPU && (scene->params.shadingsystem == SHADINGSYSTEM_OSL || scene->params.texture.use_cache)) {
 		/* set texture system */
 		scene->image_manager->set_oiio_texture_system((void*)ts);
 		OIIOGlobals *oiio_globals = (OIIOGlobals*)device->oiio_memory();



More information about the Bf-blender-cvs mailing list