Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-07-15 00:49:00 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-07-15 00:49:00 +0300
commit5ebebcfbfff4c218ab4101ee7f6a66617ee9b01f (patch)
tree86f319a9291847c2608bfd0b89bae3d504e378cf /source/blender/editors/gizmo_library
parentcd1600413246a62156441f6e7910489b19ae5a28 (diff)
WM: rename manipulator to gizmo internally
Diffstat (limited to 'source/blender/editors/gizmo_library')
-rw-r--r--source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c2
-rw-r--r--source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c2
-rw-r--r--source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c2
-rw-r--r--source/blender/editors/gizmo_library/gizmo_draw_utils.c10
-rw-r--r--source/blender/editors/gizmo_library/gizmo_geometry.h22
-rw-r--r--source/blender/editors/gizmo_library/gizmo_library_intern.h56
-rw-r--r--source/blender/editors/gizmo_library/gizmo_library_presets.c44
-rw-r--r--source/blender/editors/gizmo_library/gizmo_library_utils.c78
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c56
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c246
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c76
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c322
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c214
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c128
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c144
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c76
16 files changed, 739 insertions, 739 deletions
diff --git a/source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c b/source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c
index e8804238590..11708f5b5ce 100644
--- a/source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c
+++ b/source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c
@@ -132,7 +132,7 @@ static unsigned short indices[] = {
3, 1, 17,
};
-ManipulatorGeomInfo wm_manipulator_geom_data_arrow = {
+GizmoGeomInfo wm_gizmo_geom_data_arrow = {
.nverts = 25,
.ntris = 46,
.verts = verts,
diff --git a/source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c b/source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c
index f2d03821302..28eb772c082 100644
--- a/source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c
+++ b/source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c
@@ -66,7 +66,7 @@ static const unsigned short indices[] = {
4, 0, 7,
};
-ManipulatorGeomInfo wm_manipulator_geom_data_cube = {
+GizmoGeomInfo wm_gizmo_geom_data_cube = {
.nverts = 8,
.ntris = 12,
.verts = verts,
diff --git a/source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c b/source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c
index bc3fb6fcaff..0225a662ff3 100644
--- a/source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c
+++ b/source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c
@@ -804,7 +804,7 @@ static const unsigned short indices[] = {
186, 191, 0,
};
-ManipulatorGeomInfo wm_manipulator_geom_data_dial = {
+GizmoGeomInfo wm_gizmo_geom_data_dial = {
.nverts = 192,
.ntris = 384,
.verts = verts,
diff --git a/source/blender/editors/gizmo_library/gizmo_draw_utils.c b/source/blender/editors/gizmo_library/gizmo_draw_utils.c
index 8ae21f61758..aaaee182c71 100644
--- a/source/blender/editors/gizmo_library/gizmo_draw_utils.c
+++ b/source/blender/editors/gizmo_library/gizmo_draw_utils.c
@@ -50,18 +50,18 @@
#include "WM_api.h"
#include "WM_types.h"
-/* only for own init/exit calls (wm_manipulatortype_init/wm_manipulatortype_free) */
+/* only for own init/exit calls (wm_gizmotype_init/wm_gizmotype_free) */
#include "wm.h"
/* own includes */
#include "gizmo_library_intern.h"
/**
- * Main draw call for ManipulatorGeomInfo data
+ * Main draw call for GizmoGeomInfo data
*/
-void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const bool UNUSED(select), const float color[4])
+void wm_gizmo_geometryinfo_draw(const GizmoGeomInfo *info, const bool UNUSED(select), const float color[4])
{
- /* TODO store the Batches inside the ManipulatorGeomInfo and updated it when geom changes
+ /* TODO store the Batches inside the GizmoGeomInfo and updated it when geom changes
* So we don't need to re-created and discard it every time */
Gwn_VertBuf *vbo;
@@ -108,7 +108,7 @@ void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const boo
GWN_batch_discard(batch);
}
-void wm_manipulator_vec_draw(
+void wm_gizmo_vec_draw(
const float color[4], const float (*verts)[3], uint vert_count,
uint pos, uint primitive_type)
{
diff --git a/source/blender/editors/gizmo_library/gizmo_geometry.h b/source/blender/editors/gizmo_library/gizmo_geometry.h
index de976bbad48..254fb6b0957 100644
--- a/source/blender/editors/gizmo_library/gizmo_geometry.h
+++ b/source/blender/editors/gizmo_library/gizmo_geometry.h
@@ -24,31 +24,31 @@
/** \file gizmo_geometry.h
* \ingroup wm
*
- * \name Manipulator Geometry
+ * \name Gizmo Geometry
*
- * \brief Prototypes for arrays defining the manipulator geometry. The actual definitions can be found in files usually
- * called geom_xxx_manipulator.c
+ * \brief Prototypes for arrays defining the gizmo geometry. The actual definitions can be found in files usually
+ * called geom_xxx_gizmo.c
*/
#ifndef __GIZMO_GEOMETRY_H__
#define __GIZMO_GEOMETRY_H__
-typedef struct ManipulatorGeomInfo {
+typedef struct GizmoGeomInfo {
int nverts;
int ntris;
const float (*verts)[3];
const float (*normals)[3];
const unsigned short *indices;
-} ManipulatorGeomInfo;
+} GizmoGeomInfo;
-/* arrow manipulator */
-extern ManipulatorGeomInfo wm_manipulator_geom_data_arrow;
+/* arrow gizmo */
+extern GizmoGeomInfo wm_gizmo_geom_data_arrow;
-/* cube manipulator */
-extern ManipulatorGeomInfo wm_manipulator_geom_data_cube;
+/* cube gizmo */
+extern GizmoGeomInfo wm_gizmo_geom_data_cube;
-/* dial manipulator */
-extern ManipulatorGeomInfo wm_manipulator_geom_data_dial;
+/* dial gizmo */
+extern GizmoGeomInfo wm_gizmo_geom_data_dial;
#endif /* __GIZMO_GEOMETRY_H__ */
diff --git a/source/blender/editors/gizmo_library/gizmo_library_intern.h b/source/blender/editors/gizmo_library/gizmo_library_intern.h
index 17121d3752e..f1689ee93db 100644
--- a/source/blender/editors/gizmo_library/gizmo_library_intern.h
+++ b/source/blender/editors/gizmo_library/gizmo_library_intern.h
@@ -30,25 +30,25 @@
#ifndef __GIZMO_LIBRARY_INTERN_H__
#define __GIZMO_LIBRARY_INTERN_H__
-/* distance around which manipulators respond to input (and get highlighted) */
-#define MANIPULATOR_HOTSPOT 14.0f
+/* distance around which gizmos respond to input (and get highlighted) */
+#define GIZMO_HOTSPOT 14.0f
/**
- * Data for common interactions. Used in manipulator_library_utils.c functions.
+ * Data for common interactions. Used in gizmo_library_utils.c functions.
*/
-typedef struct ManipulatorCommonData {
+typedef struct GizmoCommonData {
int flag;
float range_fac; /* factor for arrow min/max distance */
float offset;
- /* property range for constrained manipulators */
+ /* property range for constrained gizmos */
float range;
- /* min/max value for constrained manipulators */
+ /* min/max value for constrained gizmos */
float min, max;
-} ManipulatorCommonData;
+} GizmoCommonData;
-typedef struct ManipulatorInteraction {
+typedef struct GizmoInteraction {
float init_value; /* initial property value */
float init_mval[2];
float init_offset;
@@ -60,50 +60,50 @@ typedef struct ManipulatorInteraction {
/* Total offset added by precision tweaking.
* Needed to allow toggling precision on/off without causing jumps */
float precision_offset;
-} ManipulatorInteraction;
+} GizmoInteraction;
-/* ManipulatorCommonData->flag */
+/* GizmoCommonData->flag */
enum {
- MANIPULATOR_CUSTOM_RANGE_SET = (1 << 0),
+ GIZMO_CUSTOM_RANGE_SET = (1 << 0),
};
-float manipulator_offset_from_value(
- ManipulatorCommonData *data, const float value,
+float gizmo_offset_from_value(
+ GizmoCommonData *data, const float value,
const bool constrained, const bool inverted);
-float manipulator_value_from_offset(
- ManipulatorCommonData *data, ManipulatorInteraction *inter, const float offset,
+float gizmo_value_from_offset(
+ GizmoCommonData *data, GizmoInteraction *inter, const float offset,
const bool constrained, const bool inverted, const bool use_precision);
-void manipulator_property_data_update(
- struct wmManipulator *mpr, ManipulatorCommonData *data, wmManipulatorProperty *mpr_prop,
+void gizmo_property_data_update(
+ struct wmGizmo *mpr, GizmoCommonData *data, wmGizmoProperty *mpr_prop,
const bool constrained, const bool inverted);
-void manipulator_property_value_reset(
- bContext *C, const struct wmManipulator *mpr, ManipulatorInteraction *inter, wmManipulatorProperty *mpr_prop);
+void gizmo_property_value_reset(
+ bContext *C, const struct wmGizmo *mpr, GizmoInteraction *inter, wmGizmoProperty *mpr_prop);
/* -------------------------------------------------------------------- */
-void manipulator_color_get(
- const struct wmManipulator *mpr, const bool highlight,
+void gizmo_color_get(
+ const struct wmGizmo *mpr, const bool highlight,
float r_color[4]);
-bool manipulator_window_project_2d(
- bContext *C, const struct wmManipulator *mpr, const float mval[2], int axis, bool use_offset,
+bool gizmo_window_project_2d(
+ bContext *C, const struct wmGizmo *mpr, const float mval[2], int axis, bool use_offset,
float r_co[2]);
-bool manipulator_window_project_3d(
- bContext *C, const struct wmManipulator *mpr, const float mval[2], bool use_offset,
+bool gizmo_window_project_3d(
+ bContext *C, const struct wmGizmo *mpr, const float mval[2], bool use_offset,
float r_co[3]);
/* -------------------------------------------------------------------- */
-/* Manipulator drawing */
+/* Gizmo drawing */
#include "gizmo_geometry.h"
-void wm_manipulator_geometryinfo_draw(const struct ManipulatorGeomInfo *info, const bool select, const float color[4]);
-void wm_manipulator_vec_draw(
+void wm_gizmo_geometryinfo_draw(const struct GizmoGeomInfo *info, const bool select, const float color[4]);
+void wm_gizmo_vec_draw(
const float color[4], const float (*verts)[3], uint vert_count,
uint pos, uint primitive_type);
diff --git a/source/blender/editors/gizmo_library/gizmo_library_presets.c b/source/blender/editors/gizmo_library/gizmo_library_presets.c
index d58e0c9dc85..8a6b92e48d6 100644
--- a/source/blender/editors/gizmo_library/gizmo_library_presets.c
+++ b/source/blender/editors/gizmo_library/gizmo_library_presets.c
@@ -21,9 +21,9 @@
/** \file blender/editors/gizmo_library/gizmo_library_presets.c
* \ingroup wm
*
- * \name Manipulator Lib Presets
+ * \name Gizmo Lib Presets
*
- * \brief Preset shapes that can be drawn from any manipulator type.
+ * \brief Preset shapes that can be drawn from any gizmo type.
*/
#include "MEM_guardedalloc.h"
@@ -57,7 +57,7 @@
#include "ED_gizmo_library.h" /* own include */
#include "gizmo_library_intern.h" /* own include */
-/* TODO, this is to be used by RNA. might move to ED_manipulator_library */
+/* TODO, this is to be used by RNA. might move to ED_gizmo_library */
/**
* Given a single axis, orient the matrix to a different direction.
@@ -80,15 +80,15 @@ static void single_axis_convert(
/**
* Use for all geometry.
*/
-static void ed_manipulator_draw_preset_geometry(
- const struct wmManipulator *mpr, float mat[4][4], int select_id,
- const ManipulatorGeomInfo *info)
+static void ed_gizmo_draw_preset_geometry(
+ const struct wmGizmo *mpr, float mat[4][4], int select_id,
+ const GizmoGeomInfo *info)
{
const bool is_select = (select_id != -1);
- const bool is_highlight = is_select && (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0;
+ const bool is_highlight = is_select && (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) != 0;
float color[4];
- manipulator_color_get(mpr, is_highlight, color);
+ gizmo_color_get(mpr, is_highlight, color);
if (is_select) {
GPU_select_load_id(select_id);
@@ -96,7 +96,7 @@ static void ed_manipulator_draw_preset_geometry(
gpuPushMatrix();
gpuMultMatrix(mat);
- wm_manipulator_geometryinfo_draw(info, is_select, color);
+ wm_gizmo_geometryinfo_draw(info, is_select, color);
gpuPopMatrix();
if (is_select) {
@@ -104,36 +104,36 @@ static void ed_manipulator_draw_preset_geometry(
}
}
-void ED_manipulator_draw_preset_box(
- const struct wmManipulator *mpr, float mat[4][4], int select_id)
+void ED_gizmo_draw_preset_box(
+ const struct wmGizmo *mpr, float mat[4][4], int select_id)
{
- ed_manipulator_draw_preset_geometry(mpr, mat, select_id, &wm_manipulator_geom_data_cube);
+ ed_gizmo_draw_preset_geometry(mpr, mat, select_id, &wm_gizmo_geom_data_cube);
}
-void ED_manipulator_draw_preset_arrow(
- const struct wmManipulator *mpr, float mat[4][4], int axis, int select_id)
+void ED_gizmo_draw_preset_arrow(
+ const struct wmGizmo *mpr, float mat[4][4], int axis, int select_id)
{
float mat_rotate[4][4];
single_axis_convert(OB_POSZ, mat, axis, mat_rotate);
- ed_manipulator_draw_preset_geometry(mpr, mat_rotate, select_id, &wm_manipulator_geom_data_arrow);
+ ed_gizmo_draw_preset_geometry(mpr, mat_rotate, select_id, &wm_gizmo_geom_data_arrow);
}
-void ED_manipulator_draw_preset_circle(
- const struct wmManipulator *mpr, float mat[4][4], int axis, int select_id)
+void ED_gizmo_draw_preset_circle(
+ const struct wmGizmo *mpr, float mat[4][4], int axis, int select_id)
{
float mat_rotate[4][4];
single_axis_convert(OB_POSZ, mat, axis, mat_rotate);
- ed_manipulator_draw_preset_geometry(mpr, mat_rotate, select_id, &wm_manipulator_geom_data_dial);
+ ed_gizmo_draw_preset_geometry(mpr, mat_rotate, select_id, &wm_gizmo_geom_data_dial);
}
-void ED_manipulator_draw_preset_facemap(
- const bContext *C, const struct wmManipulator *mpr, struct Scene *scene, Object *ob, const int facemap, int select_id)
+void ED_gizmo_draw_preset_facemap(
+ const bContext *C, const struct wmGizmo *mpr, struct Scene *scene, Object *ob, const int facemap, int select_id)
{
const bool is_select = (select_id != -1);
- const bool is_highlight = is_select && (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0;
+ const bool is_highlight = is_select && (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) != 0;
float color[4];
- manipulator_color_get(mpr, is_highlight, color);
+ gizmo_color_get(mpr, is_highlight, color);
if (is_select) {
GPU_select_load_id(select_id);
diff --git a/source/blender/editors/gizmo_library/gizmo_library_utils.c b/source/blender/editors/gizmo_library/gizmo_library_utils.c
index 794728dd03c..6e6bc2ed824 100644
--- a/source/blender/editors/gizmo_library/gizmo_library_utils.c
+++ b/source/blender/editors/gizmo_library/gizmo_library_utils.c
@@ -26,9 +26,9 @@
/** \file gizmo_library_utils.c
* \ingroup wm
*
- * \name Manipulator Library Utilities
+ * \name Gizmo Library Utilities
*
- * \brief This file contains functions for common behaviors of manipulators.
+ * \brief This file contains functions for common behaviors of gizmos.
*/
#include "BLI_math.h"
@@ -50,34 +50,34 @@
#include "gizmo_library_intern.h"
/* factor for precision tweaking */
-#define MANIPULATOR_PRECISION_FAC 0.05f
+#define GIZMO_PRECISION_FAC 0.05f
-BLI_INLINE float manipulator_offset_from_value_constr(
+BLI_INLINE float gizmo_offset_from_value_constr(
const float range_fac, const float min, const float range, const float value,
const bool inverted)
{
return inverted ? (range_fac * (min + range - value) / range) : (range_fac * (value / range));
}
-BLI_INLINE float manipulator_value_from_offset_constr(
+BLI_INLINE float gizmo_value_from_offset_constr(
const float range_fac, const float min, const float range, const float value,
const bool inverted)
{
return inverted ? (min + range - (value * range / range_fac)) : (value * range / range_fac);
}
-float manipulator_offset_from_value(
- ManipulatorCommonData *data, const float value, const bool constrained, const bool inverted)
+float gizmo_offset_from_value(
+ GizmoCommonData *data, const float value, const bool constrained, const bool inverted)
{
if (constrained)
- return manipulator_offset_from_value_constr(data->range_fac, data->min, data->range, value, inverted);
+ return gizmo_offset_from_value_constr(data->range_fac, data->min, data->range, value, inverted);
return value;
}
-float manipulator_value_from_offset(
- ManipulatorCommonData *data, ManipulatorInteraction *inter, const float offset,
+float gizmo_value_from_offset(
+ GizmoCommonData *data, GizmoInteraction *inter, const float offset,
const bool constrained, const bool inverted, const bool use_precision)
{
const float max = data->min + data->range;
@@ -88,26 +88,26 @@ float manipulator_value_from_offset(
}
inter->prev_offset = offset;
- float ofs_new = inter->init_offset + offset - inter->precision_offset * (1.0f - MANIPULATOR_PRECISION_FAC);
+ float ofs_new = inter->init_offset + offset - inter->precision_offset * (1.0f - GIZMO_PRECISION_FAC);
float value;
if (constrained) {
- value = manipulator_value_from_offset_constr(data->range_fac, data->min, data->range, ofs_new, inverted);
+ value = gizmo_value_from_offset_constr(data->range_fac, data->min, data->range, ofs_new, inverted);
}
else {
value = ofs_new;
}
/* clamp to custom range */
- if (data->flag & MANIPULATOR_CUSTOM_RANGE_SET) {
+ if (data->flag & GIZMO_CUSTOM_RANGE_SET) {
CLAMP(value, data->min, max);
}
return value;
}
-void manipulator_property_data_update(
- wmManipulator *mpr, ManipulatorCommonData *data, wmManipulatorProperty *mpr_prop,
+void gizmo_property_data_update(
+ wmGizmo *mpr, GizmoCommonData *data, wmGizmoProperty *mpr_prop,
const bool constrained, const bool inverted)
{
if (mpr_prop->custom_func.value_get_fn != NULL) {
@@ -121,12 +121,12 @@ void manipulator_property_data_update(
return;
}
- float value = WM_manipulator_target_property_value_get(mpr, mpr_prop);
+ float value = WM_gizmo_target_property_value_get(mpr, mpr_prop);
if (constrained) {
- if ((data->flag & MANIPULATOR_CUSTOM_RANGE_SET) == 0) {
+ if ((data->flag & GIZMO_CUSTOM_RANGE_SET) == 0) {
float range[2];
- if (WM_manipulator_target_property_range_get(mpr, mpr_prop, range)) {
+ if (WM_gizmo_target_property_range_get(mpr, mpr_prop, range)) {
data->range = range[1] - range[0];
data->min = range[0];
}
@@ -134,27 +134,27 @@ void manipulator_property_data_update(
BLI_assert(0);
}
}
- data->offset = manipulator_offset_from_value_constr(data->range_fac, data->min, data->range, value, inverted);
+ data->offset = gizmo_offset_from_value_constr(data->range_fac, data->min, data->range, value, inverted);
}
else {
data->offset = value;
}
}
-void manipulator_property_value_reset(
- bContext *C, const wmManipulator *mpr, ManipulatorInteraction *inter,
- wmManipulatorProperty *mpr_prop)
+void gizmo_property_value_reset(
+ bContext *C, const wmGizmo *mpr, GizmoInteraction *inter,
+ wmGizmoProperty *mpr_prop)
{
- WM_manipulator_target_property_value_set(C, mpr, mpr_prop, inter->init_value);
+ WM_gizmo_target_property_value_set(C, mpr, mpr_prop, inter->init_value);
}
/* -------------------------------------------------------------------- */
-void manipulator_color_get(
- const wmManipulator *mpr, const bool highlight,
+void gizmo_color_get(
+ const wmGizmo *mpr, const bool highlight,
float r_col[4])
{
- if (highlight && !(mpr->flag & WM_MANIPULATOR_DRAW_HOVER)) {
+ if (highlight && !(mpr->flag & WM_GIZMO_DRAW_HOVER)) {
copy_v4_v4(r_col, mpr->color_hi);
}
else {
@@ -165,26 +165,26 @@ void manipulator_color_get(
/* -------------------------------------------------------------------- */
/**
- * Takes mouse coordinates and returns them in relation to the manipulator.
- * Both 2D & 3D supported, use so we can use 2D manipulators in the 3D view.
+ * Takes mouse coordinates and returns them in relation to the gizmo.
+ * Both 2D & 3D supported, use so we can use 2D gizmos in the 3D view.
*/
-bool manipulator_window_project_2d(
- bContext *C, const struct wmManipulator *mpr, const float mval[2], int axis, bool use_offset,
+bool gizmo_window_project_2d(
+ bContext *C, const struct wmGizmo *mpr, const float mval[2], int axis, bool use_offset,
float r_co[2])
{
float mat[4][4];
{
float mat_identity[4][4];
- struct WM_ManipulatorMatrixParams params = {NULL};
+ struct WM_GizmoMatrixParams params = {NULL};
if (use_offset == false) {
unit_m4(mat_identity);
params.matrix_offset = mat_identity;
}
- WM_manipulator_calc_matrix_final_params(mpr, &params, mat);
+ WM_gizmo_calc_matrix_final_params(mpr, &params, mat);
}
/* rotate mouse in relation to the center and relocate it */
- if (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) {
+ if (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) {
/* For 3d views, transform 2D mouse pos onto plane. */
View3D *v3d = CTX_wm_view3d(C);
ARegion *ar = CTX_wm_region(C);
@@ -220,26 +220,26 @@ bool manipulator_window_project_2d(
}
}
-bool manipulator_window_project_3d(
- bContext *C, const struct wmManipulator *mpr, const float mval[2], bool use_offset,
+bool gizmo_window_project_3d(
+ bContext *C, const struct wmGizmo *mpr, const float mval[2], bool use_offset,
float r_co[3])
{
float mat[4][4];
{
float mat_identity[4][4];
- struct WM_ManipulatorMatrixParams params = {NULL};
+ struct WM_GizmoMatrixParams params = {NULL};
if (use_offset == false) {
unit_m4(mat_identity);
params.matrix_offset = mat_identity;
}
- WM_manipulator_calc_matrix_final_params(mpr, &params, mat);
+ WM_gizmo_calc_matrix_final_params(mpr, &params, mat);
}
- if (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) {
+ if (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) {
View3D *v3d = CTX_wm_view3d(C);
ARegion *ar = CTX_wm_region(C);
/* Note: we might want a custom reference point passed in,
- * instead of the manipulator center. */
+ * instead of the gizmo center. */
ED_view3d_win_to_3d(v3d, ar, mat[3], mval, r_co);
invert_m4(mat);
mul_m4_v3(mat, r_co);
diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c
index fbb30b95562..dfa2eeeb38b 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c
@@ -26,9 +26,9 @@
/** \file arrow2d_gizmo.c
* \ingroup wm
*
- * \name 2D Arrow Manipulator
+ * \name 2D Arrow Gizmo
*
- * \brief Simple arrow manipulator which is dragged into a certain direction.
+ * \brief Simple arrow gizmo which is dragged into a certain direction.
*/
#include "BLI_listbase.h"
@@ -61,7 +61,7 @@
#include "../gizmo_library_intern.h"
-static void arrow2d_draw_geom(wmManipulator *mpr, const float matrix[4][4], const float color[4])
+static void arrow2d_draw_geom(wmGizmo *mpr, const float matrix[4][4], const float color[4])
{
const float size = 0.11f;
const float size_breadth = size / 2.0f;
@@ -96,24 +96,24 @@ static void arrow2d_draw_geom(wmManipulator *mpr, const float matrix[4][4], cons
gpuPopMatrix();
}
-static void manipulator_arrow2d_draw(const bContext *UNUSED(C), wmManipulator *mpr)
+static void gizmo_arrow2d_draw(const bContext *UNUSED(C), wmGizmo *mpr)
{
float color[4];
float matrix_final[4][4];
- manipulator_color_get(mpr, mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT, color);
+ gizmo_color_get(mpr, mpr->state & WM_GIZMO_STATE_HIGHLIGHT, color);
GPU_line_width(mpr->line_width);
- WM_manipulator_calc_matrix_final(mpr, matrix_final);
+ WM_gizmo_calc_matrix_final(mpr, matrix_final);
GPU_blend(true);
arrow2d_draw_geom(mpr, matrix_final, color);
GPU_blend(false);
if (mpr->interaction_data) {
- ManipulatorInteraction *inter = mpr->interaction_data;
+ GizmoInteraction *inter = mpr->interaction_data;
GPU_blend(true);
arrow2d_draw_geom(mpr, inter->init_matrix_final, (const float[4]){0.5f, 0.5f, 0.5f, 0.5f});
@@ -121,26 +121,26 @@ static void manipulator_arrow2d_draw(const bContext *UNUSED(C), wmManipulator *m
}
}
-static void manipulator_arrow2d_setup(wmManipulator *mpr)
+static void gizmo_arrow2d_setup(wmGizmo *mpr)
{
- mpr->flag |= WM_MANIPULATOR_DRAW_MODAL;
+ mpr->flag |= WM_GIZMO_DRAW_MODAL;
}
-static int manipulator_arrow2d_invoke(
- bContext *UNUSED(C), wmManipulator *mpr, const wmEvent *UNUSED(event))
+static int gizmo_arrow2d_invoke(
+ bContext *UNUSED(C), wmGizmo *mpr, const wmEvent *UNUSED(event))
{
- ManipulatorInteraction *inter = MEM_callocN(sizeof(ManipulatorInteraction), __func__);
+ GizmoInteraction *inter = MEM_callocN(sizeof(GizmoInteraction), __func__);
copy_m4_m4(inter->init_matrix_basis, mpr->matrix_basis);
- WM_manipulator_calc_matrix_final(mpr, inter->init_matrix_final);
+ WM_gizmo_calc_matrix_final(mpr, inter->init_matrix_final);
mpr->interaction_data = inter;
return OPERATOR_RUNNING_MODAL;
}
-static int manipulator_arrow2d_test_select(
- bContext *UNUSED(C), wmManipulator *mpr, const wmEvent *event)
+static int gizmo_arrow2d_test_select(
+ bContext *UNUSED(C), wmGizmo *mpr, const wmEvent *event)
{
const float mval[2] = {event->mval[0], event->mval[1]};
const float arrow_length = RNA_float_get(mpr->ptr, "length");
@@ -165,14 +165,14 @@ static int manipulator_arrow2d_test_select(
/* arrow line intersection check */
float isect_1[2], isect_2[2];
const int isect = isect_line_sphere_v2(
- line[0], line[1], mval_local, MANIPULATOR_HOTSPOT + mpr->line_width * 0.5f,
+ line[0], line[1], mval_local, GIZMO_HOTSPOT + mpr->line_width * 0.5f,
isect_1, isect_2);
if (isect > 0) {
float line_ext[2][2]; /* extended line for segment check including hotspot */
copy_v2_v2(line_ext[0], line[0]);
- line_ext[1][0] = line[1][0] + MANIPULATOR_HOTSPOT * ((line[1][0] - line[0][0]) / line_len);
- line_ext[1][1] = line[1][1] + MANIPULATOR_HOTSPOT * ((line[1][1] - line[0][1]) / line_len);
+ line_ext[1][0] = line[1][0] + GIZMO_HOTSPOT * ((line[1][0] - line[0][0]) / line_len);
+ line_ext[1][1] = line[1][1] + GIZMO_HOTSPOT * ((line[1][1] - line[0][1]) / line_len);
const float lambda_1 = line_point_factor_v2(isect_1, line_ext[0], line_ext[1]);
if (isect == 1) {
@@ -193,22 +193,22 @@ static int manipulator_arrow2d_test_select(
}
/* -------------------------------------------------------------------- */
-/** \name 2D Arrow Manipulator API
+/** \name 2D Arrow Gizmo API
*
* \{ */
-static void MANIPULATOR_WT_arrow_2d(wmManipulatorType *wt)
+static void GIZMO_WT_arrow_2d(wmGizmoType *wt)
{
/* identifiers */
- wt->idname = "MANIPULATOR_WT_arrow_2d";
+ wt->idname = "GIZMO_WT_arrow_2d";
/* api callbacks */
- wt->draw = manipulator_arrow2d_draw;
- wt->setup = manipulator_arrow2d_setup;
- wt->invoke = manipulator_arrow2d_invoke;
- wt->test_select = manipulator_arrow2d_test_select;
+ wt->draw = gizmo_arrow2d_draw;
+ wt->setup = gizmo_arrow2d_setup;
+ wt->invoke = gizmo_arrow2d_invoke;
+ wt->test_select = gizmo_arrow2d_test_select;
- wt->struct_size = sizeof(wmManipulator);
+ wt->struct_size = sizeof(wmGizmo);
/* rna */
RNA_def_float(wt->srna, "length", 1.0f, 0.0f, FLT_MAX, "Arrow Line Length", "", 0.0f, FLT_MAX);
@@ -217,9 +217,9 @@ static void MANIPULATOR_WT_arrow_2d(wmManipulatorType *wt)
"Roll", "", DEG2RADF(-360.0f), DEG2RADF(360.0f));
}
-void ED_manipulatortypes_arrow_2d(void)
+void ED_gizmotypes_arrow_2d(void)
{
- WM_manipulatortype_append(MANIPULATOR_WT_arrow_2d);
+ WM_gizmotype_append(GIZMO_WT_arrow_2d);
}
/** \} */
diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
index 72b24e03c00..9807a111d26 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
@@ -26,15 +26,15 @@
/** \file arrow3d_gizmo.c
* \ingroup wm
*
- * \name Arrow Manipulator
+ * \name Arrow Gizmo
*
- * 3D Manipulator
+ * 3D Gizmo
*
- * \brief Simple arrow manipulator which is dragged into a certain direction.
+ * \brief Simple arrow gizmo which is dragged into a certain direction.
* The arrow head can have varying shapes, e.g. cone, box, etc.
*
* - `matrix[0]` is derived from Y and Z.
- * - `matrix[1]` is 'up' for manipulator types that have an up.
+ * - `matrix[1]` is 'up' for gizmo types that have an up.
* - `matrix[2]` is the arrow direction (for all arrowes).
*/
@@ -69,35 +69,35 @@
#include "../gizmo_geometry.h"
#include "../gizmo_library_intern.h"
-/* to use custom arrows exported to geom_arrow_manipulator.c */
-//#define USE_MANIPULATOR_CUSTOM_ARROWS
+/* to use custom arrows exported to geom_arrow_gizmo.c */
+//#define USE_GIZMO_CUSTOM_ARROWS
-typedef struct ArrowManipulator3D {
- wmManipulator manipulator;
- ManipulatorCommonData data;
-} ArrowManipulator3D;
+typedef struct ArrowGizmo3D {
+ wmGizmo gizmo;
+ GizmoCommonData data;
+} ArrowGizmo3D;
/* -------------------------------------------------------------------- */
-static void manipulator_arrow_matrix_basis_get(const wmManipulator *mpr, float r_matrix[4][4])
+static void gizmo_arrow_matrix_basis_get(const wmGizmo *mpr, float r_matrix[4][4])
{
- ArrowManipulator3D *arrow = (ArrowManipulator3D *)mpr;
+ ArrowGizmo3D *arrow = (ArrowGizmo3D *)mpr;
- copy_m4_m4(r_matrix, arrow->manipulator.matrix_basis);
- madd_v3_v3fl(r_matrix[3], arrow->manipulator.matrix_basis[2], arrow->data.offset);
+ copy_m4_m4(r_matrix, arrow->gizmo.matrix_basis);
+ madd_v3_v3fl(r_matrix[3], arrow->gizmo.matrix_basis[2], arrow->data.offset);
}
-static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select, const float color[4])
+static void arrow_draw_geom(const ArrowGizmo3D *arrow, const bool select, const float color[4])
{
uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
bool unbind_shader = true;
- const int draw_style = RNA_enum_get(arrow->manipulator.ptr, "draw_style");
- const int draw_options = RNA_enum_get(arrow->manipulator.ptr, "draw_options");
+ const int draw_style = RNA_enum_get(arrow->gizmo.ptr, "draw_style");
+ const int draw_options = RNA_enum_get(arrow->gizmo.ptr, "draw_options");
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
- if (draw_style == ED_MANIPULATOR_ARROW_STYLE_CROSS) {
+ if (draw_style == ED_GIZMO_ARROW_STYLE_CROSS) {
immUniformColor4fv(color);
immBegin(GWN_PRIM_LINES, 4);
@@ -107,9 +107,9 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select,
immVertex3f(pos, 0.0f, 1.0f, 0.0f);
immEnd();
}
- else if (draw_style == ED_MANIPULATOR_ARROW_STYLE_CONE) {
+ else if (draw_style == ED_GIZMO_ARROW_STYLE_CONE) {
float aspect[2];
- RNA_float_get_array(arrow->manipulator.ptr, "aspect", aspect);
+ RNA_float_get_array(arrow->gizmo.ptr, "aspect", aspect);
const float unitx = aspect[0];
const float unity = aspect[1];
const float vec[4][3] = {
@@ -119,23 +119,23 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select,
{-unitx, unity, 0},
};
- GPU_line_width(arrow->manipulator.line_width);
- wm_manipulator_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GWN_PRIM_LINE_LOOP);
+ GPU_line_width(arrow->gizmo.line_width);
+ wm_gizmo_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GWN_PRIM_LINE_LOOP);
}
else {
-#ifdef USE_MANIPULATOR_CUSTOM_ARROWS
- wm_manipulator_geometryinfo_draw(&wm_manipulator_geom_data_arrow, select, color);
+#ifdef USE_GIZMO_CUSTOM_ARROWS
+ wm_gizmo_geometryinfo_draw(&wm_gizmo_geom_data_arrow, select, color);
#else
- const float arrow_length = RNA_float_get(arrow->manipulator.ptr, "length");
+ const float arrow_length = RNA_float_get(arrow->gizmo.ptr, "length");
const float vec[2][3] = {
{0.0f, 0.0f, 0.0f},
{0.0f, 0.0f, arrow_length},
};
- if (draw_options & ED_MANIPULATOR_ARROW_DRAW_FLAG_STEM) {
- GPU_line_width(arrow->manipulator.line_width);
- wm_manipulator_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GWN_PRIM_LINE_STRIP);
+ if (draw_options & ED_GIZMO_ARROW_DRAW_FLAG_STEM) {
+ GPU_line_width(arrow->gizmo.line_width);
+ wm_gizmo_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GWN_PRIM_LINE_STRIP);
}
else {
immUniformColor4fv(color);
@@ -145,7 +145,7 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select,
gpuPushMatrix();
- if (draw_style == ED_MANIPULATOR_ARROW_STYLE_BOX) {
+ if (draw_style == ED_GIZMO_ARROW_STYLE_BOX) {
const float size = 0.05f;
/* translate to line end with some extra offset so box starts exactly where line ends */
@@ -156,10 +156,10 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select,
/* draw cube */
immUnbindProgram();
unbind_shader = false;
- wm_manipulator_geometryinfo_draw(&wm_manipulator_geom_data_cube, select, color);
+ wm_gizmo_geometryinfo_draw(&wm_gizmo_geom_data_cube, select, color);
}
else {
- BLI_assert(draw_style == ED_MANIPULATOR_ARROW_STYLE_NORMAL);
+ BLI_assert(draw_style == ED_GIZMO_ARROW_STYLE_NORMAL);
const float len = 0.25f;
const float width = 0.06f;
@@ -172,7 +172,7 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select,
}
gpuPopMatrix();
-#endif /* USE_MANIPULATOR_CUSTOM_ARROWS */
+#endif /* USE_GIZMO_CUSTOM_ARROWS */
}
if (unbind_shader) {
@@ -180,15 +180,15 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select,
}
}
-static void arrow_draw_intern(ArrowManipulator3D *arrow, const bool select, const bool highlight)
+static void arrow_draw_intern(ArrowGizmo3D *arrow, const bool select, const bool highlight)
{
- wmManipulator *mpr = &arrow->manipulator;
+ wmGizmo *mpr = &arrow->gizmo;
float color[4];
float matrix_final[4][4];
- manipulator_color_get(mpr, highlight, color);
+ gizmo_color_get(mpr, highlight, color);
- WM_manipulator_calc_matrix_final(mpr, matrix_final);
+ WM_gizmo_calc_matrix_final(mpr, matrix_final);
gpuPushMatrix();
gpuMultMatrix(matrix_final);
@@ -199,7 +199,7 @@ static void arrow_draw_intern(ArrowManipulator3D *arrow, const bool select, cons
gpuPopMatrix();
if (mpr->interaction_data) {
- ManipulatorInteraction *inter = mpr->interaction_data;
+ GizmoInteraction *inter = mpr->interaction_data;
gpuPushMatrix();
gpuMultMatrix(inter->init_matrix_final);
@@ -213,29 +213,29 @@ static void arrow_draw_intern(ArrowManipulator3D *arrow, const bool select, cons
}
}
-static void manipulator_arrow_draw_select(
- const bContext *UNUSED(C), wmManipulator *mpr,
+static void gizmo_arrow_draw_select(
+ const bContext *UNUSED(C), wmGizmo *mpr,
int select_id)
{
GPU_select_load_id(select_id);
- arrow_draw_intern((ArrowManipulator3D *)mpr, true, false);
+ arrow_draw_intern((ArrowGizmo3D *)mpr, true, false);
}
-static void manipulator_arrow_draw(const bContext *UNUSED(C), wmManipulator *mpr)
+static void gizmo_arrow_draw(const bContext *UNUSED(C), wmGizmo *mpr)
{
- arrow_draw_intern((ArrowManipulator3D *)mpr, false, (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0);
+ arrow_draw_intern((ArrowGizmo3D *)mpr, false, (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) != 0);
}
/**
* Calculate arrow offset independent from prop min value,
* meaning the range will not be offset by min value first.
*/
-static int manipulator_arrow_modal(
- bContext *C, wmManipulator *mpr, const wmEvent *event,
- eWM_ManipulatorTweak tweak_flag)
+static int gizmo_arrow_modal(
+ bContext *C, wmGizmo *mpr, const wmEvent *event,
+ eWM_GizmoFlagTweak tweak_flag)
{
- ArrowManipulator3D *arrow = (ArrowManipulator3D *)mpr;
- ManipulatorInteraction *inter = mpr->interaction_data;
+ ArrowGizmo3D *arrow = (ArrowGizmo3D *)mpr;
+ GizmoInteraction *inter = mpr->interaction_data;
View3D *v3d = CTX_wm_view3d(C);
ARegion *ar = CTX_wm_region(C);
RegionView3D *rv3d = ar->regiondata;
@@ -256,7 +256,7 @@ static int manipulator_arrow_modal(
float arrow_co[3];
float arrow_no[3];
copy_v3_v3(arrow_co, inter->init_matrix_basis[3]);
- normalize_v3_v3(arrow_no, arrow->manipulator.matrix_basis[2]);
+ normalize_v3_v3(arrow_no, arrow->gizmo.matrix_basis[2]);
int ok = 0;
@@ -268,7 +268,7 @@ static int manipulator_arrow_modal(
{
/* Force Y axis if we're view aligned */
if (j == 0) {
- if (RAD2DEGF(acosf(dot_v3v3(proj[j].ray_direction, arrow->manipulator.matrix_basis[2]))) < 5.0f) {
+ if (RAD2DEGF(acosf(dot_v3v3(proj[j].ray_direction, arrow->gizmo.matrix_basis[2]))) < 5.0f) {
normalize_v3_v3(arrow_no, rv3d->viewinv[1]);
}
}
@@ -296,24 +296,24 @@ static int manipulator_arrow_modal(
sub_v3_v3v3(offset, proj[1].location, proj[0].location);
facdir = dot_v3v3(arrow_no, offset) < 0.0f ? -1 : 1;
- ManipulatorCommonData *data = &arrow->data;
+ GizmoCommonData *data = &arrow->data;
const float ofs_new = facdir * len_v3(offset);
- wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset");
+ wmGizmoProperty *mpr_prop = WM_gizmo_target_property_find(mpr, "offset");
/* set the property for the operator and call its modal function */
- if (WM_manipulator_target_property_is_valid(mpr_prop)) {
- const int transform_flag = RNA_enum_get(arrow->manipulator.ptr, "transform");
- const bool constrained = (transform_flag & ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED) != 0;
- const bool inverted = (transform_flag & ED_MANIPULATOR_ARROW_XFORM_FLAG_INVERTED) != 0;
- const bool use_precision = (tweak_flag & WM_MANIPULATOR_TWEAK_PRECISE) != 0;
- float value = manipulator_value_from_offset(data, inter, ofs_new, constrained, inverted, use_precision);
-
- WM_manipulator_target_property_value_set(C, mpr, mpr_prop, value);
+ if (WM_gizmo_target_property_is_valid(mpr_prop)) {
+ const int transform_flag = RNA_enum_get(arrow->gizmo.ptr, "transform");
+ const bool constrained = (transform_flag & ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED) != 0;
+ const bool inverted = (transform_flag & ED_GIZMO_ARROW_XFORM_FLAG_INVERTED) != 0;
+ const bool use_precision = (tweak_flag & WM_GIZMO_TWEAK_PRECISE) != 0;
+ float value = gizmo_value_from_offset(data, inter, ofs_new, constrained, inverted, use_precision);
+
+ WM_gizmo_target_property_value_set(C, mpr, mpr_prop, value);
/* get clamped value */
- value = WM_manipulator_target_property_value_get(mpr, mpr_prop);
+ value = WM_gizmo_target_property_value_get(mpr, mpr_prop);
- data->offset = manipulator_offset_from_value(data, value, constrained, inverted);
+ data->offset = gizmo_offset_from_value(data, value, constrained, inverted);
}
else {
data->offset = ofs_new;
@@ -326,25 +326,25 @@ static int manipulator_arrow_modal(
return OPERATOR_RUNNING_MODAL;
}
-static void manipulator_arrow_setup(wmManipulator *mpr)
+static void gizmo_arrow_setup(wmGizmo *mpr)
{
- ArrowManipulator3D *arrow = (ArrowManipulator3D *)mpr;
+ ArrowGizmo3D *arrow = (ArrowGizmo3D *)mpr;
- arrow->manipulator.flag |= WM_MANIPULATOR_DRAW_MODAL;
+ arrow->gizmo.flag |= WM_GIZMO_DRAW_MODAL;
arrow->data.range_fac = 1.0f;
}
-static int manipulator_arrow_invoke(
- bContext *UNUSED(C), wmManipulator *mpr, const wmEvent *event)
+static int gizmo_arrow_invoke(
+ bContext *UNUSED(C), wmGizmo *mpr, const wmEvent *event)
{
- ArrowManipulator3D *arrow = (ArrowManipulator3D *)mpr;
- ManipulatorInteraction *inter = MEM_callocN(sizeof(ManipulatorInteraction), __func__);
- wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset");
+ ArrowGizmo3D *arrow = (ArrowGizmo3D *)mpr;
+ GizmoInteraction *inter = MEM_callocN(sizeof(GizmoInteraction), __func__);
+ wmGizmoProperty *mpr_prop = WM_gizmo_target_property_find(mpr, "offset");
- /* Some manipulators don't use properties. */
- if (WM_manipulator_target_property_is_valid(mpr_prop)) {
- inter->init_value = WM_manipulator_target_property_value_get(mpr, mpr_prop);
+ /* Some gizmos don't use properties. */
+ if (WM_gizmo_target_property_is_valid(mpr_prop)) {
+ inter->init_value = WM_gizmo_target_property_value_get(mpr, mpr_prop);
}
inter->init_offset = arrow->data.offset;
@@ -352,126 +352,126 @@ static int manipulator_arrow_invoke(
inter->init_mval[0] = event->mval[0];
inter->init_mval[1] = event->mval[1];
- manipulator_arrow_matrix_basis_get(mpr, inter->init_matrix_basis);
- WM_manipulator_calc_matrix_final(mpr, inter->init_matrix_final);
+ gizmo_arrow_matrix_basis_get(mpr, inter->init_matrix_basis);
+ WM_gizmo_calc_matrix_final(mpr, inter->init_matrix_final);
mpr->interaction_data = inter;
return OPERATOR_RUNNING_MODAL;
}
-static void manipulator_arrow_property_update(wmManipulator *mpr, wmManipulatorProperty *mpr_prop)
+static void gizmo_arrow_property_update(wmGizmo *mpr, wmGizmoProperty *mpr_prop)
{
- ArrowManipulator3D *arrow = (ArrowManipulator3D *)mpr;
- const int transform_flag = RNA_enum_get(arrow->manipulator.ptr, "transform");
- const bool constrained = (transform_flag & ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED) != 0;
- const bool inverted = (transform_flag & ED_MANIPULATOR_ARROW_XFORM_FLAG_INVERTED) != 0;
- manipulator_property_data_update(mpr, &arrow->data, mpr_prop, constrained, inverted);
+ ArrowGizmo3D *arrow = (ArrowGizmo3D *)mpr;
+ const int transform_flag = RNA_enum_get(arrow->gizmo.ptr, "transform");
+ const bool constrained = (transform_flag & ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED) != 0;
+ const bool inverted = (transform_flag & ED_GIZMO_ARROW_XFORM_FLAG_INVERTED) != 0;
+ gizmo_property_data_update(mpr, &arrow->data, mpr_prop, constrained, inverted);
}
-static void manipulator_arrow_exit(bContext *C, wmManipulator *mpr, const bool cancel)
+static void gizmo_arrow_exit(bContext *C, wmGizmo *mpr, const bool cancel)
{
- ArrowManipulator3D *arrow = (ArrowManipulator3D *)mpr;
- ManipulatorCommonData *data = &arrow->data;
- wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset");
- const bool is_prop_valid = WM_manipulator_target_property_is_valid(mpr_prop);
+ ArrowGizmo3D *arrow = (ArrowGizmo3D *)mpr;
+ GizmoCommonData *data = &arrow->data;
+ wmGizmoProperty *mpr_prop = WM_gizmo_target_property_find(mpr, "offset");
+ const bool is_prop_valid = WM_gizmo_target_property_is_valid(mpr_prop);
if (!cancel) {
/* Assign incase applying the opetration needs an updated offset
* editmesh bisect needs this. */
if (is_prop_valid) {
- data->offset = WM_manipulator_target_property_value_get(mpr, mpr_prop);
+ data->offset = WM_gizmo_target_property_value_get(mpr, mpr_prop);
}
return;
}
- ManipulatorInteraction *inter = mpr->interaction_data;
+ GizmoInteraction *inter = mpr->interaction_data;
if (is_prop_valid) {
- manipulator_property_value_reset(C, mpr, inter, mpr_prop);
+ gizmo_property_value_reset(C, mpr, inter, mpr_prop);
}
data->offset = inter->init_offset;
}
/* -------------------------------------------------------------------- */
-/** \name Arrow Manipulator API
+/** \name Arrow Gizmo API
*
* \{ */
/**
* Define a custom property UI range
*
- * \note Needs to be called before WM_manipulator_target_property_def_rna!
+ * \note Needs to be called before WM_gizmo_target_property_def_rna!
*/
-void ED_manipulator_arrow3d_set_ui_range(wmManipulator *mpr, const float min, const float max)
+void ED_gizmo_arrow3d_set_ui_range(wmGizmo *mpr, const float min, const float max)
{
- ArrowManipulator3D *arrow = (ArrowManipulator3D *)mpr;
+ ArrowGizmo3D *arrow = (ArrowGizmo3D *)mpr;
BLI_assert(min < max);
- BLI_assert(!(WM_manipulator_target_property_is_valid(WM_manipulator_target_property_find(mpr, "offset")) &&
- "Make sure this function is called before WM_manipulator_target_property_def_rna"));
+ BLI_assert(!(WM_gizmo_target_property_is_valid(WM_gizmo_target_property_find(mpr, "offset")) &&
+ "Make sure this function is called before WM_gizmo_target_property_def_rna"));
arrow->data.range = max - min;
arrow->data.min = min;
- arrow->data.flag |= MANIPULATOR_CUSTOM_RANGE_SET;
+ arrow->data.flag |= GIZMO_CUSTOM_RANGE_SET;
}
/**
* Define a custom factor for arrow min/max distance
*
- * \note Needs to be called before WM_manipulator_target_property_def_rna!
+ * \note Needs to be called before WM_gizmo_target_property_def_rna!
*/
-void ED_manipulator_arrow3d_set_range_fac(wmManipulator *mpr, const float range_fac)
+void ED_gizmo_arrow3d_set_range_fac(wmGizmo *mpr, const float range_fac)
{
- ArrowManipulator3D *arrow = (ArrowManipulator3D *)mpr;
- BLI_assert(!(WM_manipulator_target_property_is_valid(WM_manipulator_target_property_find(mpr, "offset")) &&
- "Make sure this function is called before WM_manipulator_target_property_def_rna"));
+ ArrowGizmo3D *arrow = (ArrowGizmo3D *)mpr;
+ BLI_assert(!(WM_gizmo_target_property_is_valid(WM_gizmo_target_property_find(mpr, "offset")) &&
+ "Make sure this function is called before WM_gizmo_target_property_def_rna"));
arrow->data.range_fac = range_fac;
}
-static void MANIPULATOR_WT_arrow_3d(wmManipulatorType *wt)
+static void GIZMO_WT_arrow_3d(wmGizmoType *wt)
{
/* identifiers */
- wt->idname = "MANIPULATOR_WT_arrow_3d";
+ wt->idname = "GIZMO_WT_arrow_3d";
/* api callbacks */
- wt->draw = manipulator_arrow_draw;
- wt->draw_select = manipulator_arrow_draw_select;
- wt->matrix_basis_get = manipulator_arrow_matrix_basis_get;
- wt->modal = manipulator_arrow_modal;
- wt->setup = manipulator_arrow_setup;
- wt->invoke = manipulator_arrow_invoke;
- wt->property_update = manipulator_arrow_property_update;
- wt->exit = manipulator_arrow_exit;
+ wt->draw = gizmo_arrow_draw;
+ wt->draw_select = gizmo_arrow_draw_select;
+ wt->matrix_basis_get = gizmo_arrow_matrix_basis_get;
+ wt->modal = gizmo_arrow_modal;
+ wt->setup = gizmo_arrow_setup;
+ wt->invoke = gizmo_arrow_invoke;
+ wt->property_update = gizmo_arrow_property_update;
+ wt->exit = gizmo_arrow_exit;
- wt->struct_size = sizeof(ArrowManipulator3D);
+ wt->struct_size = sizeof(ArrowGizmo3D);
/* rna */
static EnumPropertyItem rna_enum_draw_style_items[] = {
- {ED_MANIPULATOR_ARROW_STYLE_NORMAL, "NORMAL", 0, "Normal", ""},
- {ED_MANIPULATOR_ARROW_STYLE_CROSS, "CROSS", 0, "Cross", ""},
- {ED_MANIPULATOR_ARROW_STYLE_BOX, "BOX", 0, "Box", ""},
- {ED_MANIPULATOR_ARROW_STYLE_CONE, "CONE", 0, "Cone", ""},
+ {ED_GIZMO_ARROW_STYLE_NORMAL, "NORMAL", 0, "Normal", ""},
+ {ED_GIZMO_ARROW_STYLE_CROSS, "CROSS", 0, "Cross", ""},
+ {ED_GIZMO_ARROW_STYLE_BOX, "BOX", 0, "Box", ""},
+ {ED_GIZMO_ARROW_STYLE_CONE, "CONE", 0, "Cone", ""},
{0, NULL, 0, NULL, NULL}
};
static EnumPropertyItem rna_enum_draw_options_items[] = {
- {ED_MANIPULATOR_ARROW_DRAW_FLAG_STEM, "STEM", 0, "Stem", ""},
+ {ED_GIZMO_ARROW_DRAW_FLAG_STEM, "STEM", 0, "Stem", ""},
{0, NULL, 0, NULL, NULL}
};
static EnumPropertyItem rna_enum_transform_items[] = {
- {ED_MANIPULATOR_ARROW_XFORM_FLAG_INVERTED, "INVERT", 0, "Inverted", ""},
- {ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED, "CONSTRAIN", 0, "Constrained", ""},
+ {ED_GIZMO_ARROW_XFORM_FLAG_INVERTED, "INVERT", 0, "Inverted", ""},
+ {ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED, "CONSTRAIN", 0, "Constrained", ""},
{0, NULL, 0, NULL, NULL}
};
RNA_def_enum(
wt->srna, "draw_style", rna_enum_draw_style_items,
- ED_MANIPULATOR_ARROW_STYLE_NORMAL,
+ ED_GIZMO_ARROW_STYLE_NORMAL,
"Draw Style", "");
RNA_def_enum_flag(
wt->srna, "draw_options", rna_enum_draw_options_items,
- ED_MANIPULATOR_ARROW_DRAW_FLAG_STEM,
+ ED_GIZMO_ARROW_DRAW_FLAG_STEM,
"Draw Options", "");
RNA_def_enum_flag(
wt->srna, "transform", rna_enum_transform_items,
@@ -481,12 +481,12 @@ static void MANIPULATOR_WT_arrow_3d(wmManipulatorType *wt)
RNA_def_float(wt->srna, "length", 1.0f, 0.0f, FLT_MAX, "Arrow Line Length", "", 0.0f, FLT_MAX);
RNA_def_float_vector(wt->srna, "aspect", 2, NULL, 0, FLT_MAX, "Aspect", "Cone/box style only", 0.0f, FLT_MAX);
- WM_manipulatortype_target_property_def(wt, "offset", PROP_FLOAT, 1);
+ WM_gizmotype_target_property_def(wt, "offset", PROP_FLOAT, 1);
}
-void ED_manipulatortypes_arrow_3d(void)
+void ED_gizmotypes_arrow_3d(void)
{
- WM_manipulatortype_append(MANIPULATOR_WT_arrow_3d);
+ WM_gizmotype_append(GIZMO_WT_arrow_3d);
}
/** \} */
diff --git a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
index 78f374064e6..33639dd7ec7 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
@@ -21,11 +21,11 @@
/** \file button2d_gizmo.c
* \ingroup wm
*
- * \name Button Manipulator
+ * \name Button Gizmo
*
- * 2D Manipulator, also works in 3D views.
+ * 2D Gizmo, also works in 3D views.
*
- * \brief Single click button action for use in manipulator groups.
+ * \brief Single click button action for use in gizmo groups.
*
* \note Currently only basic icon & vector-shape buttons are supported.
*
@@ -66,20 +66,20 @@
#include "../gizmo_geometry.h"
#include "../gizmo_library_intern.h"
-typedef struct ButtonManipulator2D {
- wmManipulator manipulator;
+typedef struct ButtonGizmo2D {
+ wmGizmo gizmo;
bool is_init;
/* Use an icon or shape */
int icon;
Gwn_Batch *shape_batch[2];
-} ButtonManipulator2D;
+} ButtonGizmo2D;
#define CIRCLE_RESOLUTION 32
/* -------------------------------------------------------------------- */
static void button2d_geom_draw_backdrop(
- const wmManipulator *mpr, const float color[4], const bool select)
+ const wmGizmo *mpr, const float color[4], const bool select)
{
GPU_line_width(mpr->line_width);
@@ -99,10 +99,10 @@ static void button2d_geom_draw_backdrop(
}
static void button2d_draw_intern(
- const bContext *C, wmManipulator *mpr,
+ const bContext *C, wmGizmo *mpr,
const bool select, const bool highlight)
{
- ButtonManipulator2D *button = (ButtonManipulator2D *)mpr;
+ ButtonGizmo2D *button = (ButtonGizmo2D *)mpr;
const int draw_options = RNA_enum_get(mpr->ptr, "draw_options");
if (button->is_init == false) {
@@ -126,16 +126,16 @@ static void button2d_draw_intern(
float color[4];
float matrix_final[4][4];
- manipulator_color_get(mpr, highlight, color);
- WM_manipulator_calc_matrix_final(mpr, matrix_final);
+ gizmo_color_get(mpr, highlight, color);
+ WM_gizmo_calc_matrix_final(mpr, matrix_final);
- bool is_3d = (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) != 0;
+ bool is_3d = (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) != 0;
- if (draw_options & ED_MANIPULATOR_BUTTON_SHOW_HELPLINE) {
+ if (draw_options & ED_GIZMO_BUTTON_SHOW_HELPLINE) {
float matrix_final_no_offset[4][4];
- WM_manipulator_calc_matrix_final_no_offset(mpr, matrix_final_no_offset);
+ WM_gizmo_calc_matrix_final_no_offset(mpr, matrix_final_no_offset);
uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor4fv(color);
@@ -180,7 +180,7 @@ static void button2d_draw_intern(
GWN_batch_uniform_4f(button->shape_batch[i], "color", UNPACK4(color));
GWN_batch_draw(button->shape_batch[i]);
- if (draw_options & ED_MANIPULATOR_BUTTON_SHOW_OUTLINE) {
+ if (draw_options & ED_GIZMO_BUTTON_SHOW_OUTLINE) {
color[0] = 1.0f - color[0];
color[1] = 1.0f - color[1];
color[2] = 1.0f - color[2];
@@ -215,29 +215,29 @@ static void button2d_draw_intern(
}
}
-static void manipulator_button2d_draw_select(const bContext *C, wmManipulator *mpr, int select_id)
+static void gizmo_button2d_draw_select(const bContext *C, wmGizmo *mpr, int select_id)
{
GPU_select_load_id(select_id);
button2d_draw_intern(C, mpr, true, false);
}
-static void manipulator_button2d_draw(const bContext *C, wmManipulator *mpr)
+static void gizmo_button2d_draw(const bContext *C, wmGizmo *mpr)
{
- const bool is_highlight = (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0;
+ const bool is_highlight = (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) != 0;
GPU_blend(true);
button2d_draw_intern(C, mpr, false, is_highlight);
GPU_blend(false);
}
-static int manipulator_button2d_test_select(
- bContext *C, wmManipulator *mpr, const wmEvent *event)
+static int gizmo_button2d_test_select(
+ bContext *C, wmGizmo *mpr, const wmEvent *event)
{
float point_local[2];
if (0) {
/* correct, but unnecessarily slow. */
- if (manipulator_window_project_2d(
+ if (gizmo_window_project_2d(
C, mpr, (const float[2]){UNPACK2(event->mval)}, 2, true, point_local) == false)
{
return -1;
@@ -256,7 +256,7 @@ static int manipulator_button2d_test_select(
return -1;
}
-static int manipulator_button2d_cursor_get(wmManipulator *mpr)
+static int gizmo_button2d_cursor_get(wmGizmo *mpr)
{
if (RNA_boolean_get(mpr->ptr, "show_drag")) {
return BC_NSEW_SCROLLCURSOR;
@@ -264,9 +264,9 @@ static int manipulator_button2d_cursor_get(wmManipulator *mpr)
return CURSOR_STD;
}
-static void manipulator_button2d_free(wmManipulator *mpr)
+static void gizmo_button2d_free(wmGizmo *mpr)
{
- ButtonManipulator2D *shape = (ButtonManipulator2D *)mpr;
+ ButtonGizmo2D *shape = (ButtonGizmo2D *)mpr;
for (uint i = 0; i < ARRAY_SIZE(shape->shape_batch); i++) {
GWN_BATCH_DISCARD_SAFE(shape->shape_batch[i]);
@@ -276,28 +276,28 @@ static void manipulator_button2d_free(wmManipulator *mpr)
/** \} */
/* -------------------------------------------------------------------- */
-/** \name Button Manipulator API
+/** \name Button Gizmo API
*
* \{ */
-static void MANIPULATOR_WT_button_2d(wmManipulatorType *wt)
+static void GIZMO_WT_button_2d(wmGizmoType *wt)
{
/* identifiers */
- wt->idname = "MANIPULATOR_WT_button_2d";
+ wt->idname = "GIZMO_WT_button_2d";
/* api callbacks */
- wt->draw = manipulator_button2d_draw;
- wt->draw_select = manipulator_button2d_draw_select;
- wt->test_select = manipulator_button2d_test_select;
- wt->cursor_get = manipulator_button2d_cursor_get;
- wt->free = manipulator_button2d_free;
+ wt->draw = gizmo_button2d_draw;
+ wt->draw_select = gizmo_button2d_draw_select;
+ wt->test_select = gizmo_button2d_test_select;
+ wt->cursor_get = gizmo_button2d_cursor_get;
+ wt->free = gizmo_button2d_free;
- wt->struct_size = sizeof(ButtonManipulator2D);
+ wt->struct_size = sizeof(ButtonGizmo2D);
/* rna */
static EnumPropertyItem rna_enum_draw_options[] = {
- {ED_MANIPULATOR_BUTTON_SHOW_OUTLINE, "OUTLINE", 0, "Outline", ""},
- {ED_MANIPULATOR_BUTTON_SHOW_HELPLINE, "HELPLINE", 0, "Help Line", ""},
+ {ED_GIZMO_BUTTON_SHOW_OUTLINE, "OUTLINE", 0, "Outline", ""},
+ {ED_GIZMO_BUTTON_SHOW_HELPLINE, "HELPLINE", 0, "Help Line", ""},
{0, NULL, 0, NULL, NULL}
};
PropertyRNA *prop;
@@ -314,9 +314,9 @@ static void MANIPULATOR_WT_button_2d(wmManipulatorType *wt)
RNA_def_boolean(wt->srna, "show_drag", true, "Show Drag", "");
}
-void ED_manipulatortypes_button_2d(void)
+void ED_gizmotypes_button_2d(void)
{
- WM_manipulatortype_append(MANIPULATOR_WT_button_2d);
+ WM_gizmotype_append(GIZMO_WT_button_2d);
}
-/** \} */ // Button Manipulator API
+/** \} */ // Button Gizmo API
diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
index 382733d298f..a037727de58 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
@@ -26,12 +26,12 @@
/** \file cage2d_gizmo.c
* \ingroup wm
*
- * \name Cage Manipulator
+ * \name Cage Gizmo
*
- * 2D Manipulator
+ * 2D Gizmo
*
- * \brief Rectangular manipulator acting as a 'cage' around its content.
- * Interacting scales or translates the manipulator.
+ * \brief Rectangular gizmo acting as a 'cage' around its content.
+ * Interacting scales or translates the gizmo.
*/
#include "MEM_guardedalloc.h"
@@ -64,11 +64,11 @@
/* own includes */
#include "../gizmo_library_intern.h"
-#define MANIPULATOR_RESIZER_SIZE 10.0f
-#define MANIPULATOR_MARGIN_OFFSET_SCALE 1.5f
+#define GIZMO_RESIZER_SIZE 10.0f
+#define GIZMO_MARGIN_OFFSET_SCALE 1.5f
-static void manipulator_calc_rect_view_scale(
- const wmManipulator *mpr, const float dims[2], float scale[2])
+static void gizmo_calc_rect_view_scale(
+ const wmGizmo *mpr, const float dims[2], float scale[2])
{
float matrix_final_no_offset[4][4];
float asp[2] = {1.0f, 1.0f};
@@ -79,7 +79,7 @@ static void manipulator_calc_rect_view_scale(
asp[1] = dims[0] / dims[1];
}
float x_axis[3], y_axis[3];
- WM_manipulator_calc_matrix_final_no_offset(mpr, matrix_final_no_offset);
+ WM_gizmo_calc_matrix_final_no_offset(mpr, matrix_final_no_offset);
mul_v3_mat3_m4v3(x_axis, matrix_final_no_offset, mpr->matrix_offset[0]);
mul_v3_mat3_m4v3(y_axis, matrix_final_no_offset, mpr->matrix_offset[1]);
@@ -90,37 +90,37 @@ static void manipulator_calc_rect_view_scale(
scale[1] = 1.0f / len_v3(y_axis);
}
-static void manipulator_calc_rect_view_margin(
- const wmManipulator *mpr, const float dims[2], float margin[2])
+static void gizmo_calc_rect_view_margin(
+ const wmGizmo *mpr, const float dims[2], float margin[2])
{
float handle_size;
- if (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) {
+ if (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) {
handle_size = 0.15f;
}
else {
- handle_size = MANIPULATOR_RESIZER_SIZE;
+ handle_size = GIZMO_RESIZER_SIZE;
}
handle_size *= mpr->scale_final;
float scale_xy[2];
- manipulator_calc_rect_view_scale(mpr, dims, scale_xy);
+ gizmo_calc_rect_view_scale(mpr, dims, scale_xy);
margin[0] = ((handle_size * scale_xy[0]));
margin[1] = ((handle_size * scale_xy[1]));
}
/* -------------------------------------------------------------------- */
-static void manipulator_rect_pivot_from_scale_part(int part, float r_pt[2], bool r_constrain_axis[2])
+static void gizmo_rect_pivot_from_scale_part(int part, float r_pt[2], bool r_constrain_axis[2])
{
bool x = true, y = true;
switch (part) {
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X: { ARRAY_SET_ITEMS(r_pt, 0.5, 0.0); x = false; break; }
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X: { ARRAY_SET_ITEMS(r_pt, -0.5, 0.0); x = false; break; }
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_Y: { ARRAY_SET_ITEMS(r_pt, 0.0, 0.5); y = false; break; }
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_Y: { ARRAY_SET_ITEMS(r_pt, 0.0, -0.5); y = false; break; }
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MIN_Y: { ARRAY_SET_ITEMS(r_pt, 0.5, 0.5); x = y = false; break; }
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MAX_Y: { ARRAY_SET_ITEMS(r_pt, 0.5, -0.5); x = y = false; break; }
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MIN_Y: { ARRAY_SET_ITEMS(r_pt, -0.5, 0.5); x = y = false; break; }
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MAX_Y: { ARRAY_SET_ITEMS(r_pt, -0.5, -0.5); x = y = false; break; }
+ case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X: { ARRAY_SET_ITEMS(r_pt, 0.5, 0.0); x = false; break; }
+ case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X: { ARRAY_SET_ITEMS(r_pt, -0.5, 0.0); x = false; break; }
+ case ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y: { ARRAY_SET_ITEMS(r_pt, 0.0, 0.5); y = false; break; }
+ case ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y: { ARRAY_SET_ITEMS(r_pt, 0.0, -0.5); y = false; break; }
+ case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y: { ARRAY_SET_ITEMS(r_pt, 0.5, 0.5); x = y = false; break; }
+ case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y: { ARRAY_SET_ITEMS(r_pt, 0.5, -0.5); x = y = false; break; }
+ case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y: { ARRAY_SET_ITEMS(r_pt, -0.5, 0.5); x = y = false; break; }
+ case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y: { ARRAY_SET_ITEMS(r_pt, -0.5, -0.5); x = y = false; break; }
default: BLI_assert(0);
}
r_constrain_axis[0] = x;
@@ -130,7 +130,7 @@ static void manipulator_rect_pivot_from_scale_part(int part, float r_pt[2], bool
/* -------------------------------------------------------------------- */
/** \name Box Draw Style
*
- * Useful for 3D views, see: #ED_MANIPULATOR_CAGE2D_STYLE_BOX
+ * Useful for 3D views, see: #ED_GIZMO_CAGE2D_STYLE_BOX
* \{ */
static void cage2d_draw_box_corners(
@@ -179,7 +179,7 @@ static void cage2d_draw_box_interaction(
Gwn_PrimType prim_type = GWN_PRIM_NONE;
switch (highlighted) {
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X:
+ case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X:
{
rctf r = {
.xmin = -size[0], .xmax = -size[0] + margin[0],
@@ -199,7 +199,7 @@ static void cage2d_draw_box_interaction(
}
break;
}
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X:
+ case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X:
{
rctf r = {
.xmin = size[0] - margin[0], .xmax = size[0],
@@ -219,7 +219,7 @@ static void cage2d_draw_box_interaction(
}
break;
}
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_Y:
+ case ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y:
{
rctf r = {
.xmin = -size[0] + margin[0], .xmax = size[0] - margin[0],
@@ -239,7 +239,7 @@ static void cage2d_draw_box_interaction(
}
break;
}
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_Y:
+ case ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y:
{
rctf r = {
.xmin = -size[0] + margin[0], .xmax = size[0] - margin[0],
@@ -259,7 +259,7 @@ static void cage2d_draw_box_interaction(
}
break;
}
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MIN_Y:
+ case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y:
{
rctf r = {
.xmin = -size[0], .xmax = -size[0] + margin[0],
@@ -279,7 +279,7 @@ static void cage2d_draw_box_interaction(
}
break;
}
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MAX_Y:
+ case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y:
{
rctf r = {
.xmin = -size[0], .xmax = -size[0] + margin[0],
@@ -299,7 +299,7 @@ static void cage2d_draw_box_interaction(
}
break;
}
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MIN_Y:
+ case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y:
{
rctf r = {
.xmin = size[0] - margin[0], .xmax = size[0],
@@ -319,7 +319,7 @@ static void cage2d_draw_box_interaction(
}
break;
}
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MAX_Y:
+ case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y:
{
rctf r = {
.xmin = size[0] - margin[0], .xmax = size[0],
@@ -339,7 +339,7 @@ static void cage2d_draw_box_interaction(
}
break;
}
- case ED_MANIPULATOR_CAGE2D_PART_ROTATE:
+ case ED_GIZMO_CAGE2D_PART_ROTATE:
{
const float rotate_pt[2] = {0.0f, size[1] + margin[1]};
const rctf r_rotate = {
@@ -363,8 +363,8 @@ static void cage2d_draw_box_interaction(
break;
}
- case ED_MANIPULATOR_CAGE2D_PART_TRANSLATE:
- if (draw_options & ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) {
+ case ED_GIZMO_CAGE2D_PART_TRANSLATE:
+ if (draw_options & ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) {
ARRAY_SET_ITEMS(verts[0], -margin[0] / 2, -margin[1] / 2);
ARRAY_SET_ITEMS(verts[1], margin[0] / 2, margin[1] / 2);
ARRAY_SET_ITEMS(verts[2], -margin[0] / 2, margin[1] / 2);
@@ -449,7 +449,7 @@ static void cage2d_draw_box_interaction(
/* -------------------------------------------------------------------- */
/** \name Circle Draw Style
*
- * Useful for 2D views, see: #ED_MANIPULATOR_CAGE2D_STYLE_CIRCLE
+ * Useful for 2D views, see: #ED_GIZMO_CAGE2D_STYLE_CIRCLE
* \{ */
static void imm_draw_point_aspect_2d(
@@ -479,15 +479,15 @@ static void cage2d_draw_circle_wire(
immVertex2f(pos, r->xmin, r->ymax);
immEnd();
- if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_ROTATE) {
+ if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE) {
immBegin(GWN_PRIM_LINE_LOOP, 2);
immVertex2f(pos, BLI_rctf_cent_x(r), r->ymax);
immVertex2f(pos, BLI_rctf_cent_x(r), r->ymax + margin[1]);
immEnd();
}
- if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE) {
- if (draw_options & ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) {
+ if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE) {
+ if (draw_options & ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) {
const float rad[2] = {margin[0] / 2, margin[1] / 2};
const float center[2] = {BLI_rctf_cent_x(r), BLI_rctf_cent_y(r)};
@@ -525,8 +525,8 @@ static void cage2d_draw_circle_handles(
imm_draw_point_aspect_2d(pos, r->xmin, r->ymax, rad[0], rad[1], solid);
}
- if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_ROTATE) {
- const float handle[2] = {BLI_rctf_cent_x(r), r->ymax + (margin[1] * MANIPULATOR_MARGIN_OFFSET_SCALE)};
+ if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE) {
+ const float handle[2] = {BLI_rctf_cent_x(r), r->ymax + (margin[1] * GIZMO_MARGIN_OFFSET_SCALE)};
circle_fn(pos, handle[0], handle[1], rad[0], rad[1], resolu);
}
@@ -535,10 +535,10 @@ static void cage2d_draw_circle_handles(
/** \} */
-static void manipulator_cage2d_draw_intern(
- wmManipulator *mpr, const bool select, const bool highlight, const int select_id)
+static void gizmo_cage2d_draw_intern(
+ wmGizmo *mpr, const bool select, const bool highlight, const int select_id)
{
- // const bool use_clamp = (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) == 0;
+ // const bool use_clamp = (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) == 0;
float dims[2];
RNA_float_get_array(mpr->ptr, "dimensions", dims);
float matrix_final[4][4];
@@ -549,13 +549,13 @@ static void manipulator_cage2d_draw_intern(
const float size_real[2] = {dims[0] / 2.0f, dims[1] / 2.0f};
- WM_manipulator_calc_matrix_final(mpr, matrix_final);
+ WM_gizmo_calc_matrix_final(mpr, matrix_final);
gpuPushMatrix();
gpuMultMatrix(matrix_final);
float margin[2];
- manipulator_calc_rect_view_margin(mpr, dims, margin);
+ gizmo_calc_rect_view_margin(mpr, dims, margin);
/* Handy for quick testing draw (if it's outside bounds). */
if (false) {
@@ -573,17 +573,17 @@ static void manipulator_cage2d_draw_intern(
/* expand for hotspot */
const float size[2] = {size_real[0] + margin[0] / 2, size_real[1] + margin[1] / 2};
- if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE) {
+ if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE) {
int scale_parts[] = {
- ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X,
- ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X,
- ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_Y,
- ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_Y,
-
- ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MIN_Y,
- ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MAX_Y,
- ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MIN_Y,
- ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MAX_Y,
+ ED_GIZMO_CAGE2D_PART_SCALE_MIN_X,
+ ED_GIZMO_CAGE2D_PART_SCALE_MAX_X,
+ ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y,
+ ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y,
+
+ ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y,
+ ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y,
+ ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y,
+ ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y,
};
for (int i = 0; i < ARRAY_SIZE(scale_parts); i++) {
GPU_select_load_id(select_id | scale_parts[i]);
@@ -591,15 +591,15 @@ static void manipulator_cage2d_draw_intern(
mpr->color, scale_parts[i], size, margin, mpr->line_width, true, draw_options);
}
}
- if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE) {
- const int transform_part = ED_MANIPULATOR_CAGE2D_PART_TRANSLATE;
+ if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE) {
+ const int transform_part = ED_GIZMO_CAGE2D_PART_TRANSLATE;
GPU_select_load_id(select_id | transform_part);
cage2d_draw_box_interaction(
mpr->color, transform_part, size, margin, mpr->line_width, true, draw_options);
}
- if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_ROTATE) {
+ if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE) {
cage2d_draw_box_interaction(
- mpr->color, ED_MANIPULATOR_CAGE2D_PART_ROTATE, size_real, margin, mpr->line_width, true, draw_options);
+ mpr->color, ED_GIZMO_CAGE2D_PART_ROTATE, size_real, margin, mpr->line_width, true, draw_options);
}
}
else {
@@ -609,22 +609,22 @@ static void manipulator_cage2d_draw_intern(
.xmax = size_real[0],
.ymax = size_real[1],
};
- if (draw_style == ED_MANIPULATOR_CAGE2D_STYLE_BOX) {
- /* corner manipulators */
+ if (draw_style == ED_GIZMO_CAGE2D_STYLE_BOX) {
+ /* corner gizmos */
GPU_line_width(mpr->line_width + 3.0f);
cage2d_draw_box_corners(&r, margin, (const float[3]){0, 0, 0});
- /* corner manipulators */
+ /* corner gizmos */
float color[4];
- manipulator_color_get(mpr, highlight, color);
+ gizmo_color_get(mpr, highlight, color);
GPU_line_width(mpr->line_width);
cage2d_draw_box_corners(&r, margin, color);
bool show = false;
- if (mpr->highlight_part == ED_MANIPULATOR_CAGE2D_PART_TRANSLATE) {
+ if (mpr->highlight_part == ED_GIZMO_CAGE2D_PART_TRANSLATE) {
/* Only show if we're drawing the center handle
* otherwise the entire rectangle is the hotspot. */
- if (draw_options & ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) {
+ if (draw_options & ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) {
show = true;
}
}
@@ -637,14 +637,14 @@ static void manipulator_cage2d_draw_intern(
mpr->color, mpr->highlight_part, size_real, margin, mpr->line_width, false, draw_options);
}
- if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_ROTATE) {
+ if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE) {
cage2d_draw_box_interaction(
- mpr->color, ED_MANIPULATOR_CAGE2D_PART_ROTATE, size_real, margin, mpr->line_width, false, draw_options);
+ mpr->color, ED_GIZMO_CAGE2D_PART_ROTATE, size_real, margin, mpr->line_width, false, draw_options);
}
}
- else if (draw_style == ED_MANIPULATOR_CAGE2D_STYLE_CIRCLE) {
+ else if (draw_style == ED_GIZMO_CAGE2D_STYLE_CIRCLE) {
float color[4];
- manipulator_color_get(mpr, highlight, color);
+ gizmo_color_get(mpr, highlight, color);
GPU_line_smooth(true);
GPU_blend(true);
@@ -655,7 +655,7 @@ static void manipulator_cage2d_draw_intern(
cage2d_draw_circle_wire(&r, margin, color, transform_flag, draw_options);
- /* corner manipulators */
+ /* corner gizmos */
cage2d_draw_circle_handles(&r, margin, color, transform_flag, true);
cage2d_draw_circle_handles(&r, margin, (const float[3]){0, 0, 0}, transform_flag, false);
@@ -674,74 +674,74 @@ static void manipulator_cage2d_draw_intern(
/**
* For when we want to draw 2d cage in 3d views.
*/
-static void manipulator_cage2d_draw_select(const bContext *UNUSED(C), wmManipulator *mpr, int select_id)
+static void gizmo_cage2d_draw_select(const bContext *UNUSED(C), wmGizmo *mpr, int select_id)
{
- manipulator_cage2d_draw_intern(mpr, true, false, select_id);
+ gizmo_cage2d_draw_intern(mpr, true, false, select_id);
}
-static void manipulator_cage2d_draw(const bContext *UNUSED(C), wmManipulator *mpr)
+static void gizmo_cage2d_draw(const bContext *UNUSED(C), wmGizmo *mpr)
{
- const bool is_highlight = (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0;
- manipulator_cage2d_draw_intern(mpr, false, is_highlight, -1);
+ const bool is_highlight = (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) != 0;
+ gizmo_cage2d_draw_intern(mpr, false, is_highlight, -1);
}
-static int manipulator_cage2d_get_cursor(wmManipulator *mpr)
+static int gizmo_cage2d_get_cursor(wmGizmo *mpr)
{
int highlight_part = mpr->highlight_part;
- if (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) {
+ if (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) {
return BC_NSEW_SCROLLCURSOR;
}
switch (highlight_part) {
- case ED_MANIPULATOR_CAGE2D_PART_TRANSLATE:
+ case ED_GIZMO_CAGE2D_PART_TRANSLATE:
return BC_NSEW_SCROLLCURSOR;
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X:
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X:
+ case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X:
+ case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X:
return CURSOR_X_MOVE;
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_Y:
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_Y:
+ case ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y:
+ case ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y:
return CURSOR_Y_MOVE;
/* TODO diagonal cursor */
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MIN_Y:
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MIN_Y:
+ case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y:
+ case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y:
return BC_NSEW_SCROLLCURSOR;
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MAX_Y:
- case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MAX_Y:
+ case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y:
+ case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y:
return BC_NSEW_SCROLLCURSOR;
- case ED_MANIPULATOR_CAGE2D_PART_ROTATE:
+ case ED_GIZMO_CAGE2D_PART_ROTATE:
return BC_CROSSCURSOR;
default:
return CURSOR_STD;
}
}
-static int manipulator_cage2d_test_select(
- bContext *C, wmManipulator *mpr, const wmEvent *event)
+static int gizmo_cage2d_test_select(
+ bContext *C, wmGizmo *mpr, const wmEvent *event)
{
float point_local[2];
float dims[2];
RNA_float_get_array(mpr->ptr, "dimensions", dims);
const float size_real[2] = {dims[0] / 2.0f, dims[1] / 2.0f};
- if (manipulator_window_project_2d(
+ if (gizmo_window_project_2d(
C, mpr, (const float[2]){UNPACK2(event->mval)}, 2, true, point_local) == false)
{
return -1;
}
float margin[2];
- manipulator_calc_rect_view_margin(mpr, dims, margin);
+ gizmo_calc_rect_view_margin(mpr, dims, margin);
/* expand for hotspot */
const float size[2] = {size_real[0] + margin[0] / 2, size_real[1] + margin[1] / 2};
const int transform_flag = RNA_enum_get(mpr->ptr, "transform");
const int draw_options = RNA_enum_get(mpr->ptr, "draw_options");
- if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE) {
+ if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE) {
rctf r;
- if (draw_options & ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) {
+ if (draw_options & ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) {
r.xmin = -margin[0] / 2;
r.ymin = -margin[1] / 2;
r.xmax = margin[0] / 2;
@@ -755,12 +755,12 @@ static int manipulator_cage2d_test_select(
};
bool isect = BLI_rctf_isect_pt_v(&r, point_local);
if (isect) {
- return ED_MANIPULATOR_CAGE2D_PART_TRANSLATE;
+ return ED_GIZMO_CAGE2D_PART_TRANSLATE;
}
}
- /* if manipulator does not have a scale intersection, don't do it */
- if (transform_flag & (ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE | ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_UNIFORM)) {
+ /* if gizmo does not have a scale intersection, don't do it */
+ if (transform_flag & (ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE | ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM)) {
const rctf r_xmin = {.xmin = -size[0], .ymin = -size[1], .xmax = -size[0] + margin[0], .ymax = size[1]};
const rctf r_xmax = {.xmin = size[0] - margin[0], .ymin = -size[1], .xmax = size[0], .ymax = size[1]};
const rctf r_ymin = {.xmin = -size[0], .ymin = -size[1], .xmax = size[0], .ymax = -size[1] + margin[1]};
@@ -768,37 +768,37 @@ static int manipulator_cage2d_test_select(
if (BLI_rctf_isect_pt_v(&r_xmin, point_local)) {
if (BLI_rctf_isect_pt_v(&r_ymin, point_local)) {
- return ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MIN_Y;
+ return ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y;
}
if (BLI_rctf_isect_pt_v(&r_ymax, point_local)) {
- return ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MAX_Y;
+ return ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y;
}
- return ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X;
+ return ED_GIZMO_CAGE2D_PART_SCALE_MIN_X;
}
if (BLI_rctf_isect_pt_v(&r_xmax, point_local)) {
if (BLI_rctf_isect_pt_v(&r_ymin, point_local)) {
- return ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MIN_Y;
+ return ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y;
}
if (BLI_rctf_isect_pt_v(&r_ymax, point_local)) {
- return ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MAX_Y;
+ return ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y;
}
- return ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X;
+ return ED_GIZMO_CAGE2D_PART_SCALE_MAX_X;
}
if (BLI_rctf_isect_pt_v(&r_ymin, point_local)) {
- return ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_Y;
+ return ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y;
}
if (BLI_rctf_isect_pt_v(&r_ymax, point_local)) {
- return ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_Y;
+ return ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y;
}
}
- if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_ROTATE) {
+ if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE) {
/* Rotate:
* (*) <-- hot spot is here!
* +---+
* | |
* +---+ */
- const float r_rotate_pt[2] = {0.0f, size_real[1] + (margin[1] * MANIPULATOR_MARGIN_OFFSET_SCALE)};
+ const float r_rotate_pt[2] = {0.0f, size_real[1] + (margin[1] * GIZMO_MARGIN_OFFSET_SCALE)};
const rctf r_rotate = {
.xmin = r_rotate_pt[0] - margin[0] / 2.0f,
.xmax = r_rotate_pt[0] + margin[0] / 2.0f,
@@ -807,7 +807,7 @@ static int manipulator_cage2d_test_select(
};
if (BLI_rctf_isect_pt_v(&r_rotate, point_local)) {
- return ED_MANIPULATOR_CAGE2D_PART_ROTATE;
+ return ED_GIZMO_CAGE2D_PART_ROTATE;
}
}
@@ -821,20 +821,20 @@ typedef struct RectTransformInteraction {
Dial *dial;
} RectTransformInteraction;
-static void manipulator_cage2d_setup(wmManipulator *mpr)
+static void gizmo_cage2d_setup(wmGizmo *mpr)
{
- mpr->flag |= WM_MANIPULATOR_DRAW_MODAL | WM_MANIPULATOR_DRAW_NO_SCALE;
+ mpr->flag |= WM_GIZMO_DRAW_MODAL | WM_GIZMO_DRAW_NO_SCALE;
}
-static int manipulator_cage2d_invoke(
- bContext *C, wmManipulator *mpr, const wmEvent *event)
+static int gizmo_cage2d_invoke(
+ bContext *C, wmGizmo *mpr, const wmEvent *event)
{
RectTransformInteraction *data = MEM_callocN(sizeof(RectTransformInteraction), "cage_interaction");
copy_m4_m4(data->orig_matrix_offset, mpr->matrix_offset);
- WM_manipulator_calc_matrix_final_no_offset(mpr, data->orig_matrix_final_no_offset);
+ WM_gizmo_calc_matrix_final_no_offset(mpr, data->orig_matrix_final_no_offset);
- if (manipulator_window_project_2d(
+ if (gizmo_window_project_2d(
C, mpr, (const float[2]){UNPACK2(event->mval)}, 2, false, data->orig_mouse) == 0)
{
zero_v2(data->orig_mouse);
@@ -845,9 +845,9 @@ static int manipulator_cage2d_invoke(
return OPERATOR_RUNNING_MODAL;
}
-static int manipulator_cage2d_modal(
- bContext *C, wmManipulator *mpr, const wmEvent *event,
- eWM_ManipulatorTweak UNUSED(tweak_flag))
+static int gizmo_cage2d_modal(
+ bContext *C, wmGizmo *mpr, const wmEvent *event,
+ eWM_GizmoFlagTweak UNUSED(tweak_flag))
{
/* For transform logic to be managable we operate in -0.5..0.5 2D space,
* no matter the size of the rectangle, mouse coorts are scaled to unit space.
@@ -867,7 +867,7 @@ static int manipulator_cage2d_modal(
copy_m4_m4(matrix_back, mpr->matrix_offset);
copy_m4_m4(mpr->matrix_offset, data->orig_matrix_offset);
- bool ok = manipulator_window_project_2d(
+ bool ok = gizmo_window_project_2d(
C, mpr, (const float[2]){UNPACK2(event->mval)}, 2, false, point_local);
copy_m4_m4(mpr->matrix_offset, matrix_back);
if (!ok) {
@@ -876,20 +876,20 @@ static int manipulator_cage2d_modal(
}
const int transform_flag = RNA_enum_get(mpr->ptr, "transform");
- wmManipulatorProperty *mpr_prop;
+ wmGizmoProperty *mpr_prop;
- mpr_prop = WM_manipulator_target_property_find(mpr, "matrix");
+ mpr_prop = WM_gizmo_target_property_find(mpr, "matrix");
if (mpr_prop->type != NULL) {
- WM_manipulator_target_property_value_get_array(mpr, mpr_prop, &mpr->matrix_offset[0][0]);
+ WM_gizmo_target_property_value_get_array(mpr, mpr_prop, &mpr->matrix_offset[0][0]);
}
- if (mpr->highlight_part == ED_MANIPULATOR_CAGE2D_PART_TRANSLATE) {
+ if (mpr->highlight_part == ED_GIZMO_CAGE2D_PART_TRANSLATE) {
/* do this to prevent clamping from changing size */
copy_m4_m4(mpr->matrix_offset, data->orig_matrix_offset);
mpr->matrix_offset[3][0] = data->orig_matrix_offset[3][0] + (point_local[0] - data->orig_mouse[0]);
mpr->matrix_offset[3][1] = data->orig_matrix_offset[3][1] + (point_local[1] - data->orig_mouse[1]);
}
- else if (mpr->highlight_part == ED_MANIPULATOR_CAGE2D_PART_ROTATE) {
+ else if (mpr->highlight_part == ED_GIZMO_CAGE2D_PART_ROTATE) {
#define MUL_V2_V3_M4_FINAL(test_co, mouse_co) \
mul_v3_m4v3(test_co, data->orig_matrix_final_no_offset, ((const float[3]){UNPACK2(mouse_co), 0.0}))
@@ -935,8 +935,8 @@ static int manipulator_cage2d_modal(
float pivot[2];
bool constrain_axis[2] = {false};
- if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE) {
- manipulator_rect_pivot_from_scale_part(mpr->highlight_part, pivot, constrain_axis);
+ if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE) {
+ gizmo_rect_pivot_from_scale_part(mpr->highlight_part, pivot, constrain_axis);
}
else {
zero_v2(pivot);
@@ -960,7 +960,7 @@ static int manipulator_cage2d_modal(
scale[i] = 1.0f + ((delta_curr[i] - delta_orig[i]) / len_v3(data->orig_matrix_offset[i]));
- if ((transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_SIGNED) == 0) {
+ if ((transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_SIGNED) == 0) {
if (sign != signum_i(scale[i])) {
scale[i] = 0.0f;
}
@@ -968,7 +968,7 @@ static int manipulator_cage2d_modal(
}
}
- if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_UNIFORM) {
+ if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM) {
if (constrain_axis[0] == false && constrain_axis[1] == false) {
scale[1] = scale[0] = (scale[1] + scale[0]) / 2.0f;
}
@@ -995,7 +995,7 @@ static int manipulator_cage2d_modal(
}
if (mpr_prop->type != NULL) {
- WM_manipulator_target_property_value_set_array(C, mpr, mpr_prop, &mpr->matrix_offset[0][0]);
+ WM_gizmo_target_property_value_set_array(C, mpr, mpr_prop, &mpr->matrix_offset[0][0]);
}
/* tag the region for redraw */
@@ -1005,11 +1005,11 @@ static int manipulator_cage2d_modal(
return OPERATOR_RUNNING_MODAL;
}
-static void manipulator_cage2d_property_update(wmManipulator *mpr, wmManipulatorProperty *mpr_prop)
+static void gizmo_cage2d_property_update(wmGizmo *mpr, wmGizmoProperty *mpr_prop)
{
if (STREQ(mpr_prop->type->idname, "matrix")) {
- if (WM_manipulator_target_property_array_length(mpr, mpr_prop) == 16) {
- WM_manipulator_target_property_value_get_array(mpr, mpr_prop, &mpr->matrix_offset[0][0]);
+ if (WM_gizmo_target_property_array_length(mpr, mpr_prop) == 16) {
+ WM_gizmo_target_property_value_get_array(mpr, mpr_prop, &mpr->matrix_offset[0][0]);
}
else {
BLI_assert(0);
@@ -1020,7 +1020,7 @@ static void manipulator_cage2d_property_update(wmManipulator *mpr, wmManipulator
}
}
-static void manipulator_cage2d_exit(bContext *C, wmManipulator *mpr, const bool cancel)
+static void gizmo_cage2d_exit(bContext *C, wmGizmo *mpr, const bool cancel)
{
RectTransformInteraction *data = mpr->interaction_data;
@@ -1029,12 +1029,12 @@ static void manipulator_cage2d_exit(bContext *C, wmManipulator *mpr, const bool
if (!cancel)
return;
- wmManipulatorProperty *mpr_prop;
+ wmGizmoProperty *mpr_prop;
/* reset properties */
- mpr_prop = WM_manipulator_target_property_find(mpr, "matrix");
+ mpr_prop = WM_gizmo_target_property_find(mpr, "matrix");
if (mpr_prop->type != NULL) {
- WM_manipulator_target_property_value_set_array(C, mpr, mpr_prop, &data->orig_matrix_offset[0][0]);
+ WM_gizmo_target_property_value_set_array(C, mpr, mpr_prop, &data->orig_matrix_offset[0][0]);
}
copy_m4_m4(mpr->matrix_offset, data->orig_matrix_offset);
@@ -1042,59 +1042,59 @@ static void manipulator_cage2d_exit(bContext *C, wmManipulator *mpr, const bool
/* -------------------------------------------------------------------- */
-/** \name Cage Manipulator API
+/** \name Cage Gizmo API
*
* \{ */
-static void MANIPULATOR_WT_cage_2d(wmManipulatorType *wt)
+static void GIZMO_WT_cage_2d(wmGizmoType *wt)
{
/* identifiers */
- wt->idname = "MANIPULATOR_WT_cage_2d";
+ wt->idname = "GIZMO_WT_cage_2d";
/* api callbacks */
- wt->draw = manipulator_cage2d_draw;
- wt->draw_select = manipulator_cage2d_draw_select;
- wt->test_select = manipulator_cage2d_test_select;
- wt->setup = manipulator_cage2d_setup;
- wt->invoke = manipulator_cage2d_invoke;
- wt->property_update = manipulator_cage2d_property_update;
- wt->modal = manipulator_cage2d_modal;
- wt->exit = manipulator_cage2d_exit;
- wt->cursor_get = manipulator_cage2d_get_cursor;
-
- wt->struct_size = sizeof(wmManipulator);
+ wt->draw = gizmo_cage2d_draw;
+ wt->draw_select = gizmo_cage2d_draw_select;
+ wt->test_select = gizmo_cage2d_test_select;
+ wt->setup = gizmo_cage2d_setup;
+ wt->invoke = gizmo_cage2d_invoke;
+ wt->property_update = gizmo_cage2d_property_update;
+ wt->modal = gizmo_cage2d_modal;
+ wt->exit = gizmo_cage2d_exit;
+ wt->cursor_get = gizmo_cage2d_get_cursor;
+
+ wt->struct_size = sizeof(wmGizmo);
/* rna */
static EnumPropertyItem rna_enum_draw_style[] = {
- {ED_MANIPULATOR_CAGE2D_STYLE_BOX, "BOX", 0, "Box", ""},
- {ED_MANIPULATOR_CAGE2D_STYLE_CIRCLE, "CIRCLE", 0, "Circle", ""},
+ {ED_GIZMO_CAGE2D_STYLE_BOX, "BOX", 0, "Box", ""},
+ {ED_GIZMO_CAGE2D_STYLE_CIRCLE, "CIRCLE", 0, "Circle", ""},
{0, NULL, 0, NULL, NULL}
};
static EnumPropertyItem rna_enum_transform[] = {
- {ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Translate", ""},
- {ED_MANIPULATOR_CAGE2D_XFORM_FLAG_ROTATE, "ROTATE", 0, "Rotate", ""},
- {ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE, "SCALE", 0, "Scale", ""},
- {ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_UNIFORM, "SCALE_UNIFORM", 0, "Scale Uniform", ""},
+ {ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Translate", ""},
+ {ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE, "ROTATE", 0, "Rotate", ""},
+ {ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE, "SCALE", 0, "Scale", ""},
+ {ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM, "SCALE_UNIFORM", 0, "Scale Uniform", ""},
{0, NULL, 0, NULL, NULL}
};
static EnumPropertyItem rna_enum_draw_options[] = {
- {ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "XFORM_CENTER_HANDLE", 0, "Center Handle", ""},
+ {ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "XFORM_CENTER_HANDLE", 0, "Center Handle", ""},
{0, NULL, 0, NULL, NULL}
};
static float unit_v2[2] = {1.0f, 1.0f};
RNA_def_float_vector(wt->srna, "dimensions", 2, unit_v2, 0, FLT_MAX, "Dimensions", "", 0.0f, FLT_MAX);
RNA_def_enum_flag(wt->srna, "transform", rna_enum_transform, 0, "Transform Options", "");
- RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style, ED_MANIPULATOR_CAGE2D_STYLE_CIRCLE, "Draw Style", "");
+ RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style, ED_GIZMO_CAGE2D_STYLE_CIRCLE, "Draw Style", "");
RNA_def_enum_flag(
wt->srna, "draw_options", rna_enum_draw_options,
- ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "Draw Options", "");
+ ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "Draw Options", "");
- WM_manipulatortype_target_property_def(wt, "matrix", PROP_FLOAT, 16);
+ WM_gizmotype_target_property_def(wt, "matrix", PROP_FLOAT, 16);
}
-void ED_manipulatortypes_cage_2d(void)
+void ED_gizmotypes_cage_2d(void)
{
- WM_manipulatortype_append(MANIPULATOR_WT_cage_2d);
+ WM_gizmotype_append(GIZMO_WT_cage_2d);
}
/** \} */
diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
index 0f3e67d7585..e266514855b 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
@@ -26,12 +26,12 @@
/** \file cage3d_gizmo.c
* \ingroup wm
*
- * \name Cage Manipulator
+ * \name Cage Gizmo
*
- * 2D Manipulator
+ * 2D Gizmo
*
- * \brief Rectangular manipulator acting as a 'cage' around its content.
- * Interacting scales or translates the manipulator.
+ * \brief Rectangular gizmo acting as a 'cage' around its content.
+ * Interacting scales or translates the gizmo.
*/
#include "MEM_guardedalloc.h"
@@ -63,24 +63,24 @@
/* own includes */
#include "../gizmo_library_intern.h"
-#define MANIPULATOR_RESIZER_SIZE 10.0f
-#define MANIPULATOR_MARGIN_OFFSET_SCALE 1.5f
+#define GIZMO_RESIZER_SIZE 10.0f
+#define GIZMO_MARGIN_OFFSET_SCALE 1.5f
-static void manipulator_calc_matrix_final_no_offset(
- const wmManipulator *mpr, float orig_matrix_final_no_offset[4][4], bool use_space)
+static void gizmo_calc_matrix_final_no_offset(
+ const wmGizmo *mpr, float orig_matrix_final_no_offset[4][4], bool use_space)
{
float mat_identity[4][4];
- struct WM_ManipulatorMatrixParams params = {NULL};
+ struct WM_GizmoMatrixParams params = {NULL};
unit_m4(mat_identity);
if (use_space == false) {
params.matrix_basis = mat_identity;
}
params.matrix_offset = mat_identity;
- WM_manipulator_calc_matrix_final_params(mpr, &params, orig_matrix_final_no_offset);
+ WM_gizmo_calc_matrix_final_params(mpr, &params, orig_matrix_final_no_offset);
}
-static void manipulator_calc_rect_view_scale(
- const wmManipulator *mpr, const float dims[3], float scale[3])
+static void gizmo_calc_rect_view_scale(
+ const wmGizmo *mpr, const float dims[3], float scale[3])
{
UNUSED_VARS(dims);
@@ -88,7 +88,7 @@ static void manipulator_calc_rect_view_scale(
float matrix_final_no_offset[4][4];
float x_axis[3], y_axis[3], z_axis[3];
- manipulator_calc_matrix_final_no_offset(mpr, matrix_final_no_offset, false);
+ gizmo_calc_matrix_final_no_offset(mpr, matrix_final_no_offset, false);
mul_v3_mat3_m4v3(x_axis, matrix_final_no_offset, mpr->matrix_offset[0]);
mul_v3_mat3_m4v3(y_axis, matrix_final_no_offset, mpr->matrix_offset[1]);
mul_v3_mat3_m4v3(z_axis, matrix_final_no_offset, mpr->matrix_offset[2]);
@@ -98,21 +98,21 @@ static void manipulator_calc_rect_view_scale(
scale[2] = 1.0f / len_v3(z_axis);
}
-static void manipulator_calc_rect_view_margin(
- const wmManipulator *mpr, const float dims[3], float margin[3])
+static void gizmo_calc_rect_view_margin(
+ const wmGizmo *mpr, const float dims[3], float margin[3])
{
float handle_size;
- if (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) {
+ if (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) {
handle_size = 0.15f;
}
else {
- handle_size = MANIPULATOR_RESIZER_SIZE;
+ handle_size = GIZMO_RESIZER_SIZE;
}
// XXX, the scale isn't taking offset into account, we need to calculate scale per handle!
// handle_size *= mpr->scale_final;
float scale_xyz[3];
- manipulator_calc_rect_view_scale(mpr, dims, scale_xyz);
+ gizmo_calc_rect_view_scale(mpr, dims, scale_xyz);
margin[0] = ((handle_size * scale_xyz[0]));
margin[1] = ((handle_size * scale_xyz[1]));
margin[2] = ((handle_size * scale_xyz[2]));
@@ -120,12 +120,12 @@ static void manipulator_calc_rect_view_margin(
/* -------------------------------------------------------------------- */
-static void manipulator_rect_pivot_from_scale_part(int part, float r_pt[3], bool r_constrain_axis[3])
+static void gizmo_rect_pivot_from_scale_part(int part, float r_pt[3], bool r_constrain_axis[3])
{
- if (part >= ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z &&
- part <= ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z)
+ if (part >= ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z &&
+ part <= ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z)
{
- int index = (part - ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z);
+ int index = (part - ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z);
int range[3];
range[2] = index % 3;
index = index / 3;
@@ -144,7 +144,7 @@ static void manipulator_rect_pivot_from_scale_part(int part, float r_pt[3], bool
/* -------------------------------------------------------------------- */
/** \name Box Draw Style
*
- * Useful for 3D views, see: #ED_MANIPULATOR_CAGE2D_STYLE_BOX
+ * Useful for 3D views, see: #ED_GIZMO_CAGE2D_STYLE_BOX
* \{ */
static void cage3d_draw_box_corners(
@@ -165,10 +165,10 @@ static void cage3d_draw_box_interaction(
const float color[4], const int highlighted,
const float size[3], const float margin[3])
{
- if (highlighted >= ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z &&
- highlighted <= ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z)
+ if (highlighted >= ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z &&
+ highlighted <= ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z)
{
- int index = (highlighted - ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z);
+ int index = (highlighted - ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z);
int range[3];
range[2] = index % 3;
index = index / 3;
@@ -199,7 +199,7 @@ static void cage3d_draw_box_interaction(
/* -------------------------------------------------------------------- */
/** \name Circle Draw Style
*
- * Useful for 2D views, see: #ED_MANIPULATOR_CAGE2D_STYLE_CIRCLE
+ * Useful for 2D views, see: #ED_GIZMO_CAGE2D_STYLE_CIRCLE
* \{ */
static void imm_draw_point_aspect_3d(
@@ -225,8 +225,8 @@ static void cage3d_draw_circle_wire(
imm_draw_cube_wire_3d(pos, (float[3]){0}, r);
#if 0
- if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE) {
- if (draw_options & ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) {
+ if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE) {
+ if (draw_options & ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) {
const float rad[2] = {margin[0] / 2, margin[1] / 2};
const float center[2] = {0.0f, 0.0f};
@@ -279,11 +279,11 @@ static void cage3d_draw_circle_handles(
/** \} */
-static void manipulator_cage3d_draw_intern(
+static void gizmo_cage3d_draw_intern(
RegionView3D *rv3d,
- wmManipulator *mpr, const bool select, const bool highlight, const int select_id)
+ wmGizmo *mpr, const bool select, const bool highlight, const int select_id)
{
- // const bool use_clamp = (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) == 0;
+ // const bool use_clamp = (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) == 0;
float dims[3];
RNA_float_get_array(mpr->ptr, "dimensions", dims);
float matrix_final[4][4];
@@ -294,13 +294,13 @@ static void manipulator_cage3d_draw_intern(
const float size_real[3] = {dims[0] / 2.0f, dims[1] / 2.0f, dims[2] / 2.0f};
- WM_manipulator_calc_matrix_final(mpr, matrix_final);
+ WM_gizmo_calc_matrix_final(mpr, matrix_final);
gpuPushMatrix();
gpuMultMatrix(matrix_final);
float margin[3];
- manipulator_calc_rect_view_margin(mpr, dims, margin);
+ gizmo_calc_rect_view_margin(mpr, dims, margin);
/* Handy for quick testing draw (if it's outside bounds). */
if (false) {
@@ -328,12 +328,12 @@ static void manipulator_cage3d_draw_intern(
#endif
- if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE) {
- for (int i = ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z;
- i <= ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z;
+ if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE) {
+ for (int i = ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z;
+ i <= ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z;
i++)
{
- if (i == ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MID_Y_MID_Z) {
+ if (i == ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MID_Y_MID_Z) {
continue;
}
GPU_select_load_id(select_id | i);
@@ -341,8 +341,8 @@ static void manipulator_cage3d_draw_intern(
mpr->color, i, size, margin);
}
}
- if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE) {
- const int transform_part = ED_MANIPULATOR_CAGE3D_PART_TRANSLATE;
+ if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE) {
+ const int transform_part = ED_GIZMO_CAGE3D_PART_TRANSLATE;
GPU_select_load_id(select_id | transform_part);
cage3d_draw_box_interaction(
mpr->color, transform_part, size, margin);
@@ -357,22 +357,22 @@ static void manipulator_cage3d_draw_intern(
.ymax = size_real[1],
};
#endif
- if (draw_style == ED_MANIPULATOR_CAGE2D_STYLE_BOX) {
- /* corner manipulators */
+ if (draw_style == ED_GIZMO_CAGE2D_STYLE_BOX) {
+ /* corner gizmos */
GPU_line_width(mpr->line_width + 3.0f);
cage3d_draw_box_corners(size_real, margin, (const float[3]){0, 0, 0});
- /* corner manipulators */
+ /* corner gizmos */
float color[4];
- manipulator_color_get(mpr, highlight, color);
+ gizmo_color_get(mpr, highlight, color);
GPU_line_width(mpr->line_width);
cage3d_draw_box_corners(size_real, margin, color);
bool show = false;
- if (mpr->highlight_part == ED_MANIPULATOR_CAGE3D_PART_TRANSLATE) {
+ if (mpr->highlight_part == ED_GIZMO_CAGE3D_PART_TRANSLATE) {
/* Only show if we're drawing the center handle
* otherwise the entire rectangle is the hotspot. */
- if (draw_options & ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) {
+ if (draw_options & ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) {
show = true;
}
}
@@ -385,9 +385,9 @@ static void manipulator_cage3d_draw_intern(
mpr->color, mpr->highlight_part, size_real, margin);
}
}
- else if (draw_style == ED_MANIPULATOR_CAGE2D_STYLE_CIRCLE) {
+ else if (draw_style == ED_GIZMO_CAGE2D_STYLE_CIRCLE) {
float color[4];
- manipulator_color_get(mpr, highlight, color);
+ gizmo_color_get(mpr, highlight, color);
GPU_line_smooth(true);
GPU_polygon_smooth(true);
@@ -398,7 +398,7 @@ static void manipulator_cage3d_draw_intern(
GPU_line_width(mpr->line_width);
cage3d_draw_circle_wire(size_real, margin, color, transform_flag, draw_options);
- /* corner manipulators */
+ /* corner gizmos */
cage3d_draw_circle_handles(rv3d, matrix_final, size_real, margin, (const float[3]){0, 0, 0}, true, 60);
cage3d_draw_circle_handles(rv3d, matrix_final, size_real, margin, color, true, 40);
@@ -418,24 +418,24 @@ static void manipulator_cage3d_draw_intern(
/**
* For when we want to draw 3d cage in 3d views.
*/
-static void manipulator_cage3d_draw_select(const bContext *C, wmManipulator *mpr, int select_id)
+static void gizmo_cage3d_draw_select(const bContext *C, wmGizmo *mpr, int select_id)
{
ARegion *ar = CTX_wm_region(C);
RegionView3D *rv3d = ar->regiondata;
- manipulator_cage3d_draw_intern(rv3d, mpr, true, false, select_id);
+ gizmo_cage3d_draw_intern(rv3d, mpr, true, false, select_id);
}
-static void manipulator_cage3d_draw(const bContext *C, wmManipulator *mpr)
+static void gizmo_cage3d_draw(const bContext *C, wmGizmo *mpr)
{
ARegion *ar = CTX_wm_region(C);
RegionView3D *rv3d = ar->regiondata;
- const bool is_highlight = (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0;
- manipulator_cage3d_draw_intern(rv3d, mpr, false, is_highlight, -1);
+ const bool is_highlight = (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) != 0;
+ gizmo_cage3d_draw_intern(rv3d, mpr, false, is_highlight, -1);
}
-static int manipulator_cage3d_get_cursor(wmManipulator *mpr)
+static int gizmo_cage3d_get_cursor(wmGizmo *mpr)
{
- if (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) {
+ if (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) {
return BC_NSEW_SCROLLCURSOR;
}
@@ -448,21 +448,21 @@ typedef struct RectTransformInteraction {
float orig_matrix_final_no_offset[4][4];
} RectTransformInteraction;
-static void manipulator_cage3d_setup(wmManipulator *mpr)
+static void gizmo_cage3d_setup(wmGizmo *mpr)
{
- mpr->flag |= /* WM_MANIPULATOR_DRAW_MODAL | */ /* TODO */
- WM_MANIPULATOR_DRAW_NO_SCALE;
+ mpr->flag |= /* WM_GIZMO_DRAW_MODAL | */ /* TODO */
+ WM_GIZMO_DRAW_NO_SCALE;
}
-static int manipulator_cage3d_invoke(
- bContext *C, wmManipulator *mpr, const wmEvent *event)
+static int gizmo_cage3d_invoke(
+ bContext *C, wmGizmo *mpr, const wmEvent *event)
{
RectTransformInteraction *data = MEM_callocN(sizeof(RectTransformInteraction), "cage_interaction");
copy_m4_m4(data->orig_matrix_offset, mpr->matrix_offset);
- manipulator_calc_matrix_final_no_offset(mpr, data->orig_matrix_final_no_offset, true);
+ gizmo_calc_matrix_final_no_offset(mpr, data->orig_matrix_final_no_offset, true);
- if (manipulator_window_project_3d(
+ if (gizmo_window_project_3d(
C, mpr, (const float[2]){UNPACK2(event->mval)}, false, data->orig_mouse) == 0)
{
zero_v3(data->orig_mouse);
@@ -473,9 +473,9 @@ static int manipulator_cage3d_invoke(
return OPERATOR_RUNNING_MODAL;
}
-static int manipulator_cage3d_modal(
- bContext *C, wmManipulator *mpr, const wmEvent *event,
- eWM_ManipulatorTweak UNUSED(tweak_flag))
+static int gizmo_cage3d_modal(
+ bContext *C, wmGizmo *mpr, const wmEvent *event,
+ eWM_GizmoFlagTweak UNUSED(tweak_flag))
{
/* For transform logic to be managable we operate in -0.5..0.5 2D space,
* no matter the size of the rectangle, mouse coorts are scaled to unit space.
@@ -495,7 +495,7 @@ static int manipulator_cage3d_modal(
copy_m4_m4(matrix_back, mpr->matrix_offset);
copy_m4_m4(mpr->matrix_offset, data->orig_matrix_offset);
- bool ok = manipulator_window_project_3d(
+ bool ok = gizmo_window_project_3d(
C, mpr, (const float[2]){UNPACK2(event->mval)}, false, point_local);
copy_m4_m4(mpr->matrix_offset, matrix_back);
if (!ok) {
@@ -504,21 +504,21 @@ static int manipulator_cage3d_modal(
}
const int transform_flag = RNA_enum_get(mpr->ptr, "transform");
- wmManipulatorProperty *mpr_prop;
+ wmGizmoProperty *mpr_prop;
- mpr_prop = WM_manipulator_target_property_find(mpr, "matrix");
+ mpr_prop = WM_gizmo_target_property_find(mpr, "matrix");
if (mpr_prop->type != NULL) {
- WM_manipulator_target_property_value_get_array(mpr, mpr_prop, &mpr->matrix_offset[0][0]);
+ WM_gizmo_target_property_value_get_array(mpr, mpr_prop, &mpr->matrix_offset[0][0]);
}
- if (mpr->highlight_part == ED_MANIPULATOR_CAGE3D_PART_TRANSLATE) {
+ if (mpr->highlight_part == ED_GIZMO_CAGE3D_PART_TRANSLATE) {
/* do this to prevent clamping from changing size */
copy_m4_m4(mpr->matrix_offset, data->orig_matrix_offset);
mpr->matrix_offset[3][0] = data->orig_matrix_offset[3][0] + (point_local[0] - data->orig_mouse[0]);
mpr->matrix_offset[3][1] = data->orig_matrix_offset[3][1] + (point_local[1] - data->orig_mouse[1]);
mpr->matrix_offset[3][2] = data->orig_matrix_offset[3][2] + (point_local[2] - data->orig_mouse[2]);
}
- else if (mpr->highlight_part == ED_MANIPULATOR_CAGE3D_PART_ROTATE) {
+ else if (mpr->highlight_part == ED_GIZMO_CAGE3D_PART_ROTATE) {
/* TODO (if needed) */
}
else {
@@ -527,8 +527,8 @@ static int manipulator_cage3d_modal(
float pivot[3];
bool constrain_axis[3] = {false};
- if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE) {
- manipulator_rect_pivot_from_scale_part(mpr->highlight_part, pivot, constrain_axis);
+ if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE) {
+ gizmo_rect_pivot_from_scale_part(mpr->highlight_part, pivot, constrain_axis);
}
else {
zero_v3(pivot);
@@ -553,7 +553,7 @@ static int manipulator_cage3d_modal(
scale[i] = 1.0f + ((delta_curr[i] - delta_orig[i]) / len_v3(data->orig_matrix_offset[i]));
- if ((transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_SIGNED) == 0) {
+ if ((transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_SIGNED) == 0) {
if (sign != signum_i(scale[i])) {
scale[i] = 0.0f;
}
@@ -561,7 +561,7 @@ static int manipulator_cage3d_modal(
}
}
- if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_UNIFORM) {
+ if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM) {
if (constrain_axis[0] == false && constrain_axis[1] == false) {
scale[1] = scale[0] = (scale[1] + scale[0]) / 2.0f;
}
@@ -591,7 +591,7 @@ static int manipulator_cage3d_modal(
}
if (mpr_prop->type != NULL) {
- WM_manipulator_target_property_value_set_array(C, mpr, mpr_prop, &mpr->matrix_offset[0][0]);
+ WM_gizmo_target_property_value_set_array(C, mpr, mpr_prop, &mpr->matrix_offset[0][0]);
}
/* tag the region for redraw */
@@ -601,11 +601,11 @@ static int manipulator_cage3d_modal(
return OPERATOR_RUNNING_MODAL;
}
-static void manipulator_cage3d_property_update(wmManipulator *mpr, wmManipulatorProperty *mpr_prop)
+static void gizmo_cage3d_property_update(wmGizmo *mpr, wmGizmoProperty *mpr_prop)
{
if (STREQ(mpr_prop->type->idname, "matrix")) {
- if (WM_manipulator_target_property_array_length(mpr, mpr_prop) == 16) {
- WM_manipulator_target_property_value_get_array(mpr, mpr_prop, &mpr->matrix_offset[0][0]);
+ if (WM_gizmo_target_property_array_length(mpr, mpr_prop) == 16) {
+ WM_gizmo_target_property_value_get_array(mpr, mpr_prop, &mpr->matrix_offset[0][0]);
}
else {
BLI_assert(0);
@@ -616,19 +616,19 @@ static void manipulator_cage3d_property_update(wmManipulator *mpr, wmManipulator
}
}
-static void manipulator_cage3d_exit(bContext *C, wmManipulator *mpr, const bool cancel)
+static void gizmo_cage3d_exit(bContext *C, wmGizmo *mpr, const bool cancel)
{
RectTransformInteraction *data = mpr->interaction_data;
if (!cancel)
return;
- wmManipulatorProperty *mpr_prop;
+ wmGizmoProperty *mpr_prop;
/* reset properties */
- mpr_prop = WM_manipulator_target_property_find(mpr, "matrix");
+ mpr_prop = WM_gizmo_target_property_find(mpr, "matrix");
if (mpr_prop->type != NULL) {
- WM_manipulator_target_property_value_set_array(C, mpr, mpr_prop, &data->orig_matrix_offset[0][0]);
+ WM_gizmo_target_property_value_set_array(C, mpr, mpr_prop, &data->orig_matrix_offset[0][0]);
}
copy_m4_m4(mpr->matrix_offset, data->orig_matrix_offset);
@@ -636,57 +636,57 @@ static void manipulator_cage3d_exit(bContext *C, wmManipulator *mpr, const bool
/* -------------------------------------------------------------------- */
-/** \name Cage Manipulator API
+/** \name Cage Gizmo API
*
* \{ */
-static void MANIPULATOR_WT_cage_3d(wmManipulatorType *wt)
+static void GIZMO_WT_cage_3d(wmGizmoType *wt)
{
/* identifiers */
- wt->idname = "MANIPULATOR_WT_cage_3d";
+ wt->idname = "GIZMO_WT_cage_3d";
/* api callbacks */
- wt->draw = manipulator_cage3d_draw;
- wt->draw_select = manipulator_cage3d_draw_select;
- wt->setup = manipulator_cage3d_setup;
- wt->invoke = manipulator_cage3d_invoke;
- wt->property_update = manipulator_cage3d_property_update;
- wt->modal = manipulator_cage3d_modal;
- wt->exit = manipulator_cage3d_exit;
- wt->cursor_get = manipulator_cage3d_get_cursor;
+ wt->draw = gizmo_cage3d_draw;
+ wt->draw_select = gizmo_cage3d_draw_select;
+ wt->setup = gizmo_cage3d_setup;
+ wt->invoke = gizmo_cage3d_invoke;
+ wt->property_update = gizmo_cage3d_property_update;
+ wt->modal = gizmo_cage3d_modal;
+ wt->exit = gizmo_cage3d_exit;
+ wt->cursor_get = gizmo_cage3d_get_cursor;
- wt->struct_size = sizeof(wmManipulator);
+ wt->struct_size = sizeof(wmGizmo);
/* rna */
static EnumPropertyItem rna_enum_draw_style[] = {
- {ED_MANIPULATOR_CAGE2D_STYLE_BOX, "BOX", 0, "Box", ""},
- {ED_MANIPULATOR_CAGE2D_STYLE_CIRCLE, "CIRCLE", 0, "Circle", ""},
+ {ED_GIZMO_CAGE2D_STYLE_BOX, "BOX", 0, "Box", ""},
+ {ED_GIZMO_CAGE2D_STYLE_CIRCLE, "CIRCLE", 0, "Circle", ""},
{0, NULL, 0, NULL, NULL}
};
static EnumPropertyItem rna_enum_transform[] = {
- {ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Translate", ""},
- {ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE, "SCALE", 0, "Scale", ""},
- {ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_UNIFORM, "SCALE_UNIFORM", 0, "Scale Uniform", ""},
+ {ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Translate", ""},
+ {ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE, "SCALE", 0, "Scale", ""},
+ {ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM, "SCALE_UNIFORM", 0, "Scale Uniform", ""},
{0, NULL, 0, NULL, NULL}
};
static EnumPropertyItem rna_enum_draw_options[] = {
- {ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "XFORM_CENTER_HANDLE", 0, "Center Handle", ""},
+ {ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "XFORM_CENTER_HANDLE", 0, "Center Handle", ""},
{0, NULL, 0, NULL, NULL}
};
static float unit_v3[3] = {1.0f, 1.0f, 1.0f};
RNA_def_float_vector(wt->srna, "dimensions", 3, unit_v3, 0, FLT_MAX, "Dimensions", "", 0.0f, FLT_MAX);
RNA_def_enum_flag(wt->srna, "transform", rna_enum_transform, 0, "Transform Options", "");
- RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style, ED_MANIPULATOR_CAGE2D_STYLE_CIRCLE, "Draw Style", "");
+ RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style, ED_GIZMO_CAGE2D_STYLE_CIRCLE, "Draw Style", "");
RNA_def_enum_flag(
wt->srna, "draw_options", rna_enum_draw_options,
- ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "Draw Options", "");
+ ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "Draw Options", "");
- WM_manipulatortype_target_property_def(wt, "matrix", PROP_FLOAT, 16);
+ WM_gizmotype_target_property_def(wt, "matrix", PROP_FLOAT, 16);
}
-void ED_manipulatortypes_cage_3d(void)
+void ED_gizmotypes_cage_3d(void)
{
- WM_manipulatortype_append(MANIPULATOR_WT_cage_3d);
+ WM_gizmotype_append(GIZMO_WT_cage_3d);
}
/** \} */
diff --git a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
index 8d0061f66c8..b93b87b1efa 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
@@ -26,15 +26,15 @@
/** \file dial3d_gizmo.c
* \ingroup wm
*
- * \name Dial Manipulator
+ * \name Dial Gizmo
*
- * 3D Manipulator
+ * 3D Gizmo
*
- * \brief Circle shaped manipulator for circular interaction.
+ * \brief Circle shaped gizmo for circular interaction.
* Currently no own handling, use with operator only.
*
* - `matrix[0]` is derived from Y and Z.
- * - `matrix[1]` is 'up' when DialManipulator.use_start_y_axis is set.
+ * - `matrix[1]` is 'up' when DialGizmo.use_start_y_axis is set.
* - `matrix[2]` is the axis the dial rotates around (all dials).
*/
@@ -67,12 +67,12 @@
#include "../gizmo_geometry.h"
#include "../gizmo_library_intern.h"
-/* to use custom dials exported to geom_dial_manipulator.c */
-// #define USE_MANIPULATOR_CUSTOM_DIAL
+/* to use custom dials exported to geom_dial_gizmo.c */
+// #define USE_GIZMO_CUSTOM_DIAL
-static int manipulator_dial_modal(
- bContext *C, wmManipulator *mpr, const wmEvent *event,
- eWM_ManipulatorTweak tweak_flag);
+static int gizmo_dial_modal(
+ bContext *C, wmGizmo *mpr, const wmEvent *event,
+ eWM_GizmoFlagTweak tweak_flag);
typedef struct DialInteraction {
float init_mval[2];
@@ -99,9 +99,9 @@ typedef struct DialInteraction {
#define DIAL_CLIP_BIAS 0.02
/**
- * We can't use this for the #wmManipulatorType.matrix_basis_get callback, it conflicts with depth picking.
+ * We can't use this for the #wmGizmoType.matrix_basis_get callback, it conflicts with depth picking.
*/
-static void dial_calc_matrix(const wmManipulator *mpr, float mat[4][4])
+static void dial_calc_matrix(const wmGizmo *mpr, float mat[4][4])
{
float rot[3][3];
const float up[3] = {0.0f, 0.0f, 1.0f};
@@ -114,15 +114,15 @@ static void dial_calc_matrix(const wmManipulator *mpr, float mat[4][4])
/* -------------------------------------------------------------------- */
static void dial_geom_draw(
- const wmManipulator *mpr, const float color[4], const bool select,
+ const wmGizmo *mpr, const float color[4], const bool select,
float axis_modal_mat[4][4], float clip_plane[4])
{
-#ifdef USE_MANIPULATOR_CUSTOM_DIAL
+#ifdef USE_GIZMO_CUSTOM_DIAL
UNUSED_VARS(dial, col, axis_modal_mat, clip_plane);
- wm_manipulator_geometryinfo_draw(&wm_manipulator_geom_data_dial, select);
+ wm_gizmo_geometryinfo_draw(&wm_gizmo_geom_data_dial, select);
#else
const int draw_options = RNA_enum_get(mpr->ptr, "draw_options");
- const bool filled = (draw_options & ED_MANIPULATOR_DIAL_DRAW_FLAG_FILL) != 0;
+ const bool filled = (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_FILL) != 0;
GPU_line_width(mpr->line_width);
@@ -181,9 +181,9 @@ static void dial_ghostarc_draw_helpline(const float angle, const float co_outer[
}
static void dial_ghostarc_draw(
- const wmManipulator *mpr, const float angle_ofs, const float angle_delta, const float color[4])
+ const wmGizmo *mpr, const float angle_ofs, const float angle_delta, const float color[4])
{
- const float width_inner = DIAL_WIDTH - mpr->line_width * 0.5f / U.manipulator_size;
+ const float width_inner = DIAL_WIDTH - mpr->line_width * 0.5f / U.gizmo_size;
Gwn_VertFormat *format = immVertexFormat();
uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -196,7 +196,7 @@ static void dial_ghostarc_draw(
static void dial_ghostarc_get_angles(
struct Depsgraph *depsgraph,
- const wmManipulator *mpr,
+ const wmGizmo *mpr,
const wmEvent *event,
const ARegion *ar, const View3D *v3d,
float mat[4][4], const float co_outer[3],
@@ -243,7 +243,7 @@ static void dial_ghostarc_get_angles(
/* Start direction from mouse or set by user */
const float *proj_init_rel =
- (draw_options & ED_MANIPULATOR_DIAL_DRAW_FLAG_ANGLE_START_Y) ?
+ (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y) ?
mpr->matrix_basis[1] : proj_mval_init_rel;
/* return angles */
@@ -274,7 +274,7 @@ fail:
}
static void dial_draw_intern(
- const bContext *C, wmManipulator *mpr,
+ const bContext *C, wmGizmo *mpr,
const bool select, const bool highlight, float clip_plane[4])
{
float matrix_basis_adjust[4][4];
@@ -283,12 +283,12 @@ static void dial_draw_intern(
BLI_assert(CTX_wm_area(C)->spacetype == SPACE_VIEW3D);
- manipulator_color_get(mpr, highlight, color);
+ gizmo_color_get(mpr, highlight, color);
dial_calc_matrix(mpr, matrix_basis_adjust);
- WM_manipulator_calc_matrix_final_params(
- mpr, &((struct WM_ManipulatorMatrixParams) {
+ WM_gizmo_calc_matrix_final_params(
+ mpr, &((struct WM_GizmoMatrixParams) {
.matrix_basis = (void *)matrix_basis_adjust,
}), matrix_final);
@@ -296,17 +296,17 @@ static void dial_draw_intern(
gpuMultMatrix(matrix_final);
/* draw rotation indicator arc first */
- if ((mpr->flag & WM_MANIPULATOR_DRAW_VALUE) &&
- (mpr->state & WM_MANIPULATOR_STATE_MODAL))
+ if ((mpr->flag & WM_GIZMO_DRAW_VALUE) &&
+ (mpr->state & WM_GIZMO_STATE_MODAL))
{
const float co_outer[4] = {0.0f, DIAL_WIDTH, 0.0f}; /* coordinate at which the arc drawing will be started */
DialInteraction *inter = mpr->interaction_data;
- /* XXX, View3D rotation manipulator doesn't call modal. */
- if (!WM_manipulator_target_property_is_valid_any(mpr)) {
+ /* XXX, View3D rotation gizmo doesn't call modal. */
+ if (!WM_gizmo_target_property_is_valid_any(mpr)) {
wmWindow *win = CTX_wm_window(C);
- manipulator_dial_modal((bContext *)C, mpr, win->eventstate, 0);
+ gizmo_dial_modal((bContext *)C, mpr, win->eventstate, 0);
}
float angle_ofs = inter->output.angle_ofs;
@@ -323,7 +323,7 @@ static void dial_draw_intern(
if (i == 0) {
const int draw_options = RNA_enum_get(mpr->ptr, "draw_options");
- if ((draw_options & ED_MANIPULATOR_DIAL_DRAW_FLAG_ANGLE_MIRROR) == 0) {
+ if ((draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR) == 0) {
break;
}
}
@@ -332,17 +332,17 @@ static void dial_draw_intern(
}
}
- /* draw actual dial manipulator */
+ /* draw actual dial gizmo */
dial_geom_draw(mpr, color, select, matrix_basis_adjust, clip_plane);
gpuPopMatrix();
}
-static void manipulator_dial_draw_select(const bContext *C, wmManipulator *mpr, int select_id)
+static void gizmo_dial_draw_select(const bContext *C, wmGizmo *mpr, int select_id)
{
float clip_plane_buf[4];
const int draw_options = RNA_enum_get(mpr->ptr, "draw_options");
- float *clip_plane = (draw_options & ED_MANIPULATOR_DIAL_DRAW_FLAG_CLIP) ? clip_plane_buf : NULL;
+ float *clip_plane = (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_CLIP) ? clip_plane_buf : NULL;
/* enable clipping if needed */
if (clip_plane) {
@@ -363,13 +363,13 @@ static void manipulator_dial_draw_select(const bContext *C, wmManipulator *mpr,
}
}
-static void manipulator_dial_draw(const bContext *C, wmManipulator *mpr)
+static void gizmo_dial_draw(const bContext *C, wmGizmo *mpr)
{
- const bool is_modal = mpr->state & WM_MANIPULATOR_STATE_MODAL;
- const bool is_highlight = (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0;
+ const bool is_modal = mpr->state & WM_GIZMO_STATE_MODAL;
+ const bool is_highlight = (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) != 0;
float clip_plane_buf[4];
const int draw_options = RNA_enum_get(mpr->ptr, "draw_options");
- float *clip_plane = (!is_modal && (draw_options & ED_MANIPULATOR_DIAL_DRAW_FLAG_CLIP)) ? clip_plane_buf : NULL;
+ float *clip_plane = (!is_modal && (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_CLIP)) ? clip_plane_buf : NULL;
/* enable clipping if needed */
if (clip_plane) {
@@ -392,9 +392,9 @@ static void manipulator_dial_draw(const bContext *C, wmManipulator *mpr)
}
}
-static int manipulator_dial_modal(
- bContext *C, wmManipulator *mpr, const wmEvent *event,
- eWM_ManipulatorTweak UNUSED(tweak_flag))
+static int gizmo_dial_modal(
+ bContext *C, wmGizmo *mpr, const wmEvent *event,
+ eWM_GizmoFlagTweak UNUSED(tweak_flag))
{
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;
@@ -413,15 +413,15 @@ static int manipulator_dial_modal(
inter->output.angle_ofs = angle_ofs;
/* set the property for the operator and call its modal function */
- wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset");
- if (WM_manipulator_target_property_is_valid(mpr_prop)) {
- WM_manipulator_target_property_value_set(C, mpr, mpr_prop, inter->init_prop_angle + angle_delta);
+ wmGizmoProperty *mpr_prop = WM_gizmo_target_property_find(mpr, "offset");
+ if (WM_gizmo_target_property_is_valid(mpr_prop)) {
+ WM_gizmo_target_property_value_set(C, mpr, mpr_prop, inter->init_prop_angle + angle_delta);
}
return OPERATOR_RUNNING_MODAL;
}
-static void manipulator_dial_setup(wmManipulator *mpr)
+static void gizmo_dial_setup(wmGizmo *mpr)
{
const float dir_default[3] = {0.0f, 0.0f, 1.0f};
@@ -429,17 +429,17 @@ static void manipulator_dial_setup(wmManipulator *mpr)
copy_v3_v3(mpr->matrix_basis[2], dir_default);
}
-static int manipulator_dial_invoke(
- bContext *UNUSED(C), wmManipulator *mpr, const wmEvent *event)
+static int gizmo_dial_invoke(
+ bContext *UNUSED(C), wmGizmo *mpr, const wmEvent *event)
{
DialInteraction *inter = MEM_callocN(sizeof(DialInteraction), __func__);
inter->init_mval[0] = event->mval[0];
inter->init_mval[1] = event->mval[1];
- wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset");
- if (WM_manipulator_target_property_is_valid(mpr_prop)) {
- inter->init_prop_angle = WM_manipulator_target_property_value_get(mpr, mpr_prop);
+ wmGizmoProperty *mpr_prop = WM_gizmo_target_property_find(mpr, "offset");
+ if (WM_gizmo_target_property_is_valid(mpr_prop)) {
+ inter->init_prop_angle = WM_gizmo_target_property_value_get(mpr, mpr_prop);
}
mpr->interaction_data = inter;
@@ -448,40 +448,40 @@ static int manipulator_dial_invoke(
}
/* -------------------------------------------------------------------- */
-/** \name Dial Manipulator API
+/** \name Dial Gizmo API
*
* \{ */
-static void MANIPULATOR_WT_dial_3d(wmManipulatorType *wt)
+static void GIZMO_WT_dial_3d(wmGizmoType *wt)
{
/* identifiers */
- wt->idname = "MANIPULATOR_WT_dial_3d";
+ wt->idname = "GIZMO_WT_dial_3d";
/* api callbacks */
- wt->draw = manipulator_dial_draw;
- wt->draw_select = manipulator_dial_draw_select;
- wt->setup = manipulator_dial_setup;
- wt->invoke = manipulator_dial_invoke;
- wt->modal = manipulator_dial_modal;
+ wt->draw = gizmo_dial_draw;
+ wt->draw_select = gizmo_dial_draw_select;
+ wt->setup = gizmo_dial_setup;
+ wt->invoke = gizmo_dial_invoke;
+ wt->modal = gizmo_dial_modal;
- wt->struct_size = sizeof(wmManipulator);
+ wt->struct_size = sizeof(wmGizmo);
/* rna */
static EnumPropertyItem rna_enum_draw_options[] = {
- {ED_MANIPULATOR_DIAL_DRAW_FLAG_CLIP, "CLIP", 0, "Clipped", ""},
- {ED_MANIPULATOR_DIAL_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""},
- {ED_MANIPULATOR_DIAL_DRAW_FLAG_ANGLE_MIRROR, "ANGLE_MIRROR", 0, "Angle Mirror", ""},
- {ED_MANIPULATOR_DIAL_DRAW_FLAG_ANGLE_START_Y, "ANGLE_START_Y", 0, "Angle Start Y", ""},
+ {ED_GIZMO_DIAL_DRAW_FLAG_CLIP, "CLIP", 0, "Clipped", ""},
+ {ED_GIZMO_DIAL_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""},
+ {ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR, "ANGLE_MIRROR", 0, "Angle Mirror", ""},
+ {ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y, "ANGLE_START_Y", 0, "Angle Start Y", ""},
{0, NULL, 0, NULL, NULL}
};
RNA_def_enum_flag(wt->srna, "draw_options", rna_enum_draw_options, 0, "Draw Options", "");
- WM_manipulatortype_target_property_def(wt, "offset", PROP_FLOAT, 1);
+ WM_gizmotype_target_property_def(wt, "offset", PROP_FLOAT, 1);
}
-void ED_manipulatortypes_dial_3d(void)
+void ED_gizmotypes_dial_3d(void)
{
- WM_manipulatortype_append(MANIPULATOR_WT_dial_3d);
+ WM_gizmotype_append(GIZMO_WT_dial_3d);
}
/** \} */
diff --git a/source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c
index e55b57327b6..2a89c8cc4ab 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c
@@ -21,15 +21,15 @@
/** \file grab3d_gizmo.c
* \ingroup wm
*
- * \name Grab Manipulator
+ * \name Grab Gizmo
*
- * 3D Manipulator, also works in 2D views.
+ * 3D Gizmo, also works in 2D views.
*
- * \brief Simple manipulator to grab and translate.
+ * \brief Simple gizmo to grab and translate.
*
* - `matrix[0]` is derived from Y and Z.
* - `matrix[1]` currently not used.
- * - `matrix[2]` is the widget direction (for all manipulators).
+ * - `matrix[2]` is the widget direction (for all gizmos).
*
*/
@@ -62,23 +62,23 @@
#include "../gizmo_geometry.h"
#include "../gizmo_library_intern.h"
-typedef struct GrabManipulator3D {
- wmManipulator manipulator;
+typedef struct GrabGizmo3D {
+ wmGizmo gizmo;
/* Added to 'matrix_basis' when calculating the matrix. */
float prop_co[3];
-} GrabManipulator3D;
+} GrabGizmo3D;
-static void manipulator_grab_matrix_basis_get(const wmManipulator *mpr, float r_matrix[4][4])
+static void gizmo_grab_matrix_basis_get(const wmGizmo *mpr, float r_matrix[4][4])
{
- GrabManipulator3D *grab = (GrabManipulator3D *)mpr;
+ GrabGizmo3D *grab = (GrabGizmo3D *)mpr;
- copy_m4_m4(r_matrix, grab->manipulator.matrix_basis);
+ copy_m4_m4(r_matrix, grab->gizmo.matrix_basis);
add_v3_v3(r_matrix[3], grab->prop_co);
}
-static int manipulator_grab_modal(
- bContext *C, wmManipulator *mpr, const wmEvent *event,
- eWM_ManipulatorTweak tweak_flag);
+static int gizmo_grab_modal(
+ bContext *C, wmGizmo *mpr, const wmEvent *event,
+ eWM_GizmoFlagTweak tweak_flag);
typedef struct GrabInteraction {
float init_mval[2];
@@ -94,14 +94,14 @@ typedef struct GrabInteraction {
/* -------------------------------------------------------------------- */
static void grab_geom_draw(
- const wmManipulator *mpr, const float color[4], const bool select, const int draw_options)
+ const wmGizmo *mpr, const float color[4], const bool select, const int draw_options)
{
-#ifdef USE_MANIPULATOR_CUSTOM_DIAL
+#ifdef USE_GIZMO_CUSTOM_DIAL
UNUSED_VARS(grab3d, col, axis_modal_mat);
- wm_manipulator_geometryinfo_draw(&wm_manipulator_geom_data_grab3d, select);
+ wm_gizmo_geometryinfo_draw(&wm_gizmo_geom_data_grab3d, select);
#else
const int draw_style = RNA_enum_get(mpr->ptr, "draw_style");
- const bool filled = (draw_options & ED_MANIPULATOR_GRAB_DRAW_FLAG_FILL) != 0;
+ const bool filled = (draw_options & ED_GIZMO_GRAB_DRAW_FLAG_FILL) != 0;
GPU_line_width(mpr->line_width);
@@ -112,7 +112,7 @@ static void grab_geom_draw(
immUniformColor4fv(color);
- if (draw_style == ED_MANIPULATOR_GRAB_STYLE_RING_2D) {
+ if (draw_style == ED_GIZMO_GRAB_STYLE_RING_2D) {
if (filled) {
imm_draw_circle_fill_2d(pos, 0, 0, 1.0f, DIAL_RESOLUTION);
}
@@ -120,7 +120,7 @@ static void grab_geom_draw(
imm_draw_circle_wire_2d(pos, 0, 0, 1.0f, DIAL_RESOLUTION);
}
}
- else if (draw_style == ED_MANIPULATOR_GRAB_STYLE_CROSS_2D) {
+ else if (draw_style == ED_GIZMO_GRAB_STYLE_CROSS_2D) {
immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, 1.0f, 1.0f);
immVertex2f(pos, -1.0f, -1.0f);
@@ -140,7 +140,7 @@ static void grab_geom_draw(
}
static void grab3d_get_translate(
- const wmManipulator *mpr, const wmEvent *event, const ARegion *ar,
+ const wmGizmo *mpr, const wmEvent *event, const ARegion *ar,
float co_delta[3])
{
GrabInteraction *inter = mpr->interaction_data;
@@ -163,18 +163,18 @@ static void grab3d_get_translate(
}
static void grab3d_draw_intern(
- const bContext *C, wmManipulator *mpr,
+ const bContext *C, wmGizmo *mpr,
const bool select, const bool highlight)
{
GrabInteraction *inter = mpr->interaction_data;
const int draw_options = RNA_enum_get(mpr->ptr, "draw_options");
- const bool align_view = (draw_options & ED_MANIPULATOR_GRAB_DRAW_FLAG_ALIGN_VIEW) != 0;
+ const bool align_view = (draw_options & ED_GIZMO_GRAB_DRAW_FLAG_ALIGN_VIEW) != 0;
float color[4];
float matrix_final[4][4];
float matrix_align[4][4];
- manipulator_color_get(mpr, highlight, color);
- WM_manipulator_calc_matrix_final(mpr, matrix_final);
+ gizmo_color_get(mpr, highlight, color);
+ WM_gizmo_calc_matrix_final(mpr, matrix_final);
gpuPushMatrix();
gpuMultMatrix(matrix_final);
@@ -209,16 +209,16 @@ static void grab3d_draw_intern(
}
}
-static void manipulator_grab_draw_select(const bContext *C, wmManipulator *mpr, int select_id)
+static void gizmo_grab_draw_select(const bContext *C, wmGizmo *mpr, int select_id)
{
GPU_select_load_id(select_id);
grab3d_draw_intern(C, mpr, true, false);
}
-static void manipulator_grab_draw(const bContext *C, wmManipulator *mpr)
+static void gizmo_grab_draw(const bContext *C, wmGizmo *mpr)
{
- const bool is_modal = mpr->state & WM_MANIPULATOR_STATE_MODAL;
- const bool is_highlight = (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0;
+ const bool is_modal = mpr->state & WM_GIZMO_STATE_MODAL;
+ const bool is_highlight = (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) != 0;
(void)is_modal;
@@ -227,11 +227,11 @@ static void manipulator_grab_draw(const bContext *C, wmManipulator *mpr)
GPU_blend(false);
}
-static int manipulator_grab_modal(
- bContext *C, wmManipulator *mpr, const wmEvent *event,
- eWM_ManipulatorTweak UNUSED(tweak_flag))
+static int gizmo_grab_modal(
+ bContext *C, wmGizmo *mpr, const wmEvent *event,
+ eWM_GizmoFlagTweak UNUSED(tweak_flag))
{
- GrabManipulator3D *grab = (GrabManipulator3D *)mpr;
+ GrabGizmo3D *grab = (GrabGizmo3D *)mpr;
GrabInteraction *inter = mpr->interaction_data;
ARegion *ar = CTX_wm_region(C);
@@ -241,9 +241,9 @@ static int manipulator_grab_modal(
}
else {
float mval_proj_init[2], mval_proj_curr[2];
- if ((manipulator_window_project_2d(
+ if ((gizmo_window_project_2d(
C, mpr, inter->init_mval, 2, false, mval_proj_init) == false) ||
- (manipulator_window_project_2d(
+ (gizmo_window_project_2d(
C, mpr, (const float[2]){UNPACK2(event->mval)}, 2, false, mval_proj_curr) == false))
{
return OPERATOR_RUNNING_MODAL;
@@ -254,9 +254,9 @@ static int manipulator_grab_modal(
add_v3_v3v3(grab->prop_co, inter->init_prop_co, prop_delta);
/* set the property for the operator and call its modal function */
- wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset");
- if (WM_manipulator_target_property_is_valid(mpr_prop)) {
- WM_manipulator_target_property_value_set_array(C, mpr, mpr_prop, grab->prop_co);
+ wmGizmoProperty *mpr_prop = WM_gizmo_target_property_find(mpr, "offset");
+ if (WM_gizmo_target_property_is_valid(mpr_prop)) {
+ WM_gizmo_target_property_value_set_array(C, mpr, mpr_prop, grab->prop_co);
}
else {
zero_v3(grab->prop_co);
@@ -267,8 +267,8 @@ static int manipulator_grab_modal(
return OPERATOR_RUNNING_MODAL;
}
-static int manipulator_grab_invoke(
- bContext *UNUSED(C), wmManipulator *mpr, const wmEvent *event)
+static int gizmo_grab_invoke(
+ bContext *UNUSED(C), wmGizmo *mpr, const wmEvent *event)
{
GrabInteraction *inter = MEM_callocN(sizeof(GrabInteraction), __func__);
@@ -278,13 +278,13 @@ static int manipulator_grab_invoke(
#if 0
copy_v3_v3(inter->init_prop_co, grab->prop_co);
#else
- wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset");
- if (WM_manipulator_target_property_is_valid(mpr_prop)) {
- WM_manipulator_target_property_value_get_array(mpr, mpr_prop, inter->init_prop_co);
+ wmGizmoProperty *mpr_prop = WM_gizmo_target_property_find(mpr, "offset");
+ if (WM_gizmo_target_property_is_valid(mpr_prop)) {
+ WM_gizmo_target_property_value_get_array(mpr, mpr_prop, inter->init_prop_co);
}
#endif
- WM_manipulator_calc_matrix_final(mpr, inter->init_matrix_final);
+ WM_gizmo_calc_matrix_final(mpr, inter->init_matrix_final);
mpr->interaction_data = inter;
@@ -292,12 +292,12 @@ static int manipulator_grab_invoke(
}
-static int manipulator_grab_test_select(
- bContext *C, wmManipulator *mpr, const wmEvent *event)
+static int gizmo_grab_test_select(
+ bContext *C, wmGizmo *mpr, const wmEvent *event)
{
float point_local[2];
- if (manipulator_window_project_2d(
+ if (gizmo_window_project_2d(
C, mpr, (const float[2]){UNPACK2(event->mval)}, 2, true, point_local) == false)
{
return -1;
@@ -311,65 +311,65 @@ static int manipulator_grab_test_select(
return -1;
}
-static void manipulator_grab_property_update(wmManipulator *mpr, wmManipulatorProperty *mpr_prop)
+static void gizmo_grab_property_update(wmGizmo *mpr, wmGizmoProperty *mpr_prop)
{
- GrabManipulator3D *grab = (GrabManipulator3D *)mpr;
- if (WM_manipulator_target_property_is_valid(mpr_prop)) {
- WM_manipulator_target_property_value_get_array(mpr, mpr_prop, grab->prop_co);
+ GrabGizmo3D *grab = (GrabGizmo3D *)mpr;
+ if (WM_gizmo_target_property_is_valid(mpr_prop)) {
+ WM_gizmo_target_property_value_get_array(mpr, mpr_prop, grab->prop_co);
}
else {
zero_v3(grab->prop_co);
}
}
-static int manipulator_grab_cursor_get(wmManipulator *UNUSED(mpr))
+static int gizmo_grab_cursor_get(wmGizmo *UNUSED(mpr))
{
return BC_NSEW_SCROLLCURSOR;
}
/* -------------------------------------------------------------------- */
-/** \name Grab Manipulator API
+/** \name Grab Gizmo API
*
* \{ */
-static void MANIPULATOR_WT_grab_3d(wmManipulatorType *wt)
+static void GIZMO_WT_grab_3d(wmGizmoType *wt)
{
/* identifiers */
- wt->idname = "MANIPULATOR_WT_grab_3d";
+ wt->idname = "GIZMO_WT_grab_3d";
/* api callbacks */
- wt->draw = manipulator_grab_draw;
- wt->draw_select = manipulator_grab_draw_select;
- wt->test_select = manipulator_grab_test_select;
- wt->matrix_basis_get = manipulator_grab_matrix_basis_get;
- wt->invoke = manipulator_grab_invoke;
- wt->property_update = manipulator_grab_property_update;
- wt->modal = manipulator_grab_modal;
- wt->cursor_get = manipulator_grab_cursor_get;
+ wt->draw = gizmo_grab_draw;
+ wt->draw_select = gizmo_grab_draw_select;
+ wt->test_select = gizmo_grab_test_select;
+ wt->matrix_basis_get = gizmo_grab_matrix_basis_get;
+ wt->invoke = gizmo_grab_invoke;
+ wt->property_update = gizmo_grab_property_update;
+ wt->modal = gizmo_grab_modal;
+ wt->cursor_get = gizmo_grab_cursor_get;
- wt->struct_size = sizeof(GrabManipulator3D);
+ wt->struct_size = sizeof(GrabGizmo3D);
/* rna */
static EnumPropertyItem rna_enum_draw_style[] = {
- {ED_MANIPULATOR_GRAB_STYLE_RING_2D, "RING_2D", 0, "Ring", ""},
- {ED_MANIPULATOR_GRAB_STYLE_CROSS_2D, "CROSS_2D", 0, "Ring", ""},
+ {ED_GIZMO_GRAB_STYLE_RING_2D, "RING_2D", 0, "Ring", ""},
+ {ED_GIZMO_GRAB_STYLE_CROSS_2D, "CROSS_2D", 0, "Ring", ""},
{0, NULL, 0, NULL, NULL}
};
static EnumPropertyItem rna_enum_draw_options[] = {
- {ED_MANIPULATOR_GRAB_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""},
- {ED_MANIPULATOR_GRAB_DRAW_FLAG_ALIGN_VIEW, "ALIGN_VIEW", 0, "Align View", ""},
+ {ED_GIZMO_GRAB_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""},
+ {ED_GIZMO_GRAB_DRAW_FLAG_ALIGN_VIEW, "ALIGN_VIEW", 0, "Align View", ""},
{0, NULL, 0, NULL, NULL}
};
- RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style, ED_MANIPULATOR_GRAB_STYLE_RING_2D, "Draw Style", "");
+ RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style, ED_GIZMO_GRAB_STYLE_RING_2D, "Draw Style", "");
RNA_def_enum_flag(wt->srna, "draw_options", rna_enum_draw_options, 0, "Draw Options", "");
- WM_manipulatortype_target_property_def(wt, "offset", PROP_FLOAT, 3);
+ WM_gizmotype_target_property_def(wt, "offset", PROP_FLOAT, 3);
}
-void ED_manipulatortypes_grab_3d(void)
+void ED_gizmotypes_grab_3d(void)
{
- WM_manipulatortype_append(MANIPULATOR_WT_grab_3d);
+ WM_gizmotype_append(GIZMO_WT_grab_3d);
}
-/** \} */ // Grab Manipulator API
+/** \} */ // Grab Gizmo API
diff --git a/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c
index 1331a4e983f..ff02517dafa 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c
@@ -21,11 +21,11 @@
/** \file primitive3d_gizmo.c
* \ingroup wm
*
- * \name Primitive Manipulator
+ * \name Primitive Gizmo
*
- * 3D Manipulator
+ * 3D Gizmo
*
- * \brief Manipulator with primitive drawing type (plane, cube, etc.).
+ * \brief Gizmo with primitive drawing type (plane, cube, etc.).
* Currently only plane primitive supported without own handling, use with operator only.
*/
@@ -65,13 +65,13 @@ static float verts_plane[4][3] = {
/* -------------------------------------------------------------------- */
-static void manipulator_primitive_draw_geom(
+static void gizmo_primitive_draw_geom(
const float col_inner[4], const float col_outer[4], const int draw_style)
{
float (*verts)[3];
uint vert_count = 0;
- if (draw_style == ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE) {
+ if (draw_style == ED_GIZMO_PRIMITIVE_STYLE_PLANE) {
verts = verts_plane;
vert_count = ARRAY_SIZE(verts_plane);
}
@@ -79,37 +79,37 @@ static void manipulator_primitive_draw_geom(
if (vert_count > 0) {
uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
- wm_manipulator_vec_draw(col_inner, verts, vert_count, pos, GWN_PRIM_TRI_FAN);
- wm_manipulator_vec_draw(col_outer, verts, vert_count, pos, GWN_PRIM_LINE_LOOP);
+ wm_gizmo_vec_draw(col_inner, verts, vert_count, pos, GWN_PRIM_TRI_FAN);
+ wm_gizmo_vec_draw(col_outer, verts, vert_count, pos, GWN_PRIM_LINE_LOOP);
immUnbindProgram();
}
}
-static void manipulator_primitive_draw_intern(
- wmManipulator *mpr, const bool UNUSED(select),
+static void gizmo_primitive_draw_intern(
+ wmGizmo *mpr, const bool UNUSED(select),
const bool highlight)
{
float color_inner[4], color_outer[4];
float matrix_final[4][4];
const int draw_style = RNA_enum_get(mpr->ptr, "draw_style");
- manipulator_color_get(mpr, highlight, color_outer);
+ gizmo_color_get(mpr, highlight, color_outer);
copy_v4_v4(color_inner, color_outer);
color_inner[3] *= 0.5f;
- WM_manipulator_calc_matrix_final(mpr, matrix_final);
+ WM_gizmo_calc_matrix_final(mpr, matrix_final);
gpuPushMatrix();
gpuMultMatrix(matrix_final);
GPU_blend(true);
- manipulator_primitive_draw_geom(color_inner, color_outer, draw_style);
+ gizmo_primitive_draw_geom(color_inner, color_outer, draw_style);
GPU_blend(false);
gpuPopMatrix();
if (mpr->interaction_data) {
- ManipulatorInteraction *inter = mpr->interaction_data;
+ GizmoInteraction *inter = mpr->interaction_data;
copy_v4_fl(color_inner, 0.5f);
copy_v3_fl(color_outer, 0.5f);
@@ -119,39 +119,39 @@ static void manipulator_primitive_draw_intern(
gpuMultMatrix(inter->init_matrix_final);
GPU_blend(true);
- manipulator_primitive_draw_geom(color_inner, color_outer, draw_style);
+ gizmo_primitive_draw_geom(color_inner, color_outer, draw_style);
GPU_blend(false);
gpuPopMatrix();
}
}
-static void manipulator_primitive_draw_select(
- const bContext *UNUSED(C), wmManipulator *mpr,
+static void gizmo_primitive_draw_select(
+ const bContext *UNUSED(C), wmGizmo *mpr,
int select_id)
{
GPU_select_load_id(select_id);
- manipulator_primitive_draw_intern(mpr, true, false);
+ gizmo_primitive_draw_intern(mpr, true, false);
}
-static void manipulator_primitive_draw(const bContext *UNUSED(C), wmManipulator *mpr)
+static void gizmo_primitive_draw(const bContext *UNUSED(C), wmGizmo *mpr)
{
- manipulator_primitive_draw_intern(
+ gizmo_primitive_draw_intern(
mpr, false,
- (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT));
+ (mpr->state & WM_GIZMO_STATE_HIGHLIGHT));
}
-static void manipulator_primitive_setup(wmManipulator *mpr)
+static void gizmo_primitive_setup(wmGizmo *mpr)
{
- mpr->flag |= WM_MANIPULATOR_DRAW_MODAL;
+ mpr->flag |= WM_GIZMO_DRAW_MODAL;
}
-static int manipulator_primitive_invoke(
- bContext *UNUSED(C), wmManipulator *mpr, const wmEvent *UNUSED(event))
+static int gizmo_primitive_invoke(
+ bContext *UNUSED(C), wmGizmo *mpr, const wmEvent *UNUSED(event))
{
- ManipulatorInteraction *inter = MEM_callocN(sizeof(ManipulatorInteraction), __func__);
+ GizmoInteraction *inter = MEM_callocN(sizeof(GizmoInteraction), __func__);
- WM_manipulator_calc_matrix_final(mpr, inter->init_matrix_final);
+ WM_gizmo_calc_matrix_final(mpr, inter->init_matrix_final);
mpr->interaction_data = inter;
@@ -159,33 +159,33 @@ static int manipulator_primitive_invoke(
}
/* -------------------------------------------------------------------- */
-/** \name Primitive Manipulator API
+/** \name Primitive Gizmo API
*
* \{ */
-static void MANIPULATOR_WT_primitive_3d(wmManipulatorType *wt)
+static void GIZMO_WT_primitive_3d(wmGizmoType *wt)
{
/* identifiers */
- wt->idname = "MANIPULATOR_WT_primitive_3d";
+ wt->idname = "GIZMO_WT_primitive_3d";
/* api callbacks */
- wt->draw = manipulator_primitive_draw;
- wt->draw_select = manipulator_primitive_draw_select;
- wt->setup = manipulator_primitive_setup;
- wt->invoke = manipulator_primitive_invoke;
+ wt->draw = gizmo_primitive_draw;
+ wt->draw_select = gizmo_primitive_draw_select;
+ wt->setup = gizmo_primitive_setup;
+ wt->invoke = gizmo_primitive_invoke;
- wt->struct_size = sizeof(wmManipulator);
+ wt->struct_size = sizeof(wmGizmo);
static EnumPropertyItem rna_enum_draw_style[] = {
- {ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE, "PLANE", 0, "Plane", ""},
+ {ED_GIZMO_PRIMITIVE_STYLE_PLANE, "PLANE", 0, "Plane", ""},
{0, NULL, 0, NULL, NULL}
};
- RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style, ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE, "Draw Style", "");
+ RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style, ED_GIZMO_PRIMITIVE_STYLE_PLANE, "Draw Style", "");
}
-void ED_manipulatortypes_primitive_3d(void)
+void ED_gizmotypes_primitive_3d(void)
{
- WM_manipulatortype_append(MANIPULATOR_WT_primitive_3d);
+ WM_gizmotype_append(GIZMO_WT_primitive_3d);
}
/** \} */