[Bf-blender-cvs] [bfe63bb] master: Grey out high quality depth of field when it's not supported by GPU

Antony Riakiotakis noreply at git.blender.org
Mon Mar 30 12:49:34 CEST 2015


Commit: bfe63bbfc470bd2deba0c3fdd793b3f59b682979
Author: Antony Riakiotakis
Date:   Mon Mar 30 12:47:37 2015 +0200
Branches: master
https://developer.blender.org/rBbfe63bbfc470bd2deba0c3fdd793b3f59b682979

Grey out high quality depth of field when it's not supported by GPU

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

M	intern/cycles/blender/addon/ui.py
M	release/scripts/startup/bl_ui/properties_data_camera.py
M	source/blender/makesrna/intern/rna_scene.c

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

diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index f0f256f..956d8b9 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -456,11 +456,15 @@ class CyclesCamera_PT_dof(CyclesButtonsPanel, Panel):
         sub = col.row()
         sub.active = cam.dof_object is None
         sub.prop(cam, "dof_distance", text="Distance")
+
+        hq_support = dof_options.is_hq_supported
         sub = col.column(align=True)
         sub.label("Viewport:")
-        sub.prop(dof_options, "use_high_quality")
+        subhq = sub.column()
+        subhq.active = hq_support;
+        subhq.prop(dof_options, "use_high_quality")
         sub.prop(dof_options, "fstop")
-        if dof_options.use_high_quality:
+        if dof_options.use_high_quality and hq_support:
             sub.prop(dof_options, "blades")
  
         col = split.column()
diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py
index bc66e39..e425596 100644
--- a/release/scripts/startup/bl_ui/properties_data_camera.py
+++ b/release/scripts/startup/bl_ui/properties_data_camera.py
@@ -188,12 +188,14 @@ class DATA_PT_camera_dof(CameraButtonsPanel, Panel):
         sub.active = (cam.dof_object is None)
         sub.prop(cam, "dof_distance", text="Distance")
 
+        hq_support = dof_options.is_hq_supported
         col = split.column(align=True)
         col.label("Viewport:")
-        col.prop(dof_options, "use_high_quality")
+        sub = col.column()
+        sub.active = hq_support
+        sub.prop(dof_options, "use_high_quality")
         col.prop(dof_options, "fstop")
-
-        if dof_options.use_high_quality:
+        if dof_options.use_high_quality and hq_support:
             col.prop(dof_options, "blades")
 
 
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 8cf3636..700d1aa 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -45,6 +45,8 @@
 #include "BKE_paint.h"
 #include "BKE_scene.h"
 
+#include "GPU_extensions.h"
+
 #include "RNA_define.h"
 #include "RNA_enum_types.h"
 
@@ -1758,6 +1760,11 @@ static void rna_GPUDOFSettings_blades_set(PointerRNA *ptr, const int value)
 }
 
 
+static int rna_gpu_is_hq_supported_get(PointerRNA *UNUSED(ptr))
+{
+	return GPU_instanced_drawing_support() && GPU_geometry_shader_support();
+}
+
 #else
 
 static void rna_def_transform_orientation(BlenderRNA *brna)
@@ -3947,6 +3954,12 @@ static void rna_def_gpu_dof_fx(BlenderRNA *brna)
 	RNA_def_property_boolean_sdna(prop, NULL, "high_quality", 1);
 	RNA_def_property_ui_text(prop, "High Quality", "Use high quality depth of field");
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+	prop = RNA_def_property(srna, "is_hq_supported", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_funcs(prop, "rna_gpu_is_hq_supported_get", NULL);
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "High Quality", "Use high quality depth of field");
+	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 }
 
 static void rna_def_gpu_ssao_fx(BlenderRNA *brna)




More information about the Bf-blender-cvs mailing list