[Bf-blender-cvs] [e47c6dad094] soc-2019-npr: Cleanup: rna_lanpr.c format

YimingWu noreply at git.blender.org
Wed Aug 7 09:17:10 CEST 2019


Commit: e47c6dad094e7d6deeddc1757d81a2efc923ae25
Author: YimingWu
Date:   Wed Aug 7 15:16:52 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBe47c6dad094e7d6deeddc1757d81a2efc923ae25

Cleanup: rna_lanpr.c format

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

M	source/blender/makesrna/intern/rna_lanpr.c

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

diff --git a/source/blender/makesrna/intern/rna_lanpr.c b/source/blender/makesrna/intern/rna_lanpr.c
index 661d29419a5..8d90c1171fd 100644
--- a/source/blender/makesrna/intern/rna_lanpr.c
+++ b/source/blender/makesrna/intern/rna_lanpr.c
@@ -46,75 +46,20 @@
 
 #else
 
-void RNA_def_lanpr(BlenderRNA *brna)
-{
-
+static void rna_def_lanpr_line_layer(BlenderRNA* brna){
   StructRNA *srna;
   PropertyRNA *prop;
 
-  /* line style layer */
-
-  static const EnumPropertyItem lanpr_line_component_modes[] = {
-      {0, "ALL", 0, "All", "Select All lines, lines are already selected are not affected"},
-      {1, "OBJECT", 0, "Object", "Display lines for selected object"},
-      {2, "MATERIAL", 0, "Material", "Display lines that touches specific material"},
-      {3, "COLLECTION", 0, "Collection", "Display lines in specific collections"},
-      {0, NULL, 0, NULL, NULL}};
-
-  static const EnumPropertyItem rna_enum_lanpr_normal_mode[] = {
-      {LANPR_NORMAL_DIRECTIONAL,
-       "DIRECTIONAL",
-       0,
-       "Directional",
-       "Use directional vector to control line width"},
-      /* Seems working... */
-      {LANPR_NORMAL_POINT, "POINT", 0, "Point", "Use Point Light Style"},
-      {0, NULL, 0, NULL, NULL}};
-
-  srna = RNA_def_struct(brna, "LANPR_LineLayerComponent", NULL);
-  RNA_def_struct_sdna(srna, "LANPR_LineLayerComponent");
-  RNA_def_struct_ui_text(srna, "Line Layer Component", "LANPR_LineLayerComponent");
-
-  prop = RNA_def_property(srna, "component_mode", PROP_ENUM, PROP_NONE);
-  RNA_def_property_enum_items(prop, lanpr_line_component_modes);
-  RNA_def_property_enum_default(prop, 0);
-  RNA_def_property_ui_text(prop, "Mode", "Limit the range of displayed lines");
-
-  prop = RNA_def_property(srna, "object_select", PROP_POINTER, PROP_NONE);
-  RNA_def_property_struct_type(prop, "Object");
-  RNA_def_property_flag(prop, PROP_EDITABLE);
-  RNA_def_property_ui_text(prop, "Object", "Display lines for selected object");
-
-  prop = RNA_def_property(srna, "material_select", PROP_POINTER, PROP_NONE);
-  RNA_def_property_struct_type(prop, "Material");
-  RNA_def_property_flag(prop, PROP_EDITABLE);
-  RNA_def_property_ui_text(prop, "Material", "Display lines that touches specific material");
-
-  prop = RNA_def_property(srna, "collection_select", PROP_POINTER, PROP_NONE);
-  RNA_def_property_struct_type(prop, "Collection");
-  RNA_def_property_flag(prop, PROP_EDITABLE);
-  RNA_def_property_ui_text(prop, "Collection", "Display lines in specific collections");
+static const EnumPropertyItem rna_enum_lanpr_normal_mode[] = {
+    {LANPR_NORMAL_DIRECTIONAL,
+    "DIRECTIONAL",
+    0,
+    "Directional",
+    "Use directional vector to control line width"},
+    /* Seems working... */
+    {LANPR_NORMAL_POINT, "POINT", 0, "Point", "Use Point Light Style"},
+    {0, NULL, 0, NULL, NULL}};
 
-  /* Line type */
-  srna = RNA_def_struct(brna, "LANPR_LineType", NULL);
-  RNA_def_struct_sdna(srna, "LANPR_LineType");
-  RNA_def_struct_ui_text(srna, "Line Type", "LANPR_LineType");
-
-  prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_ui_text(prop, "Enabled", "This line type is enabled");
-
-  prop = RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_NONE);
-  RNA_def_property_float_default(prop, 1.0f);
-  RNA_def_property_ui_text(prop, "Thickness", "Relative thickness to master");
-  RNA_def_property_ui_range(prop, 0.0f, 2.0f, 0.01, 2);
-
-  prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
-  RNA_def_property_float_default(prop, 1.0f);
-  RNA_def_property_array(prop, 3);
-  RNA_def_property_ui_text(prop, "Color", "Color of this line type");
-  RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 2);
-
-  /* Line layer */
   srna = RNA_def_struct(brna, "LANPR_LineLayer", NULL);
   RNA_def_struct_sdna(srna, "LANPR_LineLayer");
   RNA_def_struct_ui_text(srna, "Line Layer", "LANPR_LineLayer");
@@ -215,4 +160,71 @@ void RNA_def_lanpr(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Components", "Line Layer Components");
 }
 
+static void rna_def_lanpr_line_type(BlenderRNA* brna){
+  StructRNA *srna;
+  PropertyRNA *prop;
+
+  srna = RNA_def_struct(brna, "LANPR_LineType", NULL);
+  RNA_def_struct_sdna(srna, "LANPR_LineType");
+  RNA_def_struct_ui_text(srna, "Line Type", "LANPR_LineType");
+
+  prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_ui_text(prop, "Enabled", "This line type is enabled");
+
+  prop = RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_NONE);
+  RNA_def_property_float_default(prop, 1.0f);
+  RNA_def_property_ui_text(prop, "Thickness", "Relative thickness to master");
+  RNA_def_property_ui_range(prop, 0.0f, 2.0f, 0.01, 2);
+
+  prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+  RNA_def_property_float_default(prop, 1.0f);
+  RNA_def_property_array(prop, 3);
+  RNA_def_property_ui_text(prop, "Color", "Color of this line type");
+  RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 2);
+  
+}
+
+static void rna_def_lanpr_line_component(BlenderRNA* brna){
+  StructRNA *srna;
+  PropertyRNA *prop;
+
+  static const EnumPropertyItem lanpr_line_component_modes[] = {
+      {0, "ALL", 0, "All", "Select All lines, lines are already selected are not affected"},
+      {1, "OBJECT", 0, "Object", "Display lines for selected object"},
+      {2, "MATERIAL", 0, "Material", "Display lines that touches specific material"},
+      {3, "COLLECTION", 0, "Collection", "Display lines in specific collections"},
+      {0, NULL, 0, NULL, NULL}};
+
+  srna = RNA_def_struct(brna, "LANPR_LineLayerComponent", NULL);
+  RNA_def_struct_sdna(srna, "LANPR_LineLayerComponent");
+  RNA_def_struct_ui_text(srna, "Line Layer Component", "LANPR_LineLayerComponent");
+
+  prop = RNA_def_property(srna, "component_mode", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_items(prop, lanpr_line_component_modes);
+  RNA_def_property_enum_default(prop, 0);
+  RNA_def_property_ui_text(prop, "Mode", "Limit the range of displayed lines");
+
+  prop = RNA_def_property(srna, "object_select", PROP_POINTER, PROP_NONE);
+  RNA_def_property_struct_type(prop, "Object");
+  RNA_def_property_flag(prop, PROP_EDITABLE);
+  RNA_def_property_ui_text(prop, "Object", "Display lines for selected object");
+
+  prop = RNA_def_property(srna, "material_select", PROP_POINTER, PROP_NONE);
+  RNA_def_property_struct_type(prop, "Material");
+  RNA_def_property_flag(prop, PROP_EDITABLE);
+  RNA_def_property_ui_text(prop, "Material", "Display lines that touches specific material");
+
+  prop = RNA_def_property(srna, "collection_select", PROP_POINTER, PROP_NONE);
+  RNA_def_property_struct_type(prop, "Collection");
+  RNA_def_property_flag(prop, PROP_EDITABLE);
+  RNA_def_property_ui_text(prop, "Collection", "Display lines in specific collections");
+}
+
+void RNA_def_lanpr(BlenderRNA *brna)
+{
+  rna_def_lanpr_line_component(brna);
+  rna_def_lanpr_line_type(brna);
+  rna_def_lanpr_line_layer(brna);
+}
+
 #endif
\ No newline at end of file



More information about the Bf-blender-cvs mailing list