[Bf-blender-cvs] [dea7176dba5] lanpr-under-gp: LANPR: Modifier properties added.

YimingWu noreply at git.blender.org
Sat Jun 27 15:25:01 CEST 2020


Commit: dea7176dba5c0a1ee3f606fe3aea77bbbd112b37
Author: YimingWu
Date:   Sat Jun 27 20:38:46 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rBdea7176dba5c0a1ee3f606fe3aea77bbbd112b37

LANPR: Modifier properties added.

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

M	source/blender/editors/include/ED_lineart.h
M	source/blender/makesdna/DNA_gpencil_modifier_types.h
M	source/blender/makesdna/DNA_lineart_types.h
M	source/blender/makesrna/intern/rna_gpencil_modifier.c

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

diff --git a/source/blender/editors/include/ED_lineart.h b/source/blender/editors/include/ED_lineart.h
index 059d82167d6..e81de82ef70 100644
--- a/source/blender/editors/include/ED_lineart.h
+++ b/source/blender/editors/include/ED_lineart.h
@@ -102,19 +102,6 @@ typedef struct LineartRenderVert {
   char edge_used;
 } LineartRenderVert;
 
-typedef enum eLineartEdgeFlag {
-  LRT_EDGE_FLAG_EDGE_MARK = (1 << 0),
-  LRT_EDGE_FLAG_CONTOUR = (1 << 1),
-  LRT_EDGE_FLAG_CREASE = (1 << 2),
-  LRT_EDGE_FLAG_MATERIAL = (1 << 3),
-  LRT_EDGE_FLAG_INTERSECTION = (1 << 4),
-  /**  floating edge, unimplemented yet */
-  LRT_EDGE_FLAG_FLOATING = (1 << 5),
-  LRT_EDGE_FLAG_CHAIN_PICKED = (1 << 6),
-} eLineartEdgeFlag;
-
-#define LRT_EDGE_FLAG_ALL_TYPE 0x3f
-
 typedef struct LineartRenderLine {
   struct LineartRenderLine *next, *prev;
   struct LineartRenderVert *l, *r;
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index 9f22f664ae2..6e03b0ecb67 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -802,10 +802,27 @@ typedef enum eTextureGpencil_Mode {
   STROKE_AND_FILL = 2,
 } eTextureGpencil_Mode;
 
+typedef enum eLineartGpencilModifierSource {
+  LRT_SOURCE_COLLECTION = 0,
+  LRT_SOURCE_OBJECT = 1,
+} eLineartGpencilModifierSource;
+
 typedef struct LineartGpencilModifierData {
   GpencilModifierData modifier;
 
-  /* Fill in here for Line Art */
+  short line_types; /* line type enable flags, bits in eLineartEdgeFlag */
+
+  char source_type; /* Object or Collection, from eLineartGpencilModifierSource */
+
+  char use_multiple_levels;
+  short level_start;
+  short level_end;
+
+  struct Object *source_gp;
+  struct Collection *source_collection;
+
+  struct Material *target_gp_material;
+  char target_gp_layer[64];
 
 } LineartGpencilModifierData;
 
diff --git a/source/blender/makesdna/DNA_lineart_types.h b/source/blender/makesdna/DNA_lineart_types.h
index 1f6e9151fd8..7a6b619cfd9 100644
--- a/source/blender/makesdna/DNA_lineart_types.h
+++ b/source/blender/makesdna/DNA_lineart_types.h
@@ -40,6 +40,19 @@ struct Object;
 struct Material;
 struct Collection;
 
+typedef enum eLineartEdgeFlag {
+  LRT_EDGE_FLAG_EDGE_MARK = (1 << 0),
+  LRT_EDGE_FLAG_CONTOUR = (1 << 1),
+  LRT_EDGE_FLAG_CREASE = (1 << 2),
+  LRT_EDGE_FLAG_MATERIAL = (1 << 3),
+  LRT_EDGE_FLAG_INTERSECTION = (1 << 4),
+  /**  floating edge, unimplemented yet */
+  LRT_EDGE_FLAG_FLOATING = (1 << 5),
+  LRT_EDGE_FLAG_CHAIN_PICKED = (1 << 6),
+} eLineartEdgeFlag;
+
+#define LRT_EDGE_FLAG_ALL_TYPE 0x3f
+
 typedef enum eLineartTaperSettings {
   LRT_USE_DIFFERENT_TAPER = 0,
   LRT_USE_SAME_TAPER = 1,
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index fc37161e682..55d1bdf7ec2 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -2321,10 +2321,67 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
   StructRNA *srna;
   PropertyRNA *prop;
 
+  static const EnumPropertyItem modifier_lineart_source_type[] = {
+      {LRT_SOURCE_COLLECTION, "COLLECTION", 0, "Collection", ""},
+      {LRT_SOURCE_OBJECT, "OBJECT", 0, "Object", ""},
+      {0, NULL, 0, NULL, NULL},
+  };
+
   srna = RNA_def_struct(brna, "LineartGpencilModifier", "GpencilModifier");
   RNA_def_struct_ui_text(srna, "LRT Modifier", "Genreate LRT strokes from selected source");
   RNA_def_struct_sdna(srna, "LineartGpencilModifierData");
   RNA_def_struct_ui_icon(srna, ICON_MOD_EDGESPLIT);
+
+  prop = RNA_def_property(srna, "source_type", PROP_ENUM, PROP_NONE);
+  RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+  RNA_def_property_enum_items(prop, modifier_lineart_source_type);
+  RNA_def_property_ui_text(prop, "Source Type", "Lineart stroke source type");
+
+  /* types */
+  prop = RNA_def_property(srna, "use_contour", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "line_types", LRT_EDGE_FLAG_CONTOUR);
+  RNA_def_property_ui_text(prop, "Use Contour", "Include contour lines in the result");
+
+  prop = RNA_def_property(srna, "use_crease", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "line_types", LRT_EDGE_FLAG_CREASE);
+  RNA_def_property_ui_text(prop, "Use Crease", "Include crease lines in the result");
+
+  prop = RNA_def_property(srna, "use_material", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "line_types", LRT_EDGE_FLAG_MATERIAL);
+  RNA_def_property_ui_text(
+      prop, "Use Material", "Include material separation lines in the result");
+
+  prop = RNA_def_property(srna, "use_edge_mark", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "line_types", LRT_EDGE_FLAG_EDGE_MARK);
+  RNA_def_property_ui_text(prop, "Use Edge Mark", "Include freestyle edge marks in the result");
+
+  prop = RNA_def_property(srna, "use_intersection", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "line_types", LRT_EDGE_FLAG_INTERSECTION);
+  RNA_def_property_ui_text(prop, "Use Intersection", "Include intersection lines in the result");
+
+  prop = RNA_def_property(srna, "use_multiple_levels", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "use_multiple_levels", 0);
+  RNA_def_property_ui_text(
+      prop, "Use Multiple Levels", "Select lines from multiple occlusion levels");
+
+  prop = RNA_def_property(srna, "level_start", PROP_INT, PROP_NONE);
+  RNA_def_property_int_default(prop, 0);
+  RNA_def_property_ui_text(prop, "Level Start", "Occlusion level start");
+  RNA_def_property_range(prop, 0, 128);
+
+  prop = RNA_def_property(srna, "level_end", PROP_INT, PROP_NONE);
+  RNA_def_property_int_default(prop, 0);
+  RNA_def_property_ui_text(prop, "Level End", "Occlusion level end");
+  RNA_def_property_range(prop, 0, 128);
+
+  prop = RNA_def_property(srna, "target_gp_material", PROP_POINTER, PROP_NONE);
+  RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+  RNA_def_property_struct_type(prop, "Material");
+  RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
+  RNA_def_property_ui_text(prop, "Target Material", "Target material that generated strokes use");
+
+  prop = RNA_def_property(srna, "target_gp_layer", PROP_STRING, PROP_NONE);
+  RNA_def_property_ui_text(prop, "Target Layer", "Grease pencil layer that strokes goes into.");
 }
 
 void RNA_def_greasepencil_modifier(BlenderRNA *brna)



More information about the Bf-blender-cvs mailing list