Revision: 23188
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23188
Author:   campbellbarton
Date:     2009-09-13 19:38:43 +0200 (Sun, 13 Sep 2009)

Log Message:
-----------
replace curve.curve_2d True/False with curve.dimensions (2D/3D) enum suggested 
by William.

Modified Paths:
--------------
    trunk/blender/release/ui/buttons_data_curve.py
    trunk/blender/source/blender/editors/screen/screen_ops.c
    trunk/blender/source/blender/makesrna/intern/rna_curve.c

Modified: trunk/blender/release/ui/buttons_data_curve.py
===================================================================
--- trunk/blender/release/ui/buttons_data_curve.py      2009-09-13 17:17:28 UTC 
(rev 23187)
+++ trunk/blender/release/ui/buttons_data_curve.py      2009-09-13 17:38:43 UTC 
(rev 23188)
@@ -56,7 +56,7 @@
 
                if not is_surf:
                        row = layout.row()
-                       row.itemR(curve, "curve_2d")
+                       row.itemR(curve, "dimensions", expand=True)
                
                split = layout.split()
                
@@ -64,7 +64,7 @@
                
                if not is_surf:
                        sub = col.column()
-                       sub.active = curve.curve_2d
+                       sub.active = (curve.dimensions=='2D')
                        sub.itemL(text="Caps:")
                        row = sub.row()
                        row.itemR(curve, "front")
@@ -208,7 +208,7 @@
                        if not is_surf:
                                split = layout.split()
                                col = split.column()
-                               col.active = (not curve.curve_2d)
+                               col.active = (curve.dimensions=='3D')
                                
                                col.itemL(text="Interpolation:")
                                col.itemR(act_spline, "tilt_interpolation", 
text="Tilt")

Modified: trunk/blender/source/blender/editors/screen/screen_ops.c
===================================================================
--- trunk/blender/source/blender/editors/screen/screen_ops.c    2009-09-13 
17:17:28 UTC (rev 23187)
+++ trunk/blender/source/blender/editors/screen/screen_ops.c    2009-09-13 
17:38:43 UTC (rev 23188)
@@ -3329,7 +3329,7 @@
        WM_keymap_add_item(keymap, "SCREEN_OT_region_flip", F5KEY, KM_PRESS, 0, 
0);
        WM_keymap_verify_item(keymap, "SCREEN_OT_redo_last", F6KEY, KM_PRESS, 
0, 0);
        
-       RNA_string_set(WM_keymap_add_item(keymap, "SCRIPT_OT_python_file_run", 
F7KEY, KM_PRESS, 0, 0)->ptr, "filename", "test.py");
+       RNA_string_set(WM_keymap_add_item(keymap, "SCRIPT_OT_python_file_run", 
F7KEY, KM_PRESS, 0, 0)->ptr, "path", "test.py");
        WM_keymap_verify_item(keymap, "SCRIPT_OT_python_run_ui_scripts", F8KEY, 
KM_PRESS, 0, 0);
 
        /* files */

Modified: trunk/blender/source/blender/makesrna/intern/rna_curve.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_curve.c    2009-09-13 
17:17:28 UTC (rev 23187)
+++ trunk/blender/source/blender/makesrna/intern/rna_curve.c    2009-09-13 
17:38:43 UTC (rev 23188)
@@ -167,12 +167,18 @@
 }
 
 
-static void rna_Curve_2d_set(PointerRNA *ptr, int value)
+static void rna_Curve_dimension_set(PointerRNA *ptr, int value)
 {
        Curve *cu= (Curve*)ptr->id.data;
        Nurb *nu= cu->editnurb ? cu->editnurb->first : cu->nurb.first;
 
-       if(value) {
+       if(value==CU_3D) {
+               cu->flag |=  CU_3D;
+               for( ; nu; nu= nu->next) {
+                       nu->flag &= ~CU_2D;
+               }
+       }
+       else {
                cu->flag &= ~CU_3D;
                for( ; nu; nu= nu->next) {
                        nu->flag |= CU_2D;
@@ -183,12 +189,6 @@
                                calchandlesNurb(nu);
                }
        }
-       else {
-               cu->flag |=  CU_3D;
-               for( ; nu; nu= nu->next) {
-                       nu->flag &= ~CU_2D;
-               }
-       }
 }
 
 
@@ -675,6 +675,11 @@
                        {CU_TWIST_TANGENT, "TANGENT", 0, "Tangent", "Use the 
tangent to calculate twist"},
                        {0, NULL, 0, NULL, NULL}};
 
+       static const EnumPropertyItem curve_axis_items[]= {
+               {0, "2D", 0, "2D", "Clamp the Z axis of of the curve"},
+               {CU_3D, "3D", 0, "3D", "Allow editing on the Z axis of this 
curve, also alows tilt and curve radius to be used."},
+               {0, NULL, 0, NULL, NULL}};
+                       
        srna= RNA_def_struct(brna, "Curve", "ID");
        RNA_def_struct_ui_text(srna, "Curve", "Curve datablock storing curves, 
splines and NURBS.");
        RNA_def_struct_ui_icon(srna, ICON_CURVE_DATA);
@@ -778,10 +783,12 @@
        RNA_def_property_update(prop, 0, "rna_Curve_update_data");
        
        /* Flags */
-       prop= RNA_def_property(srna, "curve_2d", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CU_3D);
-       RNA_def_property_boolean_funcs(prop, NULL, "rna_Curve_2d_set");
-       RNA_def_property_ui_text(prop, "2D Curve", "Define curve in two 
dimensions only. Note that fill only works when this is enabled.");
+
+       prop= RNA_def_property(srna, "dimensions", PROP_ENUM, PROP_NONE); /* as 
an enum */
+       RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+       RNA_def_property_enum_items(prop, curve_axis_items);
+       RNA_def_property_enum_funcs(prop, NULL, "rna_Curve_dimension_set", 
NULL);
+       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, "front", PROP_BOOLEAN, PROP_NONE);


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

Reply via email to