diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-09-19 13:47:58 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-09-19 13:47:58 +0400 |
commit | 226ff0d4da13ac66991f1708251faa5dff3f7dea (patch) | |
tree | 8269ad31363a1ccd9f56cf5609f8070a472ae949 /source | |
parent | dd204cb9f73ace004322675da7928dd274cc4882 (diff) |
Curve back/front fill changes:
- Use enum instead of back/front flags combinations.
- This flags behaves differently for 2d/3d curves so use different enums for them.
- This commit shouldn't change existing files.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_curve.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 3cf6feb005c..e3f86032213 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -74,6 +74,20 @@ EnumPropertyItem curve_type_items[] = { {CU_NURBS, "NURBS", 0, "Ease", ""}, {0, NULL, 0, NULL, NULL}}; +static const EnumPropertyItem curve3d_fill_mode_items[]= { + {0, "FULL", 0, "Full", ""}, + {CU_BACK, "BACK", 0, "Back", ""}, + {CU_FRONT, "FRONT", 0, "Front", ""}, + {CU_FRONT|CU_BACK, "HALF", 0, "Half", ""}, + {0, NULL, 0, NULL, NULL}}; + +static const EnumPropertyItem curve2d_fill_mode_items[]= { + {0, "NONE", 0, "None", ""}, + {CU_BACK, "BACK", 0, "Back", ""}, + {CU_FRONT, "FRONT", 0, "Front", ""}, + {CU_FRONT|CU_BACK, "BOTH", 0, "Both", ""}, + {0, NULL, 0, NULL, NULL}}; + #ifdef RNA_RUNTIME #include "BLI_math.h" @@ -278,6 +292,12 @@ static void rna_Curve_dimension_set(PointerRNA *ptr, int value) } } +static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +{ + Curve *cu= (Curve*)ptr->id.data; + + return (cu->flag&CU_3D) ? curve3d_fill_mode_items : curve2d_fill_mode_items; +} static int rna_Nurb_length(PointerRNA *ptr) { @@ -1345,14 +1365,11 @@ static void rna_def_curve(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Dimensions", "Select 2D or 3D curve type"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); - prop= RNA_def_property(srna, "use_fill_front", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FRONT); - RNA_def_property_ui_text(prop, "Front", "Draw filled front for extruded/beveled curves"); - RNA_def_property_update(prop, 0, "rna_Curve_update_data"); - - prop= RNA_def_property(srna, "use_fill_back", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_BACK); - RNA_def_property_ui_text(prop, "Back", "Draw filled back for extruded/beveled curves"); + prop= RNA_def_property(srna, "fill_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); + RNA_def_property_enum_items(prop, curve3d_fill_mode_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Curve_fill_mode_itemf"); + RNA_def_property_ui_text(prop, "Fill Mode", "Mode of filling curve"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); prop= RNA_def_property(srna, "twist_mode", PROP_ENUM, PROP_NONE); |