diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_curve.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_curve.c | 63 |
1 files changed, 50 insertions, 13 deletions
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 891de95a2a2..2c1ed483de6 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -562,6 +562,38 @@ static void rna_Curve_offset_set(PointerRNA *ptr, float value) cu->offset = 1.0f + value; } +static int rna_Nurb_valid_message_u_length(PointerRNA *ptr) +{ + char buff[64]; + Nurb *nu = (Nurb *)ptr->data; + BKE_nurb_valid_message( + nu->pntsu, nu->orderu, nu->flagu, nu->type, nu->pntsv > 1, "U", buff, sizeof(buff)); + return strlen(buff); +} + +static void rna_Nurb_valid_message_u(PointerRNA *ptr, char *value) +{ + Nurb *nu = (Nurb *)ptr->data; + BKE_nurb_valid_message( + nu->pntsu, nu->orderu, nu->flagu, nu->type, nu->pntsv > 1, "U", value, 64); +} + +static int rna_Nurb_valid_message_v_length(PointerRNA *ptr) +{ + char buff[64]; + Nurb *nu = (Nurb *)ptr->data; + BKE_nurb_valid_message( + nu->pntsv, nu->orderv, nu->flagv, nu->type, nu->pntsv > 1, "V", buff, sizeof(buff)); + return strlen(buff); +} + +static void rna_Nurb_valid_message_v(PointerRNA *ptr, char *value) +{ + Nurb *nu = (Nurb *)ptr->data; + BKE_nurb_valid_message( + nu->pntsv, nu->orderv, nu->flagv, nu->type, nu->pntsv > 1, "V", value, 64); +} + static int rna_Curve_body_length(PointerRNA *ptr); static void rna_Curve_body_get(PointerRNA *ptr, char *value) { @@ -1995,24 +2027,20 @@ static void rna_def_curve_nurb(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Cyclic V", "Make this surface a closed loop in the V direction"); RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_v"); - /* NOTE: endpoint and bezier flags should never be on at the same time! */ prop = RNA_def_property(srna, "use_endpoint_u", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_ENDPOINT); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text( prop, "Endpoint U", - "Make this nurbs curve or surface meet the endpoints in the U direction " - "(Cyclic U must be disabled)"); + "Make this nurbs curve or surface meet the endpoints in the U direction"); RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u"); prop = RNA_def_property(srna, "use_endpoint_v", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_ENDPOINT); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, - "Endpoint V", - "Make this nurbs surface meet the endpoints in the V direction " - "(Cyclic V must be disabled)"); + RNA_def_property_ui_text( + prop, "Endpoint V", "Make this nurbs surface meet the endpoints in the V direction "); RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v"); prop = RNA_def_property(srna, "use_bezier_u", PROP_BOOLEAN, PROP_NONE); @@ -2021,19 +2049,28 @@ static void rna_def_curve_nurb(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Bezier U", - "Make this nurbs curve or surface act like a Bezier spline in the U direction " - "(Order U must be 3 or 4, Cyclic U must be disabled)"); + "Make this nurbs curve or surface act like a Bezier spline in the U direction"); RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u"); prop = RNA_def_property(srna, "use_bezier_v", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_BEZIER); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, - "Bezier V", - "Make this nurbs surface act like a Bezier spline in the V direction " - "(Order V must be 3 or 4, Cyclic V must be disabled)"); + RNA_def_property_ui_text( + prop, "Bezier V", "Make this nurbs surface act like a Bezier spline in the V direction"); RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v"); + prop = RNA_def_property(srna, "valid_message_u", PROP_STRING, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_string_funcs( + prop, "rna_Nurb_valid_message_u", "rna_Nurb_valid_message_u_length", NULL); + RNA_def_property_ui_text(prop, "Valid U", "Validation message for NURBS definition in U"); + + prop = RNA_def_property(srna, "valid_message_v", PROP_STRING, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_string_funcs( + prop, "rna_Nurb_valid_message_v", "rna_Nurb_valid_message_v_length", NULL); + RNA_def_property_ui_text(prop, "Valid V", "Validation message for NURBS definition in V"); + prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_SMOOTH); RNA_def_property_ui_text(prop, "Smooth", "Smooth the normals of the surface or beveled curve"); |