Manipulator: split alpha out of color property
Gives more convenient access from Python: `mathutils.Color` Also correct some copy-paste error w/ property subtypes.
This commit is contained in:
parent
02257ace22
commit
ab5be294ce
|
@ -130,8 +130,12 @@ class SelectSideOfPlaneManipulatorGroup(ManipulatorGroup):
|
|||
|
||||
mpr.use_draw_value = True
|
||||
|
||||
mpr.color = 0.8, 0.8, 0.8, 0.5
|
||||
mpr.color_highlight = 1.0, 1.0, 1.0, 1.0
|
||||
mpr.color = 0.8, 0.8, 0.8
|
||||
mpr.alpha = 0.5
|
||||
|
||||
mpr.color_highlight = 1.0, 1.0, 1.0
|
||||
mpr.alpha_highlight = 1.0
|
||||
|
||||
mpr.scale_basis = 0.2
|
||||
|
||||
self.widget_grab = mpr
|
||||
|
@ -162,8 +166,11 @@ class SelectSideOfPlaneManipulatorGroup(ManipulatorGroup):
|
|||
|
||||
mpr.use_draw_value = True
|
||||
|
||||
mpr.color = 0.8, 0.8, 0.8, 0.5
|
||||
mpr.color = 0.8, 0.8, 0.8
|
||||
mpr.alpha = 0.5
|
||||
|
||||
mpr.color_highlight = 1.0, 1.0, 1.0, 1.0
|
||||
mpr.alpha_highlight = 1.0
|
||||
|
||||
self.widget_dial = mpr
|
||||
|
||||
|
|
|
@ -32,8 +32,11 @@ class MyCameraWidgetGroup(ManipulatorGroup):
|
|||
mpr.matrix_basis = ob.matrix_world.normalized()
|
||||
mpr.line_width = 3
|
||||
|
||||
mpr.color = 0.8, 0.8, 0.8, 0.5
|
||||
mpr.color_highlight = 1.0, 1.0, 1.0, 1.0
|
||||
mpr.color = 0.8, 0.8, 0.8
|
||||
mpr.alpha = 0.5
|
||||
|
||||
mpr.color_highlight = 1.0, 1.0, 1.0
|
||||
mpr.alpha_highlight = 1.0
|
||||
|
||||
self.roll_widget = mpr
|
||||
|
||||
|
|
|
@ -29,8 +29,11 @@ class MyLampWidgetGroup(ManipulatorGroup):
|
|||
mpr.matrix_basis = ob.matrix_world.normalized()
|
||||
mpr.draw_style = 'BOX'
|
||||
|
||||
mpr.color = 1, 0.5, 0, 0.5
|
||||
mpr.color_highlight = 1, 0.5, 1, 0.5
|
||||
mpr.color = 1.0, 0.5, 0.0
|
||||
mpr.alpha = 0.5
|
||||
|
||||
mpr.color_highlight = 1.0, 0.5, 1.0
|
||||
mpr.alpha_highlight = 0.5
|
||||
|
||||
self.energy_widget = mpr
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue