[Bf-blender-cvs] [01f9286] gsoc2016-improved_extrusion: Category: Improved Bezier Curve Extrusion
João Araújo
noreply at git.blender.org
Thu May 19 12:40:48 CEST 2016
Commit: 01f92861d8ba593eb8bbbde5de68a0be42189734
Author: João Araújo
Date: Thu May 19 11:00:10 2016 +0100
Branches: gsoc2016-improved_extrusion
https://developer.blender.org/rB01f92861d8ba593eb8bbbde5de68a0be42189734
Category: Improved Bezier Curve Extrusion
This feature allows the user to have more control over the extrusion of Bezier
curves. This is done by making possible unidirectional extrusion.
On a code level, the curve.c file in blenkernel was modified to take into
account these options while generating the extruded object.
The feature stops working with non-zero bevel.
===================================================================
M release/scripts/startup/bl_ui/properties_data_curve.py
M source/blender/blenkernel/intern/curve.c
M source/blender/makesdna/DNA_curve_types.h
M source/blender/makesrna/intern/rna_curve.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_data_curve.py b/release/scripts/startup/bl_ui/properties_data_curve.py
index f83dea9..1e69d76 100644
--- a/release/scripts/startup/bl_ui/properties_data_curve.py
+++ b/release/scripts/startup/bl_ui/properties_data_curve.py
@@ -172,6 +172,11 @@ class DATA_PT_geometry_curve(CurveButtonsPanelCurve, Panel):
col.label(text="Modification:")
col.prop(curve, "offset")
col.prop(curve, "extrude")
+ sub = col.row()
+ sub.prop(curve, "extrude_bezier_symmetric")
+ sub = col.row()
+ sub.active = curve.extrude_bezier_symmetric is False
+ sub.prop(curve, "reverse_direction")
col.label(text="Taper Object:")
col.prop(curve, "taper_object", text="")
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 3329d3a..259add9 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -1778,12 +1778,29 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp,
dl->parts = 1;
dl->flag = DL_FRONT_CURVE | DL_BACK_CURVE;
dl->nr = 2;
-
- fp = dl->verts;
- fp[0] = fp[1] = 0.0;
- fp[2] = -cu->ext1;
- fp[3] = fp[4] = 0.0;
- fp[5] = cu->ext1;
+
+ fp = dl->verts;
+ fp[0] = fp[1] = 0.0;
+
+ if (!(cu->flag & CU_SYM_EXTRUDE)) { /* If user wants to extrude in both directions */
+
+ fp[2] = -cu->ext1;
+ fp[5] = cu->ext1;
+ }
+ else if (cu->flag & CU_EXTRUDE_REV) { /* If user wants to extrude in the negative direction */
+
+ fp[2] = 0.0;
+ fp[5] = -cu->ext1;
+
+ }
+ else { /* Simple Bezier curve extrusion by the specified amount in the positive local z direction */
+
+ fp[2] = cu->ext1;
+
+ }
+
+ fp[3] = fp[4] = 0.0;
+
}
else if ( (cu->flag & (CU_FRONT | CU_BACK)) == 0 && cu->ext1 == 0.0f) { // we make a full round bevel in that case
nr = 4 + 2 * cu->bevresol;
@@ -1837,6 +1854,22 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp,
fp[0] = 0.0;
fp[1] = (float)(cosf(angle) * (cu->ext2));
fp[2] = (float)(sinf(angle) * (cu->ext2)) - cu->ext1;
+
+ /* if (!(cu->flag & CU_SYM_EXTRUDE)) { /* If user wants to extrude in both directions /
+
+ fp[2] = -cu->ext1;
+ }
+ else if (cu->flag & CU_EXTRUDE_REV) { /* If user wants to extrude in the negative direction /
+
+ fp[2] = 0.0;
+
+ }
+ else { /* Simple Bezier curve extrusion by the specified amount in the positive local z direction /
+
+ fp[2] = 0.0;
+
+ } */
+
angle += dangle;
fp += 3;
}
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h
index 9be3fbc..8b609d4 100644
--- a/source/blender/makesdna/DNA_curve_types.h
+++ b/source/blender/makesdna/DNA_curve_types.h
@@ -299,6 +299,8 @@ enum {
CU_DEFORM_FILL = 1 << 13, /* fill 2d curve after deformation */
CU_FILL_CAPS = 1 << 14, /* fill bevel caps */
CU_MAP_TAPER = 1 << 15, /* map taper object to beveled area */
+ CU_SYM_EXTRUDE = 1 << 16, /* in case the user wants the Bezier curve to be extruded in both directions */
+ CU_EXTRUDE_REV = 1 << 17 /* equivalent to a negative extrude */
};
/* Curve.twist_mode */
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index 3fbc789..56cf725 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -1510,6 +1510,17 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_MAP_TAPER);
RNA_def_property_ui_text(prop, "Map Taper", "Map effect of taper object on actually beveled curve");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "extrude_bezier_symmetric", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CU_SYM_EXTRUDE);
+ // RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_SYM_EXTRUDE);
+ RNA_def_property_ui_text(prop, "Extrude Symmetricaly", "Extrude the Bezier curve the same number of Blender Units in both directions");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "reverse_direction", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_EXTRUDE_REV);
+ RNA_def_property_ui_text(prop, "Reverse Extrude Direction", "Extrude the Bezier curve in the negative direction");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
/* texture space */
prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
More information about the Bf-blender-cvs
mailing list