Commit: 9733d8416fb1666d46fb968f8c57eeee11186aca Author: João Araújo Date: Fri May 20 20:22:07 2016 +0100 Branches: gsoc2016-improved_extrusion https://developer.blender.org/rB9733d8416fb1666d46fb968f8c57eeee11186aca
Improved Bezier curve extrusion This patch attempts to solve the issues with D1841. 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. Merge remote-tracking branch 'origin/master' into gsoc2016-improved_extrusion Category: Improved Bezier curve extrusion with non-zero bevel On a previous commit, the Bezier curve extrusion was improved. However, when non-zero bevel values were set, the new extrusion options stopped having effect. This commit fixes that. On a code level, the code used for extrusion and for bevel is a duplicate. On the first commit only the extrusion code was modified. On this commit, the bevel code was modified in the same way, to take into account the improved extrusion options. Differential Revision: https://developer.blender.org/D2017 =================================================================== M release/datafiles/locale M release/scripts/addons M release/scripts/addons_contrib M source/blender/blenkernel/intern/curve.c =================================================================== diff --git a/release/datafiles/locale b/release/datafiles/locale index 9628dc1..fff5b57 160000 --- a/release/datafiles/locale +++ b/release/datafiles/locale @@ -1 +1 @@ -Subproject commit 9628dc1922be2fb6281bc66f5f7512c2a57c294a +Subproject commit fff5b57dfbe2b69fb85f69715bb92acd3b3f68a2 diff --git a/release/scripts/addons b/release/scripts/addons index 407d0ea..16edba6 160000 --- a/release/scripts/addons +++ b/release/scripts/addons @@ -1 +1 @@ -Subproject commit 407d0ea752b3af73d3f13ba072671bd09eefecb1 +Subproject commit 16edba689ed3295d738fb70247b50b54872a47fa diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib index 9f29e18..8519564 160000 --- a/release/scripts/addons_contrib +++ b/release/scripts/addons_contrib @@ -1 +1 @@ -Subproject commit 9f29e18707917ec5be262431d2e09dbb85332f41 +Subproject commit 8519564c212910db4ccb0a93742f75fec36c3952 diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 1bad324..45fdf73 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1703,7 +1703,7 @@ float *BKE_curve_make_orco(Scene *scene, Object *ob, int *r_numVerts) } -/* ***************** BEVEL ****************** */ +/* ***************** BEVEL/EXTRUDE ****************** */ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, const bool for_render, const bool use_render_resolution) @@ -1770,7 +1770,7 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, else if (cu->ext1 == 0.0f && cu->ext2 == 0.0f) { /* pass */ } - else if (cu->ext2 == 0.0f) { + else if (cu->ext2 == 0.0f) { /* Extrude Bezier curve. Zero bevel. */ dl = MEM_callocN(sizeof(DispList), "makebevelcurve2"); dl->verts = MEM_mallocN(2 * sizeof(float[3]), "makebevelcurve2"); BLI_addtail(disp, dl); @@ -1782,20 +1782,21 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, fp = dl->verts; fp[0] = fp[1] = 0.0; - if (!(cu->flag & CU_SYM_EXTRUDE)) { /* If user wants to extrude in both directions */ + 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 */ + 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 */ + else { /* simple Bezier curve extrusion by the specified amount in the positive local z direction */ fp[2] = cu->ext1; + fp[5] = 0.0; } @@ -1826,7 +1827,7 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, fp += 3; } } - else { + else { /* bevel with non-zero extrusion */ short dnr; /* bevel now in three parts, for proper vertex normals */ @@ -1853,22 +1854,22 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, for (a = 0; a < nr; a++) { fp[0] = 0.0; fp[1] = (float)(cosf(angle) * (cu->ext2)); - fp[2] = (float)(sinf(angle) * (cu->ext2)) - cu->ext1; + fp[2] = (float)(sinf(angle) * (cu->ext2)); - /* if (!(cu->flag & CU_SYM_EXTRUDE)) { /* If user wants to extrude in both directions / + if (!(cu->flag & CU_SYM_EXTRUDE)) { /* if user wants to extrude in both directions */ - fp[2] = -cu->ext1; + fp[2] -= cu->ext1; } - else if (cu->flag & CU_EXTRUDE_REV) { /* If user wants to extrude in the negative direction / + else if (cu->flag & CU_EXTRUDE_REV) { /* if user wants to extrude in the negative direction */ - fp[2] = 0.0; + fp[2] -= cu->ext1; } - else { /* Simple Bezier curve extrusion by the specified amount in the positive local z direction / + else { /* simple Bezier curve extrusion by the specified amount in the positive local z direction */ - fp[2] = 0.0; + fp[2] -= 0.0; - } */ + } angle += dangle; fp += 3; @@ -1892,6 +1893,24 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, fp[4] = cu->ext2; fp[5] = cu->ext1; + 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[5] = 0.0; + + } + if ( (cu->flag & (CU_FRONT | CU_BACK)) == 0) { dl = MEM_dupallocN(dl); dl->verts = MEM_dupallocN(dl->verts); @@ -1902,6 +1921,24 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, fp[2] = -fp[2]; fp[4] = -fp[4]; fp[5] = -fp[5]; + + if (!(cu->flag & CU_SYM_EXTRUDE)) { /* if user wants to extrude in both directions */ + + fp[2] = -fp[2]; + fp[5] = -fp[5]; + } + 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[5] = 0.0; + + } } } @@ -1927,7 +1964,22 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, for (a = 0; a < nr; a++) { fp[0] = 0.0; fp[1] = (float)(cosf(angle) * (cu->ext2)); - fp[2] = (float)(sinf(angle) * (cu->ext2)) + cu->ext1; + fp[2] = (float)(sinf(angle) * (cu->ext2)); + + 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] += cu->ext1; + } + angle += dangle; fp += 3; } _______________________________________________ Bf-blender-cvs mailing list [email protected] https://lists.blender.org/mailman/listinfo/bf-blender-cvs
