[Bf-blender-cvs] [d1c089ef8df] greasepencil-object: GPencil: Add new Blend parameter to Glow effect

Antonio Vazquez noreply at git.blender.org
Sat Feb 15 19:18:56 CET 2020


Commit: d1c089ef8df44903994f8c8b06b83d5af55461af
Author: Antonio Vazquez
Date:   Sat Feb 15 19:17:02 2020 +0100
Branches: greasepencil-object
https://developer.blender.org/rBd1c089ef8df44903994f8c8b06b83d5af55461af

GPencil: Add new Blend parameter to Glow effect

Still pending the implementation. This commit only adds the parameter in the UI.

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

M	release/scripts/startup/bl_ui/properties_data_shaderfx.py
M	source/blender/makesdna/DNA_shader_fx_types.h
M	source/blender/makesrna/intern/rna_shader_fx.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_shaderfx.py b/release/scripts/startup/bl_ui/properties_data_shaderfx.py
index 061218cddb8..9b3bf1dfb9f 100644
--- a/release/scripts/startup/bl_ui/properties_data_shaderfx.py
+++ b/release/scripts/startup/bl_ui/properties_data_shaderfx.py
@@ -137,6 +137,7 @@ class DATA_PT_shader_fx(ShaderFxButtonsPanel, Panel):
             layout.prop(fx, "select_color")
 
         layout.separator()
+        layout.prop(fx, "blend_mode", text="Blend")
         layout.prop(fx, "radius")
         layout.prop(fx, "rotation")
         layout.prop(fx, "samples")
diff --git a/source/blender/makesdna/DNA_shader_fx_types.h b/source/blender/makesdna/DNA_shader_fx_types.h
index b13c3361cd5..7c09e183de8 100644
--- a/source/blender/makesdna/DNA_shader_fx_types.h
+++ b/source/blender/makesdna/DNA_shader_fx_types.h
@@ -144,7 +144,8 @@ typedef struct GlowShaderFxData {
   int samples;
   /** Rotation of effect.  */
   float rotation;
-  char _pad[4];
+  /** Blend modes. */
+  int blend_mode;
 
   ShaderFxData_Runtime runtime;
 } GlowShaderFxData;
diff --git a/source/blender/makesrna/intern/rna_shader_fx.c b/source/blender/makesrna/intern/rna_shader_fx.c
index 92447bc4fed..0b8d36fb35d 100644
--- a/source/blender/makesrna/intern/rna_shader_fx.c
+++ b/source/blender/makesrna/intern/rna_shader_fx.c
@@ -22,9 +22,10 @@
 #include <limits.h>
 #include <stdlib.h>
 
-#include "DNA_shader_fx_types.h"
+#include "DNA_gpencil_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
+#include "DNA_shader_fx_types.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -86,6 +87,14 @@ static const EnumPropertyItem rna_enum_shaderfx_colorize_modes_items[] = {
     {eShaderFxColorizeMode_Custom, "CUSTOM", 0, "Custom", ""},
     {0, NULL, 0, NULL, NULL}};
 
+static const EnumPropertyItem rna_enum_glow_blend_modes_items[] = {
+    {eGplBlendMode_Regular, "REGULAR", 0, "Regular", ""},
+    {eGplBlendMode_Add, "ADD", 0, "Add", ""},
+    {eGplBlendMode_Subtract, "SUBTRACT", 0, "Subtract", ""},
+    {eGplBlendMode_Multiply, "MULTIPLY", 0, "Multiply", ""},
+    {eGplBlendMode_Divide, "DIVIDE", 0, "Divide", ""},
+    {0, NULL, 0, NULL, NULL}};
+
 #ifdef RNA_RUNTIME
 
 #  include "BKE_shader_fx.h"
@@ -554,6 +563,13 @@ static void rna_def_shader_fx_glow(BlenderRNA *brna)
   RNA_def_property_range(prop, 0.0f, FLT_MAX);
   RNA_def_property_ui_text(prop, "Rotation", "Rotation of the effect");
   RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+  /* blend mode */
+  prop = RNA_def_property(srna, "blend_mode", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_sdna(prop, NULL, "blend_mode");
+  RNA_def_property_enum_items(prop, rna_enum_glow_blend_modes_items);
+  RNA_def_property_ui_text(prop, "Blend Mode", "Blend mode");
+  RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
 }
 
 static void rna_def_shader_fx_swirl(BlenderRNA *brna)



More information about the Bf-blender-cvs mailing list