Make the shortcuts for setting the pivot editable
This commit is contained in:
parent
69091d4035
commit
f48b76fd8d
2 changed files with 12 additions and 7 deletions
|
@ -232,13 +232,12 @@ void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
|
|||
if (k->get_control())
|
||||
return;
|
||||
|
||||
if (k->is_pressed() && !k->is_echo() && k->get_scancode() == KEY_V && drag == DRAG_NONE && can_move_pivot) {
|
||||
|
||||
if (k->get_shift()) {
|
||||
//move drag pivot
|
||||
drag = DRAG_PIVOT;
|
||||
} else if (!Input::get_singleton()->is_mouse_button_pressed(0)) {
|
||||
|
||||
if (k->is_pressed() && !k->is_echo() && drag_pivot_shortcut.is_valid() && drag_pivot_shortcut->is_shortcut(p_ev) && drag == DRAG_NONE && can_move_pivot) {
|
||||
//move drag pivot
|
||||
drag = DRAG_PIVOT;
|
||||
}
|
||||
if (k->is_pressed() && !k->is_echo() && set_pivot_shortcut.is_valid() && set_pivot_shortcut->is_shortcut(p_ev) && drag == DRAG_NONE && can_move_pivot) {
|
||||
if (!Input::get_singleton()->is_mouse_button_pressed(0)) {
|
||||
List<Node *> &selection = editor_selection->get_selected_node_list();
|
||||
Vector2 mouse_pos = viewport->get_local_mouse_pos();
|
||||
if (selection.size() && viewport->get_rect().has_point(mouse_pos)) {
|
||||
|
@ -3602,6 +3601,9 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
|||
selection_menu->connect("id_pressed", this, "_selection_result_pressed");
|
||||
selection_menu->connect("popup_hide", this, "_selection_menu_hide");
|
||||
|
||||
drag_pivot_shortcut = ED_SHORTCUT("canvas_item_editor/drag_pivot", TTR("Drag pivot from mouse position"), KEY_MASK_SHIFT | KEY_V);
|
||||
set_pivot_shortcut = ED_SHORTCUT("canvas_item_editor/set_pivot", TTR("Set pivot at mouse position"), KEY_V);
|
||||
|
||||
key_pos = true;
|
||||
key_rot = true;
|
||||
key_scale = false;
|
||||
|
|
|
@ -292,6 +292,9 @@ class CanvasItemEditor : public VBoxContainer {
|
|||
Ref<Texture> select_handle;
|
||||
Ref<Texture> anchor_handle;
|
||||
|
||||
Ref<ShortCut> drag_pivot_shortcut;
|
||||
Ref<ShortCut> set_pivot_shortcut;
|
||||
|
||||
int handle_len;
|
||||
bool _is_part_of_subscene(CanvasItem *p_item);
|
||||
void _find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, Vector<_SelectResult> &r_items, int limit = 0);
|
||||
|
|
Loading…
Reference in a new issue