diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-07-17 08:06:18 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-07-17 08:06:18 +0300 |
commit | ab5be294cec70d48ca73405f6c1641d0007035df (patch) | |
tree | 3597a2779c24ca24b32252c6b1c7dbdb7e01f491 /source/blender/makesrna | |
parent | 02257ace225fc7cb4673639bd807360fb9e12592 (diff) |
Manipulator: split alpha out of color property
Gives more convenient access from Python: `mathutils.Color`
Also correct some copy-paste error w/ property subtypes.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_wm_manipulator.c | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_manipulator.c b/source/blender/makesrna/intern/rna_wm_manipulator.c index ee5f8160280..3042553ed0e 100644 --- a/source/blender/makesrna/intern/rna_wm_manipulator.c +++ b/source/blender/makesrna/intern/rna_wm_manipulator.c @@ -309,6 +309,17 @@ static void rna_Manipulator_##func_id##_set(PointerRNA *ptr, float value) \ wmManipulator *mpr = ptr->data; \ mpr->member_id = value; \ } +#define RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_INDEX_RW_DEF(func_id, member_id, index) \ +static float rna_Manipulator_##func_id##_get(PointerRNA *ptr) \ +{ \ + wmManipulator *mpr = ptr->data; \ + return mpr->member_id[index]; \ +} \ +static void rna_Manipulator_##func_id##_set(PointerRNA *ptr, float value) \ +{ \ + wmManipulator *mpr = ptr->data; \ + mpr->member_id[index] = value; \ +} /* wmManipulator.float[len] */ #define RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_RW_DEF(func_id, member_id, len) \ static void rna_Manipulator_##func_id##_get(PointerRNA *ptr, float value[len]) \ @@ -342,8 +353,11 @@ static int rna_Manipulator_##func_id##_get(PointerRNA *ptr) \ return (mpr->member_id & flag_value) != 0; \ } -RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_RW_DEF(color, color, 4); -RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_RW_DEF(color_hi, color_hi, 4); +RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_RW_DEF(color, color, 3); +RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_RW_DEF(color_hi, color_hi, 3); + +RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_INDEX_RW_DEF(alpha, color, 3); +RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_INDEX_RW_DEF(alpha_hi, color_hi, 3); RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_RW_DEF(matrix_basis, matrix_basis, 16); RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_RW_DEF(matrix_offset, matrix_offset, 16); @@ -984,14 +998,27 @@ static void rna_def_manipulator(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_struct_name_property(srna, prop); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL); + /* Color & Alpha */ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); - RNA_def_property_array(prop, 4); + RNA_def_property_array(prop, 3); RNA_def_property_float_funcs(prop, "rna_Manipulator_color_get", "rna_Manipulator_color_set", NULL); + prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE); + RNA_def_property_ui_text(prop, "Alpha", ""); + RNA_def_property_float_funcs(prop, "rna_Manipulator_alpha_get", "rna_Manipulator_alpha_set", NULL); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); + + /* Color & Alpha (highlight) */ prop = RNA_def_property(srna, "color_highlight", PROP_FLOAT, PROP_COLOR); - RNA_def_property_array(prop, 4); + RNA_def_property_array(prop, 3); RNA_def_property_float_funcs(prop, "rna_Manipulator_color_hi_get", "rna_Manipulator_color_hi_set", NULL); - RNA_def_property_ui_text(prop, "Color", ""); + + prop = RNA_def_property(srna, "alpha_highlight", PROP_FLOAT, PROP_NONE); + RNA_def_property_ui_text(prop, "Alpha", ""); + RNA_def_property_float_funcs(prop, "rna_Manipulator_alpha_hi_get", "rna_Manipulator_alpha_hi_set", NULL); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); @@ -1005,13 +1032,13 @@ static void rna_def_manipulator(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_float_funcs(prop, "rna_Manipulator_matrix_offset_get", "rna_Manipulator_matrix_offset_set", NULL); RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); - prop = RNA_def_property(srna, "scale_basis", PROP_FLOAT, PROP_MATRIX); + prop = RNA_def_property(srna, "scale_basis", PROP_FLOAT, PROP_NONE); RNA_def_property_ui_text(prop, "Scale Basis", ""); RNA_def_property_float_funcs(prop, "rna_Manipulator_scale_basis_get", "rna_Manipulator_scale_basis_set", NULL); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); - prop = RNA_def_property(srna, "line_width", PROP_FLOAT, PROP_MATRIX); + prop = RNA_def_property(srna, "line_width", PROP_FLOAT, PROP_PIXEL); RNA_def_property_ui_text(prop, "Line Width", ""); RNA_def_property_float_funcs(prop, "rna_Manipulator_line_width_get", "rna_Manipulator_line_width_set", NULL); RNA_def_property_range(prop, 0.0f, FLT_MAX); |