Commit: 7b14065729af4266bffbf70ef0de3bd646ec555c
Author: Campbell Barton
Date:   Mon Jun 19 17:47:04 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB7b14065729af4266bffbf70ef0de3bd646ec555c

Manipulator: de-duplicate flags and scale option

===================================================================

M       release/scripts/startup/bl_ui/space_userpref.py
M       source/blender/editors/interface/resources.c
M       source/blender/editors/manipulator_library/arrow3d_manipulator.c
M       source/blender/editors/manipulator_library/dial3d_manipulator.c
M       source/blender/editors/manipulator_library/manipulator_draw_utils.c
M       source/blender/editors/mesh/editmesh_bisect.c
M       source/blender/editors/mesh/editmesh_extrude.c
M       source/blender/editors/space_view3d/space_view3d.c
M       source/blender/editors/space_view3d/view3d_header.c
M       source/blender/editors/transform/transform_manipulator.c
M       source/blender/editors/transform/transform_manipulator2d.c
M       source/blender/makesdna/DNA_userdef_types.h
M       source/blender/makesdna/DNA_view3d_types.h
M       source/blender/makesrna/intern/rna_space.c
M       source/blender/makesrna/intern/rna_userdef.c
M       source/blender/windowmanager/manipulators/intern/wm_manipulator.c
M       source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_userpref.py 
b/release/scripts/startup/bl_ui/space_userpref.py
index 13a2cb97b2d..25d0e430708 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -285,11 +285,11 @@ class USERPREF_PT_interface(Panel):
         #col.prop(view, "open_left_mouse_delay", text="Hold LMB")
         #col.prop(view, "open_right_mouse_delay", text="Hold RMB")
         col.prop(view, "show_manipulator")
+        ## Currently not working
+        # col.prop(view, "show_manipulator_shaded")
         sub = col.column()
         sub.active = view.show_manipulator
         sub.prop(view, "manipulator_size", text="Size")
-        sub.prop(view, "manipulator_handle_size", text="Handle Size")
-        sub.prop(view, "manipulator_hotspot", text="Hotspot")
 
         col.separator()
         col.separator()
diff --git a/source/blender/editors/interface/resources.c 
b/source/blender/editors/interface/resources.c
index 09ec08fe265..cf35f4d895b 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1798,14 +1798,10 @@ void init_userdef_do_versions(void)
                U.savetime = 1;
 // XXX         error(STRINGIFY(BLENDER_STARTUP_FILE)" is buggy, please 
consider removing it.\n");
        }
-       /* transform widget settings */
-       if (U.tw_hotspot == 0) {
-               U.tw_hotspot = 14;
-               U.tw_size = 25;          /* percentage of window size */
-               U.tw_handlesize = 16;    /* percentage of widget radius */
-       }
-       if (U.manipulator_scale == 0)
-               U.manipulator_scale = 75;
+       if (U.manipulator_size == 0) {
+               U.manipulator_size = 75;
+               U.manipulator_flag |= USER_MANIPULATOR_DRAW;
+       }
        if (U.pad_rot_angle == 0.0f)
                U.pad_rot_angle = 15.0f;
        
@@ -2642,9 +2638,6 @@ void init_userdef_do_versions(void)
        
        if (!USER_VERSION_ATLEAST(269, 9)) {
                bTheme *btheme;
-               
-               U.tw_size = U.tw_size * 5.0f;
-               
                /* Action Editor (and NLA Editor) - Keyframe Colors */
                /* Graph Editor - larger vertex size defaults */
                for (btheme = U.themes.first; btheme; btheme = btheme->next) {
diff --git a/source/blender/editors/manipulator_library/arrow3d_manipulator.c 
b/source/blender/editors/manipulator_library/arrow3d_manipulator.c
index 7c688ea077f..41368240f46 100644
--- a/source/blender/editors/manipulator_library/arrow3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/arrow3d_manipulator.c
@@ -163,7 +163,7 @@ static void arrow_draw_geom(const ArrowManipulator3D 
*arrow, const bool select,
                else {
                        const float len = 0.25f;
                        const float width = 0.06f;
-                       const bool use_lighting = select == false && 
((U.manipulator_flag & V3D_SHADED_MANIPULATORS) != 0);
+                       const bool use_lighting = (!select && 
((U.manipulator_flag & USER_MANIPULATOR_SHADED) != 0));
 
                        /* translate to line end */
                        gpuTranslate3f(0.0f, 0.0f, arrow->len);
diff --git a/source/blender/editors/manipulator_library/dial3d_manipulator.c 
b/source/blender/editors/manipulator_library/dial3d_manipulator.c
index f4459b6bef2..111ea04cd3b 100644
--- a/source/blender/editors/manipulator_library/dial3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/dial3d_manipulator.c
@@ -187,7 +187,7 @@ static void dial_ghostarc_draw_helpline(const float angle, 
const float co_outer[
 static void dial_ghostarc_draw(
         const DialManipulator *dial, const float angle_ofs, const float 
angle_delta, const float color[4])
 {
-       const float width_inner = DIAL_WIDTH - dial->manipulator.line_width * 
0.5f / U.manipulator_scale;
+       const float width_inner = DIAL_WIDTH - dial->manipulator.line_width * 
0.5f / U.manipulator_size;
 
        VertexFormat *format = immVertexFormat();
        uint pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, 
KEEP_FLOAT);
diff --git 
a/source/blender/editors/manipulator_library/manipulator_draw_utils.c 
b/source/blender/editors/manipulator_library/manipulator_draw_utils.c
index d9434be8e0a..cfa1bc38ed5 100644
--- a/source/blender/editors/manipulator_library/manipulator_draw_utils.c
+++ b/source/blender/editors/manipulator_library/manipulator_draw_utils.c
@@ -63,7 +63,7 @@ void wm_manipulator_geometryinfo_draw(const 
ManipulatorGeomInfo *info, const boo
        /* TODO store the Batches inside the ManipulatorGeomInfo and updated it 
when geom changes
         * So we don't need to re-created and discard it every time */
 
-       const bool use_lighting = true || (!select && ((U.manipulator_flag & 
V3D_SHADED_MANIPULATORS) != 0));
+       const bool use_lighting = true || (!select && ((U.manipulator_flag & 
USER_MANIPULATOR_SHADED) != 0));
        VertexBuffer *vbo;
        ElementList *el;
        Batch *batch;
diff --git a/source/blender/editors/mesh/editmesh_bisect.c 
b/source/blender/editors/mesh/editmesh_bisect.c
index 0f291937156..31b4c7ef87e 100644
--- a/source/blender/editors/mesh/editmesh_bisect.c
+++ b/source/blender/editors/mesh/editmesh_bisect.c
@@ -197,7 +197,7 @@ static int mesh_bisect_modal(bContext *C, wmOperator *op, 
const wmEvent *event)
                /* Setup manipulators */
                {
                        View3D *v3d = CTX_wm_view3d(C);
-                       if (v3d && (v3d->twtype & V3D_USE_MANIPULATOR)) {
+                       if (v3d && (v3d->twtype & V3D_MANIPULATOR_DRAW)) {
                                WM_manipulator_group_add("MESH_WGT_bisect");
                        }
                }
diff --git a/source/blender/editors/mesh/editmesh_extrude.c 
b/source/blender/editors/mesh/editmesh_extrude.c
index e722b89e9b1..c1f760be158 100644
--- a/source/blender/editors/mesh/editmesh_extrude.c
+++ b/source/blender/editors/mesh/editmesh_extrude.c
@@ -758,7 +758,7 @@ static int edbm_spin_invoke(bContext *C, wmOperator *op, 
const wmEvent *UNUSED(e
 #ifdef USE_MANIPULATOR
        if (ret & OPERATOR_FINISHED) {
                /* Setup manipulators */
-               if (v3d && (v3d->twtype & V3D_USE_MANIPULATOR)) {
+               if (v3d && (v3d->twtype & V3D_MANIPULATOR_DRAW)) {
                        WM_manipulator_group_add("MESH_WGT_spin");
                }
        }
diff --git a/source/blender/editors/space_view3d/space_view3d.c 
b/source/blender/editors/space_view3d/space_view3d.c
index eaf9f73b39c..41851d8d358 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -344,7 +344,7 @@ static SpaceLink *view3d_new(const bContext *C)
        v3d->near = 0.01f;
        v3d->far = 1000.0f;
 
-       v3d->twflag |= U.manipulator_flag & V3D_USE_MANIPULATOR;
+       v3d->twflag |= U.manipulator_flag & V3D_MANIPULATOR_DRAW;
        v3d->twtype = V3D_MANIP_TRANSLATE;
        v3d->around = V3D_AROUND_CENTER_MEAN;
        
diff --git a/source/blender/editors/space_view3d/view3d_header.c 
b/source/blender/editors/space_view3d/view3d_header.c
index 7acc67bc241..bb86b0a991f 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -328,7 +328,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext 
*C)
                /* Transform widget / manipulators */
                row = uiLayoutRow(layout, true);
                uiItemR(row, &v3dptr, "show_manipulator", UI_ITEM_R_ICON_ONLY, 
"", ICON_NONE);
-               if (v3d->twflag & V3D_USE_MANIPULATOR) {
+               if (v3d->twflag & V3D_MANIPULATOR_DRAW) {
                        uiItemR(row, &v3dptr, "transform_manipulators", 
UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
                }
                uiItemR(row, &v3dptr, "transform_orientation", 0, "", 
ICON_NONE);
diff --git a/source/blender/editors/transform/transform_manipulator.c 
b/source/blender/editors/transform/transform_manipulator.c
index 38d41f6dc3a..2f276eb98b5 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -1360,7 +1360,7 @@ static bool WIDGETGROUP_manipulator_poll(const struct 
bContext *C, struct wmMani
        const ScrArea *sa = CTX_wm_area(C);
        const View3D *v3d = sa->spacedata.first;
 
-       return (((v3d->twflag & V3D_USE_MANIPULATOR) != 0) &&
+       return (((v3d->twflag & V3D_MANIPULATOR_DRAW) != 0) &&
                ((v3d->twtype & (V3D_MANIP_TRANSLATE | V3D_MANIP_ROTATE | 
V3D_MANIP_SCALE)) != 0));
 }
 
diff --git a/source/blender/editors/transform/transform_manipulator2d.c 
b/source/blender/editors/transform/transform_manipulator2d.c
index 0035910f8d7..8cfa386cba2 100644
--- a/source/blender/editors/transform/transform_manipulator2d.c
+++ b/source/blender/editors/transform/transform_manipulator2d.c
@@ -199,7 +199,7 @@ void ED_widgetgroup_manipulator2d_setup(const bContext 
*UNUSED(C), wmManipulator
                ED_manipulator_arrow2d_set_line_len(axis, 0.8f);
                WM_manipulator_set_matrix_offset_location(axis, offset);
                WM_manipulator_set_line_width(axis, 
MANIPULATOR_AXIS_LINE_WIDTH);
-               WM_manipulator_set_scale(axis, U.manipulator_scale);
+               WM_manipulator_set_scale(axis, U.manipulator_size);
                WM_manipulator_set_color(axis, col);
                WM_manipulator_set_color_highlight(axis, col_hi);
 
diff --git a/source/blender/makesdna/DNA_userdef_types.h 
b/source/blender/makesdna/DNA_userdef_types.h
index 9f5d33531f6..01ad818d0f1 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -494,8 +494,7 @@ typedef struct UserDef {
        short gp_settings;
        short tb_leftmouse, tb_rightmouse;
        struct SolidLight light[3];
-       short tw_hotspot, tw_flag, tw_handlesize, tw_size;
-       short manipulator_flag, manipulator_scale;
+       short manipulator_flag, manipulator_size;
        int pad3;
        short textimeout, texcollectrate;
        short wmdrawmethod; /* removed wmpad */
@@ -796,6 +795,11 @@ typedef enum eGP_UserdefSettings {
        GP_PAINT_DOSIMPLIFY             = (1 << 1),
 } eGP_UserdefSettings;
 
+enum {
+       USER_MANIPULATOR_DRAW        = (1 << 0),
+       USER_MANIPULATOR_SHADED      = (1 << 1),
+};
+
 /* color picker types */
 typedef enum eColorPicker_Types {
        USER_CP_CIRCLE_HSV      = 0,
diff --git a/source/blender/makesdna/DNA_view3d_types.h 
b/source/blender/makesdna/DNA_view3d_types.h
index 6c526d125d6..22bb3cd5add 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -380,11 +380,10 @@ enum {
 #define V3D_MANIP_GIMBAL               4
 #define V3D_MANIP_CUSTOM               5
 
-/* View3d->twflag */
-   /* USE = user setting, DRAW = based on selection */
-#define V3D_USE_MANIPULATOR            1
-#define V3D_DRAW_MANIPULATOR        (1 << 1)
-#define V3D_SHADED_MANIPULATORS      (1 << 2)
+/* View3d->twflag (also) */
+enum {
+       V3D_MANIPULATOR_DRAW        = (1 << 0),
+};
 
 /* BGPic->flag */
 /* may want to use 1 for select ? */
diff --git a/source/bl

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to