Grey out high quality depth of field when it's not supported by GPU
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user