[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40344] trunk/blender: Curve back/ front fill changes:

Sergey Sharybin g.ulairi at gmail.com
Mon Sep 19 11:47:59 CEST 2011


Revision: 40344
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40344
Author:   nazgul
Date:     2011-09-19 09:47:58 +0000 (Mon, 19 Sep 2011)
Log Message:
-----------
Curve back/front fill changes:

- Use enum instead of back/front flags combinations.
- This flags behaves differently for 2d/3d curves so use different enums for them.
- This commit shouldn't change existing files.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/properties_data_curve.py
    trunk/blender/source/blender/makesrna/intern/rna_curve.c

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_data_curve.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_data_curve.py	2011-09-19 08:25:31 UTC (rev 40343)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_data_curve.py	2011-09-19 09:47:58 UTC (rev 40344)
@@ -110,8 +110,7 @@
             col.label(text="Fill:")
             sub = col.column()
             sub.active = (curve.dimensions == '2D' or (curve.bevel_object is None and curve.dimensions == '3D'))
-            sub.prop(curve, "use_fill_front")
-            sub.prop(curve, "use_fill_back")
+            sub.prop(curve, "fill_mode", text="")
             col.prop(curve, "use_fill_deform", text="Fill Deformed")
 
 

Modified: trunk/blender/source/blender/makesrna/intern/rna_curve.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_curve.c	2011-09-19 08:25:31 UTC (rev 40343)
+++ trunk/blender/source/blender/makesrna/intern/rna_curve.c	2011-09-19 09:47:58 UTC (rev 40344)
@@ -74,6 +74,20 @@
 	{CU_NURBS, "NURBS", 0, "Ease", ""},
 	{0, NULL, 0, NULL, NULL}};
 
+static const EnumPropertyItem curve3d_fill_mode_items[]= {
+	{0, "FULL", 0, "Full", ""},
+	{CU_BACK, "BACK", 0, "Back", ""},
+	{CU_FRONT, "FRONT", 0, "Front", ""},
+	{CU_FRONT|CU_BACK, "HALF", 0, "Half", ""},
+	{0, NULL, 0, NULL, NULL}};
+
+static const EnumPropertyItem curve2d_fill_mode_items[]= {
+	{0, "NONE", 0, "None", ""},
+	{CU_BACK, "BACK", 0, "Back", ""},
+	{CU_FRONT, "FRONT", 0, "Front", ""},
+	{CU_FRONT|CU_BACK, "BOTH", 0, "Both", ""},
+	{0, NULL, 0, NULL, NULL}};
+
 #ifdef RNA_RUNTIME
 
 #include "BLI_math.h"
@@ -278,7 +292,13 @@
 	}
 }
 
+static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+{
+	Curve *cu= (Curve*)ptr->id.data;
 
+	return (cu->flag&CU_3D)  ? curve3d_fill_mode_items : curve2d_fill_mode_items;
+}
+
 static int rna_Nurb_length(PointerRNA *ptr)
 {
 	Nurb *nu= (Nurb*)ptr->data;
@@ -1345,15 +1365,12 @@
 	RNA_def_property_ui_text(prop, "Dimensions", "Select 2D or 3D curve type");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "use_fill_front", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FRONT);
-	RNA_def_property_ui_text(prop, "Front", "Draw filled front for extruded/beveled curves");
+	prop= RNA_def_property(srna, "fill_mode", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+	RNA_def_property_enum_items(prop, curve3d_fill_mode_items);
+	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Curve_fill_mode_itemf");
+	RNA_def_property_ui_text(prop, "Fill Mode", "Mode of filling curve");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-	
-	prop= RNA_def_property(srna, "use_fill_back", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_BACK);
-	RNA_def_property_ui_text(prop, "Back", "Draw filled back for extruded/beveled curves");
-	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	prop= RNA_def_property(srna, "twist_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "twist_mode");




More information about the Bf-blender-cvs mailing list