Cleanup: rename arrow manipulator 'draw_options'
authorCampbell Barton <ideasman42@gmail.com>
Thu, 14 Jun 2018 07:17:03 +0000 (09:17 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 14 Jun 2018 07:17:03 +0000 (09:17 +0200)
Rename to 'transform' since this controls interaction.

source/blender/editors/include/ED_manipulator_library.h
source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c
source/blender/editors/space_view3d/view3d_manipulator_camera.c
source/blender/editors/space_view3d/view3d_manipulator_forcefield.c
source/blender/editors/space_view3d/view3d_manipulator_lamp.c

index b67af42..e8eeb0f 100644 (file)
@@ -75,9 +75,9 @@ enum {
 
 enum {
        /* inverted offset during interaction - if set it also sets constrained below */
-       ED_MANIPULATOR_ARROW_STYLE_INVERTED      = (1 << 3),
+       ED_MANIPULATOR_ARROW_XFORM_FLAG_INVERTED      = (1 << 3),
        /* clamp arrow interaction to property width */
-       ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED   = (1 << 4),
+       ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED   = (1 << 4),
 };
 
 void ED_manipulator_arrow3d_set_ui_range(struct wmManipulator *mpr, const float min, const float max);
index 409a2c3..9ab8b6a 100644 (file)
@@ -303,9 +303,9 @@ static int manipulator_arrow_modal(
 
        /* set the property for the operator and call its modal function */
        if (WM_manipulator_target_property_is_valid(mpr_prop)) {
-               const int draw_options = RNA_enum_get(arrow->manipulator.ptr, "draw_options");
-               const bool constrained = (draw_options & ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED) != 0;
-               const bool inverted = (draw_options & ED_MANIPULATOR_ARROW_STYLE_INVERTED) != 0;
+               const int transform_flag = RNA_enum_get(arrow->manipulator.ptr, "transform");
+               const bool constrained = (transform_flag & ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED) != 0;
+               const bool inverted = (transform_flag & ED_MANIPULATOR_ARROW_XFORM_FLAG_INVERTED) != 0;
                const bool use_precision = (tweak_flag & WM_MANIPULATOR_TWEAK_PRECISE) != 0;
                float value = manipulator_value_from_offset(data, inter, ofs_new, constrained, inverted, use_precision);
 
@@ -363,9 +363,9 @@ static int manipulator_arrow_invoke(
 static void manipulator_arrow_property_update(wmManipulator *mpr, wmManipulatorProperty *mpr_prop)
 {
        ArrowManipulator3D *arrow = (ArrowManipulator3D *)mpr;
-       const int draw_options = RNA_enum_get(arrow->manipulator.ptr, "draw_options");
-       const bool constrained = (draw_options & ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED) != 0;
-       const bool inverted = (draw_options & ED_MANIPULATOR_ARROW_STYLE_INVERTED) != 0;
+       const int transform_flag = RNA_enum_get(arrow->manipulator.ptr, "transform");
+       const bool constrained = (transform_flag & ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED) != 0;
+       const bool inverted = (transform_flag & ED_MANIPULATOR_ARROW_XFORM_FLAG_INVERTED) != 0;
        manipulator_property_data_update(mpr, &arrow->data, mpr_prop, constrained, inverted);
 }
 
@@ -448,21 +448,21 @@ static void MANIPULATOR_WT_arrow_3d(wmManipulatorType *wt)
        wt->struct_size = sizeof(ArrowManipulator3D);
 
        /* rna */
-       static EnumPropertyItem rna_enum_draw_style[] = {
+       static EnumPropertyItem rna_enum_draw_style_items[] = {
                {ED_MANIPULATOR_ARROW_STYLE_NORMAL, "NORMAL", 0, "Normal", ""},
                {ED_MANIPULATOR_ARROW_STYLE_CROSS, "CROSS", 0, "Cross", ""},
                {ED_MANIPULATOR_ARROW_STYLE_BOX, "BOX", 0, "Box", ""},
                {ED_MANIPULATOR_ARROW_STYLE_CONE, "CONE", 0, "Cone", ""},
                {0, NULL, 0, NULL, NULL}
        };
-       static EnumPropertyItem rna_enum_draw_options[] = {
-               {ED_MANIPULATOR_ARROW_STYLE_INVERTED, "INVERT", 0, "Inverted", ""},
-               {ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED, "CONSTRAIN", 0, "Constrained", ""},
+       static EnumPropertyItem rna_enum_transform_items[] = {
+               {ED_MANIPULATOR_ARROW_XFORM_FLAG_INVERTED, "INVERT", 0, "Inverted", ""},
+               {ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED, "CONSTRAIN", 0, "Constrained", ""},
                {0, NULL, 0, NULL, NULL}
        };
 
-       RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style, ED_MANIPULATOR_ARROW_STYLE_NORMAL, "Draw Style", "");
-       RNA_def_enum_flag(wt->srna, "draw_options", rna_enum_draw_options, 0, "Draw Options", "");
+       RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style_items, ED_MANIPULATOR_ARROW_STYLE_NORMAL, "Draw Style", "");
+       RNA_def_enum_flag(wt->srna, "transform", rna_enum_transform_items, 0, "Transform", "");
 
        RNA_def_float(wt->srna, "length", 1.0f, 0.0f, FLT_MAX, "Arrow Line Length", "", 0.0f, FLT_MAX);
        RNA_def_float_vector(wt->srna, "aspect", 2, NULL, 0, FLT_MAX, "Aspect", "Cone/box style only", 0.0f, FLT_MAX);
index 49fa83e..023e16c 100644 (file)
@@ -109,7 +109,7 @@ static void WIDGETGROUP_camera_setup(const bContext *C, wmManipulatorGroup *mgro
                mpr = camgroup->focal_len = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL);
                mpr->flag |= WM_MANIPULATOR_DRAW_NO_SCALE;
                RNA_enum_set(mpr->ptr, "draw_style",  ED_MANIPULATOR_ARROW_STYLE_CONE);
-               RNA_enum_set(mpr->ptr, "draw_options",  ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED);
+               RNA_enum_set(mpr->ptr, "transform",  ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED);
 
                UI_GetThemeColor3fv(TH_MANIPULATOR_PRIMARY, mpr->color);
                UI_GetThemeColor3fv(TH_MANIPULATOR_HI, mpr->color_hi);
@@ -117,7 +117,7 @@ static void WIDGETGROUP_camera_setup(const bContext *C, wmManipulatorGroup *mgro
                mpr = camgroup->ortho_scale = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL);
                mpr->flag |= WM_MANIPULATOR_DRAW_NO_SCALE;
                RNA_enum_set(mpr->ptr, "draw_style",  ED_MANIPULATOR_ARROW_STYLE_CONE);
-               RNA_enum_set(mpr->ptr, "draw_options",  ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED);
+               RNA_enum_set(mpr->ptr, "transform",  ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED);
 
                UI_GetThemeColor3fv(TH_MANIPULATOR_PRIMARY, mpr->color);
                UI_GetThemeColor3fv(TH_MANIPULATOR_HI, mpr->color_hi);
index 2a1fdee..305085b 100644 (file)
@@ -72,7 +72,7 @@ static void WIDGETGROUP_forcefield_setup(const bContext *UNUSED(C), wmManipulato
 
        wwrapper->manipulator = WM_manipulator_new("MANIPULATOR_WT_arrow_3d", mgroup, NULL);
        wmManipulator *mpr = wwrapper->manipulator;
-       RNA_enum_set(mpr->ptr, "draw_options",  ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED);
+       RNA_enum_set(mpr->ptr, "transform",  ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED);
        ED_manipulator_arrow3d_set_ui_range(mpr, -200.0f, 200.0f);
        ED_manipulator_arrow3d_set_range_fac(mpr, 6.0f);
 
index 01c38cf..f98a2f3 100644 (file)
@@ -74,7 +74,7 @@ static void WIDGETGROUP_lamp_spot_setup(const bContext *UNUSED(C), wmManipulator
 
        wwrapper->manipulator = WM_manipulator_new("MANIPULATOR_WT_arrow_3d", mgroup, NULL);
        wmManipulator *mpr = wwrapper->manipulator;
-       RNA_enum_set(mpr->ptr, "draw_options",  ED_MANIPULATOR_ARROW_STYLE_INVERTED);
+       RNA_enum_set(mpr->ptr, "transform",  ED_MANIPULATOR_ARROW_XFORM_FLAG_INVERTED);
 
        mgroup->customdata = wwrapper;