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:
authorJeroen Bakker <j.bakker@atmind.nl>2018-05-04 18:25:49 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2018-05-04 18:26:10 +0300
commita73c02a17b58427f998fa9d260d1fbcbccbe6e25 (patch)
tree3e09030a7a3055a1e26f897020d48fea57baaf91
parent26d87bd57795c39138ba982cc06a20b466eddb2c (diff)
Workbench: Color selector when in single color mode
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py4
-rw-r--r--source/blender/blenloader/intern/versioning_280.c2
-rw-r--r--source/blender/draw/engines/workbench/workbench_materials.c4
-rw-r--r--source/blender/draw/engines/workbench/workbench_private.h2
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c1
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h4
-rw-r--r--source/blender/makesrna/intern/rna_space.c6
7 files changed, 20 insertions, 3 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index bba39867079..7328f28bfad 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -3548,6 +3548,10 @@ class VIEW3D_PT_shading(Panel):
col.separator()
col.row().prop(shading, "single_color_mode", expand=True)
+ if shading.single_color_mode == 'SINGLE':
+ col.separator()
+ col.row().prop(shading, "single_color", text="")
+
col.separator()
col.row().prop(shading, "light", expand=True)
if shading.light == 'STUDIO':
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index b0cfadacb2c..8cd9c13be32 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -32,6 +32,7 @@
#include <float.h>
#include "BLI_listbase.h"
+#include "BLI_math.h"
#include "BLI_mempool.h"
#include "BLI_string.h"
#include "BLI_string_utf8.h"
@@ -1071,6 +1072,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
if (sl->spacetype == SPACE_VIEW3D) {
View3D *v3d = (View3D *)sl;
v3d->drawtype_ambient_intensity = 0.5;
+ copy_v3_fl(v3d->drawtype_single_color, 1.0f);
v3d->overlays |= V3D_OVERLAY_HIDE_CURSOR;
}
}
diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c
index a7f21223c22..73372ce74ce 100644
--- a/source/blender/draw/engines/workbench/workbench_materials.c
+++ b/source/blender/draw/engines/workbench/workbench_materials.c
@@ -190,7 +190,7 @@ static void get_material_solid_color(WORKBENCH_PrivateData *wpd, Object *ob, Mat
{
static float default_color[] = {1.0f, 1.0f, 1.0f};
if (DRW_object_is_paint_mode(ob) || wpd->drawtype_options & V3D_DRAWOPTION_SINGLE_COLOR) {
- copy_v3_v3(color, default_color);
+ copy_v3_v3(color, wpd->drawtype_single_color);
}
else if (wpd->drawtype_options & V3D_DRAWOPTION_RANDOMIZE) {
uint hash = BLI_ghashutil_strhash_p_murmur(ob->id.name);
@@ -311,12 +311,14 @@ void workbench_materials_cache_init(WORKBENCH_Data *vedata)
wpd->drawtype_options = v3d->drawtype_options;
wpd->drawtype_studiolight = v3d->drawtype_studiolight;
wpd->drawtype_ambient_intensity = v3d->drawtype_ambient_intensity;
+ copy_v3_v3(wpd->drawtype_single_color, v3d->drawtype_single_color);
}
else {
wpd->drawtype_lighting = V3D_LIGHTING_STUDIO;
wpd->drawtype_options = 0;
wpd->drawtype_studiolight = 0;
wpd->drawtype_ambient_intensity = 0.5;
+ copy_v3_fl(wpd->drawtype_single_color, 1.0f);
}
select_deferred_shaders(wpd);
diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h
index 6f1d833a551..c0dfcc4e32f 100644
--- a/source/blender/draw/engines/workbench/workbench_private.h
+++ b/source/blender/draw/engines/workbench/workbench_private.h
@@ -78,8 +78,8 @@ typedef struct WORKBENCH_PrivateData {
short drawtype_lighting;
short drawtype_options;
short drawtype_studiolight;
- short pad;
float drawtype_ambient_intensity;
+ float drawtype_single_color[3];
struct GPUUniformBuffer *world_ubo;
struct DRWShadingGroup *shadow_shgrp;
WORKBENCH_UBO_World world_data;
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 6071b8d8e94..d68c0508e33 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -324,6 +324,7 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene)
v3d->drawtype = OB_SOLID;
v3d->drawtype_lighting = V3D_LIGHTING_STUDIO;
v3d->drawtype_ambient_intensity = 0.5;
+ copy_v3_fl(v3d->drawtype_single_color, 1.0f);
v3d->gridflag = V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_FLOOR;
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 8021ed12e45..f2b7d85810d 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -261,9 +261,11 @@ typedef struct View3D {
short drawtype_options;
short drawtype_studiolight;
float drawtype_ambient_intensity;
-
+ float drawtype_single_color[3];
int overlays;
+ int pad5;
+
View3DDebug debug;
} View3D;
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index bb9c711838a..2c063d5991a 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2250,6 +2250,12 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Color", "Single Color Mode");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_3DViewShading_type_update");
+ prop = RNA_def_property(srna, "single_color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "drawtype_single_color");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Color", "Color for single color mode");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_3DViewShading_type_update");
+
prop = RNA_def_property(srna, "show_shadows", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawtype_options", V3D_DRAWOPTION_SHADOW);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);