Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py2
-rw-r--r--source/blender/blenloader/intern/versioning_userdef.c26
-rw-r--r--source/blender/draw/engines/workbench/workbench_effect_taa.c22
-rw-r--r--source/blender/draw/engines/workbench/workbench_private.h23
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h11
-rw-r--r--source/blender/makesrna/intern/rna_scene.c5
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c48
7 files changed, 101 insertions, 36 deletions
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 25252fea887..a14ffc33034 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -611,7 +611,7 @@ class USERPREF_PT_viewport_quality(PreferencePanel, Panel):
flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
- flow.prop(system, "gpu_viewport_quality")
+ flow.prop(system, "viewport_aa")
flow.prop(system, "multi_sample", text="Multisampling")
flow.prop(system, "gpencil_multi_sample", text="Grease Pencil Multisampling")
flow.prop(system, "use_edit_mode_smooth_wire")
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index 1fa1d0b2683..b3e437e39de 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -19,7 +19,7 @@
*
* Version patch user preferences.
*/
-
+#define DNA_DEPRECATED_ALLOW
#include <string.h>
#include "BLI_math.h"
@@ -28,6 +28,7 @@
#include "DNA_userdef_types.h"
#include "DNA_curve_types.h"
#include "DNA_windowmanager_types.h"
+#include "DNA_scene_types.h"
#include "BKE_addon.h"
#include "BKE_colorband.h"
@@ -554,6 +555,29 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
userdef->dupflag |= USER_DUP_GPENCIL;
}
+ if (!USER_VERSION_ATLEAST(280, 60)) {
+ const float GPU_VIEWPORT_QUALITY_FXAA = 0.10f;
+ const float GPU_VIEWPORT_QUALITY_TAA8 = 0.25f;
+ const float GPU_VIEWPORT_QUALITY_TAA16 = 0.6f;
+ const float GPU_VIEWPORT_QUALITY_TAA32 = 0.8f;
+
+ if (userdef->gpu_viewport_quality < GPU_VIEWPORT_QUALITY_FXAA) {
+ userdef->viewport_aa = SCE_DISPLAY_AA_OFF;
+ }
+ else if (userdef->gpu_viewport_quality < GPU_VIEWPORT_QUALITY_TAA8) {
+ userdef->viewport_aa = SCE_DISPLAY_AA_FXAA;
+ }
+ else if (userdef->gpu_viewport_quality < GPU_VIEWPORT_QUALITY_TAA16) {
+ userdef->viewport_aa = SCE_DISPLAY_AA_SAMPLES_8;
+ }
+ else if (userdef->gpu_viewport_quality < GPU_VIEWPORT_QUALITY_TAA32) {
+ userdef->viewport_aa = SCE_DISPLAY_AA_SAMPLES_16;
+ }
+ else {
+ userdef->viewport_aa = SCE_DISPLAY_AA_SAMPLES_32;
+ }
+ }
+
/**
* Include next version bump.
*/
diff --git a/source/blender/draw/engines/workbench/workbench_effect_taa.c b/source/blender/draw/engines/workbench/workbench_effect_taa.c
index 7c411135634..4b54b0772d3 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_taa.c
+++ b/source/blender/draw/engines/workbench/workbench_effect_taa.c
@@ -91,23 +91,19 @@ int workbench_taa_calculate_num_iterations(WORKBENCH_Data *vedata)
WORKBENCH_StorageList *stl = vedata->stl;
WORKBENCH_PrivateData *wpd = stl->g_data;
const Scene *scene = DRW_context_state_get()->scene;
- int result = scene->display.viewport_aa;
+ int result;
if (workbench_is_taa_enabled(wpd)) {
if (DRW_state_is_image_render()) {
- result = scene->display.render_aa;
- }
- else if (IN_RANGE_INCL(wpd->preferences->gpu_viewport_quality,
- GPU_VIEWPORT_QUALITY_TAA8,
- GPU_VIEWPORT_QUALITY_TAA16)) {
- result = MIN2(result, 8);
- }
- else if (IN_RANGE_INCL(wpd->preferences->gpu_viewport_quality,
- GPU_VIEWPORT_QUALITY_TAA16,
- GPU_VIEWPORT_QUALITY_TAA32)) {
- result = MIN2(result, 16);
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ if (draw_ctx->v3d) {
+ result = scene->display.viewport_aa;
+ }
+ else {
+ result = scene->display.render_aa;
+ }
}
else {
- result = MIN2(result, 32);
+ result = wpd->preferences->viewport_aa;
}
}
else {
diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h
index e25503aef6e..09d9ad65717 100644
--- a/source/blender/draw/engines/workbench/workbench_private.h
+++ b/source/blender/draw/engines/workbench/workbench_private.h
@@ -319,23 +319,32 @@ typedef struct WORKBENCH_ObjectData {
BLI_INLINE bool workbench_is_taa_enabled(WORKBENCH_PrivateData *wpd)
{
if (DRW_state_is_image_render()) {
- return DRW_context_state_get()->scene->display.render_aa > SCE_DISPLAY_AA_FXAA;
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ if (draw_ctx->v3d) {
+ return draw_ctx->scene->display.viewport_aa > SCE_DISPLAY_AA_FXAA;
+ }
+ else {
+ return draw_ctx->scene->display.render_aa > SCE_DISPLAY_AA_FXAA;
+ }
}
else {
- return DRW_context_state_get()->scene->display.viewport_aa > SCE_DISPLAY_AA_FXAA &&
- wpd->preferences->gpu_viewport_quality >= GPU_VIEWPORT_QUALITY_TAA8 &&
- !wpd->is_playback;
+ return wpd->preferences->viewport_aa > SCE_DISPLAY_AA_FXAA && !wpd->is_playback;
}
}
BLI_INLINE bool workbench_is_fxaa_enabled(WORKBENCH_PrivateData *wpd)
{
if (DRW_state_is_image_render()) {
- return DRW_context_state_get()->scene->display.render_aa == SCE_DISPLAY_AA_FXAA;
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ if (draw_ctx->v3d) {
+ return draw_ctx->scene->display.viewport_aa == SCE_DISPLAY_AA_FXAA;
+ }
+ else {
+ return draw_ctx->scene->display.render_aa == SCE_DISPLAY_AA_FXAA;
+ }
}
else {
- if (wpd->preferences->gpu_viewport_quality >= GPU_VIEWPORT_QUALITY_FXAA &&
- DRW_context_state_get()->scene->display.viewport_aa == SCE_DISPLAY_AA_FXAA) {
+ if (wpd->preferences->viewport_aa == SCE_DISPLAY_AA_FXAA) {
return true;
}
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 0b83e0d5f4c..ad20597a2b2 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -38,11 +38,6 @@ struct ColorBand;
#define MAX_STYLE_NAME 64
-#define GPU_VIEWPORT_QUALITY_FXAA 0.10f
-#define GPU_VIEWPORT_QUALITY_TAA8 0.25f
-#define GPU_VIEWPORT_QUALITY_TAA16 0.6f
-#define GPU_VIEWPORT_QUALITY_TAA32 0.8f
-
/** default offered by Blender.
* #uiFont.uifont_id */
typedef enum eUIFont_ID {
@@ -635,7 +630,7 @@ typedef struct UserDef {
short undosteps;
char _pad1[2];
int undomemory;
- float gpu_viewport_quality;
+ float gpu_viewport_quality DNA_DEPRECATED;
short gp_manhattendist, gp_euclideandist, gp_eraser;
/** #eGP_UserdefSettings. */
short gp_settings;
@@ -763,7 +758,9 @@ typedef struct UserDef {
char factor_display_type;
- char _pad5[3];
+ char viewport_aa;
+
+ char _pad5[2];
} UserDef;
/* from blenkernel blender.c */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index f1452d001bc..9664fbd3305 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -6592,13 +6592,14 @@ static void rna_def_scene_display(BlenderRNA *brna)
prop = RNA_def_property(srna, "render_aa", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_enum_scene_display_aa_methods);
- RNA_def_property_ui_text(prop, "Render Anti-Aliasing", "Method of anti-aliasing when rendering");
+ RNA_def_property_ui_text(
+ prop, "Render Anti-Aliasing", "Method of anti-aliasing when rendering final image");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
prop = RNA_def_property(srna, "viewport_aa", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_enum_scene_display_aa_methods);
RNA_def_property_ui_text(
- prop, "Viewport Anti-Aliasing", "Method of anti-aliasing in 3d viewport");
+ prop, "Viewport Anti-Aliasing", "Method of anti-aliasing when rendering 3d viewport");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
/* OpenGL render engine settings. */
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index fcdb9b53b10..6cea367c241 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -99,6 +99,45 @@ static const EnumPropertyItem rna_enum_studio_light_type_items[] = {
{0, NULL, 0, NULL, NULL},
};
+static const EnumPropertyItem rna_enum_userdef_viewport_aa_items[] = {
+ {SCE_DISPLAY_AA_OFF,
+ "OFF",
+ 0,
+ "No Anti-Aliasing",
+ "Scene will be rendering without any anti-aliasing"},
+ {SCE_DISPLAY_AA_FXAA,
+ "FXAA",
+ 0,
+ "Single Pass Anti-Aliasing",
+ "Scene will be rendered using a single pass anti-aliasing method (FXAA)"},
+ {SCE_DISPLAY_AA_SAMPLES_5,
+ "5",
+ 0,
+ "5 Samples",
+ "Scene will be rendered using 5 anti-aliasing samples"},
+ {SCE_DISPLAY_AA_SAMPLES_8,
+ "8",
+ 0,
+ "8 Samples",
+ "Scene will be rendered using 8 anti-aliasing samples"},
+ {SCE_DISPLAY_AA_SAMPLES_11,
+ "11",
+ 0,
+ "11 Samples",
+ "Scene will be rendered using 11 anti-aliasing samples"},
+ {SCE_DISPLAY_AA_SAMPLES_16,
+ "16",
+ 0,
+ "16 Samples",
+ "Scene will be rendered using 16 anti-aliasing samples"},
+ {SCE_DISPLAY_AA_SAMPLES_32,
+ "32",
+ 0,
+ "32 Samples",
+ "Scene will be rendered using 32 anti-aliasing samples"},
+ {0, NULL, 0, NULL, NULL},
+};
+
#ifdef RNA_RUNTIME
# include "BLI_math_vector.h"
@@ -4731,12 +4770,11 @@ static void rna_def_userdef_system(BlenderRNA *brna)
prop, "Region Overlap", "Draw tool/property regions over the main region");
RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
- prop = RNA_def_property(srna, "gpu_viewport_quality", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "gpu_viewport_quality");
- RNA_def_property_float_default(prop, 0.6f);
- RNA_def_property_range(prop, 0.0f, 1.0f);
+ prop = RNA_def_property(srna, "viewport_aa", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_userdef_viewport_aa_items);
RNA_def_property_ui_text(
- prop, "Viewport Quality", "Quality setting for Solid mode rendering in the 3d viewport");
+ prop, "Viewport Anti-Aliasing", "Method of anti-aliasing in 3d viewport");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "solid_lights", PROP_COLLECTION, PROP_NONE);