Merge pull request #57080 from KoBeWi/ULTIMATER_PANNING
This commit is contained in:
commit
a673e18d34
|
@ -218,7 +218,7 @@ void AnimationBezierTrackEdit::_draw_line_clipped(const Vector2 &p_from, const V
|
||||||
|
|
||||||
void AnimationBezierTrackEdit::_notification(int p_what) {
|
void AnimationBezierTrackEdit::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
||||||
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("interface/editors/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
||||||
}
|
}
|
||||||
if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) {
|
if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) {
|
||||||
close_button->set_icon(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
|
close_button->set_icon(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
|
||||||
|
@ -994,7 +994,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationBezierTrackEdit::_scroll_callback(Vector2 p_scroll_vec) {
|
void AnimationBezierTrackEdit::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) {
|
||||||
_pan_callback(-p_scroll_vec * 32);
|
_pan_callback(-p_scroll_vec * 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ class AnimationBezierTrackEdit : public Control {
|
||||||
Set<int> selection;
|
Set<int> selection;
|
||||||
|
|
||||||
Ref<ViewPanner> panner;
|
Ref<ViewPanner> panner;
|
||||||
void _scroll_callback(Vector2 p_scroll_vec);
|
void _scroll_callback(Vector2 p_scroll_vec, bool p_alt);
|
||||||
void _pan_callback(Vector2 p_scroll_vec);
|
void _pan_callback(Vector2 p_scroll_vec);
|
||||||
void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
|
void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
|
||||||
|
|
||||||
|
|
|
@ -1459,7 +1459,7 @@ int AnimationTimelineEdit::get_name_limit() const {
|
||||||
|
|
||||||
void AnimationTimelineEdit::_notification(int p_what) {
|
void AnimationTimelineEdit::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
||||||
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("interface/editors/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||||
|
@ -1799,7 +1799,7 @@ void AnimationTimelineEdit::gui_input(const Ref<InputEvent> &p_event) {
|
||||||
int x = mb->get_position().x - get_name_limit();
|
int x = mb->get_position().x - get_name_limit();
|
||||||
|
|
||||||
float ofs = x / get_zoom_scale() + get_value();
|
float ofs = x / get_zoom_scale() + get_value();
|
||||||
emit_signal(SNAME("timeline_changed"), ofs, false, Input::get_singleton()->is_key_pressed(Key::ALT));
|
emit_signal(SNAME("timeline_changed"), ofs, false, mb->is_alt_pressed());
|
||||||
dragging_timeline = true;
|
dragging_timeline = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1833,7 +1833,7 @@ void AnimationTimelineEdit::gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationTimelineEdit::_scroll_callback(Vector2 p_scroll_vec) {
|
void AnimationTimelineEdit::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) {
|
||||||
// Timeline has no vertical scroll, so we change it to horizontal.
|
// Timeline has no vertical scroll, so we change it to horizontal.
|
||||||
p_scroll_vec.x += p_scroll_vec.y;
|
p_scroll_vec.x += p_scroll_vec.y;
|
||||||
_pan_callback(-p_scroll_vec * 32);
|
_pan_callback(-p_scroll_vec * 32);
|
||||||
|
@ -1872,7 +1872,7 @@ void AnimationTimelineEdit::_track_added(int p_track) {
|
||||||
void AnimationTimelineEdit::_bind_methods() {
|
void AnimationTimelineEdit::_bind_methods() {
|
||||||
ADD_SIGNAL(MethodInfo("zoom_changed"));
|
ADD_SIGNAL(MethodInfo("zoom_changed"));
|
||||||
ADD_SIGNAL(MethodInfo("name_limit_changed"));
|
ADD_SIGNAL(MethodInfo("name_limit_changed"));
|
||||||
ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::FLOAT, "position"), PropertyInfo(Variant::BOOL, "drag")));
|
ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::FLOAT, "position"), PropertyInfo(Variant::BOOL, "drag"), PropertyInfo(Variant::BOOL, "timeline_only")));
|
||||||
ADD_SIGNAL(MethodInfo("track_added", PropertyInfo(Variant::INT, "track")));
|
ADD_SIGNAL(MethodInfo("track_added", PropertyInfo(Variant::INT, "track")));
|
||||||
ADD_SIGNAL(MethodInfo("length_changed", PropertyInfo(Variant::FLOAT, "size")));
|
ADD_SIGNAL(MethodInfo("length_changed", PropertyInfo(Variant::FLOAT, "size")));
|
||||||
}
|
}
|
||||||
|
@ -3121,7 +3121,7 @@ void AnimationTrackEdit::append_to_selection(const Rect2 &p_box, bool p_deselect
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationTrackEdit::_bind_methods() {
|
void AnimationTrackEdit::_bind_methods() {
|
||||||
ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::FLOAT, "position"), PropertyInfo(Variant::BOOL, "drag")));
|
ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::FLOAT, "position"), PropertyInfo(Variant::BOOL, "drag"), PropertyInfo(Variant::BOOL, "timeline_only")));
|
||||||
ADD_SIGNAL(MethodInfo("remove_request", PropertyInfo(Variant::INT, "track")));
|
ADD_SIGNAL(MethodInfo("remove_request", PropertyInfo(Variant::INT, "track")));
|
||||||
ADD_SIGNAL(MethodInfo("dropped", PropertyInfo(Variant::INT, "from_track"), PropertyInfo(Variant::INT, "to_track")));
|
ADD_SIGNAL(MethodInfo("dropped", PropertyInfo(Variant::INT, "from_track"), PropertyInfo(Variant::INT, "to_track")));
|
||||||
ADD_SIGNAL(MethodInfo("insert_key", PropertyInfo(Variant::FLOAT, "ofs")));
|
ADD_SIGNAL(MethodInfo("insert_key", PropertyInfo(Variant::FLOAT, "ofs")));
|
||||||
|
@ -3648,7 +3648,7 @@ void AnimationTrackEditor::_insert_track(bool p_create_reset, bool p_create_bezi
|
||||||
pos = animation->get_length();
|
pos = animation->get_length();
|
||||||
}
|
}
|
||||||
set_anim_pos(pos);
|
set_anim_pos(pos);
|
||||||
emit_signal(SNAME("timeline_changed"), pos, true);
|
emit_signal(SNAME("timeline_changed"), pos, true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4510,7 +4510,7 @@ MenuButton *AnimationTrackEditor::get_edit_menu() {
|
||||||
|
|
||||||
void AnimationTrackEditor::_notification(int p_what) {
|
void AnimationTrackEditor::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
||||||
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("interface/editors/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) {
|
if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) {
|
||||||
|
@ -5230,16 +5230,6 @@ void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->is_alt_pressed() && mb->get_button_index() == MouseButton::WHEEL_UP) {
|
|
||||||
goto_prev_step(true);
|
|
||||||
scroll->accept_event();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->is_alt_pressed() && mb->get_button_index() == MouseButton::WHEEL_DOWN) {
|
|
||||||
goto_next_step(true);
|
|
||||||
scroll->accept_event();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT) {
|
if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT) {
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
box_selecting = true;
|
box_selecting = true;
|
||||||
|
@ -5304,8 +5294,16 @@ void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationTrackEditor::_scroll_callback(Vector2 p_scroll_vec) {
|
void AnimationTrackEditor::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) {
|
||||||
_pan_callback(-p_scroll_vec * 32);
|
if (p_alt) {
|
||||||
|
if (p_scroll_vec.x < 0 || p_scroll_vec.y < 0) {
|
||||||
|
goto_prev_step(true);
|
||||||
|
} else {
|
||||||
|
goto_next_step(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_pan_callback(-p_scroll_vec * 32);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationTrackEditor::_pan_callback(Vector2 p_scroll_vec) {
|
void AnimationTrackEditor::_pan_callback(Vector2 p_scroll_vec) {
|
||||||
|
@ -5447,7 +5445,7 @@ void AnimationTrackEditor::goto_prev_step(bool p_from_mouse_event) {
|
||||||
pos = 0;
|
pos = 0;
|
||||||
}
|
}
|
||||||
set_anim_pos(pos);
|
set_anim_pos(pos);
|
||||||
emit_signal(SNAME("timeline_changed"), pos, true);
|
emit_signal(SNAME("timeline_changed"), pos, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationTrackEditor::goto_next_step(bool p_from_mouse_event) {
|
void AnimationTrackEditor::goto_next_step(bool p_from_mouse_event) {
|
||||||
|
@ -5474,7 +5472,7 @@ void AnimationTrackEditor::goto_next_step(bool p_from_mouse_event) {
|
||||||
}
|
}
|
||||||
set_anim_pos(pos);
|
set_anim_pos(pos);
|
||||||
|
|
||||||
emit_signal(SNAME("timeline_changed"), pos, true);
|
emit_signal(SNAME("timeline_changed"), pos, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
|
void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
|
||||||
|
@ -5998,7 +5996,7 @@ void AnimationTrackEditor::_bind_methods() {
|
||||||
ClassDB::bind_method("_key_deselected", &AnimationTrackEditor::_key_deselected); // Still used by some connect_compat.
|
ClassDB::bind_method("_key_deselected", &AnimationTrackEditor::_key_deselected); // Still used by some connect_compat.
|
||||||
ClassDB::bind_method("_clear_selection", &AnimationTrackEditor::_clear_selection); // Still used by some connect_compat.
|
ClassDB::bind_method("_clear_selection", &AnimationTrackEditor::_clear_selection); // Still used by some connect_compat.
|
||||||
|
|
||||||
ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::FLOAT, "position"), PropertyInfo(Variant::BOOL, "drag")));
|
ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::FLOAT, "position"), PropertyInfo(Variant::BOOL, "drag"), PropertyInfo(Variant::BOOL, "timeline_only")));
|
||||||
ADD_SIGNAL(MethodInfo("keying_changed"));
|
ADD_SIGNAL(MethodInfo("keying_changed"));
|
||||||
ADD_SIGNAL(MethodInfo("animation_len_changed", PropertyInfo(Variant::FLOAT, "len")));
|
ADD_SIGNAL(MethodInfo("animation_len_changed", PropertyInfo(Variant::FLOAT, "len")));
|
||||||
ADD_SIGNAL(MethodInfo("animation_step_changed", PropertyInfo(Variant::FLOAT, "step")));
|
ADD_SIGNAL(MethodInfo("animation_step_changed", PropertyInfo(Variant::FLOAT, "step")));
|
||||||
|
|
|
@ -82,7 +82,7 @@ class AnimationTimelineEdit : public Range {
|
||||||
bool use_fps;
|
bool use_fps;
|
||||||
|
|
||||||
Ref<ViewPanner> panner;
|
Ref<ViewPanner> panner;
|
||||||
void _scroll_callback(Vector2 p_scroll_vec);
|
void _scroll_callback(Vector2 p_scroll_vec, bool p_alt);
|
||||||
void _pan_callback(Vector2 p_scroll_vec);
|
void _pan_callback(Vector2 p_scroll_vec);
|
||||||
void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
|
void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ class AnimationTrackEditor : public VBoxContainer {
|
||||||
void _update_tracks();
|
void _update_tracks();
|
||||||
|
|
||||||
void _name_limit_changed();
|
void _name_limit_changed();
|
||||||
void _timeline_changed(float p_new_pos, bool p_drag, bool p_timeline_only = false);
|
void _timeline_changed(float p_new_pos, bool p_drag, bool p_timeline_only);
|
||||||
void _track_remove_request(int p_track);
|
void _track_remove_request(int p_track);
|
||||||
void _track_grab_focus(int p_track);
|
void _track_grab_focus(int p_track);
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ class AnimationTrackEditor : public VBoxContainer {
|
||||||
PropertyInfo _find_hint_for_track(int p_idx, NodePath &r_base_path, Variant *r_current_val = nullptr);
|
PropertyInfo _find_hint_for_track(int p_idx, NodePath &r_base_path, Variant *r_current_val = nullptr);
|
||||||
|
|
||||||
Ref<ViewPanner> panner;
|
Ref<ViewPanner> panner;
|
||||||
void _scroll_callback(Vector2 p_scroll_vec);
|
void _scroll_callback(Vector2 p_scroll_vec, bool p_alt);
|
||||||
void _pan_callback(Vector2 p_scroll_vec);
|
void _pan_callback(Vector2 p_scroll_vec);
|
||||||
void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
|
void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
|
||||||
|
|
||||||
|
|
|
@ -647,7 +647,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
||||||
// Panning
|
// Panning
|
||||||
// Enum should be in sync with ControlScheme in ViewPanner.
|
// Enum should be in sync with ControlScheme in ViewPanner.
|
||||||
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "editors/panning/2d_editor_panning_scheme", 0, "Scroll Zooms,Scroll Pans");
|
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "editors/panning/2d_editor_panning_scheme", 0, "Scroll Zooms,Scroll Pans");
|
||||||
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "editors/panning/sub_editor_panning_scheme", 0, "Scroll Zooms,Scroll Pans");
|
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "editors/panning/sub_editors_panning_scheme", 0, "Scroll Zooms,Scroll Pans");
|
||||||
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "editors/panning/animation_editors_panning_scheme", 1, "Scroll Zooms,Scroll Pans");
|
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "editors/panning/animation_editors_panning_scheme", 1, "Scroll Zooms,Scroll Pans");
|
||||||
_initial_set("editors/panning/simple_panning", false);
|
_initial_set("editors/panning/simple_panning", false);
|
||||||
_initial_set("editors/panning/warped_mouse_panning", true);
|
_initial_set("editors/panning/warped_mouse_panning", true);
|
||||||
|
|
|
@ -734,7 +734,7 @@ void AnimationNodeBlendTreeEditor::_removed_from_graph() {
|
||||||
|
|
||||||
void AnimationNodeBlendTreeEditor::_notification(int p_what) {
|
void AnimationNodeBlendTreeEditor::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
||||||
graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
||||||
graph->set_warped_panning(bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning")));
|
graph->set_warped_panning(bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1187,7 +1187,7 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CanvasItemEditor::_scroll_callback(Vector2 p_scroll_vec) {
|
void CanvasItemEditor::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) {
|
||||||
_pan_callback(-p_scroll_vec * pan_speed);
|
_pan_callback(-p_scroll_vec * pan_speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3858,7 +3858,7 @@ void CanvasItemEditor::_notification(int p_what) {
|
||||||
|
|
||||||
anchor_mode_button->set_icon(get_theme_icon(SNAME("Anchor"), SNAME("EditorIcons")));
|
anchor_mode_button->set_icon(get_theme_icon(SNAME("Anchor"), SNAME("EditorIcons")));
|
||||||
|
|
||||||
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("interface/editors/2d_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/2d_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
||||||
pan_speed = int(EditorSettings::get_singleton()->get("editors/panning/2d_editor_pan_speed"));
|
pan_speed = int(EditorSettings::get_singleton()->get("editors/panning/2d_editor_pan_speed"));
|
||||||
warped_panning = bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning"));
|
warped_panning = bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -406,7 +406,7 @@ private:
|
||||||
Ref<ViewPanner> panner;
|
Ref<ViewPanner> panner;
|
||||||
bool warped_panning = true;
|
bool warped_panning = true;
|
||||||
int pan_speed = 20;
|
int pan_speed = 20;
|
||||||
void _scroll_callback(Vector2 p_scroll_vec);
|
void _scroll_callback(Vector2 p_scroll_vec, bool p_alt);
|
||||||
void _pan_callback(Vector2 p_scroll_vec);
|
void _pan_callback(Vector2 p_scroll_vec);
|
||||||
void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
|
void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ void Polygon2DEditor::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE:
|
case NOTIFICATION_ENTER_TREE:
|
||||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||||
uv_panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
uv_panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_READY: {
|
case NOTIFICATION_READY: {
|
||||||
button_uv->set_icon(get_theme_icon(SNAME("Uv"), SNAME("EditorIcons")));
|
button_uv->set_icon(get_theme_icon(SNAME("Uv"), SNAME("EditorIcons")));
|
||||||
|
@ -926,7 +926,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Polygon2DEditor::_uv_scroll_callback(Vector2 p_scroll_vec) {
|
void Polygon2DEditor::_uv_scroll_callback(Vector2 p_scroll_vec, bool p_alt) {
|
||||||
_uv_pan_callback(-p_scroll_vec * 32);
|
_uv_pan_callback(-p_scroll_vec * 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ class Polygon2DEditor : public AbstractPolygon2DEditor {
|
||||||
TextureRect *uv_icon_zoom;
|
TextureRect *uv_icon_zoom;
|
||||||
|
|
||||||
Ref<ViewPanner> uv_panner;
|
Ref<ViewPanner> uv_panner;
|
||||||
void _uv_scroll_callback(Vector2 p_scroll_vec);
|
void _uv_scroll_callback(Vector2 p_scroll_vec, bool p_alt);
|
||||||
void _uv_pan_callback(Vector2 p_scroll_vec);
|
void _uv_pan_callback(Vector2 p_scroll_vec);
|
||||||
void _uv_zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
|
void _uv_zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
|
||||||
|
|
||||||
|
|
|
@ -602,7 +602,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureRegionEditor::_scroll_callback(Vector2 p_scroll_vec) {
|
void TextureRegionEditor::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) {
|
||||||
_pan_callback(-p_scroll_vec * 32);
|
_pan_callback(-p_scroll_vec * 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,7 +820,7 @@ void TextureRegionEditor::_notification(int p_what) {
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||||
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
if (snap_mode == SNAP_AUTOSLICE && is_visible() && autoslice_is_dirty) {
|
if (snap_mode == SNAP_AUTOSLICE && is_visible() && autoslice_is_dirty) {
|
||||||
|
|
|
@ -101,7 +101,7 @@ class TextureRegionEditor : public VBoxContainer {
|
||||||
int drag_index;
|
int drag_index;
|
||||||
|
|
||||||
Ref<ViewPanner> panner;
|
Ref<ViewPanner> panner;
|
||||||
void _scroll_callback(Vector2 p_scroll_vec);
|
void _scroll_callback(Vector2 p_scroll_vec, bool p_alt);
|
||||||
void _pan_callback(Vector2 p_scroll_vec);
|
void _pan_callback(Vector2 p_scroll_vec);
|
||||||
void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
|
void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ void TileAtlasView::gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileAtlasView::_scroll_callback(Vector2 p_scroll_vec) {
|
void TileAtlasView::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) {
|
||||||
_pan_callback(-p_scroll_vec * 32);
|
_pan_callback(-p_scroll_vec * 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,7 +524,7 @@ void TileAtlasView::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE:
|
case NOTIFICATION_ENTER_TREE:
|
||||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED:
|
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED:
|
||||||
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NOTIFICATION_READY:
|
case NOTIFICATION_READY:
|
||||||
|
|
|
@ -67,7 +67,7 @@ private:
|
||||||
virtual void gui_input(const Ref<InputEvent> &p_event) override;
|
virtual void gui_input(const Ref<InputEvent> &p_event) override;
|
||||||
|
|
||||||
Ref<ViewPanner> panner;
|
Ref<ViewPanner> panner;
|
||||||
void _scroll_callback(Vector2 p_scroll_vec);
|
void _scroll_callback(Vector2 p_scroll_vec, bool p_alt);
|
||||||
void _pan_callback(Vector2 p_scroll_vec);
|
void _pan_callback(Vector2 p_scroll_vec);
|
||||||
void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
|
void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
|
||||||
|
|
||||||
|
|
|
@ -3224,7 +3224,7 @@ void VisualShaderEditor::_notification(int p_what) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
||||||
graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
||||||
graph->set_warped_panning(bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning")));
|
graph->set_warped_panning(bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3913,7 +3913,7 @@ void VisualScriptEditor::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE:
|
case NOTIFICATION_ENTER_TREE:
|
||||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||||
graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
||||||
graph->set_warped_panning(bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning")));
|
graph->set_warped_panning(bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning")));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|
|
@ -1356,7 +1356,7 @@ void GraphEdit::gui_input(const Ref<InputEvent> &p_ev) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphEdit::_scroll_callback(Vector2 p_scroll_vec) {
|
void GraphEdit::_scroll_callback(Vector2 p_scroll_vec, bool p_alt) {
|
||||||
if (p_scroll_vec.x != 0) {
|
if (p_scroll_vec.x != 0) {
|
||||||
h_scroll->set_value(h_scroll->get_value() + (h_scroll->get_page() * Math::abs(p_scroll_vec.x) / 8) * SIGN(p_scroll_vec.x));
|
h_scroll->set_value(h_scroll->get_value() + (h_scroll->get_page() * Math::abs(p_scroll_vec.x) / 8) * SIGN(p_scroll_vec.x));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -131,7 +131,7 @@ private:
|
||||||
|
|
||||||
Ref<ViewPanner> panner;
|
Ref<ViewPanner> panner;
|
||||||
bool warped_panning = true;
|
bool warped_panning = true;
|
||||||
void _scroll_callback(Vector2 p_scroll_vec);
|
void _scroll_callback(Vector2 p_scroll_vec, bool p_alt);
|
||||||
void _pan_callback(Vector2 p_scroll_vec);
|
void _pan_callback(Vector2 p_scroll_vec);
|
||||||
void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
|
void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ bool ViewPanner::gui_input(const Ref<InputEvent> &p_event, Rect2 p_canvas_rect)
|
||||||
panning.y += mb->get_factor() * scroll_vec.y;
|
panning.y += mb->get_factor() * scroll_vec.y;
|
||||||
panning.x += mb->get_factor() * scroll_vec.x;
|
panning.x += mb->get_factor() * scroll_vec.x;
|
||||||
}
|
}
|
||||||
callback_helper(scroll_callback, varray(panning));
|
callback_helper(scroll_callback, varray(panning, mb->is_alt_pressed()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -66,7 +66,7 @@ bool ViewPanner::gui_input(const Ref<InputEvent> &p_event, Rect2 p_canvas_rect)
|
||||||
panning.y += mb->get_factor() * scroll_vec.y;
|
panning.y += mb->get_factor() * scroll_vec.y;
|
||||||
panning.x += mb->get_factor() * scroll_vec.x;
|
panning.x += mb->get_factor() * scroll_vec.x;
|
||||||
}
|
}
|
||||||
callback_helper(scroll_callback, varray(panning));
|
callback_helper(scroll_callback, varray(panning, mb->is_alt_pressed()));
|
||||||
return true;
|
return true;
|
||||||
} else if (!mb->is_shift_pressed()) {
|
} else if (!mb->is_shift_pressed()) {
|
||||||
scroll_vec.y *= mb->get_factor();
|
scroll_vec.y *= mb->get_factor();
|
||||||
|
@ -76,7 +76,7 @@ bool ViewPanner::gui_input(const Ref<InputEvent> &p_event, Rect2 p_canvas_rect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use Alt only for scrolling.
|
// Alt is not used for button presses, so ignore it.
|
||||||
if (mb->is_alt_pressed()) {
|
if (mb->is_alt_pressed()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue