[Bf-blender-cvs] [47d04c4af46] soc-2019-npr: LANPR: Added collection target and related options.

YimingWu noreply at git.blender.org
Tue Jun 25 10:55:18 CEST 2019


Commit: 47d04c4af46a2095c42acdf569d6a4472f15e329
Author: YimingWu
Date:   Tue Jun 25 16:54:47 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB47d04c4af46a2095c42acdf569d6a4472f15e329

LANPR: Added collection target and related options.

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

M	release/scripts/startup/bl_ui/properties_collection.py
M	source/blender/makesdna/DNA_collection_types.h
M	source/blender/makesrna/intern/rna_collection.c

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

diff --git a/release/scripts/startup/bl_ui/properties_collection.py b/release/scripts/startup/bl_ui/properties_collection.py
index 73e2ef43bea..e3110155ae2 100644
--- a/release/scripts/startup/bl_ui/properties_collection.py
+++ b/release/scripts/startup/bl_ui/properties_collection.py
@@ -66,10 +66,27 @@ class COLLECTION_PT_lanpr_collection(CollectionButtonsPanel, Panel):
     def draw(self,context):
         layout = self.layout
         collection = context.collection
+        lanpr = collection.lanpr
         row = layout.row()
-        row.prop(collection.lanpr,"usage",expand=True)
-        if collection.lanpr.usage!='INCLUDE':
-            layout.prop(collection.lanpr,"force")
+        row.prop(lanpr,"usage",expand=True)
+        if lanpr.usage!='INCLUDE':
+            layout.prop(lanpr,"force")
+        else:
+            row = layout.row()
+            row.prop(lanpr,"target")
+            
+            if lanpr.target:
+                row = layout.row(align=True)
+                row.prop(lanpr,'use_multiple_levels', icon='GP_MULTIFRAME_EDITING', icon_only=True)
+                row.prop(lanpr,'level_begin')
+                if lanpr.use_multiple_levels:
+                    row.prop(lanpr,'level_end')
+                row = layout.row()
+                row.prop(lanpr,'replace', text='Replace existing frames')
+                row = layout.row()
+                row.prop(lanpr,'layer')
+                row.prop(lanpr,'material')
+
 
 classes = (
     COLLECTION_PT_collection_flags,
diff --git a/source/blender/makesdna/DNA_collection_types.h b/source/blender/makesdna/DNA_collection_types.h
index 78c9b991863..db255ad9a99 100644
--- a/source/blender/makesdna/DNA_collection_types.h
+++ b/source/blender/makesdna/DNA_collection_types.h
@@ -46,7 +46,16 @@ typedef struct CollectionChild {
 typedef struct CollectionLANPR {
   short usage;
   short force; /* force objects with LANPR modifier follow the rule */
+
   char _pad[4];
+
+  struct Object *target;
+  int replace;
+  int layer;
+  int material;
+  int use_multiple_levels;
+  int level_begin;
+  int level_end;
 } CollectionLANPR;
 
 /* CollectionLANPR->mode */
diff --git a/source/blender/makesrna/intern/rna_collection.c b/source/blender/makesrna/intern/rna_collection.c
index 2141f58ff53..6b749bece03 100644
--- a/source/blender/makesrna/intern/rna_collection.c
+++ b/source/blender/makesrna/intern/rna_collection.c
@@ -389,6 +389,39 @@ static void rna_def_collection_lanpr(BlenderRNA *brna, StructRNA *srna)
   RNA_def_property_boolean_default(prop, 0);
   RNA_def_property_ui_text(
       prop, "Force", "Force object who has LANPR modifiers to follow the rule");
+
+  prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+  RNA_def_property_pointer_sdna(prop, NULL, "target");
+  RNA_def_property_ui_text(prop, "Target", "GPencil object to put the stroke result");
+  RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_GPencil_object_poll");
+  RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+
+  prop = RNA_def_property(srna, "replace", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_ui_text(prop, "Replace", "Replace existing GP frames");
+
+  prop = RNA_def_property(srna, "layer", PROP_INT, PROP_NONE);
+  RNA_def_property_range(prop, 0, 100);
+  RNA_def_property_ui_range(prop, 0, 100, 1, -1);
+  RNA_def_property_ui_text(prop, "Layer", "GPencil layer to put the results into");
+
+  prop = RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
+  RNA_def_property_range(prop, 0, 100);
+  RNA_def_property_ui_range(prop, 0, 100, 1, -1);
+  RNA_def_property_ui_text(prop, "Material", "GPencil material to use to generate the results");
+
+  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, "Multiple", "Use multiple occlusion levels");
+
+  prop = RNA_def_property(srna, "level_begin", PROP_INT, PROP_NONE);
+  RNA_def_property_range(prop, 0, 255);
+  RNA_def_property_ui_range(prop, 0, 255, 1, -1);
+  RNA_def_property_ui_text(prop, "Level", "Occlusion level");
+
+  prop = RNA_def_property(srna, "level_end", PROP_INT, PROP_NONE);
+  RNA_def_property_range(prop, 0, 255);
+  RNA_def_property_ui_range(prop, 0, 255, 1, -1);
+  RNA_def_property_ui_text(prop, "To", "Occlusion level");
 }
 
 void RNA_def_collections(BlenderRNA *brna)



More information about the Bf-blender-cvs mailing list