diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_curve.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/curve_bevel.c | 44 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/displist.cc | 6 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_260.c | 2 | ||||
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 4 | ||||
-rw-r--r-- | source/blender/editors/curve/editcurve_paint.c | 4 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_convert.c | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_curve_defaults.h | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_curve_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesdna/intern/dna_rename_defs.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_curve.c | 10 |
11 files changed, 43 insertions, 40 deletions
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index 5e474c0c5ac..2f7569b1f03 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -75,8 +75,8 @@ typedef struct CVKeyIndex { #define SEGMENTSV(nu) (((nu)->flagv & CU_NURB_CYCLIC) ? (nu)->pntsv : (nu)->pntsv - 1) #define CU_DO_RADIUS(cu, nu) \ - ((((cu)->flag & (CU_PATH_RADIUS | CU_3D)) || (cu)->bevobj || (cu)->ext1 != 0.0f || \ - (cu)->ext2 != 0.0f) ? \ + ((((cu)->flag & (CU_PATH_RADIUS | CU_3D)) || (cu)->bevobj || (cu)->extrude != 0.0f || \ + (cu)->bevel_radius != 0.0f) ? \ 1 : \ 0) diff --git a/source/blender/blenkernel/intern/curve_bevel.c b/source/blender/blenkernel/intern/curve_bevel.c index d205d8cca46..18e4ab3ade1 100644 --- a/source/blender/blenkernel/intern/curve_bevel.c +++ b/source/blender/blenkernel/intern/curve_bevel.c @@ -64,8 +64,8 @@ static void bevel_quarter_fill(const Curve *curve, float angle = 0.0f; const float dangle = (float)M_PI_2 / (curve->bevresol + 1); for (int i = 0; i < curve->bevresol + 1; i++) { - quarter_coords_x[i] = (float)(cosf(angle) * (curve->ext2)); - quarter_coords_y[i] = (float)(sinf(angle) * (curve->ext2)); + quarter_coords_x[i] = (float)(cosf(angle) * (curve->bevel_radius)); + quarter_coords_y[i] = (float)(sinf(angle) * (curve->bevel_radius)); angle += dangle; } } @@ -76,11 +76,11 @@ static void bevel_quarter_fill(const Curve *curve, /* If there aren't enough samples, the curveprofile won't * sample the start vertex, so set it manually instead. */ - quarter_coords_x[0] = curve->ext2; + quarter_coords_x[0] = curve->bevel_radius; quarter_coords_y[0] = 0.0f; for (int i = 1; i < curve->bevresol + 1; i++) { - quarter_coords_x[i] = (float)(curve->bevel_profile->segments[i].x * (curve->ext2)); - quarter_coords_y[i] = (float)(curve->bevel_profile->segments[i].y * (curve->ext2)); + quarter_coords_x[i] = (float)(curve->bevel_profile->segments[i].x * (curve->bevel_radius)); + quarter_coords_y[i] = (float)(curve->bevel_profile->segments[i].y * (curve->bevel_radius)); } } } @@ -133,13 +133,13 @@ static void curve_bevel_make_extrude_and_fill(const Curve *cu, /* Add the bottom vertex. */ fp[0] = 0.0f; fp[1] = 0.0f; - fp[2] = -cu->ext1 - cu->ext2; + fp[2] = -cu->extrude - cu->bevel_radius; fp += 3; for (int i = cu->bevresol; i >= 0; i--) { fp[0] = 0.0f; fp[1] = quarter_coords_x[i]; - fp[2] = -quarter_coords_y[i] - cu->ext1; + fp[2] = -quarter_coords_y[i] - cu->extrude; fp += 3; } } @@ -147,8 +147,8 @@ static void curve_bevel_make_extrude_and_fill(const Curve *cu, /* Add the extrusion if we're only building either the back or the front. */ if (use_extrude && ELEM(fill_type, FRONT, BACK)) { fp[0] = 0.0f; - fp[1] = cu->ext2; - fp[2] = (fill_type == FRONT) ? -cu->ext1 : cu->ext1; + fp[1] = cu->bevel_radius; + fp[2] = (fill_type == FRONT) ? -cu->extrude : cu->extrude; fp += 3; } @@ -159,13 +159,13 @@ static void curve_bevel_make_extrude_and_fill(const Curve *cu, for (int i = front_start; i < cu->bevresol + 1; i++) { fp[0] = 0.0f; fp[1] = quarter_coords_x[i]; - fp[2] = quarter_coords_y[i] + cu->ext1; + fp[2] = quarter_coords_y[i] + cu->extrude; fp += 3; } /* Add the top vertex. */ fp[0] = 0.0f; fp[1] = 0.0f; - fp[2] = cu->ext1 + cu->ext2; + fp[2] = cu->extrude + cu->bevel_radius; fp += 3; } @@ -174,22 +174,22 @@ static void curve_bevel_make_extrude_and_fill(const Curve *cu, for (int i = cu->bevresol; i > 0; i--) { fp[0] = 0.0f; fp[1] = -quarter_coords_x[i]; - fp[2] = quarter_coords_y[i] + cu->ext1; + fp[2] = quarter_coords_y[i] + cu->extrude; fp += 3; } if (use_extrude) { /* Add the extrusion. */ fp[0] = 0.0f; - fp[1] = -cu->ext2; - fp[2] = cu->ext1; + fp[1] = -cu->bevel_radius; + fp[2] = cu->extrude; fp += 3; } for (int i = 0; i < cu->bevresol + 1; i++) { fp[0] = 0.0f; fp[1] = -quarter_coords_x[i]; - fp[2] = -quarter_coords_y[i] - cu->ext1; + fp[2] = -quarter_coords_y[i] - cu->extrude; fp += 3; } } @@ -213,8 +213,8 @@ static void curve_bevel_make_full_circle(const Curve *cu, ListBase *disp) for (int i = 0; i < nr; i++) { fp[0] = 0.0; - fp[1] = (cosf(angle) * (cu->ext2)); - fp[2] = (sinf(angle) * (cu->ext2)) - cu->ext1; + fp[1] = (cosf(angle) * (cu->bevel_radius)); + fp[2] = (sinf(angle) * (cu->bevel_radius)) - cu->extrude; angle += dangle; fp += 3; } @@ -232,9 +232,9 @@ static void curve_bevel_make_only_extrude(const Curve *cu, ListBase *disp) float *fp = dl->verts; fp[0] = fp[1] = 0.0; - fp[2] = -cu->ext1; + fp[2] = -cu->extrude; fp[3] = fp[4] = 0.0; - fp[5] = cu->ext1; + fp[5] = cu->extrude; } static void curve_bevel_make_from_object(const Curve *cu, ListBase *disp) @@ -247,7 +247,7 @@ static void curve_bevel_make_from_object(const Curve *cu, ListBase *disp) } Curve *bevcu = cu->bevobj->data; - if (bevcu->ext1 == 0.0f && bevcu->ext2 == 0.0f) { + if (bevcu->extrude == 0.0f && bevcu->bevel_radius == 0.0f) { ListBase bevdisp = {NULL, NULL}; float facx = cu->bevobj->scale[0]; float facy = cu->bevobj->scale[1]; @@ -299,8 +299,8 @@ ListBase BKE_curve_bevel_make(const Curve *curve) } } else { - const bool use_extrude = curve->ext1 != 0.0f; - const bool use_bevel = curve->ext2 != 0.0f; + const bool use_extrude = curve->extrude != 0.0f; + const bool use_bevel = curve->bevel_radius != 0.0f; /* Pass. */ if (use_extrude && !use_bevel) { curve_bevel_make_only_extrude(curve, &bevel_shape); diff --git a/source/blender/blenkernel/intern/displist.cc b/source/blender/blenkernel/intern/displist.cc index 73aea944665..cae7a5fa65c 100644 --- a/source/blender/blenkernel/intern/displist.cc +++ b/source/blender/blenkernel/intern/displist.cc @@ -830,7 +830,7 @@ static bool do_curve_implicit_mesh_conversion(const Curve *curve, } /* Curve objects with implicit "tube" meshes should convert implicitly to a mesh. */ - if (curve->ext1 != 0.0f || curve->ext2 != 0.0f) { + if (curve->extrude != 0.0f || curve->bevel_radius != 0.0f) { return true; } @@ -1310,11 +1310,11 @@ static GeometrySet evaluate_curve_type_object(Depsgraph *depsgraph, ListBase dlbev = BKE_curve_bevel_make(cu); /* no bevel or extrude, and no width correction? */ - if (BLI_listbase_is_empty(&dlbev) && cu->width == 1.0f) { + if (BLI_listbase_is_empty(&dlbev) && cu->offset == 1.0f) { curve_to_displist(cu, deformed_nurbs, for_render, r_dispbase); } else { - const float widfac = cu->width - 1.0f; + const float widfac = cu->offset - 1.0f; const BevList *bl = (BevList *)ob->runtime.curve_cache->bev.first; const Nurb *nu = (Nurb *)deformed_nurbs->first; diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index c4d04392cba..8a22fd07c24 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -1892,7 +1892,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) for (cu = bmain->curves.first; cu; cu = cu->id.next) { if (cu->flag & (CU_FRONT | CU_BACK)) { - if (cu->ext1 != 0.0f || cu->ext2 != 0.0f) { + if (cu->extrude != 0.0f || cu->bevel_radius != 0.0f) { Nurb *nu; for (nu = cu->nurb.first; nu; nu = nu->next) { diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 3b05975d22d..f8977b835b3 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -6856,9 +6856,9 @@ int ED_curve_join_objects_exec(bContext *C, wmOperator *op) /* Compensate for different bevel depth. */ bool do_radius = false; float compensate_radius = 0.0f; - if (cu->ext2 != 0.0f && cu_active->ext2 != 0.0f) { + if (cu->bevel_radius != 0.0f && cu_active->bevel_radius != 0.0f) { float compensate_scale = mat4_to_scale(cmat); - compensate_radius = cu->ext2 / cu_active->ext2 * compensate_scale; + compensate_radius = cu->bevel_radius / cu_active->bevel_radius * compensate_scale; do_radius = true; } diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index 784f67ac4f1..403ace56e3b 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -144,7 +144,7 @@ static float stroke_elem_radius_from_pressure(const struct CurveDrawData *cdd, const float pressure) { const Curve *cu = cdd->vc.obedit->data; - return ((pressure * cdd->radius.range) + cdd->radius.min) * cu->ext2; + return ((pressure * cdd->radius.range) + cdd->radius.min) * cu->bevel_radius; } static float stroke_elem_radius(const struct CurveDrawData *cdd, const struct StrokeElem *selem) @@ -364,7 +364,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), Object *obedit = cdd->vc.obedit; Curve *cu = obedit->data; - if (cu->ext2 > 0.0f) { + if (cu->bevel_radius > 0.0f) { BLI_mempool_iter iter; const struct StrokeElem *selem; diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c index 656fec565df..bf414851aed 100644 --- a/source/blender/editors/gpencil/gpencil_convert.c +++ b/source/blender/editors/gpencil/gpencil_convert.c @@ -1324,7 +1324,7 @@ static void gpencil_layer_to_curve(bContext *C, cu->flag |= CU_3D; cu->bevresol = gtd->bevel_resolution; - cu->ext2 = gtd->bevel_depth; + cu->bevel_radius = gtd->bevel_depth; gtd->inittime = ((bGPDstroke *)gpf->strokes.first)->inittime; diff --git a/source/blender/makesdna/DNA_curve_defaults.h b/source/blender/makesdna/DNA_curve_defaults.h index 557615fd047..614653db2b8 100644 --- a/source/blender/makesdna/DNA_curve_defaults.h +++ b/source/blender/makesdna/DNA_curve_defaults.h @@ -34,7 +34,7 @@ .pathlen = 100, \ .resolu = 12, \ .resolv = 12, \ - .width = 1.0, \ + .offset = 1.0, \ .wordspace = 1.0, \ .spacing = 1.0f, \ .linedist = 1.0, \ diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index 341b5fee4e4..7230ac38f2f 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -237,7 +237,7 @@ typedef struct Curve { int pathlen; short bevresol, totcol; int flag; - float width, ext1, ext2; + float offset, extrude, bevel_radius; /* default */ short resolu, resolv; diff --git a/source/blender/makesdna/intern/dna_rename_defs.h b/source/blender/makesdna/intern/dna_rename_defs.h index 9b8bfb5af15..50dd5d8e86e 100644 --- a/source/blender/makesdna/intern/dna_rename_defs.h +++ b/source/blender/makesdna/intern/dna_rename_defs.h @@ -145,3 +145,6 @@ DNA_STRUCT_RENAME_ELEM(LineartGpencilModifierData, transparency_flags, mask_swit DNA_STRUCT_RENAME_ELEM(LineartGpencilModifierData, transparency_mask, material_mask_bits) DNA_STRUCT_RENAME_ELEM(SurfaceDeformModifierData, numverts, num_bind_verts) DNA_STRUCT_RENAME_ELEM(MaterialLineArt, transparency_mask, material_mask_bits) +DNA_STRUCT_RENAME_ELEM(Curve, width, offset) +DNA_STRUCT_RENAME_ELEM(Curve, ext1, extrude) +DNA_STRUCT_RENAME_ELEM(Curve, ext2, bevel_radius) diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 8c89162f571..5dea3d32bbc 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -569,13 +569,13 @@ static void rna_Curve_resolution_v_update_data(Main *bmain, Scene *scene, Pointe static float rna_Curve_offset_get(PointerRNA *ptr) { Curve *cu = (Curve *)ptr->owner_id; - return cu->width - 1.0f; + return cu->offset - 1.0f; } static void rna_Curve_offset_set(PointerRNA *ptr, float value) { Curve *cu = (Curve *)ptr->owner_id; - cu->width = 1.0f + value; + cu->offset = 1.0f + value; } static int rna_Curve_body_length(PointerRNA *ptr); @@ -1656,14 +1656,14 @@ static void rna_def_curve(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Curve_bevel_resolution_update"); prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH); - RNA_def_property_float_sdna(prop, NULL, "width"); + RNA_def_property_float_sdna(prop, NULL, "offset"); RNA_def_property_ui_range(prop, -1.0, 1.0, 0.1, 3); RNA_def_property_float_funcs(prop, "rna_Curve_offset_get", "rna_Curve_offset_set", NULL); RNA_def_property_ui_text(prop, "Offset", "Distance to move the curve parallel to its normals"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); prop = RNA_def_property(srna, "extrude", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH); - RNA_def_property_float_sdna(prop, NULL, "ext1"); + RNA_def_property_float_sdna(prop, NULL, "extrude"); RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 3); RNA_def_property_range(prop, 0.0, FLT_MAX); RNA_def_property_ui_text(prop, @@ -1673,7 +1673,7 @@ static void rna_def_curve(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Curve_update_data"); prop = RNA_def_property(srna, "bevel_depth", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH); - RNA_def_property_float_sdna(prop, NULL, "ext2"); + RNA_def_property_float_sdna(prop, NULL, "bevel_radius"); RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 3); RNA_def_property_ui_text( prop, "Bevel Depth", "Radius of the bevel geometry, not including extrusion"); |