[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38657] branches/nurbs-merge: - Returned back knots type selection rather than checkboxes.
Sergey Sharybin
g.ulairi at gmail.com
Sun Jul 24 14:32:19 CEST 2011
Revision: 38657
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38657
Author: nazgul
Date: 2011-07-24 12:32:18 +0000 (Sun, 24 Jul 2011)
Log Message:
-----------
- Returned back knots type selection rather than checkboxes.
It was overwritten by recent merge.
- Some additional small fixes like moving "Refine" from
curve editing tools to surface editing tools.
TODO:
- Correct poll function for refine operator.
Currently it could be called for beziers which leads to crash.
- cyclic_u is the onyl way to make bezier cyclic, but this flag
could also be used for surfaces which could produce incorrect
knot type.
Modified Paths:
--------------
branches/nurbs-merge/release/scripts/ui/properties_data_curve.py
branches/nurbs-merge/release/scripts/ui/space_view3d_toolbar.py
branches/nurbs-merge/source/blender/makesrna/intern/rna_curve.c
Modified: branches/nurbs-merge/release/scripts/ui/properties_data_curve.py
===================================================================
--- branches/nurbs-merge/release/scripts/ui/properties_data_curve.py 2011-07-24 11:24:30 UTC (rev 38656)
+++ branches/nurbs-merge/release/scripts/ui/properties_data_curve.py 2011-07-24 12:32:18 UTC (rev 38657)
@@ -197,8 +197,6 @@
is_surf = (ob.type == 'SURFACE')
is_poly = (act_spline.type == 'POLY')
- split = layout.split()
-
if is_poly:
# These settings are below but its easier to have
# poly's set aside since they use so few settings
@@ -206,45 +204,38 @@
col.label(text="Cyclic:")
col.prop(act_spline, "use_smooth")
col = split.column()
- col.prop(act_spline, "use_cyclic_u", text="U")
+ col.prop(act_spline, "use_cyclic_u", text="Cyclic")
else:
+ split = layout.split()
col = split.column()
- col.label(text="Cyclic:")
- if act_spline.type == 'NURBS':
- col.label(text="Bezier:")
- col.label(text="Endpoint:")
- col.label(text="Order:")
- col.label(text="Resolution:")
+ if is_surf:
+ col.label(text="Surface type U:")
- col = split.column()
- col.prop(act_spline, "use_cyclic_u", text="U")
-
if act_spline.type == 'NURBS':
sub = col.column()
- # sub.active = (not act_spline.use_cyclic_u)
- sub.prop(act_spline, "use_bezier_u", text="U")
- sub.prop(act_spline, "use_endpoint_u", text="U")
+ sub.prop(act_spline, "knots_type_u", text="")
sub = col.column()
- sub.prop(act_spline, "order_u", text="U")
- col.prop(act_spline, "resolution_u", text="U")
+ col.prop(act_spline, "order_u", text="Order")
+ else:
+ col.prop(act_spline, "use_cyclic_u", text="Cyclic")
+ col.prop(act_spline, "resolution_u", text="Resolution")
+
if is_surf:
col = split.column()
- col.prop(act_spline, "use_cyclic_v", text="V")
+ col.label(text="Surface type V:")
- # its a surface, assume its a nurb.
sub = col.column()
- sub.active = (not act_spline.use_cyclic_v)
- sub.prop(act_spline, "use_bezier_v", text="V")
- sub.prop(act_spline, "use_endpoint_v", text="V")
+ sub.prop(act_spline, "knots_type_v", text="")
+
sub = col.column()
- sub.prop(act_spline, "order_v", text="V")
- sub.prop(act_spline, "resolution_v", text="V")
+ col.prop(act_spline, "order_v", text="Order")
- if not is_surf:
+ col.prop(act_spline, "resolution_v", text="Resolution")
+ else:
split = layout.split()
col = split.column()
col.active = (curve.dimensions == '3D')
Modified: branches/nurbs-merge/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- branches/nurbs-merge/release/scripts/ui/space_view3d_toolbar.py 2011-07-24 11:24:30 UTC (rev 38656)
+++ branches/nurbs-merge/release/scripts/ui/space_view3d_toolbar.py 2011-07-24 12:32:18 UTC (rev 38657)
@@ -201,8 +201,6 @@
col.operator("curve.extrude")
col.operator("curve.subdivide")
- col.operator("curve.refine")
-
col = layout.column(align=True)
col.label(text="Repeat:")
col.operator("screen.repeat_last")
@@ -243,6 +241,8 @@
col.operator("curve.extrude")
col.operator("curve.subdivide")
+ col.operator("curve.surface_refine")
+
col = layout.column(align=True)
col.label(text="Repeat:")
col.operator("screen.repeat_last")
Modified: branches/nurbs-merge/source/blender/makesrna/intern/rna_curve.c
===================================================================
--- branches/nurbs-merge/source/blender/makesrna/intern/rna_curve.c 2011-07-24 11:24:30 UTC (rev 38656)
+++ branches/nurbs-merge/source/blender/makesrna/intern/rna_curve.c 2011-07-24 12:32:18 UTC (rev 38657)
@@ -561,6 +561,22 @@
return BLI_strdup("");
}
+static void rna_Curve_knotsTypeU_set(PointerRNA *ptr, int value)
+{
+ Nurb *nu= (Nurb*)ptr->data;
+
+ nu->flagu &= ~(CU_NURB_BEZIER | CU_NURB_ENDPOINT | CU_NURB_CYCLIC);
+ nu->flagu|= value;
+}
+
+static void rna_Curve_knotsTypeV_set(PointerRNA *ptr, int value)
+{
+ Nurb *nu= (Nurb*)ptr->data;
+
+ nu->flagv &= ~(CU_NURB_BEZIER | CU_NURB_ENDPOINT | CU_NURB_CYCLIC);
+ nu->flagv|= value;
+}
+
#else
static void rna_def_bpoint(BlenderRNA *brna)
@@ -1286,6 +1302,13 @@
{KEY_CU_EASE, "EASE", 0, "Ease", ""}, /* todo, define somewhere, not one of BEZT_IPO_* */
{0, NULL, 0, NULL, NULL}};
+ static const EnumPropertyItem curve_knots_items[]= {
+ {CU_NURB_ENDPOINT, "CLAMPED", 0, "Clamped", "Make this nurbs surface meet the endpoints."},
+ {CU_NURB_UNCLAMPED, "UNCLAMPED", 0, "Unclamped", "Make this curve or surface open at the endpoints."},
+ {CU_NURB_CYCLIC, "CYCLIC", 0, "Cyclic", "Make this curve or surface a closed loop."},
+ {CU_NURB_BEZIER, "BEZIER", 0, "Bezier", "Make this nurbs curve or surface act like a bezier spline (Order must be 3 or 4)."},
+ {0, NULL, 0, NULL, NULL}};
+
StructRNA *srna;
PropertyRNA *prop;
@@ -1366,38 +1389,25 @@
RNA_def_property_ui_text(prop, "Resolution V", "Surface subdivisions per segment");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+ /* used for beziers and polys only */
prop= RNA_def_property(srna, "use_cyclic_u", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_CYCLIC);
RNA_def_property_ui_text(prop, "Cyclic U", "Make this curve or surface a closed loop in the U direction");
RNA_def_property_update(prop, 0, "rna_Nurb_update_handle_data"); /* only needed for cyclic_u because cyclic_v cant do bezier */
- prop= RNA_def_property(srna, "use_cyclic_v", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_CYCLIC);
- RNA_def_property_ui_text(prop, "Cyclic V", "Make this surface a closed loop in the V direction");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
-
- /* Note, endpoint and bezier flags should never be on at the same time! */
- prop= RNA_def_property(srna, "use_endpoint_u", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_ENDPOINT);
- RNA_def_property_ui_text(prop, "Endpoint U", "Make this nurbs curve or surface meet the endpoints in the U direction (Cyclic U must be disabled)");
+ prop= RNA_def_property(srna, "knots_type_u", PROP_ENUM, PROP_NONE); /* as an enum */
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flagu");
+ RNA_def_property_enum_items(prop, curve_knots_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Curve_knotsTypeU_set", NULL);
+ RNA_def_property_ui_text(prop, "U-knots type", "Knots type in U direction.");
RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
- prop= RNA_def_property(srna, "use_endpoint_v", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_ENDPOINT);
- RNA_def_property_ui_text(prop, "Endpoint V", "Make this nurbs surface meet the endpoints in the V direction (Cyclic V must be disabled)");
- RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
+ prop= RNA_def_property(srna, "knots_type_v", PROP_ENUM, PROP_NONE); /* as an enum */
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flagv");
+ RNA_def_property_enum_items(prop, curve_knots_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Curve_knotsTypeV_set", NULL);
+ RNA_def_property_ui_text(prop, "V-knots type", "Knots type in V direction.");
- prop= RNA_def_property(srna, "use_bezier_u", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_BEZIER);
- RNA_def_property_ui_text(prop, "Bezier U", "Make this nurbs curve or surface act like a bezier spline in the U direction (Order U must be 3 or 4, Cyclic U must be disabled)");
- RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
-
- prop= RNA_def_property(srna, "use_bezier_v", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_BEZIER);
- RNA_def_property_ui_text(prop, "Bezier V", "Make this nurbs surface act like a bezier spline in the V direction (Order V must be 3 or 4, Cyclic V must be disabled)");
- RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
-
/* prop= RNA_def_property(srna, "isolines", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "isovis", 0);
RNA_def_property_ui_text(prop, "Isolines", "Turn on isolines which define the surface in U and V."); //TODO eman better description?
More information about the Bf-blender-cvs
mailing list