fix [#35543] Bezier curve width and twist fail to apply when more than 1 point is edited

This commit is contained in:
Campbell Barton
2013-05-27 23:51:01 +00:00
parent c498a8f2b4
commit 5de17660e2
2 changed files with 7 additions and 3 deletions

View File

@@ -382,6 +382,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
if (block) { /* buttons */
uiBut *but;
int yi = 200;
const float tilt_limit = DEG2RADF(21600.0f);
const int buth = 20 * UI_DPI_FAC;
const int but_margin = 2;
const char *c;
@@ -458,7 +459,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
uiDefButR(block, NUM, 0, IFACE_("Radius"), 0, yi -= buth + but_margin, 200, buth,
&data_ptr, "radius", 0, 0.0, 100.0, 1, 3, NULL);
uiDefButR(block, NUM, 0, IFACE_("Tilt"), 0, yi -= buth + but_margin, 200, buth,
&data_ptr, "tilt", 0, -FLT_MAX, FLT_MAX, 1, 3, NULL);
&data_ptr, "tilt", 0, -tilt_limit, tilt_limit, 1, 3, NULL);
}
else if (totcurvedata > 1) {
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Weight:"),
@@ -469,7 +470,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
&(tfp->ve_median[C_RADIUS]), 0.0, 100.0, 1, 3, TIP_("Radius of curve control points"));
but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Tilt:"),
0, yi -= buth + but_margin, 200, buth,
&(tfp->ve_median[C_TILT]), -FLT_MAX, FLT_MAX, 1, 3,
&(tfp->ve_median[C_TILT]), -tilt_limit, tilt_limit, 1, 3,
TIP_("Tilt of curve control points"));
uiButSetUnitType(but, PROP_UNIT_ROTATION);
}

View File

@@ -32,6 +32,7 @@
#include "DNA_scene_types.h"
#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BKE_font.h"
@@ -688,6 +689,7 @@ static void rna_def_bpoint(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
const float tilt_limit = DEG2RADF(21600.0f);
srna = RNA_def_struct(brna, "SplinePoint", NULL);
RNA_def_struct_sdna(srna, "BPoint");
@@ -720,7 +722,8 @@ static void rna_def_bpoint(BlenderRNA *brna)
/* Number values */
prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "alfa");
/*RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);*/
RNA_def_property_range(prop, -tilt_limit, tilt_limit);
RNA_def_property_ui_range(prop, -tilt_limit, tilt_limit, 0.1, 3);
RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");