Commit: ed01da08fdad9f7740da16d32948643bf4365d4c
Author: Antony Riakiotakis
Date:   Fri Nov 21 14:07:25 2014 +0100
Branches: input_method_editor
https://developer.blender.org/rBed01da08fdad9f7740da16d32948643bf4365d4c

Cycles: support for specular color in solid shading mode, available in
the material panel.

Patch by Phillipp Oeser (D62) with some minor modifications, thanks!

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

M       intern/cycles/blender/addon/ui.py
M       source/blender/gpu/intern/gpu_draw.c

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

diff --git a/intern/cycles/blender/addon/ui.py 
b/intern/cycles/blender/addon/ui.py
index e4f34f3..bce98df 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -1020,20 +1020,9 @@ class CyclesMaterial_PT_settings(CyclesButtonsPanel, 
Panel):
         cmat = mat.cycles
 
         split = layout.split()
-
-        col = split.column(align=True)
-        col.prop(mat, "diffuse_color", text="Viewport Color")
-        col.prop(mat, "alpha")
-
-        col = split.column(align=True)
-        col.label()
-        col.prop(mat, "pass_index")
-
-        split = layout.split()
-
         col = split.column()
-        col.label(text="Surface:")
-        col.prop(cmat, "sample_as_light", text="Multiple Importance")
+        col.prop(mat, "pass_index")
+        col.prop(cmat, "sample_as_light")
         col.prop(cmat, "use_transparent_shadow")
 
         col = split.column()
@@ -1044,6 +1033,21 @@ class CyclesMaterial_PT_settings(CyclesButtonsPanel, 
Panel):
         col.prop(cmat, "volume_interpolation", text="")
         col.prop(cmat, "homogeneous_volume", text="Homogeneous")
 
+        layout.separator()
+        layout.label("Viewport Shading:")
+
+        split = layout.split()
+
+        col = split.column()
+        col.label("Diffuse")
+        col.label("Specular")
+        col.label("Hardness")
+
+        col = split.column()
+        col.prop(mat, "diffuse_color", text="")
+        col.prop(mat, "specular_color", text="")
+        col.prop(mat, "specular_hardness", text="")
+
 
 class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
     bl_label = ""
diff --git a/source/blender/gpu/intern/gpu_draw.c 
b/source/blender/gpu/intern/gpu_draw.c
index 622e7b5..0034b1c 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -1391,7 +1391,7 @@ static struct GPUMaterialState {
 /* fixed function material, alpha handed by caller */
 static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material 
*bmat, const int gamma, const Object *ob, const int new_shading_nodes)
 {
-       if (new_shading_nodes || bmat->mode & MA_SHLESS) {
+       if (bmat->mode & MA_SHLESS) {
                copy_v3_v3(smat->diff, &bmat->r);
                smat->diff[3]= 1.0;
 
@@ -1401,6 +1401,19 @@ static void gpu_material_to_fixed(GPUMaterialFixed 
*smat, const Material *bmat,
                zero_v4(smat->spec);
                smat->hard= 0;
        }
+       else if (new_shading_nodes) {
+               copy_v3_v3(smat->diff, &bmat->r);
+               smat->diff[3]= 1.0;
+               
+               copy_v3_v3(smat->spec, &bmat->specr);
+               smat->spec[3] = 1.0;
+               smat->hard= CLAMPIS(bmat->har, 0, 128);
+               
+               if (gamma) {
+                       linearrgb_to_srgb_v3_v3(smat->diff, smat->diff);
+                       linearrgb_to_srgb_v3_v3(smat->spec, smat->spec);
+               }               
+       }
        else {
                mul_v3_v3fl(smat->diff, &bmat->r, bmat->ref + bmat->emit);
                smat->diff[3]= 1.0; /* caller may set this to bmat->alpha */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to