WM: move manipulator library into editors
authorCampbell Barton <ideasman42@gmail.com>
Wed, 7 Jun 2017 21:16:47 +0000 (07:16 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 7 Jun 2017 21:42:17 +0000 (07:42 +1000)
As with operators, the window-manager has the API for defining,
the editor can implement and register its own manipulators.

This exposes wmManipulator, keeping it opaque isn't
practical if editors and Python are to implement their own.

29 files changed:
build_files/cmake/macros.cmake
source/blender/editors/CMakeLists.txt
source/blender/editors/include/ED_manipulator_library.h [new file with mode: 0644]
source/blender/editors/manipulator_library/CMakeLists.txt [new file with mode: 0644]
source/blender/editors/manipulator_library/arrow2d_manipulator.c [moved from source/blender/windowmanager/manipulators/intern/manipulator_library/arrow2d_manipulator.c with 90% similarity]
source/blender/editors/manipulator_library/arrow3d_manipulator.c [moved from source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c with 88% similarity]
source/blender/editors/manipulator_library/cage2d_manipulator.c [moved from source/blender/windowmanager/manipulators/intern/manipulator_library/cage_manipulator.c with 77% similarity]
source/blender/editors/manipulator_library/dial3d_manipulator.c [moved from source/blender/windowmanager/manipulators/intern/manipulator_library/dial_manipulator.c with 89% similarity]
source/blender/editors/manipulator_library/geom_arrow_manipulator.c [moved from source/blender/windowmanager/manipulators/intern/manipulator_library/geom_arrow_manipulator.c with 97% similarity]
source/blender/editors/manipulator_library/geom_cube_manipulator.c [moved from source/blender/windowmanager/manipulators/intern/manipulator_library/geom_cube_manipulator.c with 95% similarity]
source/blender/editors/manipulator_library/geom_dial_manipulator.c [moved from source/blender/windowmanager/manipulators/intern/manipulator_library/geom_dial_manipulator.c with 99% similarity]
source/blender/editors/manipulator_library/manipulator_draw_utils.c [new file with mode: 0644]
source/blender/editors/manipulator_library/manipulator_geometry.h [moved from source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_geometry.h with 94% similarity]
source/blender/editors/manipulator_library/manipulator_library_intern.h [moved from source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_intern.h with 87% similarity]
source/blender/editors/manipulator_library/manipulator_library_utils.c [moved from source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_utils.c with 96% similarity]
source/blender/editors/manipulator_library/primitive3d_manipulator.c [moved from source/blender/windowmanager/manipulators/intern/manipulator_library/primitive_manipulator.c with 85% similarity]
source/blender/editors/space_api/spacetypes.c
source/blender/editors/space_node/node_widgets.c
source/blender/editors/space_view3d/view3d_manipulators.c
source/blender/editors/transform/transform_manipulator.c
source/blender/editors/util/CMakeLists.txt
source/blender/windowmanager/CMakeLists.txt
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/manipulators/WM_manipulator_library.h [deleted file]
source/blender/windowmanager/manipulators/WM_manipulator_types.h
source/blender/windowmanager/manipulators/intern/wm_manipulator.c
source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h
source/blender/windowmanager/manipulators/intern/wm_manipulatorgroup.c
source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c

index 92342d580c37d580619500e10f6083751ffd1c73..563e83fd79a6a90a9f10d818a4f94704275c405a 100644 (file)
@@ -579,6 +579,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
                bf_editor_curve
                bf_editor_gpencil
                bf_editor_interface
+               bf_editor_manipulator_library
                bf_editor_mesh
                bf_editor_metaball
                bf_editor_object
index f62db3c1ddbe2d7a152ce161baa296bb8e08b3f7..757fca0a1b236fad2773c2c681a2e3413a9e2620 100644 (file)
@@ -29,6 +29,7 @@ if(WITH_BLENDER)
        add_subdirectory(gpencil)
        add_subdirectory(interface)
        add_subdirectory(io)
+       add_subdirectory(manipulator_library)
        add_subdirectory(mask)
        add_subdirectory(mesh)
        add_subdirectory(metaball)
diff --git a/source/blender/editors/include/ED_manipulator_library.h b/source/blender/editors/include/ED_manipulator_library.h
new file mode 100644 (file)
index 0000000..a9c04c8
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file ED_manipulator_library.h
+ *  \ingroup wm
+ *
+ * \name Generic Manipulators.
+ *
+ * This is exposes pre-defined manipulators for re-use.
+ */
+
+
+#ifndef __ED_MANIPULATOR_LIBRARY_H__
+#define __ED_MANIPULATOR_LIBRARY_H__
+
+/* initialize manipulators */
+void ED_manipulatortypes_arrow_2d(void);
+void ED_manipulatortypes_arrow_3d(void);
+void ED_manipulatortypes_cage_2d(void);
+void ED_manipulatortypes_dial_3d(void);
+void ED_manipulatortypes_facemap_3d(void);
+void ED_manipulatortypes_primitive_3d(void);
+
+struct wmManipulatorGroup;
+
+/* -------------------------------------------------------------------- */
+/* 3D Arrow Manipulator */
+
+enum {
+       ED_MANIPULATOR_ARROW_STYLE_NORMAL        =  1,
+       ED_MANIPULATOR_ARROW_STYLE_NO_AXIS       = (1 << 1),
+       ED_MANIPULATOR_ARROW_STYLE_CROSS         = (1 << 2),
+       /* inverted offset during interaction - if set it also sets constrained below */
+       ED_MANIPULATOR_ARROW_STYLE_INVERTED      = (1 << 3),
+       /* clamp arrow interaction to property width */
+       ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED   = (1 << 4),
+       /* use a box for the arrowhead */
+       ED_MANIPULATOR_ARROW_STYLE_BOX           = (1 << 5),
+       ED_MANIPULATOR_ARROW_STYLE_CONE          = (1 << 6),
+};
+
+/* slots for properties */
+enum {
+       ED_MANIPULATOR_ARROW_SLOT_OFS_WORLD_SPACE = 0
+};
+
+struct wmManipulator *ED_manipulator_arrow3d_new(
+        struct wmManipulatorGroup *mgroup, const char *name, const int style);
+void ED_manipulator_arrow3d_set_direction(struct wmManipulator *manipulator, const float direction[3]);
+void ED_manipulator_arrow3d_set_up_vector(struct wmManipulator *manipulator, const float direction[3]);
+void ED_manipulator_arrow3d_set_line_len(struct wmManipulator *manipulator, const float len);
+void ED_manipulator_arrow3d_set_ui_range(struct wmManipulator *manipulator, const float min, const float max);
+void ED_manipulator_arrow3d_set_range_fac(struct wmManipulator *manipulator, const float range_fac);
+void ED_manipulator_arrow3d_cone_set_aspect(struct wmManipulator *manipulator, const float aspect[2]);
+
+
+/* -------------------------------------------------------------------- */
+/* 2D Arrow Manipulator */
+
+struct wmManipulator *ED_manipulator_arrow2d_new(struct wmManipulatorGroup *mgroup, const char *name);
+void ED_manipulator_arrow2d_set_angle(struct wmManipulator *manipulator, const float rot_fac);
+void ED_manipulator_arrow2d_set_line_len(struct wmManipulator *manipulator, const float len);
+
+
+/* -------------------------------------------------------------------- */
+/* Cage Manipulator */
+
+enum {
+       ED_MANIPULATOR_RECT_TRANSFORM_STYLE_TRANSLATE       =  1,       /* Manipulator translates */
+       ED_MANIPULATOR_RECT_TRANSFORM_STYLE_ROTATE          = (1 << 1), /* Manipulator rotates */
+       ED_MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE           = (1 << 2), /* Manipulator scales */
+       ED_MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM   = (1 << 3), /* Manipulator scales uniformly */
+};
+
+enum {
+       ED_MANIPULATOR_RECT_TX_SLOT_OFFSET = 0,
+       ED_MANIPULATOR_RECT_TX_SLOT_SCALE = 1
+};
+
+struct wmManipulator *ED_manipulator_rect_transform_new(
+        struct wmManipulatorGroup *mgroup, const char *name, const int style);
+void ED_manipulator_rect_transform_set_dimensions(
+        struct wmManipulator *manipulator, const float width, const float height);
+
+
+/* -------------------------------------------------------------------- */
+/* Dial Manipulator */
+
+enum {
+       ED_MANIPULATOR_DIAL_STYLE_RING = 0,
+       ED_MANIPULATOR_DIAL_STYLE_RING_CLIPPED = 1,
+       ED_MANIPULATOR_DIAL_STYLE_RING_FILLED = 2,
+};
+
+struct wmManipulator *ED_manipulator_dial3d_new(
+        struct wmManipulatorGroup *mgroup, const char *name, const int style);
+void ED_manipulator_dial3d_set_up_vector(
+        struct wmManipulator *manipulator, const float direction[3]);
+
+
+/* -------------------------------------------------------------------- */
+/* Facemap Manipulator */
+
+struct wmManipulator *ED_manipulator_facemap_new(
+        struct wmManipulatorGroup *mgroup, const char *name, const int style,
+        struct Object *ob, const int facemap);
+struct bFaceMap *ED_manipulator_facemap_get_fmap(struct wmManipulator *manipulator);
+
+
+/* -------------------------------------------------------------------- */
+/* Primitive Manipulator */
+
+enum {
+       ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE = 0,
+};
+
+struct wmManipulator *ED_manipulator_primitive3d_new(
+        struct wmManipulatorGroup *mgroup, const char *name, const int style);
+void ED_manipulator_primitive3d_set_direction(struct wmManipulator *manipulator, const float direction[3]);
+void ED_manipulator_primitive3d_set_up_vector(struct wmManipulator *manipulator, const float direction[3]);
+
+#endif  /* __ED_MANIPULATOR_LIBRARY_H__ */
diff --git a/source/blender/editors/manipulator_library/CMakeLists.txt b/source/blender/editors/manipulator_library/CMakeLists.txt
new file mode 100644 (file)
index 0000000..bcb814e
--- /dev/null
@@ -0,0 +1,56 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+set(INC
+       ../include
+       ../../blenkernel
+       ../../blenlib
+       ../../blentranslation
+       ../../bmesh
+       ../../depsgraph
+       ../../gpu
+       ../../makesdna
+       ../../makesrna
+       ../../windowmanager
+       ../../../../intern/guardedalloc
+       ../../../../intern/eigen
+       ../../../../intern/glew-mx
+)
+
+set(INC_SYS
+       ${GLEW_INCLUDE_PATH}
+)
+
+set(SRC
+       arrow2d_manipulator.c
+       arrow3d_manipulator.c
+       cage2d_manipulator.c
+       dial3d_manipulator.c
+       geom_arrow_manipulator.c
+       geom_cube_manipulator.c
+       manipulator_draw_utils.c
+       manipulator_library_utils.c
+       primitive3d_manipulator.c
+
+       manipulator_geometry.h
+       manipulator_library_intern.h
+)
+
+add_definitions(${GL_DEFINITIONS})
+
+blender_add_lib(bf_editor_manipulator_library "${SRC}" "${INC}" "${INC_SYS}")
similarity index 90%
rename from source/blender/windowmanager/manipulators/intern/manipulator_library/arrow2d_manipulator.c
rename to source/blender/editors/manipulator_library/arrow2d_manipulator.c
index 0cec342dd066517bb4ed3929e2fe8d0f03a58c0f..6182772375270f9ab5e14f3f7c263732b813ec4b 100644 (file)
@@ -23,7 +23,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/windowmanager/manipulators/intern/manipulator_library/arrow2d_manipulator.c
+/** \file arrow2d_manipulator.c
  *  \ingroup wm
  *
  * \name 2D Arrow Manipulator
@@ -43,6 +43,7 @@
 #include "DNA_windowmanager_types.h"
 
 #include "ED_screen.h"
+#include "ED_manipulator_library.h"
 
 #include "GPU_draw.h"
 #include "GPU_immediate.h"
 #include "WM_types.h"
 
 /* own includes */
-#include "WM_manipulator_api.h"
-#include "WM_manipulator_types.h"
-#include "wm_manipulator_wmapi.h"
-#include "WM_manipulator_library.h"
-#include "wm_manipulator_intern.h"
+#include "WM_api.h"
+
 #include "manipulator_library_intern.h"
 
 
@@ -112,7 +110,7 @@ static void manipulator_arrow2d_draw(const bContext *UNUSED(C), struct wmManipul
        ArrowManipulator2D *arrow = (ArrowManipulator2D *)manipulator;
        float col[4];
 
-       manipulator_color_get(manipulator, manipulator->state & WM_MANIPULATOR_HIGHLIGHT, col);
+       manipulator_color_get(manipulator, manipulator->state & WM_MANIPULATOR_STATE_HIGHLIGHT, col);
 
        glLineWidth(manipulator->line_width);
        glEnable(GL_BLEND);
@@ -190,7 +188,7 @@ static int manipulator_arrow2d_intersect(
  *
  * \{ */
 
-struct wmManipulator *MANIPULATOR_arrow2d_new(wmManipulatorGroup *mgroup, const char *name)
+struct wmManipulator *ED_manipulator_arrow2d_new(wmManipulatorGroup *mgroup, const char *name)
 {
        const wmManipulatorType *mpt = WM_manipulatortype_find("MANIPULATOR_WT_arrow_2d", false);
        ArrowManipulator2D *arrow = (ArrowManipulator2D *)WM_manipulator_new(mpt, mgroup, name);
@@ -202,13 +200,13 @@ struct wmManipulator *MANIPULATOR_arrow2d_new(wmManipulatorGroup *mgroup, const
        return &arrow->manipulator;
 }
 
-void MANIPULATOR_arrow2d_set_angle(struct wmManipulator *manipulator, const float angle)
+void ED_manipulator_arrow2d_set_angle(struct wmManipulator *manipulator, const float angle)
 {
        ArrowManipulator2D *arrow = (ArrowManipulator2D *)manipulator;
        arrow->angle = angle;
 }
 
-void MANIPULATOR_arrow2d_set_line_len(struct wmManipulator *manipulator, const float len)
+void ED_manipulator_arrow2d_set_line_len(struct wmManipulator *manipulator, const float len)
 {
        ArrowManipulator2D *arrow = (ArrowManipulator2D *)manipulator;
        arrow->line_len = len;
@@ -233,11 +231,3 @@ void ED_manipulatortypes_arrow_2d(void)
 }
 
 /** \} */ /* Arrow Manipulator API */
-
-
-/* -------------------------------------------------------------------- */
-
-void fix_linking_manipulator_arrow2d(void)
-{
-       (void)0;
-}
similarity index 88%
rename from source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c
rename to source/blender/editors/manipulator_library/arrow3d_manipulator.c
index 95bd0bd1a455b1adbfc53e9b2761613172ce8776..87e26aeba667dd0f184d415174a225b089d4c8df 100644 (file)
@@ -23,7 +23,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c
+/** \file arrow3d_manipulator.c
  *  \ingroup wm
  *
  * \name Arrow Manipulator
@@ -45,6 +45,7 @@
 
 #include "ED_view3d.h"
 #include "ED_screen.h"
+#include "ED_manipulator_library.h"
 
 #include "GPU_draw.h"
 #include "GPU_immediate.h"
@@ -60,8 +61,6 @@
 #include "WM_api.h"
 
 /* own includes */
-#include "wm_manipulator_wmapi.h"
-#include "wm_manipulator_intern.h"
 #include "manipulator_geometry.h"
 #include "manipulator_library_intern.h"
 
@@ -106,7 +105,7 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select,
 
        immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
 
-       if (arrow->style & MANIPULATOR_ARROW_STYLE_CROSS) {
+       if (arrow->style & ED_MANIPULATOR_ARROW_STYLE_CROSS) {
                immUniformColor4fv(color);
 
                immBegin(PRIM_LINES, 4);
@@ -116,7 +115,7 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select,
                immVertex3f(pos,  0.0f,  1.0f, 0.0f);
                immEnd();
        }
-       else if (arrow->style & MANIPULATOR_ARROW_STYLE_CONE) {
+       else if (arrow->style & ED_MANIPULATOR_ARROW_STYLE_CONE) {
                const float unitx = arrow->aspect[0];
                const float unity = arrow->aspect[1];
                const float vec[4][3] = {
@@ -147,7 +146,7 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select,
 
                gpuPushMatrix();
 
-               if (arrow->style & MANIPULATOR_ARROW_STYLE_BOX) {
+               if (arrow->style & ED_MANIPULATOR_ARROW_STYLE_BOX) {
                        const float size = 0.05f;
 
                        /* translate to line end with some extra offset so box starts exactly where line ends */
@@ -249,7 +248,7 @@ static void manipulator_arrow_render_3d_intersect(
 
 static void manipulator_arrow_draw(const bContext *UNUSED(C), wmManipulator *manipulator)
 {
-       arrow_draw_intern((ArrowManipulator3D *)manipulator, false, (manipulator->state & WM_MANIPULATOR_HIGHLIGHT) != 0);
+       arrow_draw_intern((ArrowManipulator3D *)manipulator, false, (manipulator->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0);
 }
 
 /**
@@ -344,12 +343,12 @@ static void manipulator_arrow_handler(bContext *C, wmManipulator *manipulator, c
 
        ManipulatorCommonData *data = &arrow->data;
        const float ofs_new = facdir * len_v3(offset);
-       const int slot = ARROW_SLOT_OFFSET_WORLD_SPACE;
+       const int slot = ED_MANIPULATOR_ARROW_SLOT_OFS_WORLD_SPACE;
 
        /* set the property for the operator and call its modal function */
        if (manipulator->props[slot]) {
-               const bool constrained = arrow->style & MANIPULATOR_ARROW_STYLE_CONSTRAINED;
-               const bool inverted = arrow->style & MANIPULATOR_ARROW_STYLE_INVERTED;
+               const bool constrained = arrow->style & ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED;
+               const bool inverted = arrow->style & ED_MANIPULATOR_ARROW_STYLE_INVERTED;
                const bool use_precision = flag & WM_MANIPULATOR_TWEAK_PRECISE;
                float value = manipulator_value_from_offset(data, inter, ofs_new, constrained, inverted, use_precision);
 
@@ -374,8 +373,8 @@ static void manipulator_arrow_invoke(
 {
        ArrowManipulator3D *arrow = (ArrowManipulator3D *)manipulator;
        ManipulatorInteraction *inter = MEM_callocN(sizeof(ManipulatorInteraction), __func__);
-       PointerRNA ptr = manipulator->ptr[ARROW_SLOT_OFFSET_WORLD_SPACE];
-       PropertyRNA *prop = manipulator->props[ARROW_SLOT_OFFSET_WORLD_SPACE];
+       PointerRNA ptr = manipulator->ptr[ED_MANIPULATOR_ARROW_SLOT_OFS_WORLD_SPACE];
+       PropertyRNA *prop = manipulator->props[ED_MANIPULATOR_ARROW_SLOT_OFS_WORLD_SPACE];
 
        if (prop) {
                inter->init_value = RNA_property_float_get(&ptr, prop);
@@ -398,8 +397,8 @@ static void manipulator_arrow_prop_data_update(wmManipulator *manipulator, const
        ArrowManipulator3D *arrow = (ArrowManipulator3D *)manipulator;
        manipulator_property_data_update(
                manipulator, &arrow->data, slot,
-               (arrow->style & MANIPULATOR_ARROW_STYLE_CONSTRAINED) != 0,
-               (arrow->style & MANIPULATOR_ARROW_STYLE_INVERTED) != 0);
+               (arrow->style & ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED) != 0,
+               (arrow->style & ED_MANIPULATOR_ARROW_STYLE_INVERTED) != 0);
 }
 
 static void manipulator_arrow_exit(bContext *C, wmManipulator *manipulator, const bool cancel)
@@ -411,7 +410,7 @@ static void manipulator_arrow_exit(bContext *C, wmManipulator *manipulator, cons
        ManipulatorCommonData *data = &arrow->data;
        ManipulatorInteraction *inter = manipulator->interaction_data;
 
-       manipulator_property_value_reset(C, manipulator, inter, ARROW_SLOT_OFFSET_WORLD_SPACE);
+       manipulator_property_value_reset(C, manipulator, inter, ED_MANIPULATOR_ARROW_SLOT_OFS_WORLD_SPACE);
        data->offset = inter->init_offset;
 }
 
@@ -421,7 +420,7 @@ static void manipulator_arrow_exit(bContext *C, wmManipulator *manipulator, cons
  *
  * \{ */
 
-wmManipulator *MANIPULATOR_arrow_new(wmManipulatorGroup *mgroup, const char *name, const int style)
+wmManipulator *ED_manipulator_arrow3d_new(wmManipulatorGroup *mgroup, const char *name, const int style)
 {
        const wmManipulatorType *mpt = WM_manipulatortype_find("MANIPULATOR_WT_arrow_3d", false);
        ArrowManipulator3D *arrow = (ArrowManipulator3D *)WM_manipulator_new(mpt, mgroup, name);
@@ -429,8 +428,8 @@ wmManipulator *MANIPULATOR_arrow_new(wmManipulatorGroup *mgroup, const char *nam
        int real_style = style;
 
        /* inverted only makes sense in a constrained arrow */
-       if (real_style & MANIPULATOR_ARROW_STYLE_INVERTED) {
-               real_style |= MANIPULATOR_ARROW_STYLE_CONSTRAINED;
+       if (real_style & ED_MANIPULATOR_ARROW_STYLE_INVERTED) {
+               real_style |= ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED;
        }
 
        const float dir_default[3] = {0.0f, 0.0f, 1.0f};
@@ -448,7 +447,7 @@ wmManipulator *MANIPULATOR_arrow_new(wmManipulatorGroup *mgroup, const char *nam
 /**
  * Define direction the arrow will point towards
  */
-void MANIPULATOR_arrow_set_direction(wmManipulator *manipulator, const float direction[3])
+void ED_manipulator_arrow3d_set_direction(wmManipulator *manipulator, const float direction[3])
 {
        ArrowManipulator3D *arrow = (ArrowManipulator3D *)manipulator;
 
@@ -459,7 +458,7 @@ void MANIPULATOR_arrow_set_direction(wmManipulator *manipulator, const float dir
 /**
  * Define up-direction of the arrow manipulator
  */
-void MANIPULATOR_arrow_set_up_vector(wmManipulator *manipulator, const float direction[3])
+void ED_manipulator_arrow3d_set_up_vector(wmManipulator *manipulator, const float direction[3])
 {
        ArrowManipulator3D *arrow = (ArrowManipulator3D *)manipulator;
 
@@ -476,7 +475,7 @@ void MANIPULATOR_arrow_set_up_vector(wmManipulator *manipulator, const float dir
 /**
  * Define a custom arrow line length
  */
-void MANIPULATOR_arrow_set_line_len(wmManipulator *manipulator, const float len)
+void ED_manipulator_arrow3d_set_line_len(wmManipulator *manipulator, const float len)
 {
        ArrowManipulator3D *arrow = (ArrowManipulator3D *)manipulator;
        arrow->len = len;
@@ -487,7 +486,7 @@ void MANIPULATOR_arrow_set_line_len(wmManipulator *manipulator, const float len)
  *
  * \note Needs to be called before WM_manipulator_set_property!
  */
-void MANIPULATOR_arrow_set_ui_range(wmManipulator *manipulator, const float min, const float max)
+void ED_manipulator_arrow3d_set_ui_range(wmManipulator *manipulator, const float min, const float max)
 {
        ArrowManipulator3D *arrow = (ArrowManipulator3D *)manipulator;
 
@@ -505,7 +504,7 @@ void MANIPULATOR_arrow_set_ui_range(wmManipulator *manipulator, const float min,
  *
  * \note Needs to be called before WM_manipulator_set_property!
  */
-void MANIPULATOR_arrow_set_range_fac(wmManipulator *manipulator, const float range_fac)
+void ED_manipulator_arrow3d_set_range_fac(wmManipulator *manipulator, const float range_fac)
 {
        ArrowManipulator3D *arrow = (ArrowManipulator3D *)manipulator;
 
@@ -518,7 +517,7 @@ void MANIPULATOR_arrow_set_range_fac(wmManipulator *manipulator, const float ran
 /**
  * Define xy-aspect for arrow cone
  */
-void MANIPULATOR_arrow_cone_set_aspect(wmManipulator *manipulator, const float aspect[2])
+void ED_manipulator_arrow3d_cone_set_aspect(wmManipulator *manipulator, const float aspect[2])
 {
        ArrowManipulator3D *arrow = (ArrowManipulator3D *)manipulator;
 
@@ -549,11 +548,3 @@ void ED_manipulatortypes_arrow_3d(void)
 }
 
 /** \} */ /* Arrow Manipulator API */
-
-
-/* -------------------------------------------------------------------- */
-
-void fix_linking_manipulator_arrow(void)
-{
-       (void)0;
-}
similarity index 77%
rename from source/blender/windowmanager/manipulators/intern/manipulator_library/cage_manipulator.c
rename to source/blender/editors/manipulator_library/cage2d_manipulator.c
index 30c24b1c788d9d486b58934078bb585df88917c5..97b4e451bc788be98347724f0bcfe1817196ce19 100644 (file)
@@ -23,7 +23,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/windowmanager/manipulators/intern/manipulator_library/cage_manipulator.c
+/** \file cage2d_manipulator.c
  *  \ingroup wm
  *
  * \name Cage Manipulator
@@ -44,6 +44,7 @@
 #include "DNA_manipulator_types.h"
 
 #include "ED_screen.h"
+#include "ED_manipulator_library.h"
 
 #include "GPU_matrix.h"
 #include "GPU_shader.h"
 #include "WM_types.h"
 
 /* own includes */
-#include "wm_manipulator_wmapi.h"
-#include "wm_manipulator_intern.h"
+//#include "wm_manipulator_wmapi.h"
+//#include "wm_manipulator_intern.h"
 
 
 /* wmManipulator->highlighted_part */
 enum {
-       MANIPULATOR_RECT_TRANSFORM_INTERSECT_TRANSLATE     = 1,
-       MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_LEFT   = 2,
-       MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_RIGHT  = 3,
-       MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_UP     = 4,
-       MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_DOWN   = 5
+       ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_TRANSLATE     = 1,
+       ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_LEFT   = 2,
+       ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_RIGHT  = 3,
+       ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_UP     = 4,
+       ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_DOWN   = 5
 };
 
 #define MANIPULATOR_RECT_MIN_WIDTH 15.0f
@@ -128,7 +129,7 @@ static void rect_transform_draw_interaction(
        float verts[4][2];
 
        switch (highlighted) {
-               case MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_LEFT:
+               case ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_LEFT:
                        verts[0][0] = -half_w + w;
                        verts[0][1] = -half_h;
                        verts[1][0] = -half_w;
@@ -139,7 +140,7 @@ static void rect_transform_draw_interaction(
                        verts[3][1] = half_h;
                        break;
 
-               case MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_RIGHT:
+               case ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_RIGHT:
                        verts[0][0] = half_w - w;
                        verts[0][1] = -half_h;
                        verts[1][0] = half_w;
@@ -150,7 +151,7 @@ static void rect_transform_draw_interaction(
                        verts[3][1] = half_h;
                        break;
 
-               case MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_DOWN:
+               case ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_DOWN:
                        verts[0][0] = -half_w;
                        verts[0][1] = -half_h + h;
                        verts[1][0] = -half_w;
@@ -161,7 +162,7 @@ static void rect_transform_draw_interaction(
                        verts[3][1] = -half_h + h;
                        break;
 
-               case MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_UP:
+               case ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_UP:
                        verts[0][0] = -half_w;
                        verts[0][1] = half_h - h;
                        verts[1][0] = -half_w;
@@ -220,7 +221,7 @@ static void manipulator_rect_transform_draw(const bContext *UNUSED(C), wmManipul
        gpuPushMatrix();
        gpuTranslate2f(manipulator->origin[0] + manipulator->offset[0],
                       manipulator->origin[1] + manipulator->offset[1]);
-       if (cage->style & MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM)
+       if (cage->style & ED_MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM)
                gpuScaleUniform(cage->scale[0]);
        else
                gpuScale2fv(cage->scale);
@@ -231,7 +232,7 @@ static void manipulator_rect_transform_draw(const bContext *UNUSED(C), wmManipul
                aspy = w / h;
        w = min_ff(aspx * w / MANIPULATOR_RESIZER_WIDTH, MANIPULATOR_RESIZER_WIDTH / cage->scale[0]);
        h = min_ff(aspy * h / MANIPULATOR_RESIZER_WIDTH, MANIPULATOR_RESIZER_WIDTH / 
-                  ((cage->style & MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM) ? cage->scale[0] : cage->scale[1]));
+                  ((cage->style & ED_MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM) ? cage->scale[0] : cage->scale[1]));
 
        /* corner manipulators */
        glLineWidth(cage->manipulator.line_width + 3.0f);
@@ -252,13 +253,13 @@ static void manipulator_rect_transform_draw(const bContext *UNUSED(C), wmManipul
 static int manipulator_rect_transform_get_cursor(wmManipulator *manipulator)
 {
        switch (manipulator->highlighted_part) {
-               case MANIPULATOR_RECT_TRANSFORM_INTERSECT_TRANSLATE:
+               case ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_TRANSLATE:
                        return BC_HANDCURSOR;
-               case MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_LEFT:
-               case MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_RIGHT:
+               case ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_LEFT:
+               case ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_RIGHT:
                        return CURSOR_X_MOVE;
-               case MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_DOWN:
-               case MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_UP:
+               case ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_DOWN:
+               case ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_UP:
                        return CURSOR_Y_MOVE;
                default:
                        return CURSOR_STD;
@@ -284,7 +285,7 @@ static int manipulator_rect_transform_intersect(
        point_local[1] -= manipulator->offset[1];
        //rotate_m2(matrot, -cage->transform.rotation);
 
-       if (cage->style & MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM)
+       if (cage->style & ED_MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM)
                mul_v2_fl(point_local, 1.0f / cage->scale[0]);
        else {
                point_local[0] /= cage->scale[0];
@@ -297,7 +298,7 @@ static int manipulator_rect_transform_intersect(
                aspy = w / h;
        w = min_ff(aspx * w / MANIPULATOR_RESIZER_WIDTH, MANIPULATOR_RESIZER_WIDTH / cage->scale[0]);
        h = min_ff(aspy * h / MANIPULATOR_RESIZER_WIDTH, MANIPULATOR_RESIZER_WIDTH / 
-                  ((cage->style & MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM) ? cage->scale[0] : cage->scale[1]));
+                  ((cage->style & ED_MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM) ? cage->scale[0] : cage->scale[1]));
 
 
        rctf r;
@@ -310,10 +311,10 @@ static int manipulator_rect_transform_intersect(
        bool isect = BLI_rctf_isect_pt_v(&r, point_local);
 
        if (isect)
-               return MANIPULATOR_RECT_TRANSFORM_INTERSECT_TRANSLATE;
+               return ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_TRANSLATE;
 
        /* if manipulator does not have a scale intersection, don't do it */
-       if (cage->style & (MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE | MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM)) {
+       if (cage->style & (ED_MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE | ED_MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM)) {
                r.xmin = -half_w;
                r.ymin = -half_h;
                r.xmax = -half_w + w;
@@ -322,7 +323,7 @@ static int manipulator_rect_transform_intersect(
                isect = BLI_rctf_isect_pt_v(&r, point_local);
 
                if (isect)
-                       return MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_LEFT;
+                       return ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_LEFT;
 
                r.xmin = half_w - w;
                r.ymin = -half_h;
@@ -332,7 +333,7 @@ static int manipulator_rect_transform_intersect(
                isect = BLI_rctf_isect_pt_v(&r, point_local);
 
                if (isect)
-                       return MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_RIGHT;
+                       return ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_RIGHT;
 
                r.xmin = -half_w;
                r.ymin = -half_h;
@@ -342,7 +343,7 @@ static int manipulator_rect_transform_intersect(
                isect = BLI_rctf_isect_pt_v(&r, point_local);
 
                if (isect)
-                       return MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_DOWN;
+                       return ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_DOWN;
 
                r.xmin = -half_w;
                r.ymin = half_h - h;
@@ -352,7 +353,7 @@ static int manipulator_rect_transform_intersect(
                isect = BLI_rctf_isect_pt_v(&r, point_local);
 
                if (isect)
-                       return MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_UP;
+                       return ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_UP;
        }
 
        return 0;
@@ -373,16 +374,16 @@ static bool manipulator_rect_transform_get_prop_value(wmManipulator *manipulator
                return false;
        }
        else {
-               if (slot == RECT_TRANSFORM_SLOT_OFFSET) {
+               if (slot == ED_MANIPULATOR_RECT_TX_SLOT_OFFSET) {
                        if (RNA_property_array_length(&manipulator->ptr[slot], manipulator->props[slot]) != 2) {
                                fprintf(stderr, "Rect Transform manipulator offset not only be bound to array float property");
                                return false;
                        }
                        RNA_property_float_get_array(&manipulator->ptr[slot], manipulator->props[slot], value);
                }
-               else if (slot == RECT_TRANSFORM_SLOT_SCALE) {
+               else if (slot == ED_MANIPULATOR_RECT_TX_SLOT_SCALE) {
                        RectTransformManipulator *cage = (RectTransformManipulator *)manipulator;
-                       if (cage->style & MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM) {
+                       if (cage->style & ED_MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM) {
                                *value = RNA_property_float_get(&manipulator->ptr[slot], manipulator->props[slot]);
                        }
                        else {
@@ -426,32 +427,32 @@ static void manipulator_rect_transform_handler(
        const float valuey = (event->mval[1] - data->orig_mouse[1]);
 
 
-       if (manipulator->highlighted_part == MANIPULATOR_RECT_TRANSFORM_INTERSECT_TRANSLATE) {
+       if (manipulator->highlighted_part == ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_TRANSLATE) {
                manipulator->offset[0] = data->orig_offset[0] + valuex;
                manipulator->offset[1] = data->orig_offset[1] + valuey;
        }
-       else if (manipulator->highlighted_part == MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_LEFT) {
+       else if (manipulator->highlighted_part == ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_LEFT) {
                manipulator->offset[0] = data->orig_offset[0] + valuex / 2.0;
                cage->scale[0] = (cage->w * data->orig_scale[0] - valuex) / cage->w;
        }
-       else if (manipulator->highlighted_part == MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_RIGHT) {
+       else if (manipulator->highlighted_part == ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_RIGHT) {
                manipulator->offset[0] = data->orig_offset[0] + valuex / 2.0;
                cage->scale[0] = (cage->w * data->orig_scale[0] + valuex) / cage->w;
        }
-       else if (manipulator->highlighted_part == MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_DOWN) {
+       else if (manipulator->highlighted_part == ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_DOWN) {
                manipulator->offset[1] = data->orig_offset[1] + valuey / 2.0;
 
-               if (cage->style & MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM) {
+               if (cage->style & ED_MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM) {
                        cage->scale[0] = (cage->h * data->orig_scale[0] - valuey) / cage->h;
                }
                else {
                        cage->scale[1] = (cage->h * data->orig_scale[1] - valuey) / cage->h;
                }
        }
-       else if (manipulator->highlighted_part == MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_UP) {
+       else if (manipulator->highlighted_part == ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_UP) {
                manipulator->offset[1] = data->orig_offset[1] + valuey / 2.0;
 
-               if (cage->style & MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM) {
+               if (cage->style & ED_MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM) {
                        cage->scale[0] = (cage->h * data->orig_scale[0] + valuey) / cage->h;
                }
                else {
@@ -460,7 +461,7 @@ static void manipulator_rect_transform_handler(
        }
 
        /* clamping - make sure manipulator is at least 5 pixels wide */
-       if (cage->style & MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM) {
+       if (cage->style & ED_MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM) {
                if (cage->scale[0] < MANIPULATOR_RECT_MIN_WIDTH / cage->h || 
                    cage->scale[0] < MANIPULATOR_RECT_MIN_WIDTH / cage->w) 
                {
@@ -480,19 +481,19 @@ static void manipulator_rect_transform_handler(
                }
        }
 
-       if (manipulator->props[RECT_TRANSFORM_SLOT_OFFSET]) {
-               PointerRNA ptr = manipulator->ptr[RECT_TRANSFORM_SLOT_OFFSET];
-               PropertyRNA *prop = manipulator->props[RECT_TRANSFORM_SLOT_OFFSET];
+       if (manipulator->props[ED_MANIPULATOR_RECT_TX_SLOT_OFFSET]) {
+               PointerRNA ptr = manipulator->ptr[ED_MANIPULATOR_RECT_TX_SLOT_OFFSET];
+               PropertyRNA *prop = manipulator->props[ED_MANIPULATOR_RECT_TX_SLOT_OFFSET];
 
                RNA_property_float_set_array(&ptr, prop, manipulator->offset);
                RNA_property_update(C, &ptr, prop);
        }
 
-       if (manipulator->props[RECT_TRANSFORM_SLOT_SCALE]) {
-               PointerRNA ptr = manipulator->ptr[RECT_TRANSFORM_SLOT_SCALE];
-               PropertyRNA *prop = manipulator->props[RECT_TRANSFORM_SLOT_SCALE];
+       if (manipulator->props[ED_MANIPULATOR_RECT_TX_SLOT_SCALE]) {
+               PointerRNA ptr = manipulator->ptr[ED_MANIPULATOR_RECT_TX_SLOT_SCALE];
+               PropertyRNA *prop = manipulator->props[ED_MANIPULATOR_RECT_TX_SLOT_SCALE];
 
-               if (cage->style & MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM) {
+               if (cage->style & ED_MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM) {
                        RNA_property_float_set(&ptr, prop, cage->scale[0]);
                }
                else {
@@ -509,10 +510,10 @@ static void manipulator_rect_transform_prop_data_update(wmManipulator *manipulat
 {
        RectTransformManipulator *cage = (RectTransformManipulator *)manipulator;
 
-       if (slot == RECT_TRANSFORM_SLOT_OFFSET)
-               manipulator_rect_transform_get_prop_value(manipulator, RECT_TRANSFORM_SLOT_OFFSET, manipulator->offset);
-       if (slot == RECT_TRANSFORM_SLOT_SCALE)
-               manipulator_rect_transform_get_prop_value(manipulator, RECT_TRANSFORM_SLOT_SCALE, cage->scale);
+       if (slot == ED_MANIPULATOR_RECT_TX_SLOT_OFFSET)
+               manipulator_rect_transform_get_prop_value(manipulator, ED_MANIPULATOR_RECT_TX_SLOT_OFFSET, manipulator->offset);
+       if (slot == ED_MANIPULATOR_RECT_TX_SLOT_SCALE)
+               manipulator_rect_transform_get_prop_value(manipulator, ED_MANIPULATOR_RECT_TX_SLOT_SCALE, cage->scale);
 }
 
 static void manipulator_rect_transform_exit(bContext *C, wmManipulator *manipulator, const bool cancel)
@@ -524,18 +525,18 @@ static void manipulator_rect_transform_exit(bContext *C, wmManipulator *manipula
                return;
 
        /* reset properties */
-       if (manipulator->props[RECT_TRANSFORM_SLOT_OFFSET]) {
-               PointerRNA ptr = manipulator->ptr[RECT_TRANSFORM_SLOT_OFFSET];
-               PropertyRNA *prop = manipulator->props[RECT_TRANSFORM_SLOT_OFFSET];
+       if (manipulator->props[ED_MANIPULATOR_RECT_TX_SLOT_OFFSET]) {
+               PointerRNA ptr = manipulator->ptr[ED_MANIPULATOR_RECT_TX_SLOT_OFFSET];
+               PropertyRNA *prop = manipulator->props[ED_MANIPULATOR_RECT_TX_SLOT_OFFSET];
 
                RNA_property_float_set_array(&ptr, prop, data->orig_offset);
                RNA_property_update(C, &ptr, prop);
        }
-       if (manipulator->props[RECT_TRANSFORM_SLOT_SCALE]) {
-               PointerRNA ptr = manipulator->ptr[RECT_TRANSFORM_SLOT_SCALE];
-               PropertyRNA *prop = manipulator->props[RECT_TRANSFORM_SLOT_SCALE];
+       if (manipulator->props[ED_MANIPULATOR_RECT_TX_SLOT_SCALE]) {
+               PointerRNA ptr = manipulator->ptr[ED_MANIPULATOR_RECT_TX_SLOT_SCALE];
+               PropertyRNA *prop = manipulator->props[ED_MANIPULATOR_RECT_TX_SLOT_SCALE];
 
-               if (cage->style & MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM) {
+               if (cage->style & ED_MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM) {
                        RNA_property_float_set(&ptr, prop, data->orig_scale[0]);
                }
                else {
@@ -551,7 +552,7 @@ static void manipulator_rect_transform_exit(bContext *C, wmManipulator *manipula
  *
  * \{ */
 
-wmManipulator *MANIPULATOR_rect_transform_new(wmManipulatorGroup *mgroup, const char *name, const int style)
+wmManipulator *ED_manipulator_rect_transform_new(wmManipulatorGroup *mgroup, const char *name, const int style)
 {
        const wmManipulatorType *mpt = WM_manipulatortype_find("MANIPULATOR_WT_cage", false);
        RectTransformManipulator *cage = (RectTransformManipulator *)WM_manipulator_new(mpt, mgroup, name);
@@ -563,7 +564,7 @@ wmManipulator *MANIPULATOR_rect_transform_new(wmManipulatorGroup *mgroup, const
        return &cage->manipulator;
 }
 
-void MANIPULATOR_rect_transform_set_dimensions(wmManipulator *manipulator, const float width, const float height)
+void ED_manipulator_rect_transform_set_dimensions(wmManipulator *manipulator, const float width, const float height)
 {
        RectTransformManipulator *cage = (RectTransformManipulator *)manipulator;
        cage->w = width;
@@ -589,17 +590,9 @@ static void MANIPULATOR_WT_cage(wmManipulatorType *wt)
        wt->size = sizeof(RectTransformManipulator);
 }
 
-void ED_manipulatortypes_cage(void)
+void ED_manipulatortypes_cage_2d(void)
 {
        WM_manipulatortype_append(MANIPULATOR_WT_cage);
 }
 
 /** \} */ // Cage Manipulator API
-
-
-/* -------------------------------------------------------------------- */
-
-void fix_linking_manipulator_cage(void)
-{
-       (void)0;
-}
similarity index 89%
rename from source/blender/windowmanager/manipulators/intern/manipulator_library/dial_manipulator.c
rename to source/blender/editors/manipulator_library/dial3d_manipulator.c
index aeb1fa76abd9829f94c76171e0dc61f576f63df2..5097c8cab6f0841334dc62732a79d3e2fbb4b2a3 100644 (file)
@@ -23,7 +23,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/windowmanager/manipulators/intern/manipulator_library/dial_manipulator.c
+/** \file dial3d_manipulator.c
  *  \ingroup wm
  *
  * \name Dial Manipulator
@@ -45,6 +45,7 @@
 
 #include "ED_screen.h"
 #include "ED_view3d.h"
+#include "ED_manipulator_library.h"
 
 #include "GPU_select.h"
 
 #include "WM_types.h"
 
 /* own includes */
-#include "WM_manipulator_types.h"
-#include "WM_manipulator_library.h"
-#include "wm_manipulator_wmapi.h"
-#include "wm_manipulator_intern.h"
 #include "manipulator_geometry.h"
 #include "manipulator_library_intern.h"
 
@@ -97,7 +94,7 @@ static void dial_geom_draw(
        UNUSED_VARS(dial, col, axis_modal_mat, clip_plane);
        wm_manipulator_geometryinfo_draw(&wm_manipulator_geom_data_dial, select);
 #else
-       const bool filled = (dial->style == MANIPULATOR_DIAL_STYLE_RING_FILLED);
+       const bool filled = (dial->style == ED_MANIPULATOR_DIAL_STYLE_RING_FILLED);
 
        glLineWidth(dial->manipulator.line_width);
 
@@ -243,7 +240,7 @@ static void dial_draw_intern(
        gpuTranslate3fv(dial->manipulator.offset);
 
        /* draw rotation indicator arc first */
-       if ((dial->manipulator.flag & WM_MANIPULATOR_DRAW_VALUE) && (dial->manipulator.state & WM_MANIPULATOR_ACTIVE)) {
+       if ((dial->manipulator.flag & WM_MANIPULATOR_DRAW_VALUE) && (dial->manipulator.state & WM_MANIPULATOR_STATE_ACTIVE)) {
                wmWindow *win = CTX_wm_window(C);
                const float co_outer[4] = {0.0f, DIAL_WIDTH, 0.0f}; /* coordinate at which the arc drawing will be started */
                float angle_ofs, angle_delta;
@@ -266,7 +263,7 @@ static void manipulator_dial_render_3d_intersect(const bContext *C, wmManipulato
 {
        DialManipulator *dial = (DialManipulator *)manipulator;
        float clip_plane_buf[4];
-       float *clip_plane = (dial->style == MANIPULATOR_DIAL_STYLE_RING_CLIPPED) ? clip_plane_buf : NULL;
+       float *clip_plane = (dial->style == ED_MANIPULATOR_DIAL_STYLE_RING_CLIPPED) ? clip_plane_buf : NULL;
 
        /* enable clipping if needed */
        if (clip_plane) {
@@ -289,10 +286,10 @@ static void manipulator_dial_render_3d_intersect(const bContext *C, wmManipulato
 static void manipulator_dial_draw(const bContext *C, wmManipulator *manipulator)
 {
        DialManipulator *dial = (DialManipulator *)manipulator;
-       const bool active = manipulator->state & WM_MANIPULATOR_ACTIVE;
-       const bool highlight = (manipulator->state & WM_MANIPULATOR_HIGHLIGHT) != 0;
+       const bool active = manipulator->state & WM_MANIPULATOR_STATE_ACTIVE;
+       const bool highlight = (manipulator->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0;
        float clip_plane_buf[4];
-       float *clip_plane = (!active && dial->style == MANIPULATOR_DIAL_STYLE_RING_CLIPPED) ? clip_plane_buf : NULL;
+       float *clip_plane = (!active && dial->style == ED_MANIPULATOR_DIAL_STYLE_RING_CLIPPED) ? clip_plane_buf : NULL;
 
        /* enable clipping if needed */
        if (clip_plane) {
@@ -332,7 +329,7 @@ static void manipulator_dial_invoke(
  *
  * \{ */
 
-wmManipulator *MANIPULATOR_dial_new(wmManipulatorGroup *mgroup, const char *name, const int style)
+wmManipulator *ED_manipulator_dial3d_new(wmManipulatorGroup *mgroup, const char *name, const int style)
 {
        const wmManipulatorType *mpt = WM_manipulatortype_find("MANIPULATOR_WT_dial", false);
        DialManipulator *dial = (DialManipulator *)WM_manipulator_new(mpt, mgroup, name);
@@ -350,7 +347,7 @@ wmManipulator *MANIPULATOR_dial_new(wmManipulatorGroup *mgroup, const char *name
 /**
  * Define up-direction of the dial manipulator
  */
-void MANIPULATOR_dial_set_up_vector(wmManipulator *manipulator, const float direction[3])
+void ED_manipulator_dial3d_set_up_vector(wmManipulator *manipulator, const float direction[3])
 {
        DialManipulator *dial = (DialManipulator *)manipulator;
 
@@ -358,7 +355,7 @@ void MANIPULATOR_dial_set_up_vector(wmManipulator *manipulator, const float dire
        normalize_v3(dial->direction);
 }
 
-static void MANIPULATOR_WT_dial(wmManipulatorType *wt)
+static void MANIPULATOR_WT_dial_3d(wmManipulatorType *wt)
 {
        /* identifiers */
        wt->idname = "MANIPULATOR_WT_dial";
@@ -371,16 +368,9 @@ static void MANIPULATOR_WT_dial(wmManipulatorType *wt)
        wt->size = sizeof(DialManipulator);
 }
 
-void ED_manipulatortypes_dial(void)
+void ED_manipulatortypes_dial_3d(void)
 {
-       WM_manipulatortype_append(MANIPULATOR_WT_dial);
+       WM_manipulatortype_append(MANIPULATOR_WT_dial_3d);
 }
 
 /** \} */ // Dial Manipulator API
-
-/* -------------------------------------------------------------------- */
-
-void fix_linking_manipulator_dial(void)
-{
-       (void)0;
-}
similarity index 97%
rename from source/blender/windowmanager/manipulators/intern/manipulator_library/geom_arrow_manipulator.c
rename to source/blender/editors/manipulator_library/geom_arrow_manipulator.c
index 0f874e588bcf395e2833c45eec5e250563ee1a4e..73518e5ac388ea33ca8ad859756bc1a02383a4ba 100644 (file)
@@ -21,7 +21,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/windowmanager/manipulators/intern/manipulator_library/geom_arrow_manipulator.c
+/** \file geom_arrow_manipulator.c
  *  \ingroup wm
  */
 
similarity index 95%
rename from source/blender/windowmanager/manipulators/intern/manipulator_library/geom_cube_manipulator.c
rename to source/blender/editors/manipulator_library/geom_cube_manipulator.c
index d06007052581892c0e41ba50d42e4c707c010b18..a79d9161e963bcbe6cd66648a24db4ea8ec9597a 100644 (file)
@@ -23,7 +23,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/windowmanager/manipulators/intern/manipulator_library/geom_cube_manipulator.c
+/** \file geom_cube_manipulator.c
  *  \ingroup wm
  */
 
similarity index 99%
rename from source/blender/windowmanager/manipulators/intern/manipulator_library/geom_dial_manipulator.c
rename to source/blender/editors/manipulator_library/geom_dial_manipulator.c
index 7f2edbcf60e56836752d6ea49b393cc43740bd4e..dbabe7ad136dea55a332fb0fc698834eeee87d53 100644 (file)
@@ -21,7 +21,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/windowmanager/manipulators/intern/manipulator_library/geom_dial_manipulator.c
+/** \file geom_dial_manipulator.c
  *  \ingroup wm
  */
 
diff --git a/source/blender/editors/manipulator_library/manipulator_draw_utils.c b/source/blender/editors/manipulator_library/manipulator_draw_utils.c
new file mode 100644 (file)
index 0000000..fc7b22a
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2014 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file manipulator_draw_utils.c
+ *  \ingroup wm
+ */
+
+#include "BKE_context.h"
+
+#include "BLI_listbase.h"
+#include "BLI_ghash.h"
+#include "BLI_math.h"
+#include "BLI_string.h"
+#include "BLI_string_utils.h"
+
+#include "DNA_manipulator_types.h"
+
+#include "ED_screen.h"
+#include "ED_view3d.h"
+
+#include "GPU_batch.h"
+#include "GPU_glew.h"
+#include "GPU_immediate.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "RNA_access.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+/* only for own init/exit calls (wm_manipulatortype_init/wm_manipulatortype_free) */
+#include "wm.h"
+
+/* own includes */
+#include "manipulator_library_intern.h"
+
+/**
+ * Main draw call for ManipulatorGeomInfo data
+ */
+void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const bool select, const float color[4])
+{
+       /* 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));
+       VertexBuffer *vbo;
+       ElementList *el;
+       Batch *batch;
+       ElementListBuilder elb = {0};
+
+       VertexFormat format = {0};
+       unsigned int pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+       unsigned int nor_id;
+
+       if (use_lighting) {
+               nor_id = VertexFormat_add_attrib(&format, "nor", COMP_I16, 3, NORMALIZE_INT_TO_FLOAT);
+       }
+
+       /* Elements */
+       ElementListBuilder_init(&elb, PRIM_TRIANGLES, info->ntris, info->nverts);
+       for (int i = 0; i < info->ntris; ++i) {
+               const unsigned short *idx = &info->indices[i * 3];
+               add_triangle_vertices(&elb, idx[0], idx[1], idx[2]);
+       }
+       el = ElementList_build(&elb);
+
+       vbo = VertexBuffer_create_with_format(&format);
+       VertexBuffer_allocate_data(vbo, info->nverts);
+
+       VertexBuffer_fill_attrib(vbo, pos_id, info->verts);
+
+       if (use_lighting) {
+               /* Normals are expected to be smooth. */
+               VertexBuffer_fill_attrib(vbo, nor_id, info->normals);
+       }
+
+       batch = Batch_create(PRIM_TRIANGLES, vbo, el);
+       Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR);
+
+       Batch_Uniform4fv(batch, "color", color);
+
+       glEnable(GL_CULL_FACE);
+       // glEnable(GL_DEPTH_TEST);
+
+       Batch_draw(batch);
+
+       glDisable(GL_DEPTH_TEST);
+       // glDisable(GL_CULL_FACE);
+
+
+       Batch_discard_all(batch);
+}
+
+void wm_manipulator_vec_draw(
+        const float color[4], const float (*verts)[3], unsigned int vert_count,
+        unsigned int pos, unsigned int primitive_type)
+{
+       immUniformColor4fv(color);
+       immBegin(primitive_type, vert_count);
+       for (int i = 0; i < vert_count; i++) {
+               immVertex3fv(pos, verts[i]);
+       }
+       immEnd();
+}
similarity index 94%
rename from source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_geometry.h
rename to source/blender/editors/manipulator_library/manipulator_geometry.h
index b3df79834a359db8c8d78bb494632696e0ffcbd2..0eff1ca89d8600c98ee2c4af12e068323799b112 100644 (file)
@@ -21,7 +21,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/windowmanager/manipulators/intern/manipulator_library/manipulator_geometry.h
+/** \file manipulator_geometry.h
  *  \ingroup wm
  *
  * \name Manipulator Geometry
similarity index 87%
rename from source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_intern.h
rename to source/blender/editors/manipulator_library/manipulator_library_intern.h
index e432fa1523a61d66e70e052d3d04ad07972d18fd..c2d750deee0710c971440c2c9b52728dfee257df 100644 (file)
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_intern.h
+/** \file manipulator_library_intern.h
  *  \ingroup wm
  */
 
-
 #ifndef __MANIPULATOR_LIBRARY_INTERN_H__
 #define __MANIPULATOR_LIBRARY_INTERN_H__
 
@@ -96,5 +95,17 @@ void manipulator_color_get(
         const struct wmManipulator *manipulator, const bool highlight,
         float r_col[]);
 
+
+/* -------------------------------------------------------------------- */
+/* Manipulator drawing */
+
+#include "manipulator_geometry.h"
+
+void wm_manipulator_geometryinfo_draw(const struct ManipulatorGeomInfo *info, const bool select, const float color[4]);
+void wm_manipulator_vec_draw(
+        const float color[4], const float (*verts)[3], unsigned int vert_count,
+        unsigned int pos, unsigned int primitive_type);
+
+
 #endif  /* __MANIPULATOR_LIBRARY_INTERN_H__ */
 
similarity index 96%
rename from source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_utils.c
rename to source/blender/editors/manipulator_library/manipulator_library_utils.c
index 0617e9e873b2baad4a9efb20befb3d9e82409353..0950f27213d1f00f69402277004066d1212a2377 100644 (file)
@@ -23,7 +23,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_utils.c
+/** \file manipulator_library_utils.c
  *  \ingroup wm
  *
  * \name Manipulator Library Utilities
 #include "RNA_access.h"
 
 #include "WM_api.h"
+#include "WM_types.h"
 
 /* own includes */
-#include "WM_manipulator_types.h"
-#include "wm_manipulator_wmapi.h"
-#include "wm_manipulator_intern.h"
 #include "manipulator_library_intern.h"
 
 /* factor for precision tweaking */
similarity index 85%
rename from source/blender/windowmanager/manipulators/intern/manipulator_library/primitive_manipulator.c
rename to source/blender/editors/manipulator_library/primitive3d_manipulator.c
index c67aeace8d93d71e1d744f3aaebb0fc69aebb83f..cc8fbeb17d2ce36600ba9269de747362881f6e8f 100644 (file)
@@ -18,7 +18,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/windowmanager/manipulators/intern/manipulator_library/primitive_manipulator.c
+/** \file primitive_manipulator.c
  *  \ingroup wm
  *
  * \name Primitive Manipulator
 #include "WM_api.h"
 #include "WM_types.h"
 
+#include "ED_manipulator_library.h"
+
 /* own includes */
-#include "WM_manipulator_types.h"
-#include "WM_manipulator_library.h"
-#include "wm_manipulator_wmapi.h"
-#include "wm_manipulator_intern.h"
 #include "manipulator_library_intern.h"
 
 
@@ -86,7 +84,7 @@ static void manipulator_primitive_draw_geom(
        float (*verts)[3];
        unsigned int vert_count = 0;
 
-       if (style == MANIPULATOR_PRIMITIVE_STYLE_PLANE) {
+       if (style == ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE) {
                verts = verts_plane;
                vert_count = ARRAY_SIZE(verts_plane);
        }
@@ -171,7 +169,7 @@ static void manipulator_primitive_draw(const bContext *UNUSED(C), wmManipulator
 {
        manipulator_primitive_draw_intern(
                    (PrimitiveManipulator *)manipulator, false,
-                   (manipulator->state & WM_MANIPULATOR_HIGHLIGHT));
+                   (manipulator->state & WM_MANIPULATOR_STATE_HIGHLIGHT));
 }
 
 static void manipulator_primitive_invoke(
@@ -191,9 +189,9 @@ static void manipulator_primitive_invoke(
  *
  * \{ */
 
-wmManipulator *MANIPULATOR_primitive_new(wmManipulatorGroup *mgroup, const char *name, const int style)
+wmManipulator *ED_manipulator_primitive3d_new(wmManipulatorGroup *mgroup, const char *name, const int style)
 {
-       const wmManipulatorType *mpt = WM_manipulatortype_find("MANIPULATOR_WT_primitive", false);
+       const wmManipulatorType *mpt = WM_manipulatortype_find("MANIPULATOR_WT_primitive3d", false);
        PrimitiveManipulator *prim = (PrimitiveManipulator *)WM_manipulator_new(mpt, mgroup, name);
 
        const float dir_default[3] = {0.0f, 0.0f, 1.0f};
@@ -210,7 +208,7 @@ wmManipulator *MANIPULATOR_primitive_new(wmManipulatorGroup *mgroup, const char
 /**
  * Define direction the primitive will point towards
  */
-void MANIPULATOR_primitive_set_direction(wmManipulator *manipulator, const float direction[3])
+void ED_manipulator_primitive3d_set_direction(wmManipulator *manipulator, const float direction[3])
 {
        PrimitiveManipulator *prim = (PrimitiveManipulator *)manipulator;
 
@@ -220,7 +218,7 @@ void MANIPULATOR_primitive_set_direction(wmManipulator *manipulator, const float
 /**
  * Define up-direction of the primitive manipulator
  */
-void MANIPULATOR_primitive_set_up_vector(wmManipulator *manipulator, const float direction[3])
+void ED_manipulator_primitive3d_set_up_vector(wmManipulator *manipulator, const float direction[3])
 {
        PrimitiveManipulator *prim = (PrimitiveManipulator *)manipulator;
 
@@ -233,10 +231,10 @@ void MANIPULATOR_primitive_set_up_vector(wmManipulator *manipulator, const float
        }
 }
 
-static void MANIPULATOR_WT_primitive(wmManipulatorType *wt)
+static void MANIPULATOR_WT_primitive3d(wmManipulatorType *wt)
 {
        /* identifiers */
-       wt->idname = "MANIPULATOR_WT_primitive";
+       wt->idname = "MANIPULATOR_WT_primitive3d";
 
        /* api callbacks */
        wt->draw = manipulator_primitive_draw;
@@ -246,17 +244,9 @@ static void MANIPULATOR_WT_primitive(wmManipulatorType *wt)
        wt->size = sizeof(PrimitiveManipulator);
 }
 
-void ED_manipulatortypes_primitive(void)
+void ED_manipulatortypes_primitive_3d(void)
 {
-       WM_manipulatortype_append(MANIPULATOR_WT_primitive);
+       WM_manipulatortype_append(MANIPULATOR_WT_primitive3d);
 }
 
 /** \} */ // Primitive Manipulator API
-
-
-/* -------------------------------------------------------------------- */
-
-void fix_linking_manipulator_primitive(void)
-{
-       (void)0;
-}
index acc197bcc5b920c11ae800f4b8c9c7719475686e..16ccf1da916226bce97d15d650bd008e256520b1 100644 (file)
@@ -66,6 +66,7 @@
 #include "ED_clip.h"
 #include "ED_mask.h"
 #include "ED_sequencer.h"
+#include "ED_manipulator_library.h"
 
 #include "io_ops.h"
 
@@ -126,20 +127,11 @@ void ED_spacetypes_init(void)
        ED_operatortypes_ui();
 
        /* manipulator types */
-
-       /* FIXME */
-       extern void ED_manipulatortypes_dial(void);
-       extern void ED_manipulatortypes_arrow_2d(void);
-       extern void ED_manipulatortypes_arrow_3d(void);
-       extern void ED_manipulatortypes_facemap(void);
-       extern void ED_manipulatortypes_primitive(void);
-       extern void ED_manipulatortypes_cage(void);
-
-       ED_manipulatortypes_dial();
+       ED_manipulatortypes_dial_3d();
        ED_manipulatortypes_arrow_2d();
        ED_manipulatortypes_arrow_3d();
-       ED_manipulatortypes_primitive();
-       ED_manipulatortypes_cage();
+       ED_manipulatortypes_primitive_3d();
+       ED_manipulatortypes_cage_2d();
 
        /* register types for operators and manipulators */
        spacetypes = BKE_spacetypes_list();
index 9e7445b856624c3d75cad50c364f464cbe80d637..2ff6472f8d033ffcff778601d49a6a44eda564bb 100644 (file)
@@ -28,6 +28,7 @@
 #include "DNA_manipulator_types.h"
 
 #include "ED_screen.h"
+#include "ED_manipulator_library.h"
 
 #include "IMB_imbuf_types.h"
 
@@ -64,9 +65,9 @@ static void WIDGETGROUP_node_transform_init(const bContext *UNUSED(C), wmManipul
 {
        wmManipulatorWrapper *wwrapper = MEM_mallocN(sizeof(wmManipulatorWrapper), __func__);
 
-       wwrapper->manipulator = MANIPULATOR_rect_transform_new(
+       wwrapper->manipulator = ED_manipulator_rect_transform_new(
                wgroup, "backdrop_cage",
-               MANIPULATOR_RECT_TRANSFORM_STYLE_TRANSLATE | MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM);
+               ED_MANIPULATOR_RECT_TRANSFORM_STYLE_TRANSLATE | ED_MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM);
        wgroup->customdata = wwrapper;
 
 }
@@ -86,7 +87,7 @@ static void WIDGETGROUP_node_transform_refresh(const bContext *C, wmManipulatorG
                const float w = (ibuf->x > 0) ? ibuf->x : 64.0f;
                const float h = (ibuf->y > 0) ? ibuf->y : 64.0f;
 
-               MANIPULATOR_rect_transform_set_dimensions(cage, w, h);
+               ED_manipulator_rect_transform_set_dimensions(cage, w, h);
                WM_manipulator_set_origin(cage, origin);
                WM_manipulator_set_flag(cage, WM_MANIPULATOR_HIDDEN, false);
 
@@ -94,8 +95,8 @@ static void WIDGETGROUP_node_transform_refresh(const bContext *C, wmManipulatorG
                SpaceNode *snode = CTX_wm_space_node(C);
                PointerRNA nodeptr;
                RNA_pointer_create(snode->id, &RNA_SpaceNodeEditor, snode, &nodeptr);
-               WM_manipulator_set_property(cage, RECT_TRANSFORM_SLOT_OFFSET, &nodeptr, "backdrop_offset");
-               WM_manipulator_set_property(cage, RECT_TRANSFORM_SLOT_SCALE, &nodeptr, "backdrop_zoom");
+               WM_manipulator_set_property(cage, ED_MANIPULATOR_RECT_TX_SLOT_OFFSET, &nodeptr, "backdrop_offset");
+               WM_manipulator_set_property(cage, ED_MANIPULATOR_RECT_TX_SLOT_SCALE, &nodeptr, "backdrop_zoom");
        }
        else {
                WM_manipulator_set_flag(cage, WM_MANIPULATOR_HIDDEN, true);
index 8d853498740fa606d2b9cadf3e2fdbb147c7a100..87513a6294b49dab41a1f78afee7559ad220f2f5 100644 (file)
@@ -43,6 +43,7 @@
 
 #include "ED_armature.h"
 #include "ED_screen.h"
+#include "ED_manipulator_library.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -78,10 +79,10 @@ static void WIDGETGROUP_lamp_init(const bContext *UNUSED(C), wmManipulatorGroup
 
        wmManipulatorWrapper *wwrapper = MEM_mallocN(sizeof(wmManipulatorWrapper), __func__);
 
-       wwrapper->manipulator = MANIPULATOR_arrow_new(wgroup, propname, MANIPULATOR_ARROW_STYLE_INVERTED);
+       wwrapper->manipulator = ED_manipulator_arrow3d_new(wgroup, propname, ED_MANIPULATOR_ARROW_STYLE_INVERTED);
        wgroup->customdata = wwrapper;
 
-       MANIPULATOR_arrow_set_range_fac(wwrapper->manipulator, 4.0f);
+       ED_manipulator_arrow3d_set_range_fac(wwrapper->manipulator, 4.0f);
        WM_manipulator_set_color(wwrapper->manipulator, color);
        WM_manipulator_set_color_highlight(wwrapper->manipulator, color_hi);
 }
@@ -95,14 +96,14 @@ static void WIDGETGROUP_lamp_refresh(const bContext *C, wmManipulatorGroup *wgro
 
        negate_v3_v3(dir, ob->obmat[2]);
 
-       MANIPULATOR_arrow_set_direction(wwrapper->manipulator, dir);
+       ED_manipulator_arrow3d_set_direction(wwrapper->manipulator, dir);
        WM_manipulator_set_origin(wwrapper->manipulator, ob->obmat[3]);
 
        /* need to set property here for undo. TODO would prefer to do this in _init */
        PointerRNA lamp_ptr;
        const char *propname = "spot_size";
        RNA_pointer_create(&la->id, &RNA_Lamp, la, &lamp_ptr);
-       WM_manipulator_set_property(wwrapper->manipulator, ARROW_SLOT_OFFSET_WORLD_SPACE, &lamp_ptr, propname);
+       WM_manipulator_set_property(wwrapper->manipulator, ED_MANIPULATOR_ARROW_SLOT_OFS_WORLD_SPACE, &lamp_ptr, propname);
 }
 
 void VIEW3D_WGT_lamp(wmManipulatorGroupType *wgt)
@@ -158,7 +159,7 @@ static void cameragroup_property_setup(wmManipulator *widget, Object *ob, Camera
        RNA_property_float_ui_range(&camera_ptr, prop, &min, &max, &step, &precision);
        range = max - min;
 
-       MANIPULATOR_arrow_set_range_fac(widget, is_ortho ? (scale_fac * range) : (drawsize * range / half_sensor));
+       ED_manipulator_arrow3d_set_range_fac(widget, is_ortho ? (scale_fac * range) : (drawsize * range / half_sensor));
 }
 
 static void WIDGETGROUP_camera_init(const bContext *C, wmManipulatorGroup *wgroup)
@@ -177,7 +178,7 @@ static void WIDGETGROUP_camera_init(const bContext *C, wmManipulatorGroup *wgrou
                const float color[4] = {1.0f, 0.3f, 0.0f, 1.0f};
                const float color_hi[4] = {1.0f, 0.3f, 0.0f, 1.0f};
 
-               camgroup->dop_dist = MANIPULATOR_arrow_new(wgroup, "dof_distance", MANIPULATOR_ARROW_STYLE_CROSS);
+               camgroup->dop_dist = ED_manipulator_arrow3d_new(wgroup, "dof_distance", ED_MANIPULATOR_ARROW_STYLE_CROSS);
                WM_manipulator_set_flag(camgroup->dop_dist, WM_MANIPULATOR_DRAW_HOVER, true);
                WM_manipulator_set_color(camgroup->dop_dist, color);
                WM_manipulator_set_color_highlight(camgroup->dop_dist, color_hi);
@@ -189,16 +190,16 @@ static void WIDGETGROUP_camera_init(const bContext *C, wmManipulatorGroup *wgrou
                const float color[4] = {1.0f, 1.0, 0.27f, 0.5f};
                const float color_hi[4] = {1.0f, 1.0, 0.27f, 1.0f};
 
-               camgroup->focal_len = MANIPULATOR_arrow_new(
+               camgroup->focal_len = ED_manipulator_arrow3d_new(
                        wgroup, "focal_len",
-                       (MANIPULATOR_ARROW_STYLE_CONE | MANIPULATOR_ARROW_STYLE_CONSTRAINED));
+                       (ED_MANIPULATOR_ARROW_STYLE_CONE | ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED));
                WM_manipulator_set_color(camgroup->focal_len, color);
                WM_manipulator_set_color_highlight(camgroup->focal_len, color_hi);
                cameragroup_property_setup(camgroup->focal_len, ob, ca, false);
 
-               camgroup->ortho_scale = MANIPULATOR_arrow_new(
+               camgroup->ortho_scale = ED_manipulator_arrow3d_new(
                        wgroup, "ortho_scale",
-                       (MANIPULATOR_ARROW_STYLE_CONE | MANIPULATOR_ARROW_STYLE_CONSTRAINED));
+                       (ED_MANIPULATOR_ARROW_STYLE_CONE | ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED));
                WM_manipulator_set_color(camgroup->ortho_scale, color);
                WM_manipulator_set_color_highlight(camgroup->ortho_scale, color_hi);
                cameragroup_property_setup(camgroup->ortho_scale, ob, ca, true);
@@ -221,14 +222,14 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmManipulatorGroup *wg
        negate_v3_v3(dir, ob->obmat[2]);
 
        if (ca->flag & CAM_SHOWLIMITS) {
-               MANIPULATOR_arrow_set_direction(camgroup->dop_dist, dir);
-               MANIPULATOR_arrow_set_up_vector(camgroup->dop_dist, ob->obmat[1]);
+               ED_manipulator_arrow3d_set_direction(camgroup->dop_dist, dir);
+               ED_manipulator_arrow3d_set_up_vector(camgroup->dop_dist, ob->obmat[1]);
                WM_manipulator_set_origin(camgroup->dop_dist, ob->obmat[3]);
                WM_manipulator_set_scale(camgroup->dop_dist, ca->drawsize);
                WM_manipulator_set_flag(camgroup->dop_dist, WM_MANIPULATOR_HIDDEN, false);
 
                /* need to set property here for undo. TODO would prefer to do this in _init */
-               WM_manipulator_set_property(camgroup->dop_dist, ARROW_SLOT_OFFSET_WORLD_SPACE, &camera_ptr, "dof_distance");
+               WM_manipulator_set_property(camgroup->dop_dist, ED_MANIPULATOR_ARROW_SLOT_OFS_WORLD_SPACE, &camera_ptr, "dof_distance");
        }
        else {
                WM_manipulator_set_flag(camgroup->dop_dist, WM_MANIPULATOR_HIDDEN, true);
@@ -263,16 +264,16 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmManipulatorGroup *wg
                asp[0] = (sensor_fit == CAMERA_SENSOR_FIT_HOR) ? 1.0 : aspx / aspy;
                asp[1] = (sensor_fit == CAMERA_SENSOR_FIT_HOR) ? aspy / aspx : 1.0f;
 
-               MANIPULATOR_arrow_set_up_vector(widget, ob->obmat[1]);
-               MANIPULATOR_arrow_set_direction(widget, dir);
-               MANIPULATOR_arrow_cone_set_aspect(widget, asp);
+               ED_manipulator_arrow3d_set_up_vector(widget, ob->obmat[1]);
+               ED_manipulator_arrow3d_set_direction(widget, dir);
+               ED_manipulator_arrow3d_cone_set_aspect(widget, asp);
                WM_manipulator_set_origin(widget, ob->obmat[3]);
                WM_manipulator_set_offset(widget, offset);
                WM_manipulator_set_scale(widget, drawsize);
 
                /* need to set property here for undo. TODO would prefer to do this in _init */
-               WM_manipulator_set_property(camgroup->focal_len, ARROW_SLOT_OFFSET_WORLD_SPACE, &camera_ptr, "lens");
-               WM_manipulator_set_property(camgroup->ortho_scale, ARROW_SLOT_OFFSET_WORLD_SPACE, &camera_ptr, "ortho_scale");
+               WM_manipulator_set_property(camgroup->focal_len, ED_MANIPULATOR_ARROW_SLOT_OFS_WORLD_SPACE, &camera_ptr, "lens");
+               WM_manipulator_set_property(camgroup->ortho_scale, ED_MANIPULATOR_ARROW_SLOT_OFS_WORLD_SPACE, &camera_ptr, "ortho_scale");
        }
 }
 
@@ -311,10 +312,10 @@ static void WIDGETGROUP_forcefield_init(const bContext *UNUSED(C), wmManipulator
        wmManipulatorWrapper *wwrapper = MEM_mallocN(sizeof(wmManipulatorWrapper), __func__);
        wgroup->customdata = wwrapper;
 
-       wwrapper->manipulator = MANIPULATOR_arrow_new(wgroup, "field_strength", MANIPULATOR_ARROW_STYLE_CONSTRAINED);
+       wwrapper->manipulator = ED_manipulator_arrow3d_new(wgroup, "field_strength", ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED);
 
-       MANIPULATOR_arrow_set_ui_range(wwrapper->manipulator, -200.0f, 200.0f);
-       MANIPULATOR_arrow_set_range_fac(wwrapper->manipulator, 6.0f);
+       ED_manipulator_arrow3d_set_ui_range(wwrapper->manipulator, -200.0f, 200.0f);
+       ED_manipulator_arrow3d_set_range_fac(wwrapper->manipulator, 6.0f);
        WM_manipulator_set_color(wwrapper->manipulator, col);
        WM_manipulator_set_color_highlight(wwrapper->manipulator, col_hi);
 }
@@ -332,11 +333,11 @@ static void WIDGETGROUP_forcefield_refresh(const bContext *C, wmManipulatorGroup
 
                RNA_pointer_create(&ob->id, &RNA_FieldSettings, pd, &field_ptr);
 
-               MANIPULATOR_arrow_set_direction(wwrapper->manipulator, ob->obmat[2]);
+               ED_manipulator_arrow3d_set_direction(wwrapper->manipulator, ob->obmat[2]);
                WM_manipulator_set_origin(wwrapper->manipulator, ob->obmat[3]);
                WM_manipulator_set_offset(wwrapper->manipulator, ofs);
                WM_manipulator_set_flag(wwrapper->manipulator, WM_MANIPULATOR_HIDDEN, false);
-               WM_manipulator_set_property(wwrapper->manipulator, ARROW_SLOT_OFFSET_WORLD_SPACE, &field_ptr, "strength");
+               WM_manipulator_set_property(wwrapper->manipulator, ED_MANIPULATOR_ARROW_SLOT_OFS_WORLD_SPACE, &field_ptr, "strength");
        }
        else {
                WM_manipulator_set_flag(wwrapper->manipulator, WM_MANIPULATOR_HIDDEN, true);
index 6d38037ab30b0c6c42f3a52fe9d309b46bc0a02d..2b06eb34bcbbf687ec1e75cfab003d3f1f99cb1c 100644 (file)
@@ -74,6 +74,7 @@
 #include "ED_view3d.h"
 #include "ED_gpencil.h"
 #include "ED_screen.h"
+#include "ED_manipulator_library.h"
 
 #include "UI_resources.h"
 
@@ -1087,29 +1088,29 @@ static ManipulatorGroup *manipulatorgroup_init(wmManipulatorGroup *wgroup)
        man = MEM_callocN(sizeof(ManipulatorGroup), "manipulator_data");
 
        /* add/init widgets - order matters! */
-       man->rotate_t = MANIPULATOR_dial_new(wgroup, "rotate_t", MANIPULATOR_DIAL_STYLE_RING_FILLED);
-
-       man->scale_c = MANIPULATOR_dial_new(wgroup, "scale_c", MANIPULATOR_DIAL_STYLE_RING);
-       man->scale_x = MANIPULATOR_arrow_new(wgroup, "scale_x", MANIPULATOR_ARROW_STYLE_BOX);
-       man->scale_y = MANIPULATOR_arrow_new(wgroup, "scale_y", MANIPULATOR_ARROW_STYLE_BOX);
-       man->scale_z = MANIPULATOR_arrow_new(wgroup, "scale_z", MANIPULATOR_ARROW_STYLE_BOX);
-       man->scale_xy = MANIPULATOR_primitive_new(wgroup, "scale_xy", MANIPULATOR_PRIMITIVE_STYLE_PLANE);
-       man->scale_yz = MANIPULATOR_primitive_new(wgroup, "scale_yz", MANIPULATOR_PRIMITIVE_STYLE_PLANE);
-       man->scale_zx = MANIPULATOR_primitive_new(wgroup, "scale_zx", MANIPULATOR_PRIMITIVE_STYLE_PLANE);
-
-       man->rotate_x = MANIPULATOR_dial_new(wgroup, "rotate_x", MANIPULATOR_DIAL_STYLE_RING_CLIPPED);
-       man->rotate_y = MANIPULATOR_dial_new(wgroup, "rotate_y", MANIPULATOR_DIAL_STYLE_RING_CLIPPED);
-       man->rotate_z = MANIPULATOR_dial_new(wgroup, "rotate_z", MANIPULATOR_DIAL_STYLE_RING_CLIPPED);
+       man->rotate_t = ED_manipulator_dial3d_new(wgroup, "rotate_t", ED_MANIPULATOR_DIAL_STYLE_RING_FILLED);
+
+       man->scale_c = ED_manipulator_dial3d_new(wgroup, "scale_c", ED_MANIPULATOR_DIAL_STYLE_RING);
+       man->scale_x = ED_manipulator_arrow3d_new(wgroup, "scale_x", ED_MANIPULATOR_ARROW_STYLE_BOX);
+       man->scale_y = ED_manipulator_arrow3d_new(wgroup, "scale_y", ED_MANIPULATOR_ARROW_STYLE_BOX);
+       man->scale_z = ED_manipulator_arrow3d_new(wgroup, "scale_z", ED_MANIPULATOR_ARROW_STYLE_BOX);
+       man->scale_xy = ED_manipulator_primitive3d_new(wgroup, "scale_xy", ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
+       man->scale_yz = ED_manipulator_primitive3d_new(wgroup, "scale_yz", ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
+       man->scale_zx = ED_manipulator_primitive3d_new(wgroup, "scale_zx", ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
+
+       man->rotate_x = ED_manipulator_dial3d_new(wgroup, "rotate_x", ED_MANIPULATOR_DIAL_STYLE_RING_CLIPPED);
+       man->rotate_y = ED_manipulator_dial3d_new(wgroup, "rotate_y", ED_MANIPULATOR_DIAL_STYLE_RING_CLIPPED);
+       man->rotate_z = ED_manipulator_dial3d_new(wgroup, "rotate_z", ED_MANIPULATOR_DIAL_STYLE_RING_CLIPPED);
        /* init screen aligned widget last here, looks better, behaves better */
-       man->rotate_c = MANIPULATOR_dial_new(wgroup, "rotate_c", MANIPULATOR_DIAL_STYLE_RING);
+       man->rotate_c = ED_manipulator_dial3d_new(wgroup, "rotate_c", ED_MANIPULATOR_DIAL_STYLE_RING);
 
-       man->translate_c = MANIPULATOR_dial_new(wgroup, "translate_c", MANIPULATOR_DIAL_STYLE_RING);
-       man->translate_x = MANIPULATOR_arrow_new(wgroup, "translate_x", MANIPULATOR_ARROW_STYLE_NORMAL);
-       man->translate_y = MANIPULATOR_arrow_new(wgroup, "translate_y", MANIPULATOR_ARROW_STYLE_NORMAL);
-       man->translate_z = MANIPULATOR_arrow_new(wgroup, "translate_z", MANIPULATOR_ARROW_STYLE_NORMAL);
-       man->translate_xy = MANIPULATOR_primitive_new(wgroup, "translate_xy", MANIPULATOR_PRIMITIVE_STYLE_PLANE);
-       man->translate_yz = MANIPULATOR_primitive_new(wgroup, "translate_yz", MANIPULATOR_PRIMITIVE_STYLE_PLANE);
-       man->translate_zx = MANIPULATOR_primitive_new(wgroup, "translate_zx", MANIPULATOR_PRIMITIVE_STYLE_PLANE);
+       man->translate_c = ED_manipulator_dial3d_new(wgroup, "translate_c", ED_MANIPULATOR_DIAL_STYLE_RING);
+       man->translate_x = ED_manipulator_arrow3d_new(wgroup, "translate_x", ED_MANIPULATOR_ARROW_STYLE_NORMAL);
+       man->translate_y = ED_manipulator_arrow3d_new(wgroup, "translate_y", ED_MANIPULATOR_ARROW_STYLE_NORMAL);
+       man->translate_z = ED_manipulator_arrow3d_new(wgroup, "translate_z", ED_MANIPULATOR_ARROW_STYLE_NORMAL);
+       man->translate_xy = ED_manipulator_primitive3d_new(wgroup, "translate_xy", ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
+       man->translate_yz = ED_manipulator_primitive3d_new(wgroup, "translate_yz", ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
+       man->translate_zx = ED_manipulator_primitive3d_new(wgroup, "translate_zx", ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
 
        return man;
 }
@@ -1253,15 +1254,15 @@ static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGrou
 
                                manipulator_line_range(v3d, axis_type, &start_co[2], &len);
 
-                               MANIPULATOR_arrow_set_direction(axis, rv3d->twmat[aidx_norm]);
-                               MANIPULATOR_arrow_set_line_len(axis, len);
+                               ED_manipulator_arrow3d_set_direction(axis, rv3d->twmat[aidx_norm]);
+                               ED_manipulator_arrow3d_set_line_len(axis, len);
                                WM_manipulator_set_offset(axis, start_co);
                                break;
                        }
                        case MAN_AXIS_ROT_X:
                        case MAN_AXIS_ROT_Y:
                        case MAN_AXIS_ROT_Z:
-                               MANIPULATOR_dial_set_up_vector(axis, rv3d->twmat[aidx_norm]);
+                               ED_manipulator_dial3d_set_up_vector(axis, rv3d->twmat[aidx_norm]);
                                break;
                        case MAN_AXIS_TRANS_XY:
                        case MAN_AXIS_TRANS_YZ:
@@ -1269,8 +1270,8 @@ static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGrou
                        case MAN_AXIS_SCALE_XY:
                        case MAN_AXIS_SCALE_YZ:
                        case MAN_AXIS_SCALE_ZX:
-                               MANIPULATOR_primitive_set_direction(axis, rv3d->twmat[aidx_norm - 1 < 0 ? 2 : aidx_norm - 1]);
-                               MANIPULATOR_primitive_set_up_vector(axis, rv3d->twmat[aidx_norm + 1 > 2 ? 0 : aidx_norm + 1]);
+                               ED_manipulator_primitive3d_set_direction(axis, rv3d->twmat[aidx_norm - 1 < 0 ? 2 : aidx_norm - 1]);
+                               ED_manipulator_primitive3d_set_up_vector(axis, rv3d->twmat[aidx_norm + 1 > 2 ? 0 : aidx_norm + 1]);
                                break;
                }
        }
@@ -1322,7 +1323,7 @@ static void WIDGETGROUP_manipulator_draw_prepare(const bContext *C, wmManipulato
                        case MAN_AXIS_ROT_C:
                        case MAN_AXIS_SCALE_C:
                        case MAN_AXIS_ROT_T:
-                               MANIPULATOR_dial_set_up_vector(axis, rv3d->viewinv[2]);
+                               ED_manipulator_dial3d_set_up_vector(axis, rv3d->viewinv[2]);
                                break;
                }
        }
index 766f70d025c1d8b0f2b3a9ced58918f33749f09d..3612aab468f85da14436e71fe44a7b701a47fd70 100644 (file)
@@ -64,6 +64,7 @@ set(SRC
        ../include/ED_lattice.h
        ../include/ED_logic.h
        ../include/ED_markers.h
+       ../include/ED_manipulator_library.h
        ../include/ED_mask.h
        ../include/ED_mball.h
        ../include/ED_mesh.h
index b61b4472c4a3fc067ae7a388fb1d9e1151a3fb6e..a7f8a783078d41b3414756cef1a7a950bd7d86de 100644 (file)
@@ -74,14 +74,7 @@ set(SRC
        manipulators/intern/wm_manipulator.c
        manipulators/intern/wm_manipulatorgroup.c
        manipulators/intern/wm_manipulatormap.c
-       manipulators/intern/manipulator_library/arrow_manipulator.c
-       manipulators/intern/manipulator_library/arrow2d_manipulator.c
-       manipulators/intern/manipulator_library/cage_manipulator.c
-       manipulators/intern/manipulator_library/dial_manipulator.c
-       manipulators/intern/manipulator_library/primitive_manipulator.c
-       manipulators/intern/manipulator_library/geom_arrow_manipulator.c
-       manipulators/intern/manipulator_library/geom_cube_manipulator.c
-       manipulators/intern/manipulator_library/manipulator_library_utils.c
+
 
        WM_api.h
        WM_keymap.h
@@ -96,12 +89,9 @@ set(SRC
        wm_window.h
        manipulators/WM_manipulator_api.h
        manipulators/WM_manipulator_types.h
-       manipulators/WM_manipulator_library.h
        manipulators/wm_manipulator_fn.h
        manipulators/wm_manipulator_wmapi.h
        manipulators/intern/wm_manipulator_intern.h
-       manipulators/intern/manipulator_library/manipulator_geometry.h
-       manipulators/intern/manipulator_library/manipulator_library_intern.h
 )
 
 if(WITH_AUDASPACE)
index 6fa9429d04f6d073e28da0d9c04c6e8ff35bbf24..3501105d404250cbebb7ad9a4674217403c94813 100644 (file)
@@ -44,7 +44,6 @@
 
 /* Include external manipulator API's */
 #include "manipulators/WM_manipulator_api.h"
-#include "manipulators/WM_manipulator_library.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_library.h b/source/blender/windowmanager/manipulators/WM_manipulator_library.h
deleted file mode 100644 (file)
index 4e0c5b0..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/windowmanager/manipulators/WM_manipulator_library.h
- *  \ingroup wm
- *
- * \name Generic Manipulator Library
- *
- * Only included in WM_api.h and lower level files.
- */
-
-
-#ifndef __WM_MANIPULATOR_LIBRARY_H__
-#define __WM_MANIPULATOR_LIBRARY_H__
-
-struct wmManipulatorGroup;
-
-
-/* -------------------------------------------------------------------- */
-/* 3D Arrow Manipulator */
-
-enum {
-       MANIPULATOR_ARROW_STYLE_NORMAL        =  1,
-       MANIPULATOR_ARROW_STYLE_NO_AXIS       = (1 << 1),
-       MANIPULATOR_ARROW_STYLE_CROSS         = (1 << 2),
-       MANIPULATOR_ARROW_STYLE_INVERTED      = (1 << 3), /* inverted offset during interaction - if set it also sets constrained below */
-       MANIPULATOR_ARROW_STYLE_CONSTRAINED   = (1 << 4), /* clamp arrow interaction to property width */
-       MANIPULATOR_ARROW_STYLE_BOX           = (1 << 5), /* use a box for the arrowhead */
-       MANIPULATOR_ARROW_STYLE_CONE          = (1 << 6),
-};
-
-/* slots for properties */
-enum {
-       ARROW_SLOT_OFFSET_WORLD_SPACE = 0
-};
-
-struct wmManipulator *MANIPULATOR_arrow_new(struct wmManipulatorGroup *mgroup, const char *name, const int style);
-void MANIPULATOR_arrow_set_direction(struct wmManipulator *manipulator, const float direction[3]);
-void MANIPULATOR_arrow_set_up_vector(struct wmManipulator *manipulator, const float direction[3]);
-void MANIPULATOR_arrow_set_line_len(struct wmManipulator *manipulator, const float len);
-void MANIPULATOR_arrow_set_ui_range(struct wmManipulator *manipulator, const float min, const float max);
-void MANIPULATOR_arrow_set_range_fac(struct wmManipulator *manipulator, const float range_fac);
-void MANIPULATOR_arrow_cone_set_aspect(struct wmManipulator *manipulator, const float aspect[2]);
-
-
-/* -------------------------------------------------------------------- */
-/* 2D Arrow Manipulator */
-
-struct wmManipulator *MANIPULATOR_arrow2d_new(struct wmManipulatorGroup *mgroup, const char *name);
-void MANIPULATOR_arrow2d_set_angle(struct wmManipulator *manipulator, const float rot_fac);
-void MANIPULATOR_arrow2d_set_line_len(struct wmManipulator *manipulator, const float len);
-
-
-/* -------------------------------------------------------------------- */
-/* Cage Manipulator */
-
-enum {
-       MANIPULATOR_RECT_TRANSFORM_STYLE_TRANSLATE       =  1,       /* Manipulator translates */
-       MANIPULATOR_RECT_TRANSFORM_STYLE_ROTATE          = (1 << 1), /* Manipulator rotates */
-       MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE           = (1 << 2), /* Manipulator scales */
-       MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM   = (1 << 3), /* Manipulator scales uniformly */
-};
-
-enum {
-       RECT_TRANSFORM_SLOT_OFFSET = 0,
-       RECT_TRANSFORM_SLOT_SCALE = 1
-};
-
-struct wmManipulator *MANIPULATOR_rect_transform_new(
-        struct wmManipulatorGroup *mgroup, const char *name, const int style);
-void MANIPULATOR_rect_transform_set_dimensions(
-        struct wmManipulator *manipulator, const float width, const float height);
-
-
-/* -------------------------------------------------------------------- */
-/* Dial Manipulator */
-
-enum {
-       MANIPULATOR_DIAL_STYLE_RING = 0,
-       MANIPULATOR_DIAL_STYLE_RING_CLIPPED = 1,
-       MANIPULATOR_DIAL_STYLE_RING_FILLED = 2,
-};
-
-struct wmManipulator *MANIPULATOR_dial_new(struct wmManipulatorGroup *mgroup, const char *name, const int style);
-void MANIPULATOR_dial_set_up_vector(struct wmManipulator *manipulator, const float direction[3]);
-
-
-/* -------------------------------------------------------------------- */
-/* Facemap Manipulator */
-
-struct wmManipulator *MANIPULATOR_facemap_new(
-        struct wmManipulatorGroup *mgroup, const char *name, const int style,
-        struct Object *ob, const int facemap);
-struct bFaceMap *MANIPULATOR_facemap_get_fmap(struct wmManipulator *manipulator);
-
-
-/* -------------------------------------------------------------------- */
-/* Primitive Manipulator */
-
-enum {
-       MANIPULATOR_PRIMITIVE_STYLE_PLANE = 0,
-};
-
-struct wmManipulator *MANIPULATOR_primitive_new(struct wmManipulatorGroup *mgroup, const char *name, const int style);
-void MANIPULATOR_primitive_set_direction(struct wmManipulator *manipulator, const float direction[3]);
-void MANIPULATOR_primitive_set_up_vector(struct wmManipulator *manipulator, const float direction[3]);
-
-extern void ED_manipulatortypes_dial(void);
-extern void ED_manipulatortypes_arrow_2d(void);
-extern void ED_manipulatortypes_arrow_3d(void);
-extern void ED_manipulatortypes_facemap(void);
-extern void ED_manipulatortypes_primitive(void);
-extern void ED_manipulatortypes_cage(void);
-
-#endif  /* __WM_MANIPULATOR_LIBRARY_H__ */
-
index 01f5d1c01992d5ccb45788df94cada50d6bbe73c..fbbbffd18b05b7571dc7c5f6a16574e16c963c04 100644 (file)
@@ -48,6 +48,56 @@ struct wmKeyConfig;
 /* -------------------------------------------------------------------- */
 /* wmManipulator */
 
+/* manipulators are set per region by registering them on manipulator-maps */
+struct wmManipulator {
+       struct wmManipulator *next, *prev;
+
+       char idname[64 + 4]; /* MAX_NAME + 4 for unique '.001', '.002', etc suffix */
+
+       /* While we don't have a real type, use this to put type-like vars. */
+       const struct wmManipulatorType *type;
+
+       /* Overrides 'type->handler' when set. */
+       wmManipulatorFnHandler custom_handler;
+
+       void *custom_data;
+
+       /* pointer back to group this manipulator is in (just for quick access) */
+       struct wmManipulatorGroup *parent_mgroup;
+
+       int flag; /* flags that influence the behavior or how the manipulators are drawn */
+       short state; /* state flags (active, highlighted, selected) */
+
+       unsigned char highlighted_part;
+
+       /* center of manipulator in space, 2d or 3d */
+       float origin[3];
+       /* custom offset from origin */
+       float offset[3];
+       /* runtime property, set the scale while drawing on the viewport */
+       float scale;
+       /* user defined scale, in addition to the original one */
+       float user_scale;
+       /* user defined width for line drawing */
+       float line_width;
+       /* manipulator colors (uses default fallbacks if not defined) */
+       float col[4], col_hi[4];
+
+       /* data used during interaction */
+       void *interaction_data;
+
+       /* name of operator to spawn when activating the manipulator */
+       const char *opname;
+       /* operator properties if manipulator spawns and controls an operator,
+        * or owner pointer if manipulator spawns and controls a property */
+       PointerRNA opptr;
+
+       /* arrays of properties attached to various manipulator parameters. As
+        * the manipulator is interacted with, those properties get updated */
+       PointerRNA *ptr;
+       PropertyRNA **props;
+};
+
 /**
  * Simple utility wrapper for storing a single manipulator as wmManipulatorGroup.customdata (which gets freed).
  */
@@ -64,6 +114,23 @@ enum {
        WM_MANIPULATOR_HIDDEN      = (1 << 3),
 };
 
+/* wmManipulator.state */
+enum {
+       WM_MANIPULATOR_STATE_HIGHLIGHT   = (1 << 0), /* while hovered */
+       WM_MANIPULATOR_STATE_ACTIVE      = (1 << 1), /* while dragging */
+       WM_MANIPULATOR_STATE_SELECT      = (1 << 2),
+};
+
+/**
+ * \brief Manipulator tweak flag.
+ * Bitflag passed to manipulator while tweaking.
+ */
+enum {
+       /* drag with extra precision (shift)
+        * NOTE: Manipulators are responsible for handling this (manipulator->handler callback)! */
+       WM_MANIPULATOR_TWEAK_PRECISE = (1 << 0),
+};
+
 typedef struct wmManipulatorType {
        struct wmManipulatorGroupType *next, *prev;
 
index a2d88b35b54167707171f05bb069df131678ad77..d70822e8c56654b8dc9fe39ee01be7e7f589dbf1 100644 (file)
@@ -58,8 +58,6 @@
 #include "wm_manipulator_wmapi.h"
 #include "wm_manipulator_intern.h"
 
-#include "manipulator_library/manipulator_geometry.h"
-
 static void wm_manipulator_register(
         wmManipulatorGroup *mgroup, wmManipulator *manipulator, const char *name);
 
@@ -163,91 +161,12 @@ static wmManipulator *wm_manipulator_create(
        return mpr;
 }
 
-
-/**
- * Main draw call for ManipulatorGeomInfo data
- */
-void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const bool select, const float color[4])
-{
-       /* 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));
-       VertexBuffer *vbo;
-       ElementList *el;
-       Batch *batch;
-       ElementListBuilder elb = {0};
-
-       VertexFormat format = {0};
-       unsigned int pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
-       unsigned int nor_id;
-
-       if (use_lighting) {
-               nor_id = VertexFormat_add_attrib(&format, "nor", COMP_I16, 3, NORMALIZE_INT_TO_FLOAT);
-       }
-
-       /* Elements */
-       ElementListBuilder_init(&elb, PRIM_TRIANGLES, info->ntris, info->nverts);
-       for (int i = 0; i < info->ntris; ++i) {
-               const unsigned short *idx = &info->indices[i * 3];
-               add_triangle_vertices(&elb, idx[0], idx[1], idx[2]);
-       }
-       el = ElementList_build(&elb);
-
-       vbo = VertexBuffer_create_with_format(&format);
-       VertexBuffer_allocate_data(vbo, info->nverts);
-
-       VertexBuffer_fill_attrib(vbo, pos_id, info->verts);
-
-       if (use_lighting) {
-               /* Normals are expected to be smooth. */
-               VertexBuffer_fill_attrib(vbo, nor_id, info->normals);
-       }
-
-       batch = Batch_create(PRIM_TRIANGLES, vbo, el);
-       Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR);
-
-       Batch_Uniform4fv(batch, "color", color);
-
-       glEnable(GL_CULL_FACE);
-       // glEnable(GL_DEPTH_TEST);
-
-       Batch_draw(batch);
-
-       glDisable(GL_DEPTH_TEST);
-       // glDisable(GL_CULL_FACE);
-
-
-       Batch_discard_all(batch);
-}
-
-void wm_manipulator_vec_draw(
-        const float color[4], const float (*verts)[3], unsigned int vert_count,
-        unsigned int pos, unsigned int primitive_type)
-{
-       immUniformColor4fv(color);
-       immBegin(primitive_type, vert_count);
-       for (int i = 0; i < vert_count; i++) {
-               immVertex3fv(pos, verts[i]);
-       }
-       immEnd();
-}
-
 wmManipulator *WM_manipulator_new(const wmManipulatorType *mpt, wmManipulatorGroup *mgroup, const char *name)
 {
        wmManipulator *mpr = wm_manipulator_create(mpt);
 
        wm_manipulator_register(mgroup, mpr, name);
 
-       /* XXX: never happens */
-       if (name[0] == '\n') {
-               fix_linking_manipulator_arrow();
-               fix_linking_manipulator_arrow2d();
-               fix_linking_manipulator_cage();
-               fix_linking_manipulator_dial();
-               fix_linking_manipulator_primitive();
-       }
-
        return mpr;
 }
 
@@ -311,13 +230,13 @@ static void wm_manipulator_register(wmManipulatorGroup *mgroup, wmManipulator *m
  */
 void WM_manipulator_delete(ListBase *manipulatorlist, wmManipulatorMap *mmap, wmManipulator *manipulator, bContext *C)
 {
-       if (manipulator->state & WM_MANIPULATOR_HIGHLIGHT) {
+       if (manipulator->state & WM_MANIPULATOR_STATE_HIGHLIGHT) {
                wm_manipulatormap_set_highlighted_manipulator(mmap, C, NULL, 0);
        }
-       if (manipulator->state & WM_MANIPULATOR_ACTIVE) {
+       if (manipulator->state & WM_MANIPULATOR_STATE_ACTIVE) {
                wm_manipulatormap_set_active_manipulator(mmap, C, NULL, NULL);
        }
-       if (manipulator->state & WM_MANIPULATOR_SELECTED) {
+       if (manipulator->state & WM_MANIPULATOR_STATE_SELECT) {
                wm_manipulator_deselect(mmap, manipulator);
        }
 
@@ -513,7 +432,7 @@ bool wm_manipulator_deselect(wmManipulatorMap *mmap, wmManipulator *manipulator)
        bool changed = false;
 
        /* caller should check! */
-       BLI_assert(manipulator->state & WM_MANIPULATOR_SELECTED);
+       BLI_assert(manipulator->state & WM_MANIPULATOR_STATE_SELECT);
 
        /* remove manipulator from selected_manipulators array */
        for (int i = 0; i < (*tot_selected); i++) {
@@ -535,7 +454,7 @@ bool wm_manipulator_deselect(wmManipulatorMap *mmap, wmManipulator *manipulator)
                (*tot_selected)--;
        }
 
-       manipulator->state &= ~WM_MANIPULATOR_SELECTED;
+       manipulator->state &= ~WM_MANIPULATOR_STATE_SELECT;
        return changed;
 }
 
@@ -550,7 +469,7 @@ bool wm_manipulator_select(bContext *C, wmManipulatorMap *mmap, wmManipulator *m
        wmManipulator ***sel = &mmap->mmap_context.selected_manipulator;
        int *tot_selected = &mmap->mmap_context.tot_selected;
 
-       if (!manipulator || (manipulator->state & WM_MANIPULATOR_SELECTED))
+       if (!manipulator || (manipulator->state & WM_MANIPULATOR_STATE_SELECT))
                return false;
 
        (*tot_selected)++;
@@ -558,7 +477,7 @@ bool wm_manipulator_select(bContext *C, wmManipulatorMap *mmap, wmManipulator *m
        *sel = MEM_reallocN(*sel, sizeof(wmManipulator *) * (*tot_selected));
        (*sel)[(*tot_selected) - 1] = manipulator;
 
-       manipulator->state |= WM_MANIPULATOR_SELECTED;
+       manipulator->state |= WM_MANIPULATOR_STATE_SELECT;
        if (manipulator->type->select) {
                manipulator->type->select(C, manipulator, SEL_SELECT);
        }
@@ -617,15 +536,15 @@ bool wm_manipulator_is_visible(wmManipulator *manipulator)
        if (manipulator->flag & WM_MANIPULATOR_HIDDEN) {
                return false;
        }
-       if ((manipulator->state & WM_MANIPULATOR_ACTIVE) &&
+       if ((manipulator->state & WM_MANIPULATOR_STATE_ACTIVE) &&
            !(manipulator->flag & (WM_MANIPULATOR_DRAW_ACTIVE | WM_MANIPULATOR_DRAW_VALUE)))
        {
                /* don't draw while active (while dragging) */
                return false;
        }
        if ((manipulator->flag & WM_MANIPULATOR_DRAW_HOVER) &&
-           !(manipulator->state & WM_MANIPULATOR_HIGHLIGHT) &&
-           !(manipulator->state & WM_MANIPULATOR_SELECTED)) /* still draw selected manipulators */
+           !(manipulator->state & WM_MANIPULATOR_STATE_HIGHLIGHT) &&
+           !(manipulator->state & WM_MANIPULATOR_STATE_SELECT)) /* still draw selected manipulators */
        {
                /* only draw on mouse hover */
                return false;
index ca48b05e7862a04876f0f0700d26396da0cf2745..bf2240e7219a6cb44005898c6ea8de880c4c2294 100644 (file)
@@ -38,73 +38,6 @@ struct GHashIterator;
 /* -------------------------------------------------------------------- */
 /* wmManipulator */
 
-/* manipulators are set per region by registering them on manipulator-maps */
-struct wmManipulator {
-       struct wmManipulator *next, *prev;
-
-       char idname[MAX_NAME + 4]; /* + 4 for unique '.001', '.002', etc suffix */
-
-       /* While we don't have a real type, use this to put type-like vars. */
-       const struct wmManipulatorType *type;
-
-       /* Overrides 'type->handler' when set. */
-       wmManipulatorFnHandler custom_handler;
-
-       void *custom_data;
-
-       /* pointer back to group this manipulator is in (just for quick access) */
-       struct wmManipulatorGroup *parent_mgroup;
-
-       int flag; /* flags that influence the behavior or how the manipulators are drawn */
-       short state; /* state flags (active, highlighted, selected) */
-
-       unsigned char highlighted_part;
-
-       /* center of manipulator in space, 2d or 3d */
-       float origin[3];
-       /* custom offset from origin */
-       float offset[3];
-       /* runtime property, set the scale while drawing on the viewport */
-       float scale;
-       /* user defined scale, in addition to the original one */
-       float user_scale;
-       /* user defined width for line drawing */
-       float line_width;
-       /* manipulator colors (uses default fallbacks if not defined) */
-       float col[4], col_hi[4];
-
-       /* data used during interaction */
-       void *interaction_data;
-
-       /* name of operator to spawn when activating the manipulator */
-       const char *opname;
-       /* operator properties if manipulator spawns and controls an operator,
-        * or owner pointer if manipulator spawns and controls a property */
-       PointerRNA opptr;
-
-       /* arrays of properties attached to various manipulator parameters. As
-        * the manipulator is interacted with, those properties get updated */
-       PointerRNA *ptr;
-       PropertyRNA **props;
-};
-
-/* wmManipulator.state */
-enum {
-       WM_MANIPULATOR_HIGHLIGHT   = (1 << 0), /* while hovered */
-       WM_MANIPULATOR_ACTIVE      = (1 << 1), /* while dragging */
-       WM_MANIPULATOR_SELECTED    = (1 << 2),
-};
-
-/**
- * \brief Manipulator tweak flag.
- * Bitflag passed to manipulator while tweaking.
- */
-enum {
-       /* drag with extra precision (shift)
-        * NOTE: Manipulators are responsible for handling this (manipulator->handler callback)! */
-       WM_MANIPULATOR_TWEAK_PRECISE = (1 << 0),
-};
-
 bool wm_manipulator_deselect(struct wmManipulatorMap *mmap, struct wmManipulator *manipulator);
 bool wm_manipulator_select(bContext *C, struct wmManipulatorMap *mmap, struct wmManipulator *manipulator);
 
@@ -112,13 +45,6 @@ void wm_manipulator_calculate_scale(struct wmManipulator *manipulator, const bCo
 void wm_manipulator_update(struct wmManipulator *manipulator, const bContext *C, const bool refresh_map);
 bool wm_manipulator_is_visible(struct wmManipulator *manipulator);
 
-void fix_linking_manipulator_arrow(void);
-void fix_linking_manipulator_arrow2d(void);
-void fix_linking_manipulator_cage(void);
-void fix_linking_manipulator_dial(void);
-void fix_linking_manipulator_facemap(void);
-void fix_linking_manipulator_primitive(void);
-
 /* -------------------------------------------------------------------- */
 /* wmManipulatorGroup */
 
@@ -191,14 +117,4 @@ struct wmManipulatorMapType {
 void wm_manipulatormap_selected_delete(struct wmManipulatorMap *mmap);
 bool wm_manipulatormap_deselect_all(struct wmManipulatorMap *mmap, struct wmManipulator ***sel);
 
-
-/* -------------------------------------------------------------------- */
-/* Manipulator drawing */
-
-void wm_manipulator_geometryinfo_draw(const struct ManipulatorGeomInfo *info, const bool select, const float color[4]);
-void wm_manipulator_vec_draw(
-        const float color[4], const float (*verts)[3], unsigned int vert_count,
-        unsigned int pos, unsigned int primitive_type);
-
-#endif  /* __WM_MANIPULATOR_INTERN_H__ */
-
+#endif
\ No newline at end of file
index 18bee2e4457a4cf99c9f5c2525719dc62dc9088f..94e12b88dcd19ff8ed6cc6ea4730e68f96688a84 100644 (file)
@@ -240,7 +240,7 @@ static int manipulator_select_invoke(bContext *C, wmOperator *op, const wmEvent
        }
 
        if (highlighted) {
-               const bool is_selected = (highlighted->state & WM_MANIPULATOR_SELECTED);
+               const bool is_selected = (highlighted->state & WM_MANIPULATOR_STATE_SELECT);
                bool redraw = false;
 
                if (toggle) {
index 00bc9f2ea56650148790dce82a00ab98bc9fe2aa..13900ed8545ec9ebf2314a742991e7d1ccca1482 100644 (file)
@@ -288,7 +288,7 @@ static void manipulator_find_active_3D_loop(const bContext *C, ListBase *visible
        }
 }
 
-static int manipulator_find_intersected_3D_intern(
+static int manipulator_find_intersected_3d_intern(
         ListBase *visible_manipulators, const bContext *C, const int co[2],
         const float hotspot)
 {
@@ -330,7 +330,7 @@ static int manipulator_find_intersected_3D_intern(
 /**
  * Try to find a 3D manipulator at screen-space coordinate \a co. Uses OpenGL picking.
  */
-static wmManipulator *manipulator_find_intersected_3D(
+static wmManipulator *manipulator_find_intersected_3d(
         bContext *C, const int co[2], ListBase *visible_manipulators,
         unsigned char *part)
 {
@@ -342,12 +342,12 @@ static wmManipulator *manipulator_find_intersected_3D(
        /* set up view matrices */
        view3d_operator_needs_opengl(C);
 
-       ret = manipulator_find_intersected_3D_intern(visible_manipulators, C, co, 0.5f * hotspot);
+       ret = manipulator_find_intersected_3d_intern(visible_manipulators, C, co, 0.5f * hotspot);
 
        if (ret != -1) {
                LinkData *link;
                int retsec;
-               retsec = manipulator_find_intersected_3D_intern(visible_manipulators, C, co, 0.2f * hotspot);
+               retsec = manipulator_find_intersected_3d_intern(visible_manipulators, C, co, 0.2f * hotspot);
 
                if (retsec != -1)
                        ret = retsec;
@@ -383,7 +383,7 @@ wmManipulator *wm_manipulatormap_find_highlighted_manipulator(
        }
 
        if (!BLI_listbase_is_empty(&visible_3d_manipulators)) {
-               manipulator = manipulator_find_intersected_3D(C, event->mval, &visible_3d_manipulators, part);
+               manipulator = manipulator_find_intersected_3d(C, event->mval, &visible_3d_manipulators, part);
                BLI_freelistN(&visible_3d_manipulators);
        }
 
@@ -455,7 +455,7 @@ bool wm_manipulatormap_deselect_all(wmManipulatorMap *mmap, wmManipulator ***sel
                return false;
 
        for (int i = 0; i < mmap->mmap_context.tot_selected; i++) {
-               (*sel)[i]->state &= ~WM_MANIPULATOR_SELECTED;
+               (*sel)[i]->state &= ~WM_MANIPULATOR_STATE_SELECT;
                (*sel)[i] = NULL;
        }
        wm_manipulatormap_selected_delete(mmap);
@@ -493,10 +493,10 @@ static bool wm_manipulatormap_select_all_intern(
        GHASH_ITER_INDEX (gh_iter, hash, i) {
                wmManipulator *manipulator_iter = BLI_ghashIterator_getValue(&gh_iter);
 
-               if ((manipulator_iter->state & WM_MANIPULATOR_SELECTED) == 0) {
+               if ((manipulator_iter->state & WM_MANIPULATOR_STATE_SELECT) == 0) {
                        changed = true;
                }
-               manipulator_iter->state |= WM_MANIPULATOR_SELECTED;
+               manipulator_iter->state |= WM_MANIPULATOR_STATE_SELECT;
                if (manipulator_iter->type->select) {
                        manipulator_iter->type->select(C, manipulator_iter, action);
                }
@@ -598,14 +598,14 @@ void wm_manipulatormap_set_highlighted_manipulator(
            (manipulator && part != manipulator->highlighted_part))
        {
                if (mmap->mmap_context.highlighted_manipulator) {
-                       mmap->mmap_context.highlighted_manipulator->state &= ~WM_MANIPULATOR_HIGHLIGHT;
+                       mmap->mmap_context.highlighted_manipulator->state &= ~WM_MANIPULATOR_STATE_HIGHLIGHT;
                        mmap->mmap_context.highlighted_manipulator->highlighted_part = 0;
                }
 
                mmap->mmap_context.highlighted_manipulator = manipulator;
 
                if (manipulator) {
-                       manipulator->state |= WM_MANIPULATOR_HIGHLIGHT;
+                       manipulator->state |= WM_MANIPULATOR_STATE_HIGHLIGHT;
                        manipulator->highlighted_part = part;
 
                        if (C && manipulator->type->cursor_get) {
@@ -637,7 +637,7 @@ void wm_manipulatormap_set_active_manipulator(
         wmManipulatorMap *mmap, bContext *C, const wmEvent *event, wmManipulator *manipulator)
 {
        if (manipulator && C) {
-               manipulator->state |= WM_MANIPULATOR_ACTIVE;
+               manipulator->state |= WM_MANIPULATOR_STATE_ACTIVE;
                mmap->mmap_context.active_manipulator = manipulator;
 
                if (manipulator->opname) {
@@ -655,7 +655,7 @@ void wm_manipulatormap_set_active_manipulator(
 
                                /* we failed to hook the manipulator to the operator handler or operator was cancelled, return */
                                if (!mmap->mmap_context.active_manipulator) {
-                                       manipulator->state &= ~WM_MANIPULATOR_ACTIVE;
+                                       manipulator->state &= ~WM_MANIPULATOR_STATE_ACTIVE;
                                        /* first activate the manipulator itself */
                                        if (manipulator->interaction_data) {
                                                MEM_freeN(manipulator->interaction_data);
@@ -685,7 +685,7 @@ void wm_manipulatormap_set_active_manipulator(
 
                /* deactivate, manipulator but first take care of some stuff */
                if (manipulator) {
-                       manipulator->state &= ~WM_MANIPULATOR_ACTIVE;
+                       manipulator->state &= ~WM_MANIPULATOR_STATE_ACTIVE;
                        /* first activate the manipulator itself */
                        if (manipulator->interaction_data) {
                                MEM_freeN(manipulator->interaction_data);