Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/ui/buttons_data_curve.py107
-rw-r--r--source/blender/editors/object/object_edit.c1
-rw-r--r--source/blender/makesrna/intern/rna_curve.c46
3 files changed, 113 insertions, 41 deletions
diff --git a/release/ui/buttons_data_curve.py b/release/ui/buttons_data_curve.py
index ced3c6597e0..46311493ad3 100644
--- a/release/ui/buttons_data_curve.py
+++ b/release/ui/buttons_data_curve.py
@@ -7,6 +7,13 @@ class DataButtonsPanel(bpy.types.Panel):
__context__ = "data"
def poll(self, context):
+ return (context.object and context.object.type in ('CURVE', 'SURFACE') and context.curve)
+
+class DataButtonsPanelCurve(DataButtonsPanel):
+ '''
+ Same as above but for curves only
+ '''
+ def poll(self, context):
return (context.object and context.object.type == 'CURVE' and context.curve)
class DATA_PT_context_curve(DataButtonsPanel):
@@ -37,17 +44,24 @@ class DATA_PT_shape_curve(DataButtonsPanel):
ob = context.object
curve = context.curve
space = context.space_data
+ is_surf = (ob.type == 'SURFACE')
- layout.itemR(curve, "curve_2d")
+ row = layout.row()
+ row.itemR(curve, "curve_2d")
+ row.itemR(curve, "use_twist_correction")
+
split = layout.split()
col = split.column()
- sub = col.column()
- sub.active = curve.curve_2d
- sub.itemL(text="Caps:")
- sub.itemR(curve, "front")
- sub.itemR(curve, "back")
+
+ if not is_surf:
+ sub = col.column()
+ sub.active = curve.curve_2d
+ sub.itemL(text="Caps:")
+ row = sub.row()
+ row.itemR(curve, "front")
+ row.itemR(curve, "back")
col.itemL(text="Textures:")
# col.itemR(curve, "uv_orco")
@@ -58,23 +72,26 @@ class DATA_PT_shape_curve(DataButtonsPanel):
sub = col.column(align=True)
sub.itemR(curve, "resolution_u", text="Preview U")
sub.itemR(curve, "render_resolution_u", text="Render U")
- sub = col.column(align=True)
- sub.itemR(curve, "resolution_v", text="Preview V")
- sub.itemR(curve, "render_resolution_v", text="Render V")
+
+ if is_surf:
+ sub = col.column(align=True)
+ sub.itemR(curve, "resolution_v", text="Preview V")
+ sub.itemR(curve, "render_resolution_v", text="Render V")
+
# col.itemL(text="Display:")
# col.itemL(text="HANDLES")
# col.itemL(text="NORMALS")
# col.itemR(curve, "vertex_normal_flip")
-class DATA_PT_geometry_curve(DataButtonsPanel):
+class DATA_PT_geometry_curve(DataButtonsPanelCurve):
__label__ = "Geometry "
def draw(self, context):
layout = self.layout
curve = context.curve
-
+
split = layout.split()
col = split.column()
@@ -88,31 +105,32 @@ class DATA_PT_geometry_curve(DataButtonsPanel):
col.itemR(curve, "bevel_depth", text="Depth")
col.itemR(curve, "bevel_resolution", text="Resolution")
col.itemR(curve, "bevel_object", icon='ICON_OUTLINER_OB_CURVE')
+
-class DATA_PT_pathanim(DataButtonsPanel):
+class DATA_PT_pathanim(DataButtonsPanelCurve):
__label__ = "Path Animation"
def draw_header(self, context):
curve = context.curve
- self.layout.itemR(curve, "path", text="")
+ self.layout.itemR(curve, "use_path", text="")
def draw(self, context):
layout = self.layout
curve = context.curve
- layout.active = curve.path
+ layout.active = curve.use_path
split = layout.split()
col = split.column()
col.itemR(curve, "path_length", text="Frames")
- col.itemR(curve, "follow")
+ col.itemR(curve, "use_path_follow")
col = split.column()
- col.itemR(curve, "stretch")
- col.itemR(curve, "offset_path_distance", text="Offset Children")
+ col.itemR(curve, "use_stretch")
+ col.itemR(curve, "use_time_offset", text="Offset Children")
class DATA_PT_current_curve(DataButtonsPanel):
__label__ = "Current Curve"
@@ -120,33 +138,56 @@ class DATA_PT_current_curve(DataButtonsPanel):
def draw(self, context):
layout = self.layout
+ ob = context.object
currentcurve = context.curve.curves[0] # XXX
-
+ is_surf = (ob.type == 'SURFACE')
+
split = layout.split()
-
+
col = split.column()
col.itemL(text="Cyclic:")
- col.itemR(currentcurve, "cyclic_u", text="U")
- col.itemR(currentcurve, "cyclic_v", text="V")
- col.itemL(text="Order:")
- col.itemR(currentcurve, "order_u", text="U")
- col.itemR(currentcurve, "order_v", text="V")
- col.itemL(text="Endpoints:")
- col.itemR(currentcurve, "endpoint_u", text="U")
- col.itemR(currentcurve, "endpoint_v", text="V")
+ if currentcurve.type == 'NURBS':
+ col.itemL(text="Bezier:")
+ col.itemL(text="Endpoint:")
+ col.itemL(text="Order:")
+ col.itemL(text="Resolution:")
+
col = split.column()
- col.itemL(text="Bezier:")
- col.itemR(currentcurve, "bezier_u", text="U")
- col.itemR(currentcurve, "bezier_v", text="V")
- col.itemL(text="Resolution:")
+ col.itemR(currentcurve, "cyclic_u", text="U")
+
+ if currentcurve.type == 'NURBS':
+ sub = col.column()
+ sub.active = (not currentcurve.cyclic_u)
+ sub.itemR(currentcurve, "bezier_u", text="U")
+ sub.itemR(currentcurve, "endpoint_u", text="U")
+
+ sub = col.column()
+ sub.itemR(currentcurve, "order_u", text="U")
col.itemR(currentcurve, "resolution_u", text="U")
- col.itemR(currentcurve, "resolution_v", text="V")
+
+ if is_surf:
+ col = split.column()
+ col.itemR(currentcurve, "cyclic_v", text="V")
+
+ # its a surface, assume its a nurb.
+ sub = col.column()
+ sub.active = (not currentcurve.cyclic_v)
+ sub.itemR(currentcurve, "bezier_v", text="V")
+ sub.itemR(currentcurve, "endpoint_v", text="V")
+ sub = col.column()
+ sub.itemR(currentcurve, "resolution_v", text="V")
+ sub.itemR(currentcurve, "order_v", text="V")
+
+
+ split = layout.split()
+ col = split.column()
col.itemL(text="Interpolation:")
col.itemR(currentcurve, "tilt_interpolation", text="Tilt")
- col.itemR(currentcurve, "radius_interpolation", text="Tilt")
+ col.itemR(currentcurve, "radius_interpolation", text="Radius")
col.itemR(currentcurve, "smooth")
+
bpy.types.register(DATA_PT_context_curve)
bpy.types.register(DATA_PT_shape_curve)
bpy.types.register(DATA_PT_geometry_curve)
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index a5d365cafd4..d226834bc21 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -6816,7 +6816,6 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
for(nu=cu->nurb.first; nu; nu=nu->next) {
if(!clear) nu->flag |= ME_SMOOTH;
else nu->flag &= ~ME_SMOOTH;
- nu= nu->next;
}
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index d19a2289490..8c805c11f78 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -148,6 +148,20 @@ static int rna_Nurb_length(PointerRNA *ptr)
return nu->pntsv>0 ? nu->pntsu*nu->pntsv : nu->pntsu;
}
+/* grr! mixing CU_2D with type is dodgy */
+static int rna_Nurb_type_get(PointerRNA *ptr)
+{
+ Nurb *nu= (Nurb*)ptr->data;
+ return nu->type & 7;
+}
+
+static void rna_Nurb_type_set(PointerRNA *ptr, int value)
+{
+ Nurb *nu= (Nurb*)ptr->data;
+ nu->type &= CU_2D;
+ nu->type |= value;
+}
+
static void rna_BPoint_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
Nurb *nu= (Nurb*)ptr->data;
@@ -161,7 +175,6 @@ static void rna_Curve_update_data(bContext *C, PointerRNA *ptr)
DAG_id_flush_update(id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, id);
}
-
#else
static void rna_def_bpoint(BlenderRNA *brna)
@@ -203,7 +216,7 @@ static void rna_def_bpoint(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
- prop= RNA_def_property(srna, "bevel_radius", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "radius");
/*RNA_def_property_range(prop, 0.0f, 1.0f);*/
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -297,7 +310,7 @@ static void rna_def_beztriple(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
- prop= RNA_def_property(srna, "bevel_radius", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "radius");
/*RNA_def_property_range(prop, 0.0f, 1.0f);*/
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -317,22 +330,22 @@ static void rna_def_path(BlenderRNA *brna, StructRNA *srna)
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
/* flags */
- prop= RNA_def_property(srna, "path", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_path", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_PATH);
RNA_def_property_ui_text(prop, "Path", "Enable the curve to become a translation path.");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
- prop= RNA_def_property(srna, "follow", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_path_follow", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FOLLOW);
RNA_def_property_ui_text(prop, "Follow", "Make curve path children to rotate along the path.");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
- prop= RNA_def_property(srna, "stretch", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_STRETCH);
RNA_def_property_ui_text(prop, "Stretch", "Option for curve-deform: makes deformed child to stretch along entire path.");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
- prop= RNA_def_property(srna, "offset_path_distance", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_time_offset", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_OFFS_PATHDIST);
RNA_def_property_ui_text(prop, "Offset Path Distance", "Children will use TimeOffs value as path distance offset.");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
@@ -677,6 +690,11 @@ static void rna_def_curve(BlenderRNA *brna)
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, "use_twist_correction", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_NO_TWIST);
+ RNA_def_property_ui_text(prop, "Minimal Twist", "Correct for twisting.");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
prop= RNA_def_property(srna, "retopo", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_RETOPO);
RNA_def_property_ui_text(prop, "Retopo", "Turn on the re-topology tool.");
@@ -685,6 +703,14 @@ static void rna_def_curve(BlenderRNA *brna)
static void rna_def_curve_nurb(BlenderRNA *brna)
{
+ static EnumPropertyItem curve_type_items[] = {
+ {CU_POLY, "POLY", 0, "Poly", ""},
+ {CU_BEZIER, "BEZIER", 0, "Bezier", ""},
+ {CU_BSPLINE, "BSPLINE", 0, "BSpline", ""},
+ {CU_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
+ {CU_NURBS, "NURBS", 0, "Ease", ""},
+ {0, NULL, 0, NULL, NULL}};
+
static EnumPropertyItem spline_interpolation_items[] = {
{BEZT_IPO_CONST, "LINEAR", 0, "Linear", ""},
{BEZT_IPO_LIN, "CARDINAL", 0, "Cardinal", ""},
@@ -722,6 +748,12 @@ static void rna_def_curve_nurb(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Radius Interpolation", "The type of radius interpolation for Bezier curves.");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+ // XXX - switching type probably needs comprehensive recalc of data like in 2.4x
+ prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, curve_type_items);
+ RNA_def_property_enum_funcs(prop, "rna_Nurb_type_get", "rna_Nurb_type_set", NULL);
+ RNA_def_property_ui_text(prop, "Type", "The interpolation type for this curve element.");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop= RNA_def_property(srna, "point_count_u", PROP_INT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/