diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_curve.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_curve.c | 86 |
1 files changed, 51 insertions, 35 deletions
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 233303ef613..b92d156b674 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -57,11 +57,11 @@ static const EnumPropertyItem beztriple_handle_type_items[] = { #endif const EnumPropertyItem rna_enum_keyframe_handle_type_items[] = { - {HD_FREE, "FREE", 0, "Free", ""}, - {HD_VECT, "VECTOR", 0, "Vector", ""}, - {HD_ALIGN, "ALIGNED", 0, "Aligned", ""}, - {HD_AUTO, "AUTO", 0, "Automatic", ""}, - {HD_AUTO_ANIM, "AUTO_CLAMPED", 0, "Auto Clamped", "Auto handles clamped to not overshoot"}, + {HD_FREE, "FREE", ICON_HANDLETYPE_FREE_VEC, "Free", "Completely independent manually set handle"}, + {HD_ALIGN, "ALIGNED", ICON_HANDLETYPE_ALIGNED_VEC, "Aligned", "Manually set handle with rotation locked together with its pair"}, + {HD_VECT, "VECTOR", ICON_HANDLETYPE_VECTOR_VEC, "Vector", "Automatic handles that create straight lines"}, + {HD_AUTO, "AUTO", ICON_HANDLETYPE_AUTO_VEC, "Automatic", "Automatic handles that create smooth curves"}, + {HD_AUTO_ANIM, "AUTO_CLAMPED", ICON_HANDLETYPE_AUTO_CLAMP_VEC, "Auto Clamped", "Automatic handles that create smooth curves which only change direction at keyframes"}, {0, NULL, 0, NULL, NULL} }; @@ -124,9 +124,11 @@ static const EnumPropertyItem curve2d_fill_mode_items[] = { #include "DNA_object_types.h" #include "BKE_curve.h" -#include "BKE_depsgraph.h" #include "BKE_main.h" +#include "DEG_depsgraph.h" +#include "DEG_depsgraph_build.h" + #include "WM_api.h" #include "MEM_guardedalloc.h" @@ -300,8 +302,9 @@ static void rna_Curve_dimension_set(PointerRNA *ptr, int value) BKE_curve_curve_dimension_update(cu); } -static const EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) +static const EnumPropertyItem *rna_Curve_fill_mode_itemf( + bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { Curve *cu = (Curve *)ptr->id.data; @@ -338,7 +341,7 @@ static void rna_BPoint_array_begin(CollectionPropertyIterator *iter, PointerRNA static void rna_Curve_update_data_id(Main *UNUSED(bmain), Scene *UNUSED(scene), ID *id) { - DAG_id_tag_update(id, 0); + DEG_id_tag_update(id, 0); WM_main_add_notifier(NC_GEOM | ND_DATA, id); } @@ -349,7 +352,7 @@ static void rna_Curve_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Curve_update_deps(Main *bmain, Scene *scene, PointerRNA *ptr) { - DAG_relations_tag_update(bmain); + DEG_relations_tag_update(bmain); rna_Curve_update_data(bmain, scene, ptr); } @@ -638,7 +641,7 @@ static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, PointerRNA * BKE_nurb_free(nu); RNA_POINTER_INVALIDATE(nu_ptr); - DAG_id_tag_update(&cu->id, OB_RECALC_DATA); + DEG_id_tag_update(&cu->id, ID_RECALC_GEOMETRY); WM_main_add_notifier(NC_GEOM | ND_DATA, NULL); } @@ -648,7 +651,7 @@ static void rna_Curve_spline_clear(Curve *cu) BKE_nurbList_free(nurbs); - DAG_id_tag_update(&cu->id, OB_RECALC_DATA); + DEG_id_tag_update(&cu->id, ID_RECALC_GEOMETRY); WM_main_add_notifier(NC_GEOM | ND_DATA, NULL); } @@ -954,19 +957,28 @@ static void rna_def_font(BlenderRNA *UNUSED(brna), StructRNA *srna) PropertyRNA *prop; static const EnumPropertyItem prop_align_items[] = { - {CU_ALIGN_X_LEFT, "LEFT", 0, "Left", "Align text to the left"}, - {CU_ALIGN_X_MIDDLE, "CENTER", 0, "Center", "Center text"}, - {CU_ALIGN_X_RIGHT, "RIGHT", 0, "Right", "Align text to the right"}, - {CU_ALIGN_X_JUSTIFY, "JUSTIFY", 0, "Justify", "Align to the left and the right"}, - {CU_ALIGN_X_FLUSH, "FLUSH", 0, "Flush", "Align to the left and the right, with equal character spacing"}, + {CU_ALIGN_X_LEFT, "LEFT", ICON_ALIGN_LEFT, "Left", "Align text to the left"}, + {CU_ALIGN_X_MIDDLE, "CENTER", ICON_ALIGN_CENTER, "Center", "Center text"}, + {CU_ALIGN_X_RIGHT, "RIGHT", ICON_ALIGN_RIGHT, "Right", "Align text to the right"}, + {CU_ALIGN_X_JUSTIFY, "JUSTIFY", ICON_ALIGN_JUSTIFY, "Justify", "Align to the left and the right"}, + {CU_ALIGN_X_FLUSH, "FLUSH", ICON_ALIGN_FLUSH, "Flush", "Align to the left and the right, with equal character spacing"}, {0, NULL, 0, NULL, NULL} }; static const EnumPropertyItem prop_align_y_items[] = { - {CU_ALIGN_Y_TOP_BASELINE, "TOP_BASELINE", 0, "Top Base-Line", "Align to top but use the base-line of the text"}, - {CU_ALIGN_Y_TOP, "TOP", 0, "Top", "Align text to the top"}, - {CU_ALIGN_Y_CENTER, "CENTER", 0, "Center", "Align text to the middle"}, - {CU_ALIGN_Y_BOTTOM, "BOTTOM", 0, "Bottom", "Align text to the bottom"}, + {CU_ALIGN_Y_TOP_BASELINE, "TOP_BASELINE", ICON_ALIGN_TOP, "Top Base-Line", "Align to top but use the base-line of the text"}, + {CU_ALIGN_Y_TOP, "TOP", ICON_ALIGN_TOP, "Top", "Align text to the top"}, + {CU_ALIGN_Y_CENTER, "CENTER", ICON_ALIGN_MIDDLE, "Center", "Align text to the middle"}, + {CU_ALIGN_Y_BOTTOM, "BOTTOM", ICON_ALIGN_BOTTOM, "Bottom", "Align text to the bottom"}, + {CU_ALIGN_Y_BOTTOM_BASELINE, "BOTTOM_BASELINE", ICON_ALIGN_BOTTOM, "Bottom Base-Line", + "Align text to the bottom but use the base-line of the text"}, + {0, NULL, 0, NULL, NULL} + }; + + static const EnumPropertyItem prop_overflow_items[] = { + {CU_OVERFLOW_NONE, "NONE", 0, "Overflow", "Let the text overflow outside the text boxes"}, + {CU_OVERFLOW_SCALE, "SCALE", 0, "Scale to Fit", "Scale down the text to fit inside the text boxes"}, + {CU_OVERFLOW_TRUNCATE, "TRUNCATE", 0, "Truncate", "Truncate the text that would go outside the text boxes"}, {0, NULL, 0, NULL, NULL} }; @@ -983,6 +995,14 @@ static void rna_def_font(BlenderRNA *UNUSED(brna), StructRNA *srna) RNA_def_property_ui_text(prop, "Text Vertical Align", "Text vertical align from the object center"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); + prop = RNA_def_property(srna, "overflow", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "overflow"); + RNA_def_property_enum_items(prop, prop_overflow_items); + RNA_def_property_enum_default(prop, CU_OVERFLOW_NONE); + RNA_def_property_ui_text(prop, "Textbox Overflow", + "Handle the text behavior when it doesn't fit in the text boxes"); + RNA_def_property_update(prop, 0, "rna_Curve_update_data"); + /* number values */ prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "fsize"); @@ -1175,16 +1195,19 @@ static void rna_def_charinfo(BlenderRNA *brna) prop = RNA_def_property(srna, "use_bold", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_BOLD); RNA_def_property_ui_text(prop, "Bold", ""); + RNA_def_property_ui_icon(prop, ICON_BOLD, 0); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); prop = RNA_def_property(srna, "use_italic", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_ITALIC); RNA_def_property_ui_text(prop, "Italic", ""); + RNA_def_property_ui_icon(prop, ICON_ITALIC, 0); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); prop = RNA_def_property(srna, "use_underline", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_UNDERLINE); RNA_def_property_ui_text(prop, "Underline", ""); + RNA_def_property_ui_icon(prop, ICON_UNDERLINE, 0); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); /* probably there is no reason to expose this */ @@ -1198,6 +1221,7 @@ static void rna_def_charinfo(BlenderRNA *brna) prop = RNA_def_property(srna, "use_small_caps", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_SMALLCAPS); RNA_def_property_ui_text(prop, "Small Caps", ""); + RNA_def_property_ui_icon(prop, ICON_SMALL_CAPS, 0); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED); @@ -1240,7 +1264,7 @@ static void rna_def_curve_spline_points(BlenderRNA *brna, PropertyRNA *cprop) /*PropertyRNA *prop; */ FunctionRNA *func; - /*PropertyRNA *parm; */ + PropertyRNA *parm; RNA_def_property_srna(cprop, "SplinePoints"); srna = RNA_def_struct(brna, "SplinePoints", NULL); @@ -1250,7 +1274,8 @@ static void rna_def_curve_spline_points(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "add", "rna_Curve_spline_points_add"); RNA_def_function_ui_description(func, "Add a number of points to this spline"); RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS); - RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX); + parm = RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); #if 0 func = RNA_def_function(srna, "remove", "rna_Curve_spline_remove"); @@ -1268,7 +1293,7 @@ static void rna_def_curve_spline_bezpoints(BlenderRNA *brna, PropertyRNA *cprop) /*PropertyRNA *prop; */ FunctionRNA *func; - /*PropertyRNA *parm; */ + PropertyRNA *parm; RNA_def_property_srna(cprop, "SplineBezierPoints"); srna = RNA_def_struct(brna, "SplineBezierPoints", NULL); @@ -1278,7 +1303,8 @@ static void rna_def_curve_spline_bezpoints(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "add", "rna_Curve_spline_bezpoints_add"); RNA_def_function_ui_description(func, "Add a number of points to this spline"); RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS); - RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX); + parm = RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); #if 0 func = RNA_def_function(srna, "remove", "rna_Curve_spline_remove"); @@ -1379,16 +1405,6 @@ static void rna_def_curve(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Splines", "Collection of splines in this curve data object"); rna_def_curve_splines(brna, prop); - prop = RNA_def_property(srna, "show_handles", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", CU_HIDE_HANDLES); - RNA_def_property_ui_text(prop, "Draw Handles", "Display Bezier handles in editmode"); - RNA_def_property_update(prop, NC_GEOM | ND_DATA, NULL); - - prop = RNA_def_property(srna, "show_normal_face", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", CU_HIDE_NORMALS); - RNA_def_property_ui_text(prop, "Draw Normals", "Display 3D curve normals in editmode"); - RNA_def_property_update(prop, NC_GEOM | ND_DATA, NULL); - rna_def_path(brna, srna); /* Number values */ |