Commit: e1a66201da2595b8d5afd7072a1f3730ca34d04a
Author: Antonioya
Date:   Wed Oct 24 11:02:52 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBe1a66201da2595b8d5afd7072a1f3730ca34d04a

GP: Add layer pass index to time modifier

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

M       release/scripts/startup/bl_ui/properties_data_gpencil.py
M       release/scripts/startup/bl_ui/properties_data_modifier.py
M       source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
M       source/blender/makesdna/DNA_gpencil_modifier_types.h
M       source/blender/makesdna/DNA_gpencil_types.h
M       source/blender/makesrna/intern/rna_gpencil.c
M       source/blender/makesrna/intern/rna_gpencil_modifier.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py 
b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index b53e8c62599..29ba3c1ff83 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -187,6 +187,9 @@ class 
DATA_PT_gpencil_layer_optionpanel(LayerDataButtonsPanel, Panel):
         col = layout.row(align=True)
         col.prop(gpl, "line_change", text="Stroke Thickness")
 
+        col = layout.row(align=True)
+        col.prop(gpl, "pass_index")
+
         col = layout.row(align=True)
         col.prop(gpl, "lock_material")
 
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 55ec0d2c070..36a5c91f44d 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1813,6 +1813,10 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, 
Panel):
         row.prop_search(md, "layer", gpd, "layers", text="", 
icon='GREASEPENCIL')
         row.prop(md, "invert_layers", text="", icon='ARROW_LEFTRIGHT')
 
+        row = layout.row(align=True)
+        row.prop(md, "pass_index", text="Pass")
+        row.prop(md, "invert_pass", text="", icon='ARROW_LEFTRIGHT')
+
         row = layout.row()
         row.enabled = md.mode != 'FIX'
         row.prop(md, "use_keep_loop")
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
index 0096c6c00d5..cb7e508e3db 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
@@ -71,7 +71,8 @@ static int remapTime(
        TimeGpencilModifierData *mmd = (TimeGpencilModifierData *)md;
        const int sfra = scene->r.sfra;
        const int efra = scene->r.efra;
-       const bool invgpl = mmd->flag & GP_SIMPLIFY_INVERT_LAYER;
+       const bool invgpl = mmd->flag & GP_TIME_INVERT_LAYER;
+       const bool invpass = mmd->flag & GP_TIME_INVERT_PASS;
 
        /* omit if filter by layer */
        if (mmd->layername[0] != '\0') {
@@ -86,6 +87,19 @@ static int remapTime(
                        }
                }
        }
+       /* verify pass */
+       if (mmd->pass_index > 0) {
+               if (invpass == false) {
+                       if (gpl->pass_index != mmd->pass_index) {
+                               return cfra;
+                       }
+               }
+               else {
+                       if (gpl->pass_index == mmd->pass_index) {
+                               return cfra;
+                       }
+               }
+       }
 
        /* if fix mode, return predefined frame number */
        if (mmd->mode == GP_TIME_MODE_FIX) {
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h 
b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index 9d543ddbc78..17ec1073c1d 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -143,15 +143,18 @@ typedef enum eThickGpencil_Flag {
 typedef struct TimeGpencilModifierData {
        GpencilModifierData modifier;
        char layername[64];          /* layer name */
+       int pass_index;               /* custom index for passes */
        int flag;                    /* flags */
        int offset;
        float frame_scale;           /* animation scale */
        int mode;
+       char pad_[4];
 } TimeGpencilModifierData;
 
 typedef enum eTimeGpencil_Flag {
        GP_TIME_INVERT_LAYER = (1 << 0),
        GP_TIME_KEEP_LOOP    = (1 << 1),
+       GP_TIME_INVERT_PASS  = (1 << 2),
 } eTimeGpencil_Flag;
 
 typedef enum eTimeGpencil_Mode {
diff --git a/source/blender/makesdna/DNA_gpencil_types.h 
b/source/blender/makesdna/DNA_gpencil_types.h
index 858008afd91..54559ce89f7 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -260,7 +260,7 @@ typedef struct bGPDlayer {
                                                         * needs to be kept 
unique, as it's used as the layer identifier */
 
        short thickness;                /* thickness to apply to strokes 
(Annotations) */
-       char pad_1[2];
+       short pass_index;       /* used to filter groups of layers in modifiers 
*/
 
        struct Object *parent;  /* parent object */
        float inverse[4][4];    /* inverse matrix (only used if parented) */
diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index a02868622e4..de31c884b6b 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1094,6 +1094,12 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Onion Skinning", "Display onion skins 
before and after the current frame");
        RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_GPencil_update");
 
+       /* pass index for compositing and modifiers */
+       prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
+       RNA_def_property_int_sdna(prop, NULL, "pass_index");
+       RNA_def_property_ui_text(prop, "Pass Index", "Index number for the 
\"Layer Index\" pass");
+       RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_GPencil_update");
+
        /* Flags */
        prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_HIDE);
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c 
b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index 0ef07b46309..1230c9862ed 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -750,11 +750,22 @@ static void rna_def_modifier_gpenciltime(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Layer", "Layer name");
        RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
 
+       prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "pass_index");
+       RNA_def_property_range(prop, 0, 100);
+       RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
+       RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
        prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TIME_INVERT_LAYER);
        RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
        RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
 
+       prop = RNA_def_property(srna, "invert_pass", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TIME_INVERT_PASS);
+       RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+       RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
        prop = RNA_def_property(srna, "offset", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "offset");
        RNA_def_property_range(prop, -INT_MAX, INT_MAX);

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

Reply via email to