[Bf-blender-cvs] [484acb2b619] greasepencil-object: Remove Opacity parameter for Colors

Antonio Vazquez noreply at git.blender.org
Wed Jun 6 18:53:11 CEST 2018


Commit: 484acb2b619c8450be73a3d5c245275406a0bf1d
Author: Antonio Vazquez
Date:   Wed Jun 6 18:53:04 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB484acb2b619c8450be73a3d5c245275406a0bf1d

Remove Opacity parameter for Colors

In order to keep consistency with Blender UI, the color has included the alpha factor in the same property and not as separated value.

This improves the material slots too, because now you can set the alpha directly.

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

M	release/scripts/startup/bl_ui/properties_material_gpencil.py
M	source/blender/makesrna/intern/rna_material.c

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

diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index bc827ba84ce..824e181e02a 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -147,23 +147,18 @@ class MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
         layout.use_property_split = True
 
         ma = context.object.active_material
-        if (ma is not None) and (ma.grease_pencil):
+        if ma is not None and ma.grease_pencil is not None:
             gpcolor = ma.grease_pencil
 
-            split = layout.split(percentage=1.0)
-            split.active = not gpcolor.lock
+            col = layout.column()
+            col.active = not gpcolor.lock
 
-            col = split.column(align=True)
-            row = col.row(align=True)
-            row.enabled = not gpcolor.lock
-            row.prop(gpcolor, "mode")
-            col.separator()
+            col.prop(gpcolor, "mode")
 
-            col.enabled = not gpcolor.lock
             col.prop(gpcolor, "stroke_style", text="Style")
 
             if gpcolor.stroke_style == 'TEXTURE':
-                row = layout.row()
+                row = col.row()
                 row.enabled = not gpcolor.lock
                 col = row.column(align=True)
                 col.template_ID(gpcolor, "stroke_image", open="image.open")
@@ -171,15 +166,9 @@ class MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
                 col.prop(gpcolor, "use_pattern", text="Use As Pattern")
 
             if gpcolor.stroke_style == 'SOLID' or gpcolor.use_pattern is True:
-                row = layout.row()
-                col = row.column(align=True)
                 col.prop(gpcolor, "color", text="Color")
-                col.prop(gpcolor, "alpha", slider=True)
 
             # Options
-            row = layout.row()
-            row.active = not gpcolor.lock
-            col = row.column(align=True)
             col.prop(gpcolor, "pass_index")
 
 
@@ -209,7 +198,6 @@ class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, Panel):
 
             if gpcolor.fill_style != 'TEXTURE':
                 col.prop(gpcolor, "fill_color", text="Color")
-                col.prop(gpcolor, "fill_alpha", text="Opacity", slider=True)
                 col.separator()
                 if gpcolor.texture_mix is True or gpcolor.fill_style in ('GRADIENT', 'RADIAL'):
                     col.prop(gpcolor, "mix_factor", text="Mix", slider=True)
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 4e8f1ffb655..84a72355007 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -382,31 +382,18 @@ static void rna_def_material_greasepencil(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_float_sdna(prop, NULL, "stroke_rgba");
-	RNA_def_property_array(prop, 3);
+	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Color", "");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_Material_update");
 
-	prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_float_sdna(prop, NULL, "stroke_rgba[3]");
-	RNA_def_property_range(prop, 0.0, 1.0f);
-	RNA_def_property_ui_text(prop, "Opacity", "Color Opacity");
-	RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_Material_update");
-
 	/* Fill Drawing Color */
 	prop = RNA_def_property(srna, "fill_color", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "fill_rgba");
-	RNA_def_property_array(prop, 3);
+	RNA_def_property_array(prop, 4);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Fill Color", "Color for filling region bounded by each stroke");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_Material_update");
 
-	/* Fill alpha */
-	prop = RNA_def_property(srna, "fill_alpha", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_float_sdna(prop, NULL, "fill_rgba[3]");
-	RNA_def_property_range(prop, 0.0, 1.0f);
-	RNA_def_property_ui_text(prop, "Fill Opacity", "Opacity for filling region bounded by each stroke");
-	RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_Material_update");
-
 	/* Secondary Drawing Color */
 	prop = RNA_def_property(srna, "mix_color", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "mix_rgba");



More information about the Bf-blender-cvs mailing list