[Bf-blender-cvs] [23c42898a1f] greasepencil-object: Add inverse filter options for modifiers
Antonio Vazquez
noreply at git.blender.org
Wed Jul 19 14:04:07 CEST 2017
Commit: 23c42898a1fb090587498e1da062b73659fc38f1
Author: Antonio Vazquez
Date: Wed Jul 19 14:03:57 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB23c42898a1fb090587498e1da062b73659fc38f1
Add inverse filter options for modifiers
===================================================================
M release/scripts/startup/bl_ui/properties_data_modifier.py
M source/blender/blenkernel/intern/gpencil.c
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesrna/intern/rna_modifier.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 0597dc03418..e77ae851db2 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1544,8 +1544,12 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col = split.column()
col.label("Layer:")
- col.prop_search(md, "layer", gpd, "layers", text="", icon="GREASEPENCIL")
- col.prop(md, "passindex", text="Pass")
+ row = col.row(align=True)
+ row.prop_search(md, "layer", gpd, "layers", text="", icon="GREASEPENCIL")
+ row.prop(md, "inverse_layers", text="", icon="ARROW_LEFTRIGHT")
+ row = col.row(align=True)
+ row.prop(md, "passindex", text="Pass")
+ row.prop(md, "inverse_pass", text="", icon="ARROW_LEFTRIGHT")
row = layout.row(align=True)
row.label("Affect:")
@@ -1562,12 +1566,15 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
row = col.row(align=True)
row.prop(md, "level")
row.prop(md, "simple", text="", icon="PARTICLE_POINT")
- col.prop(md, "passindex", text="Pass")
-
+ row = col.row(align=True)
+ row.prop(md, "passindex", text="Pass")
+ row.prop(md, "inverse_pass", text="", icon="ARROW_LEFTRIGHT")
col = split.column()
col.label("Layer:")
- col.prop_search(md, "layer", gpd, "layers", text="", icon="GREASEPENCIL")
+ row = col.row(align=True)
+ row.prop_search(md, "layer", gpd, "layers", text="", icon="GREASEPENCIL")
+ row.prop(md, "inverse_layers", text="", icon="ARROW_LEFTRIGHT")
def GP_THICK(self, layout, ob, md):
gpd = ob.grease_pencil
@@ -1576,11 +1583,15 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col = split.column()
row = col.row(align=True)
row.prop(md, "thickness")
- col.prop(md, "passindex", text="Pass")
+ row = col.row(align=True)
+ row.prop(md, "passindex", text="Pass")
+ row.prop(md, "inverse_pass", text="", icon="ARROW_LEFTRIGHT")
col = split.column()
col.label("Layer:")
- col.prop_search(md, "layer", gpd, "layers", text="", icon="GREASEPENCIL")
+ row = col.row(align=True)
+ row.prop_search(md, "layer", gpd, "layers", text="", icon="GREASEPENCIL")
+ row.prop(md, "inverse_layers", text="", icon="ARROW_LEFTRIGHT")
def GP_TINT(self, layout, ob, md):
gpd = ob.grease_pencil
@@ -1592,8 +1603,12 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col = split.column()
col.label("Layer:")
- col.prop_search(md, "layer", gpd, "layers", text="", icon="GREASEPENCIL")
- col.prop(md, "passindex", text="Pass")
+ row = col.row(align=True)
+ row.prop_search(md, "layer", gpd, "layers", text="", icon="GREASEPENCIL")
+ row.prop(md, "inverse_layers", text="", icon="ARROW_LEFTRIGHT")
+ row = col.row(align=True)
+ row.prop(md, "passindex", text="Pass")
+ row.prop(md, "inverse_pass", text="", icon="ARROW_LEFTRIGHT")
row = layout.row()
row.prop(md, "create_colors")
@@ -1608,8 +1623,12 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col = split.column()
col.label("Layer:")
- col.prop_search(md, "layer", gpd, "layers", text="", icon="GREASEPENCIL")
- col.prop(md, "passindex", text="Pass")
+ row = col.row(align=True)
+ row.prop_search(md, "layer", gpd, "layers", text="", icon="GREASEPENCIL")
+ row.prop(md, "inverse_layers", text="", icon="ARROW_LEFTRIGHT")
+ row = col.row(align=True)
+ row.prop(md, "passindex", text="Pass")
+ row.prop(md, "inverse_pass", text="", icon="ARROW_LEFTRIGHT")
classes = (
DATA_PT_modifiers,
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 88b343ca4ed..983ad984169 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1527,17 +1527,31 @@ BoundBox *BKE_gpencil_boundbox_get(Object *ob)
/******************** Modifiers **********************************/
/* verify if valid layer and pass index */
-static bool is_stroke_affected_by_modifier(char *mlayername, int mpassindex, int minpoints, bGPDlayer *gpl, bGPDstroke *gps)
+static bool is_stroke_affected_by_modifier(char *mlayername, int mpassindex, int minpoints, bGPDlayer *gpl, bGPDstroke *gps, int inv1, int inv2)
{
/* omit if filter by layer */
if (mlayername[0] != '\0') {
- if (!STREQ(mlayername, gpl->info)) {
- return false;
+ if (inv1 == 0) {
+ if (!STREQ(mlayername, gpl->info)) {
+ return false;
+ }
+ }
+ else {
+ if (STREQ(mlayername, gpl->info)) {
+ return false;
+ }
}
}
/* verify pass */
- if (gps->palcolor->index != mpassindex) {
- return false;
+ if (inv2 == 0) {
+ if (gps->palcolor->index != mpassindex) {
+ return false;
+ }
+ }
+ else {
+ if (gps->palcolor->index == mpassindex) {
+ return false;
+ }
}
/* need to have a minimum number of points */
@@ -1590,7 +1604,8 @@ void ED_gpencil_noise_modifier(GpencilNoiseModifierData *mmd, bGPDlayer *gpl, bG
int sc_frame = 0;
int sc_diff = 0;
- if (!is_stroke_affected_by_modifier(mmd->layername, mmd->passindex, 3, gpl, gps)) {
+ if (!is_stroke_affected_by_modifier(mmd->layername, mmd->passindex, 3, gpl, gps,
+ (int) mmd->flag & GP_NOISE_INVERSE_LAYER, (int)mmd->flag & GP_NOISE_INVERSE_PASS)) {
return;
}
@@ -1702,7 +1717,8 @@ void ED_gpencil_subdiv_modifier(GpencilSubdivModifierData *mmd, bGPDlayer *gpl,
int totnewpoints, oldtotpoints;
int i2;
- if (!is_stroke_affected_by_modifier(mmd->layername, mmd->passindex, 2, gpl, gps)) {
+ if (!is_stroke_affected_by_modifier(mmd->layername, mmd->passindex, 3, gpl, gps,
+ (int)mmd->flag & GP_SUBDIV_INVERSE_LAYER, (int)mmd->flag & GP_SUBDIV_INVERSE_PASS)) {
return;
}
@@ -1772,7 +1788,8 @@ void ED_gpencil_subdiv_modifier(GpencilSubdivModifierData *mmd, bGPDlayer *gpl,
/* change stroke thickness */
void ED_gpencil_thick_modifier(GpencilThickModifierData *mmd, bGPDlayer *gpl, bGPDstroke *gps)
{
- if (!is_stroke_affected_by_modifier(mmd->layername, mmd->passindex, 0, gpl, gps)) {
+ if (!is_stroke_affected_by_modifier(mmd->layername, mmd->passindex, 3, gpl, gps,
+ (int)mmd->flag & GP_THICK_INVERSE_LAYER, (int)mmd->flag & GP_THICK_INVERSE_PASS)) {
return;
}
@@ -1782,9 +1799,11 @@ void ED_gpencil_thick_modifier(GpencilThickModifierData *mmd, bGPDlayer *gpl, bG
/* tint strokes */
void ED_gpencil_tint_modifier(GpencilTintModifierData *mmd, bGPDlayer *gpl, bGPDstroke *gps)
{
- if (!is_stroke_affected_by_modifier(mmd->layername, mmd->passindex, 0, gpl, gps)) {
+ if (!is_stroke_affected_by_modifier(mmd->layername, mmd->passindex, 3, gpl, gps,
+ (int)mmd->flag & GP_TINT_INVERSE_LAYER, (int)mmd->flag & GP_TINT_INVERSE_PASS)) {
return;
}
+
interp_v3_v3v3(gps->palcolor->rgb, gps->palcolor->rgb, mmd->rgb, mmd->factor);
interp_v3_v3v3(gps->palcolor->fill, gps->palcolor->fill, mmd->rgb, mmd->factor);
}
@@ -1796,9 +1815,11 @@ void ED_gpencil_array_modifier(int id, GpencilArrayModifierData *mmd, bGPDlayer
bGPDstroke *gps_dst, *old_gps;
float offset[3];
- if (!is_stroke_affected_by_modifier(mmd->layername, mmd->passindex, 0, gpl, gps)) {
+ if (!is_stroke_affected_by_modifier(mmd->layername, mmd->passindex, 3, gpl, gps,
+ (int)mmd->flag & GP_ARRAY_INVERSE_LAYER, (int)mmd->flag & GP_ARRAY_INVERSE_PASS)) {
return;
}
+
/* if temp do not apply if was created by previous modifier to avoid infinite loop */
if (gps->flag & GP_STROKE_TEMP) {
if (gps->mod_idx <= id) {
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 3d0513af56f..e4b1e8b7658 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1636,6 +1636,8 @@ typedef enum eGpencilNoise_Flag {
GP_NOISE_MOD_THICKNESS = (1 << 3),
GP_NOISE_FULL_STROKE = (1 << 4),
GP_NOISE_MOVE_EXTREME = (1 << 5),
+ GP_NOISE_INVERSE_LAYER = (1 << 6),
+ GP_NOISE_INVERSE_PASS = (1 << 7),
} eGpencilNoise_Flag;
@@ -1649,7 +1651,9 @@ typedef struct GpencilSubdivModifierData {
} GpencilSubdivModifierData;
typedef enum eGpencilSubdiv_Flag {
- GP_SUBDIV_SIMPLE = (1 << 0),
+ GP_SUBDIV_SIMPLE = (1 << 0),
+ GP_SUBDIV_INVERSE_LAYER = (1 << 1),
+ GP_SUBDIV_INVERSE_PASS = (1 << 2),
} eGpencilSubdiv_Flag;
typedef struct GpencilThickModifierData {
@@ -1661,6 +1665,11 @@ typedef struct GpencilThickModifierData {
char pad[4];
} GpencilThickModifierData;
+typedef enum eGpencilThick_Flag {
+ GP_THICK_INVERSE_LAYER = (1 << 0),
+ GP_THICK_INVERSE_PASS = (1 << 1),
+} eGpencilThick_Flag;
+
typedef struct GpencilTintModifierData {
ModifierData modifier;
char layername[64]; /* layer name */
@@ -1672,6 +1681,8 @@ typedef struct GpencilTintModifierData {
typedef enum eGpencilTint_Flag {
GP_TINT_CREATE_COLORS = (1 << 0),
+ GP_TINT_INVERSE_LAYER = (1 << 1),
+ GP_TINT_INVERSE_PASS = (1 << 2),
} eGpencilTint_Flag;
typedef struct GpencilArrayModifierData {
@@ -1686,8 +1697,10 @@ typedef struct GpencilArrayModifierData {
} GpencilArrayModifierData;
typedef enum eGpencilArray_Flag {
- GP_ARRAY_RANDOM_SIZE = (1 << 0),
- GP_ARRAY_RANDOM_ROT = (1 << 1),
+ GP_ARRAY_RANDOM_SIZE = (1 << 0),
+ GP_ARRAY_RANDOM_ROT = (1 << 1),
+ GP_ARRAY_INVERSE_LAYER = (1 << 1),
+ GP_ARRAY_INVERSE_PASS = (1 << 2),
} eGpencilArray_Flag;
#define MOD_MESHSEQ_READ_ALL \
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 1e9661dd212..8bd9b7cf9cc 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -4838,6 +4838,16 @@ static void rna_def_modifier_gpencilnoise(BlenderRNA *brna)
RNA_def_property_range(prop, 1, 100);
RNA_def_property_ui_text(prop, "Step", "Number of frames before recalculate random values again");
RNA_def_property_update(prop, 0, "rna_Mo
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list