UI: rename Translate/Grab to Move in UI, shortcuts stay the same.
This commit is contained in:
parent
32ef77bf0a
commit
f1c8c25a3e
@ -489,7 +489,7 @@ class DOPESHEET_MT_key_transform(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("transform.transform", text="Grab/Move").mode = 'TIME_TRANSLATE'
|
||||
layout.operator("transform.transform", text="Move").mode = 'TIME_TRANSLATE'
|
||||
layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
|
||||
layout.operator("transform.transform", text="Slide").mode = 'TIME_SLIDE'
|
||||
layout.operator("transform.transform", text="Scale").mode = 'TIME_SCALE'
|
||||
|
@ -306,7 +306,7 @@ class GRAPH_MT_key_transform(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("transform.translate", text="Grab/Move")
|
||||
layout.operator("transform.translate", text="Move")
|
||||
layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
|
||||
layout.operator("transform.rotate", text="Rotate")
|
||||
layout.operator("transform.resize", text="Scale")
|
||||
|
@ -228,7 +228,7 @@ class NLA_MT_edit_transform(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("transform.translate", text="Grab/Move")
|
||||
layout.operator("transform.translate", text="Move")
|
||||
layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
|
||||
layout.operator("transform.transform", text="Scale").mode = 'TIME_SCALE'
|
||||
|
||||
|
@ -389,8 +389,8 @@ class SEQUENCER_MT_strip_transform(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("transform.transform", text="Grab/Move").mode = 'TRANSLATION'
|
||||
layout.operator("transform.transform", text="Grab/Extend from Frame").mode = 'TIME_EXTEND'
|
||||
layout.operator("transform.transform", text="Move").mode = 'TRANSLATION'
|
||||
layout.operator("transform.transform", text="Move/Extend from Frame").mode = 'TIME_EXTEND'
|
||||
layout.operator("sequencer.slip", text="Slip Strip Contents")
|
||||
|
||||
layout.separator()
|
||||
|
@ -196,7 +196,7 @@ def marker_menu_generic(layout):
|
||||
layout.separator()
|
||||
|
||||
layout.operator("marker.rename", text="Rename Marker")
|
||||
layout.operator("marker.move", text="Grab/Move Marker")
|
||||
layout.operator("marker.move", text="Move Marker")
|
||||
|
||||
layout.separator()
|
||||
|
||||
|
@ -304,7 +304,7 @@ class _defs_transform:
|
||||
layout.prop(tool_settings, "use_gizmo_apron")
|
||||
|
||||
return dict(
|
||||
text="Grab",
|
||||
text="Move",
|
||||
# cursor='SCROLL_XY',
|
||||
icon="ops.transform.translate",
|
||||
widget="TRANSFORM_GGT_gizmo",
|
||||
|
@ -114,20 +114,20 @@ class SelectSideOfPlaneGizmoGroup(GizmoGroup):
|
||||
from mathutils import Matrix, Vector
|
||||
|
||||
# ----
|
||||
# Grab
|
||||
# Move
|
||||
|
||||
def grab_get_cb():
|
||||
def move_get_cb():
|
||||
op = SelectSideOfPlaneGizmoGroup.my_target_operator(context)
|
||||
return op.plane_co
|
||||
|
||||
def grab_set_cb(value):
|
||||
def move_set_cb(value):
|
||||
op = SelectSideOfPlaneGizmoGroup.my_target_operator(context)
|
||||
op.plane_co = value
|
||||
# XXX, this may change!
|
||||
op.execute(context)
|
||||
|
||||
mpr = self.gizmos.new("GIZMO_GT_grab_3d")
|
||||
mpr.target_set_handler("offset", get=grab_get_cb, set=grab_set_cb)
|
||||
mpr = self.gizmos.new("GIZMO_GT_move_3d")
|
||||
mpr.target_set_handler("offset", get=move_get_cb, set=move_set_cb)
|
||||
|
||||
mpr.use_draw_value = True
|
||||
|
||||
@ -139,7 +139,7 @@ class SelectSideOfPlaneGizmoGroup(GizmoGroup):
|
||||
|
||||
mpr.scale_basis = 0.2
|
||||
|
||||
self.widget_grab = mpr
|
||||
self.widget_move = mpr
|
||||
|
||||
# ----
|
||||
# Dial
|
||||
@ -189,12 +189,12 @@ class SelectSideOfPlaneGizmoGroup(GizmoGroup):
|
||||
co = Vector(op.plane_co)
|
||||
no = Vector(op.plane_no).normalized()
|
||||
|
||||
# Grab
|
||||
# Move
|
||||
no_z = no
|
||||
no_y = no_z.orthogonal()
|
||||
no_x = no_z.cross(no_y)
|
||||
|
||||
matrix = self.widget_grab.matrix_basis
|
||||
matrix = self.widget_move.matrix_basis
|
||||
matrix.identity()
|
||||
matrix.col[0].xyz = no_x
|
||||
matrix.col[1].xyz = no_y
|
||||
|
@ -52,7 +52,7 @@ set(SRC
|
||||
gizmo_types/cage2d_gizmo.c
|
||||
gizmo_types/cage3d_gizmo.c
|
||||
gizmo_types/dial3d_gizmo.c
|
||||
gizmo_types/grab3d_gizmo.c
|
||||
gizmo_types/move3d_gizmo.c
|
||||
gizmo_types/primitive3d_gizmo.c
|
||||
)
|
||||
|
||||
|
@ -1071,7 +1071,7 @@ static void GIZMO_GT_cage_2d(wmGizmoType *gzt)
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
static EnumPropertyItem rna_enum_transform[] = {
|
||||
{ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Translate", ""},
|
||||
{ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Move", ""},
|
||||
{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", ""},
|
||||
|
@ -664,7 +664,7 @@ static void GIZMO_GT_cage_3d(wmGizmoType *gzt)
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
static EnumPropertyItem rna_enum_transform[] = {
|
||||
{ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Translate", ""},
|
||||
{ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Move", ""},
|
||||
{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}
|
||||
|
@ -18,14 +18,14 @@
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/** \file grab3d_gizmo.c
|
||||
/** \file move3d_gizmo.c
|
||||
* \ingroup wm
|
||||
*
|
||||
* \name Grab Gizmo
|
||||
* \name Move Gizmo
|
||||
*
|
||||
* 3D Gizmo, also works in 2D views.
|
||||
*
|
||||
* \brief Simple gizmo to grab and translate.
|
||||
* \brief Simple gizmo to move and translate.
|
||||
*
|
||||
* - `matrix[0]` is derived from Y and Z.
|
||||
* - `matrix[1]` currently not used.
|
||||
@ -62,46 +62,46 @@
|
||||
#include "../gizmo_geometry.h"
|
||||
#include "../gizmo_library_intern.h"
|
||||
|
||||
typedef struct GrabGizmo3D {
|
||||
typedef struct MoveGizmo3D {
|
||||
wmGizmo gizmo;
|
||||
/* Added to 'matrix_basis' when calculating the matrix. */
|
||||
float prop_co[3];
|
||||
} GrabGizmo3D;
|
||||
} MoveGizmo3D;
|
||||
|
||||
static void gizmo_grab_matrix_basis_get(const wmGizmo *gz, float r_matrix[4][4])
|
||||
static void gizmo_move_matrix_basis_get(const wmGizmo *gz, float r_matrix[4][4])
|
||||
{
|
||||
GrabGizmo3D *grab = (GrabGizmo3D *)gz;
|
||||
MoveGizmo3D *move = (MoveGizmo3D *)gz;
|
||||
|
||||
copy_m4_m4(r_matrix, grab->gizmo.matrix_basis);
|
||||
add_v3_v3(r_matrix[3], grab->prop_co);
|
||||
copy_m4_m4(r_matrix, move->gizmo.matrix_basis);
|
||||
add_v3_v3(r_matrix[3], move->prop_co);
|
||||
}
|
||||
|
||||
static int gizmo_grab_modal(
|
||||
static int gizmo_move_modal(
|
||||
bContext *C, wmGizmo *gz, const wmEvent *event,
|
||||
eWM_GizmoFlagTweak tweak_flag);
|
||||
|
||||
typedef struct GrabInteraction {
|
||||
typedef struct MoveInteraction {
|
||||
float init_mval[2];
|
||||
|
||||
/* only for when using properties */
|
||||
float init_prop_co[3];
|
||||
|
||||
float init_matrix_final[4][4];
|
||||
} GrabInteraction;
|
||||
} MoveInteraction;
|
||||
|
||||
#define DIAL_RESOLUTION 32
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
static void grab_geom_draw(
|
||||
static void move_geom_draw(
|
||||
const wmGizmo *gz, const float color[4], const bool select, const int draw_options)
|
||||
{
|
||||
#ifdef USE_GIZMO_CUSTOM_DIAL
|
||||
UNUSED_VARS(grab3d, col, axis_modal_mat);
|
||||
wm_gizmo_geometryinfo_draw(&wm_gizmo_geom_data_grab3d, select);
|
||||
UNUSED_VARS(move3d, col, axis_modal_mat);
|
||||
wm_gizmo_geometryinfo_draw(&wm_gizmo_geom_data_move3d, select);
|
||||
#else
|
||||
const int draw_style = RNA_enum_get(gz->ptr, "draw_style");
|
||||
const bool filled = (draw_options & ED_GIZMO_GRAB_DRAW_FLAG_FILL) != 0;
|
||||
const bool filled = (draw_options & ED_GIZMO_MOVE_DRAW_FLAG_FILL) != 0;
|
||||
|
||||
GPU_line_width(gz->line_width);
|
||||
|
||||
@ -112,7 +112,7 @@ static void grab_geom_draw(
|
||||
|
||||
immUniformColor4fv(color);
|
||||
|
||||
if (draw_style == ED_GIZMO_GRAB_STYLE_RING_2D) {
|
||||
if (draw_style == ED_GIZMO_MOVE_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_GIZMO_GRAB_STYLE_CROSS_2D) {
|
||||
else if (draw_style == ED_GIZMO_MOVE_STYLE_CROSS_2D) {
|
||||
immBegin(GPU_PRIM_LINES, 4);
|
||||
immVertex2f(pos, 1.0f, 1.0f);
|
||||
immVertex2f(pos, -1.0f, -1.0f);
|
||||
@ -139,11 +139,11 @@ static void grab_geom_draw(
|
||||
#endif
|
||||
}
|
||||
|
||||
static void grab3d_get_translate(
|
||||
static void move3d_get_translate(
|
||||
const wmGizmo *gz, const wmEvent *event, const ARegion *ar,
|
||||
float co_delta[3])
|
||||
{
|
||||
GrabInteraction *inter = gz->interaction_data;
|
||||
MoveInteraction *inter = gz->interaction_data;
|
||||
const float mval_delta[2] = {
|
||||
event->mval[0] - inter->init_mval[0],
|
||||
event->mval[1] - inter->init_mval[1],
|
||||
@ -162,13 +162,13 @@ static void grab3d_get_translate(
|
||||
mul_m3_v3(matrix_space_inv, co_delta);
|
||||
}
|
||||
|
||||
static void grab3d_draw_intern(
|
||||
static void move3d_draw_intern(
|
||||
const bContext *C, wmGizmo *gz,
|
||||
const bool select, const bool highlight)
|
||||
{
|
||||
GrabInteraction *inter = gz->interaction_data;
|
||||
MoveInteraction *inter = gz->interaction_data;
|
||||
const int draw_options = RNA_enum_get(gz->ptr, "draw_options");
|
||||
const bool align_view = (draw_options & ED_GIZMO_GRAB_DRAW_FLAG_ALIGN_VIEW) != 0;
|
||||
const bool align_view = (draw_options & ED_GIZMO_MOVE_DRAW_FLAG_ALIGN_VIEW) != 0;
|
||||
float color[4];
|
||||
float matrix_final[4][4];
|
||||
float matrix_align[4][4];
|
||||
@ -190,7 +190,7 @@ static void grab3d_draw_intern(
|
||||
}
|
||||
|
||||
GPU_blend(true);
|
||||
grab_geom_draw(gz, color, select, draw_options);
|
||||
move_geom_draw(gz, color, select, draw_options);
|
||||
GPU_blend(false);
|
||||
GPU_matrix_pop();
|
||||
|
||||
@ -203,19 +203,19 @@ static void grab3d_draw_intern(
|
||||
}
|
||||
|
||||
GPU_blend(true);
|
||||
grab_geom_draw(gz, (const float[4]){0.5f, 0.5f, 0.5f, 0.5f}, select, draw_options);
|
||||
move_geom_draw(gz, (const float[4]){0.5f, 0.5f, 0.5f, 0.5f}, select, draw_options);
|
||||
GPU_blend(false);
|
||||
GPU_matrix_pop();
|
||||
}
|
||||
}
|
||||
|
||||
static void gizmo_grab_draw_select(const bContext *C, wmGizmo *gz, int select_id)
|
||||
static void gizmo_move_draw_select(const bContext *C, wmGizmo *gz, int select_id)
|
||||
{
|
||||
GPU_select_load_id(select_id);
|
||||
grab3d_draw_intern(C, gz, true, false);
|
||||
move3d_draw_intern(C, gz, true, false);
|
||||
}
|
||||
|
||||
static void gizmo_grab_draw(const bContext *C, wmGizmo *gz)
|
||||
static void gizmo_move_draw(const bContext *C, wmGizmo *gz)
|
||||
{
|
||||
const bool is_modal = gz->state & WM_GIZMO_STATE_MODAL;
|
||||
const bool is_highlight = (gz->state & WM_GIZMO_STATE_HIGHLIGHT) != 0;
|
||||
@ -223,21 +223,21 @@ static void gizmo_grab_draw(const bContext *C, wmGizmo *gz)
|
||||
(void)is_modal;
|
||||
|
||||
GPU_blend(true);
|
||||
grab3d_draw_intern(C, gz, false, is_highlight);
|
||||
move3d_draw_intern(C, gz, false, is_highlight);
|
||||
GPU_blend(false);
|
||||
}
|
||||
|
||||
static int gizmo_grab_modal(
|
||||
static int gizmo_move_modal(
|
||||
bContext *C, wmGizmo *gz, const wmEvent *event,
|
||||
eWM_GizmoFlagTweak UNUSED(tweak_flag))
|
||||
{
|
||||
GrabGizmo3D *grab = (GrabGizmo3D *)gz;
|
||||
GrabInteraction *inter = gz->interaction_data;
|
||||
MoveGizmo3D *move = (MoveGizmo3D *)gz;
|
||||
MoveInteraction *inter = gz->interaction_data;
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
|
||||
float prop_delta[3];
|
||||
if (CTX_wm_area(C)->spacetype == SPACE_VIEW3D) {
|
||||
grab3d_get_translate(gz, event, ar, prop_delta);
|
||||
move3d_get_translate(gz, event, ar, prop_delta);
|
||||
}
|
||||
else {
|
||||
float mval_proj_init[2], mval_proj_curr[2];
|
||||
@ -251,15 +251,15 @@ static int gizmo_grab_modal(
|
||||
sub_v2_v2v2(prop_delta, mval_proj_curr, mval_proj_init);
|
||||
prop_delta[2] = 0.0f;
|
||||
}
|
||||
add_v3_v3v3(grab->prop_co, inter->init_prop_co, prop_delta);
|
||||
add_v3_v3v3(move->prop_co, inter->init_prop_co, prop_delta);
|
||||
|
||||
/* set the property for the operator and call its modal function */
|
||||
wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
|
||||
if (WM_gizmo_target_property_is_valid(gz_prop)) {
|
||||
WM_gizmo_target_property_float_set_array(C, gz, gz_prop, grab->prop_co);
|
||||
WM_gizmo_target_property_float_set_array(C, gz, gz_prop, move->prop_co);
|
||||
}
|
||||
else {
|
||||
zero_v3(grab->prop_co);
|
||||
zero_v3(move->prop_co);
|
||||
}
|
||||
|
||||
ED_region_tag_redraw(ar);
|
||||
@ -267,16 +267,16 @@ static int gizmo_grab_modal(
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
|
||||
static int gizmo_grab_invoke(
|
||||
static int gizmo_move_invoke(
|
||||
bContext *UNUSED(C), wmGizmo *gz, const wmEvent *event)
|
||||
{
|
||||
GrabInteraction *inter = MEM_callocN(sizeof(GrabInteraction), __func__);
|
||||
MoveInteraction *inter = MEM_callocN(sizeof(MoveInteraction), __func__);
|
||||
|
||||
inter->init_mval[0] = event->mval[0];
|
||||
inter->init_mval[1] = event->mval[1];
|
||||
|
||||
#if 0
|
||||
copy_v3_v3(inter->init_prop_co, grab->prop_co);
|
||||
copy_v3_v3(inter->init_prop_co, move->prop_co);
|
||||
#else
|
||||
wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
|
||||
if (WM_gizmo_target_property_is_valid(gz_prop)) {
|
||||
@ -292,7 +292,7 @@ static int gizmo_grab_invoke(
|
||||
}
|
||||
|
||||
|
||||
static int gizmo_grab_test_select(
|
||||
static int gizmo_move_test_select(
|
||||
bContext *C, wmGizmo *gz, const int mval[2])
|
||||
{
|
||||
float point_local[2];
|
||||
@ -311,65 +311,65 @@ static int gizmo_grab_test_select(
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void gizmo_grab_property_update(wmGizmo *gz, wmGizmoProperty *gz_prop)
|
||||
static void gizmo_move_property_update(wmGizmo *gz, wmGizmoProperty *gz_prop)
|
||||
{
|
||||
GrabGizmo3D *grab = (GrabGizmo3D *)gz;
|
||||
MoveGizmo3D *move = (MoveGizmo3D *)gz;
|
||||
if (WM_gizmo_target_property_is_valid(gz_prop)) {
|
||||
WM_gizmo_target_property_float_get_array(gz, gz_prop, grab->prop_co);
|
||||
WM_gizmo_target_property_float_get_array(gz, gz_prop, move->prop_co);
|
||||
}
|
||||
else {
|
||||
zero_v3(grab->prop_co);
|
||||
zero_v3(move->prop_co);
|
||||
}
|
||||
}
|
||||
|
||||
static int gizmo_grab_cursor_get(wmGizmo *UNUSED(gz))
|
||||
static int gizmo_move_cursor_get(wmGizmo *UNUSED(gz))
|
||||
{
|
||||
return BC_NSEW_SCROLLCURSOR;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Grab Gizmo API
|
||||
/** \name Move Gizmo API
|
||||
*
|
||||
* \{ */
|
||||
|
||||
static void GIZMO_GT_grab_3d(wmGizmoType *gzt)
|
||||
static void GIZMO_GT_move_3d(wmGizmoType *gzt)
|
||||
{
|
||||
/* identifiers */
|
||||
gzt->idname = "GIZMO_GT_grab_3d";
|
||||
gzt->idname = "GIZMO_GT_move_3d";
|
||||
|
||||
/* api callbacks */
|
||||
gzt->draw = gizmo_grab_draw;
|
||||
gzt->draw_select = gizmo_grab_draw_select;
|
||||
gzt->test_select = gizmo_grab_test_select;
|
||||
gzt->matrix_basis_get = gizmo_grab_matrix_basis_get;
|
||||
gzt->invoke = gizmo_grab_invoke;
|
||||
gzt->property_update = gizmo_grab_property_update;
|
||||
gzt->modal = gizmo_grab_modal;
|
||||
gzt->cursor_get = gizmo_grab_cursor_get;
|
||||
gzt->draw = gizmo_move_draw;
|
||||
gzt->draw_select = gizmo_move_draw_select;
|
||||
gzt->test_select = gizmo_move_test_select;
|
||||
gzt->matrix_basis_get = gizmo_move_matrix_basis_get;
|
||||
gzt->invoke = gizmo_move_invoke;
|
||||
gzt->property_update = gizmo_move_property_update;
|
||||
gzt->modal = gizmo_move_modal;
|
||||
gzt->cursor_get = gizmo_move_cursor_get;
|
||||
|
||||
gzt->struct_size = sizeof(GrabGizmo3D);
|
||||
gzt->struct_size = sizeof(MoveGizmo3D);
|
||||
|
||||
/* rna */
|
||||
static EnumPropertyItem rna_enum_draw_style[] = {
|
||||
{ED_GIZMO_GRAB_STYLE_RING_2D, "RING_2D", 0, "Ring", ""},
|
||||
{ED_GIZMO_GRAB_STYLE_CROSS_2D, "CROSS_2D", 0, "Ring", ""},
|
||||
{ED_GIZMO_MOVE_STYLE_RING_2D, "RING_2D", 0, "Ring", ""},
|
||||
{ED_GIZMO_MOVE_STYLE_CROSS_2D, "CROSS_2D", 0, "Ring", ""},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
static EnumPropertyItem rna_enum_draw_options[] = {
|
||||
{ED_GIZMO_GRAB_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""},
|
||||
{ED_GIZMO_GRAB_DRAW_FLAG_ALIGN_VIEW, "ALIGN_VIEW", 0, "Align View", ""},
|
||||
{ED_GIZMO_MOVE_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""},
|
||||
{ED_GIZMO_MOVE_DRAW_FLAG_ALIGN_VIEW, "ALIGN_VIEW", 0, "Align View", ""},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
RNA_def_enum(gzt->srna, "draw_style", rna_enum_draw_style, ED_GIZMO_GRAB_STYLE_RING_2D, "Draw Style", "");
|
||||
RNA_def_enum(gzt->srna, "draw_style", rna_enum_draw_style, ED_GIZMO_MOVE_STYLE_RING_2D, "Draw Style", "");
|
||||
RNA_def_enum_flag(gzt->srna, "draw_options", rna_enum_draw_options, 0, "Draw Options", "");
|
||||
|
||||
WM_gizmotype_target_property_def(gzt, "offset", PROP_FLOAT, 3);
|
||||
}
|
||||
|
||||
void ED_gizmotypes_grab_3d(void)
|
||||
void ED_gizmotypes_move_3d(void)
|
||||
{
|
||||
WM_gizmotype_append(GIZMO_GT_grab_3d);
|
||||
WM_gizmotype_append(GIZMO_GT_move_3d);
|
||||
}
|
||||
|
||||
/** \} */ // Grab Gizmo API
|
||||
/** \} */ // Move Gizmo API
|
@ -37,7 +37,7 @@ void ED_gizmotypes_button_2d(void);
|
||||
void ED_gizmotypes_cage_2d(void);
|
||||
void ED_gizmotypes_cage_3d(void);
|
||||
void ED_gizmotypes_dial_3d(void);
|
||||
void ED_gizmotypes_grab_3d(void);
|
||||
void ED_gizmotypes_move_3d(void);
|
||||
void ED_gizmotypes_facemap_3d(void);
|
||||
void ED_gizmotypes_preselect_3d(void);
|
||||
void ED_gizmotypes_primitive_3d(void);
|
||||
@ -189,19 +189,19 @@ enum {
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Grab Gizmo */
|
||||
/* Move Gizmo */
|
||||
|
||||
/* draw_options */
|
||||
enum {
|
||||
ED_GIZMO_GRAB_DRAW_FLAG_NOP = 0,
|
||||
ED_GIZMO_MOVE_DRAW_FLAG_NOP = 0,
|
||||
/* only for solid shapes */
|
||||
ED_GIZMO_GRAB_DRAW_FLAG_FILL = (1 << 0),
|
||||
ED_GIZMO_GRAB_DRAW_FLAG_ALIGN_VIEW = (1 << 1),
|
||||
ED_GIZMO_MOVE_DRAW_FLAG_FILL = (1 << 0),
|
||||
ED_GIZMO_MOVE_DRAW_FLAG_ALIGN_VIEW = (1 << 1),
|
||||
};
|
||||
|
||||
enum {
|
||||
ED_GIZMO_GRAB_STYLE_RING_2D = 0,
|
||||
ED_GIZMO_GRAB_STYLE_CROSS_2D = 1,
|
||||
ED_GIZMO_MOVE_STYLE_RING_2D = 0,
|
||||
ED_GIZMO_MOVE_STYLE_CROSS_2D = 1,
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@ -662,11 +662,11 @@ static void gizmo_mesh_bisect_setup(const bContext *C, wmGizmoGroup *gzgroup)
|
||||
gzgroup->customdata = man;
|
||||
|
||||
const wmGizmoType *gzt_arrow = WM_gizmotype_find("GIZMO_GT_arrow_3d", true);
|
||||
const wmGizmoType *gzt_grab = WM_gizmotype_find("GIZMO_GT_grab_3d", true);
|
||||
const wmGizmoType *gzt_move = WM_gizmotype_find("GIZMO_GT_move_3d", true);
|
||||
const wmGizmoType *gzt_dial = WM_gizmotype_find("GIZMO_GT_dial_3d", true);
|
||||
|
||||
man->translate_z = WM_gizmo_new_ptr(gzt_arrow, gzgroup, NULL);
|
||||
man->translate_c = WM_gizmo_new_ptr(gzt_grab, gzgroup, NULL);
|
||||
man->translate_c = WM_gizmo_new_ptr(gzt_move, gzgroup, NULL);
|
||||
man->rotate_c = WM_gizmo_new_ptr(gzt_dial, gzgroup, NULL);
|
||||
|
||||
UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, man->translate_z->color);
|
||||
@ -674,7 +674,7 @@ static void gizmo_mesh_bisect_setup(const bContext *C, wmGizmoGroup *gzgroup)
|
||||
UI_GetThemeColor3fv(TH_GIZMO_SECONDARY, man->rotate_c->color);
|
||||
|
||||
RNA_enum_set(man->translate_z->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_NORMAL);
|
||||
RNA_enum_set(man->translate_c->ptr, "draw_style", ED_GIZMO_GRAB_STYLE_RING_2D);
|
||||
RNA_enum_set(man->translate_c->ptr, "draw_style", ED_GIZMO_MOVE_STYLE_RING_2D);
|
||||
|
||||
WM_gizmo_set_flag(man->translate_c, WM_GIZMO_DRAW_VALUE, true);
|
||||
WM_gizmo_set_flag(man->rotate_c, WM_GIZMO_DRAW_VALUE, true);
|
||||
|
@ -437,11 +437,11 @@ static void gizmo_mesh_extrude_setup(const bContext *UNUSED(C), wmGizmoGroup *gz
|
||||
gzgroup->customdata = man;
|
||||
|
||||
const wmGizmoType *gzt_arrow = WM_gizmotype_find("GIZMO_GT_arrow_3d", true);
|
||||
const wmGizmoType *gzt_grab = WM_gizmotype_find("GIZMO_GT_button_2d", true);
|
||||
const wmGizmoType *gzt_move = WM_gizmotype_find("GIZMO_GT_button_2d", true);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
man->adjust_xyz_no[i] = WM_gizmo_new_ptr(gzt_arrow, gzgroup, NULL);
|
||||
man->invoke_xyz_no[i] = WM_gizmo_new_ptr(gzt_grab, gzgroup, NULL);
|
||||
man->invoke_xyz_no[i] = WM_gizmo_new_ptr(gzt_move, gzgroup, NULL);
|
||||
man->invoke_xyz_no[i]->flag |= WM_GIZMO_DRAW_OFFSET_SCALE;
|
||||
}
|
||||
|
||||
|
@ -328,11 +328,11 @@ static void gizmo_mesh_spin_setup(const bContext *C, wmGizmoGroup *gzgroup)
|
||||
gzgroup->customdata = man;
|
||||
|
||||
const wmGizmoType *gzt_arrow = WM_gizmotype_find("GIZMO_GT_arrow_3d", true);
|
||||
const wmGizmoType *gzt_grab = WM_gizmotype_find("GIZMO_GT_grab_3d", true);
|
||||
const wmGizmoType *gzt_move = WM_gizmotype_find("GIZMO_GT_move_3d", true);
|
||||
const wmGizmoType *gzt_dial = WM_gizmotype_find("GIZMO_GT_dial_3d", true);
|
||||
|
||||
man->translate_z = WM_gizmo_new_ptr(gzt_arrow, gzgroup, NULL);
|
||||
man->translate_c = WM_gizmo_new_ptr(gzt_grab, gzgroup, NULL);
|
||||
man->translate_c = WM_gizmo_new_ptr(gzt_move, gzgroup, NULL);
|
||||
man->rotate_c = WM_gizmo_new_ptr(gzt_dial, gzgroup, NULL);
|
||||
man->angle_z = WM_gizmo_new_ptr(gzt_dial, gzgroup, NULL);
|
||||
|
||||
@ -343,7 +343,7 @@ static void gizmo_mesh_spin_setup(const bContext *C, wmGizmoGroup *gzgroup)
|
||||
|
||||
|
||||
RNA_enum_set(man->translate_z->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_NORMAL);
|
||||
RNA_enum_set(man->translate_c->ptr, "draw_style", ED_GIZMO_GRAB_STYLE_RING_2D);
|
||||
RNA_enum_set(man->translate_c->ptr, "draw_style", ED_GIZMO_MOVE_STYLE_RING_2D);
|
||||
|
||||
WM_gizmo_set_flag(man->translate_c, WM_GIZMO_DRAW_VALUE, true);
|
||||
WM_gizmo_set_flag(man->rotate_c, WM_GIZMO_DRAW_VALUE, true);
|
||||
|
@ -132,7 +132,7 @@ void ED_spacetypes_init(void)
|
||||
/* gizmo types */
|
||||
ED_gizmotypes_button_2d();
|
||||
ED_gizmotypes_dial_3d();
|
||||
ED_gizmotypes_grab_3d();
|
||||
ED_gizmotypes_move_3d();
|
||||
ED_gizmotypes_arrow_2d();
|
||||
ED_gizmotypes_arrow_3d();
|
||||
ED_gizmotypes_preselect_3d();
|
||||
|
@ -431,10 +431,10 @@ static void WIDGETGROUP_node_sbeam_setup(const bContext *UNUSED(C), wmGizmoGroup
|
||||
{
|
||||
struct NodeSunBeamsWidgetGroup *sbeam_group = MEM_mallocN(sizeof(struct NodeSunBeamsWidgetGroup), __func__);
|
||||
|
||||
sbeam_group->gizmo = WM_gizmo_new("GIZMO_GT_grab_3d", gzgroup, NULL);
|
||||
sbeam_group->gizmo = WM_gizmo_new("GIZMO_GT_move_3d", gzgroup, NULL);
|
||||
wmGizmo *gz = sbeam_group->gizmo;
|
||||
|
||||
RNA_enum_set(gz->ptr, "draw_style", ED_GIZMO_GRAB_STYLE_CROSS_2D);
|
||||
RNA_enum_set(gz->ptr, "draw_style", ED_GIZMO_MOVE_STYLE_CROSS_2D);
|
||||
|
||||
gz->scale_basis = 0.05f;
|
||||
|
||||
@ -535,13 +535,13 @@ static bool WIDGETGROUP_node_corner_pin_poll(const bContext *C, wmGizmoGroupType
|
||||
static void WIDGETGROUP_node_corner_pin_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
|
||||
{
|
||||
struct NodeCornerPinWidgetGroup *cpin_group = MEM_mallocN(sizeof(struct NodeCornerPinWidgetGroup), __func__);
|
||||
const wmGizmoType *gzt_grab_3d = WM_gizmotype_find("GIZMO_GT_grab_3d", false);
|
||||
const wmGizmoType *gzt_move_3d = WM_gizmotype_find("GIZMO_GT_move_3d", false);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
cpin_group->gizmos[i] = WM_gizmo_new_ptr(gzt_grab_3d, gzgroup, NULL);
|
||||
cpin_group->gizmos[i] = WM_gizmo_new_ptr(gzt_move_3d, gzgroup, NULL);
|
||||
wmGizmo *gz = cpin_group->gizmos[i];
|
||||
|
||||
RNA_enum_set(gz->ptr, "draw_style", ED_GIZMO_GRAB_STYLE_CROSS_2D);
|
||||
RNA_enum_set(gz->ptr, "draw_style", ED_GIZMO_MOVE_STYLE_CROSS_2D);
|
||||
|
||||
gz->scale_basis = 0.01f;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ static void WIDGETGROUP_armature_spline_setup(const bContext *C, wmGizmoGroup *g
|
||||
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
|
||||
bPoseChannel *pchan = BKE_pose_channel_active(ob);
|
||||
|
||||
const wmGizmoType *gzt_grab = WM_gizmotype_find("GIZMO_GT_grab_3d", true);
|
||||
const wmGizmoType *gzt_move = WM_gizmotype_find("GIZMO_GT_move_3d", true);
|
||||
|
||||
struct BoneSplineWidgetGroup *bspline_group = MEM_callocN(sizeof(struct BoneSplineWidgetGroup), __func__);
|
||||
gzgroup->customdata = bspline_group;
|
||||
@ -163,10 +163,10 @@ static void WIDGETGROUP_armature_spline_setup(const bContext *C, wmGizmoGroup *g
|
||||
/* Handles */
|
||||
for (int i = 0; i < ARRAY_SIZE(bspline_group->handles); i++) {
|
||||
wmGizmo *gz;
|
||||
gz = bspline_group->handles[i].gizmo = WM_gizmo_new_ptr(gzt_grab, gzgroup, NULL);
|
||||
RNA_enum_set(gz->ptr, "draw_style", ED_GIZMO_GRAB_STYLE_RING_2D);
|
||||
gz = bspline_group->handles[i].gizmo = WM_gizmo_new_ptr(gzt_move, gzgroup, NULL);
|
||||
RNA_enum_set(gz->ptr, "draw_style", ED_GIZMO_MOVE_STYLE_RING_2D);
|
||||
RNA_enum_set(gz->ptr, "draw_options",
|
||||
ED_GIZMO_GRAB_DRAW_FLAG_FILL | ED_GIZMO_GRAB_DRAW_FLAG_ALIGN_VIEW);
|
||||
ED_GIZMO_MOVE_DRAW_FLAG_FILL | ED_GIZMO_MOVE_DRAW_FLAG_ALIGN_VIEW);
|
||||
WM_gizmo_set_flag(gz, WM_GIZMO_DRAW_VALUE, true);
|
||||
|
||||
UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, gz->color);
|
||||
|
@ -261,7 +261,7 @@ static bool WIDGETGROUP_lamp_target_poll(const bContext *C, wmGizmoGroupType *UN
|
||||
static void WIDGETGROUP_lamp_target_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
|
||||
{
|
||||
wmGizmoWrapper *wwrapper = MEM_mallocN(sizeof(wmGizmoWrapper), __func__);
|
||||
wwrapper->gizmo = WM_gizmo_new("GIZMO_GT_grab_3d", gzgroup, NULL);
|
||||
wwrapper->gizmo = WM_gizmo_new("GIZMO_GT_move_3d", gzgroup, NULL);
|
||||
wmGizmo *gz = wwrapper->gizmo;
|
||||
|
||||
gzgroup->customdata = wwrapper;
|
||||
@ -274,7 +274,7 @@ static void WIDGETGROUP_lamp_target_setup(const bContext *UNUSED(C), wmGizmoGrou
|
||||
wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_transform_axis_target", true);
|
||||
|
||||
RNA_enum_set(gz->ptr, "draw_options",
|
||||
ED_GIZMO_GRAB_DRAW_FLAG_FILL | ED_GIZMO_GRAB_DRAW_FLAG_ALIGN_VIEW);
|
||||
ED_GIZMO_MOVE_DRAW_FLAG_FILL | ED_GIZMO_MOVE_DRAW_FLAG_ALIGN_VIEW);
|
||||
|
||||
WM_gizmo_operator_set(gz, 0, ot, NULL);
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmGizmoGroup *
|
||||
const struct NavigateGizmoInfo *info = &g_navigate_params[i];
|
||||
navgroup->gz_array[i] = WM_gizmo_new(info->gizmo, gzgroup, NULL);
|
||||
wmGizmo *gz = navgroup->gz_array[i];
|
||||
gz->flag |= WM_GIZMO_GRAB_CURSOR | WM_GIZMO_DRAW_MODAL;
|
||||
gz->flag |= WM_GIZMO_MOVE_CURSOR | WM_GIZMO_DRAW_MODAL;
|
||||
|
||||
if (i == MPR_ROTATE) {
|
||||
gz->color[3] = 0.0f;
|
||||
|
@ -932,7 +932,7 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf)
|
||||
{TFM_MODAL_EDGESLIDE_DOWN, "EDGESLIDE_PREV_NEXT", 0, "Select previous Edge Slide Edge", ""},
|
||||
{TFM_MODAL_PROPSIZE, "PROPORTIONAL_SIZE", 0, "Adjust Proportional Influence", ""},
|
||||
{TFM_MODAL_INSERTOFS_TOGGLE_DIR, "INSERTOFS_TOGGLE_DIR", 0, "Toggle Direction for Node Auto-offset", ""},
|
||||
{TFM_MODAL_TRANSLATE, "TRANSLATE", 0, "Translate", ""},
|
||||
{TFM_MODAL_TRANSLATE, "TRANSLATE", 0, "Move", ""},
|
||||
{TFM_MODAL_ROTATE, "ROTATE", 0, "Rotate", ""},
|
||||
{TFM_MODAL_RESIZE, "RESIZE", 0, "Resize", ""},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
|
@ -1487,7 +1487,7 @@ static void WIDGETGROUP_gizmo_setup(const bContext *C, wmGizmoGroup *gzgroup)
|
||||
man->twtype = SCE_MANIP_TRANSLATE | SCE_MANIP_ROTATE | SCE_MANIP_SCALE;
|
||||
man->use_twtype_refresh = true;
|
||||
}
|
||||
else if (STREQ(tref->idname, "Grab")) {
|
||||
else if (STREQ(tref->idname, "Move")) {
|
||||
man->twtype |= SCE_MANIP_TRANSLATE;
|
||||
}
|
||||
else if (STREQ(tref->idname, "Rotate")) {
|
||||
@ -1782,7 +1782,7 @@ static void WIDGETGROUP_xform_cage_refresh(const bContext *C, wmGizmoGroup *gzgr
|
||||
gizmo_prepare_mat(C, v3d, rv3d, &tbounds);
|
||||
|
||||
WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false);
|
||||
WM_gizmo_set_flag(gz, WM_GIZMO_GRAB_CURSOR, true);
|
||||
WM_gizmo_set_flag(gz, WM_GIZMO_MOVE_CURSOR, true);
|
||||
|
||||
float dims[3];
|
||||
sub_v3_v3v3(dims, rv3d->tw_axis_max, rv3d->tw_axis_min);
|
||||
|
@ -637,8 +637,8 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
|
||||
static void TRANSFORM_OT_translate(struct wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Translate";
|
||||
ot->description = "Translate (move) selected items";
|
||||
ot->name = "Move";
|
||||
ot->description = "Move selected items";
|
||||
ot->idname = OP_TRANSLATION;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
|
||||
|
||||
|
@ -423,7 +423,7 @@ const EnumPropertyItem rna_enum_bake_pass_filter_type_items[] = {
|
||||
};
|
||||
|
||||
static const EnumPropertyItem rna_enum_gizmo_items[] = {
|
||||
{SCE_MANIP_TRANSLATE, "TRANSLATE", 0, "Translate", ""},
|
||||
{SCE_MANIP_TRANSLATE, "TRANSLATE", 0, "Move", ""},
|
||||
{SCE_MANIP_ROTATE, "ROTATE", 0, "Rotate", ""},
|
||||
{SCE_MANIP_SCALE, "SCALE", 0, "Scale", ""},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
|
@ -404,7 +404,7 @@ RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_draw_value, flag, WM_GIZMO_DRAW_VALUE);
|
||||
RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_draw_offset_scale, flag, WM_GIZMO_DRAW_OFFSET_SCALE);
|
||||
RNA_GIZMO_GENERIC_FLAG_NEG_RW_DEF(flag_use_draw_scale, flag, WM_GIZMO_DRAW_OFFSET_SCALE);
|
||||
RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_hide, flag, WM_GIZMO_HIDDEN);
|
||||
RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_grab_cursor, flag, WM_GIZMO_GRAB_CURSOR);
|
||||
RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_grab_cursor, flag, WM_GIZMO_MOVE_CURSOR);
|
||||
RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_select_background, flag, WM_GIZMO_SELECT_BACKGROUND);
|
||||
|
||||
/* wmGizmo.state */
|
||||
@ -1100,7 +1100,7 @@ static void rna_def_gizmo(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
prop, "rna_Gizmo_flag_hide_get", "rna_Gizmo_flag_hide_set");
|
||||
RNA_def_property_ui_text(prop, "Hide", "");
|
||||
RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
|
||||
/* WM_GIZMO_GRAB_CURSOR */
|
||||
/* WM_GIZMO_MOVE_CURSOR */
|
||||
prop = RNA_def_property(srna, "use_grab_cursor", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_funcs(
|
||||
prop, "rna_Gizmo_flag_use_grab_cursor_get", "rna_Gizmo_flag_use_grab_cursor_set");
|
||||
|
@ -83,7 +83,7 @@ typedef enum eWM_GizmoFlagFlag {
|
||||
/**
|
||||
* Hide the cursor and lock it's position while interacting with this gizmo.
|
||||
*/
|
||||
WM_GIZMO_GRAB_CURSOR = (1 << 6),
|
||||
WM_GIZMO_MOVE_CURSOR = (1 << 6),
|
||||
/** Don't write into the depth buffer when selecting. */
|
||||
WM_GIZMO_SELECT_BACKGROUND = (1 << 7),
|
||||
} eWM_GizmoFlagFlag;
|
||||
|
@ -111,7 +111,7 @@ struct wmGizmoMap {
|
||||
struct wmGizmo *modal;
|
||||
/* array for all selected gizmos */
|
||||
struct wmGizmoMapSelectState select;
|
||||
/* cursor location at point of entering modal (see: WM_GIZMO_GRAB_CURSOR) */
|
||||
/* cursor location at point of entering modal (see: WM_GIZMO_MOVE_CURSOR) */
|
||||
int event_xy[2];
|
||||
short event_grabcursor;
|
||||
/* until we have nice cursor push/pop API. */
|
||||
|
@ -955,7 +955,7 @@ void wm_gizmomap_modal_set(
|
||||
gz->state |= WM_GIZMO_STATE_MODAL;
|
||||
gzmap->gzmap_context.modal = gz;
|
||||
|
||||
if ((gz->flag & WM_GIZMO_GRAB_CURSOR) &&
|
||||
if ((gz->flag & WM_GIZMO_MOVE_CURSOR) &&
|
||||
(event->is_motion_absolute == false))
|
||||
{
|
||||
WM_cursor_grab_enable(win, true, true, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user