summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp7
-rw-r--r--editor/plugins/mesh_editor_plugin.cpp165
-rw-r--r--editor/plugins/mesh_editor_plugin.h23
-rw-r--r--editor/plugins/script_editor_plugin.cpp29
-rw-r--r--editor/plugins/script_editor_plugin.h4
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp60
6 files changed, 140 insertions, 148 deletions
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index 58948071fd..156a74144c 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "animation_tree_editor_plugin.h"
-#include "core/project_settings.h"
#include "core/io/resource_loader.h"
+#include "core/project_settings.h"
#include "os/input.h"
#include "os/keyboard.h"
#include "scene/gui/menu_button.h"
@@ -371,6 +371,7 @@ void AnimationTreeEditor::_popup_edit_dialog() {
edit_label[0]->show();
edit_scroll[0]->set_min(0);
edit_scroll[0]->set_max(1);
+ edit_scroll[0]->set_step(0.01);
edit_scroll[0]->set_value(anim_tree->mix_node_get_amount(edited_node));
edit_scroll[0]->set_begin(Point2(15, 25));
edit_scroll[0]->show();
@@ -383,6 +384,7 @@ void AnimationTreeEditor::_popup_edit_dialog() {
edit_label[0]->show();
edit_scroll[0]->set_min(0);
edit_scroll[0]->set_max(1);
+ edit_scroll[0]->set_step(0.01);
edit_scroll[0]->set_value(anim_tree->blend2_node_get_amount(edited_node));
edit_scroll[0]->set_begin(Point2(15, 25));
edit_scroll[0]->show();
@@ -398,6 +400,7 @@ void AnimationTreeEditor::_popup_edit_dialog() {
edit_label[0]->show();
edit_scroll[0]->set_min(-1);
edit_scroll[0]->set_max(1);
+ edit_scroll[0]->set_step(0.01);
edit_scroll[0]->set_value(anim_tree->blend3_node_get_amount(edited_node));
edit_scroll[0]->set_begin(Point2(15, 25));
edit_scroll[0]->show();
@@ -411,6 +414,7 @@ void AnimationTreeEditor::_popup_edit_dialog() {
edit_label[0]->show();
edit_scroll[0]->set_min(0);
edit_scroll[0]->set_max(1);
+ edit_scroll[0]->set_step(0.01);
edit_scroll[0]->set_value(anim_tree->blend4_node_get_amount(edited_node).x);
edit_scroll[0]->set_begin(Point2(15, 25));
edit_scroll[0]->show();
@@ -419,6 +423,7 @@ void AnimationTreeEditor::_popup_edit_dialog() {
edit_label[1]->show();
edit_scroll[1]->set_min(0);
edit_scroll[1]->set_max(1);
+ edit_scroll[1]->set_step(0.01);
edit_scroll[1]->set_value(anim_tree->blend4_node_get_amount(edited_node).y);
edit_scroll[1]->set_begin(Point2(15, 75));
edit_scroll[1]->show();
diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp
index f377d3a7cc..23b19e61b9 100644
--- a/editor/plugins/mesh_editor_plugin.cpp
+++ b/editor/plugins/mesh_editor_plugin.cpp
@@ -29,18 +29,17 @@
/*************************************************************************/
#include "mesh_editor_plugin.h"
-#if 0
-void MeshEditor::_gui_input(InputEvent p_event) {
+void MeshEditor::_gui_input(Ref<InputEvent> p_event) {
+ Ref<InputEventMouseMotion> mm = p_event;
+ if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
- if (p_event.type==InputEvent::MOUSE_MOTION && p_event->get_button_mask()&BUTTON_MASK_LEFT) {
-
- rot_x-=p_event->get_relative().y*0.01;
- rot_y-=p_event->get_relative().x*0.01;
- if (rot_x<-Math_PI/2)
- rot_x=-Math_PI/2;
- else if (rot_x>Math_PI/2) {
- rot_x=Math_PI/2;
+ rot_x -= mm->get_relative().y * 0.01;
+ rot_y -= mm->get_relative().x * 0.01;
+ if (rot_x < -Math_PI / 2)
+ rot_x = -Math_PI / 2;
+ else if (rot_x > Math_PI / 2) {
+ rot_x = Math_PI / 2;
}
_update_rotation();
}
@@ -48,35 +47,30 @@ void MeshEditor::_gui_input(InputEvent p_event) {
void MeshEditor::_notification(int p_what) {
- if (p_what==NOTIFICATION_FIXED_PROCESS) {
-
+ if (p_what == NOTIFICATION_FIXED_PROCESS) {
}
-
- if (p_what==NOTIFICATION_READY) {
+ if (p_what == NOTIFICATION_READY) {
//get_scene()->connect("node_removed",this,"_node_removed");
if (first_enter) {
- //it's in propertyeditor so.. could be moved around
+ //it's in propertyeditor so. could be moved around
- light_1_switch->set_normal_texture(get_icon("MaterialPreviewLight1","EditorIcons"));
- light_1_switch->set_pressed_texture(get_icon("MaterialPreviewLight1Off","EditorIcons"));
- light_2_switch->set_normal_texture(get_icon("MaterialPreviewLight2","EditorIcons"));
- light_2_switch->set_pressed_texture(get_icon("MaterialPreviewLight2Off","EditorIcons"));
- first_enter=false;
+ light_1_switch->set_normal_texture(get_icon("MaterialPreviewLight1", "EditorIcons"));
+ light_1_switch->set_pressed_texture(get_icon("MaterialPreviewLight1Off", "EditorIcons"));
+ light_2_switch->set_normal_texture(get_icon("MaterialPreviewLight2", "EditorIcons"));
+ light_2_switch->set_pressed_texture(get_icon("MaterialPreviewLight2Off", "EditorIcons"));
+ first_enter = false;
}
-
}
- if (p_what==NOTIFICATION_DRAW) {
-
+ if (p_what == NOTIFICATION_DRAW) {
- Ref<Texture> checkerboard = get_icon("Checkerboard","EditorIcons");
+ Ref<Texture> checkerboard = get_icon("Checkerboard", "EditorIcons");
Size2 size = get_size();
- draw_texture_rect(checkerboard,Rect2(Point2(),size),true);
-
+ //draw_texture_rect(checkerboard, Rect2(Point2(), size), true);
}
}
@@ -85,125 +79,115 @@ void MeshEditor::_update_rotation() {
Transform t;
t.basis.rotate(Vector3(0, 1, 0), -rot_y);
t.basis.rotate(Vector3(1, 0, 0), -rot_x);
- mesh_instance->set_transform(t);
-
+ rotation->set_transform(t);
}
void MeshEditor::edit(Ref<Mesh> p_mesh) {
- mesh=p_mesh;
+ mesh = p_mesh;
mesh_instance->set_mesh(mesh);
if (mesh.is_null()) {
hide();
} else {
- rot_x=0;
- rot_y=0;
+ rot_x = 0;
+ rot_y = 0;
_update_rotation();
- AABB aabb= mesh->get_aabb();
- Vector3 ofs = aabb.pos + aabb.size*0.5;
- aabb.pos-=ofs;
- float m = MAX(aabb.size.x,aabb.size.y)*0.5;
- if (m!=0) {
- m=1.0/m;
- m*=0.5;
+ Rect3 aabb = mesh->get_aabb();
+ print_line("aabb: " + aabb);
+ Vector3 ofs = aabb.position + aabb.size * 0.5;
+ float m = aabb.get_longest_axis_size();
+ if (m != 0) {
+ m = 1.0 / m;
+ m *= 0.5;
//print_line("scale: "+rtos(m));
Transform xform;
- xform.basis.scale(Vector3(m,m,m));
- xform.origin=-xform.basis.xform(ofs); //-ofs*m;
- xform.origin.z-=aabb.size.z*2;
+ xform.basis.scale(Vector3(m, m, m));
+ xform.origin = -xform.basis.xform(ofs); //-ofs*m;
+ //xform.origin.z -= aabb.get_longest_axis_size() * 2;
mesh_instance->set_transform(xform);
}
-
}
-
}
+void MeshEditor::_button_pressed(Node *p_button) {
-void MeshEditor::_button_pressed(Node* p_button) {
-
- if (p_button==light_1_switch) {
- light1->set_enabled(!light_1_switch->is_pressed());
+ if (p_button == light_1_switch) {
+ light1->set_visible(!light_1_switch->is_pressed());
}
- if (p_button==light_2_switch) {
- light2->set_enabled(!light_2_switch->is_pressed());
+ if (p_button == light_2_switch) {
+ light2->set_visible(!light_2_switch->is_pressed());
}
-
-
}
void MeshEditor::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"),&MeshEditor::_gui_input);
- ClassDB::bind_method(D_METHOD("_button_pressed"),&MeshEditor::_button_pressed);
-
+ ClassDB::bind_method(D_METHOD("_gui_input"), &MeshEditor::_gui_input);
+ ClassDB::bind_method(D_METHOD("_button_pressed"), &MeshEditor::_button_pressed);
}
MeshEditor::MeshEditor() {
- viewport = memnew( Viewport );
+ viewport = memnew(Viewport);
Ref<World> world;
world.instance();
viewport->set_world(world); //use own world
add_child(viewport);
viewport->set_disable_input(true);
+ set_stretch(true);
- camera = memnew( Camera );
- camera->set_transform(Transform(Matrix3(),Vector3(0,0,3)));
- camera->set_perspective(45,0.1,10);
+ camera = memnew(Camera);
+ camera->set_transform(Transform(Basis(), Vector3(0, 0, 1.1)));
+ camera->set_perspective(45, 0.1, 10);
viewport->add_child(camera);
- light1 = memnew( DirectionalLight );
- light1->set_transform(Transform().looking_at(Vector3(-1,-1,-1),Vector3(0,1,0)));
+ light1 = memnew(DirectionalLight);
+ light1->set_transform(Transform().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
viewport->add_child(light1);
- light2 = memnew( DirectionalLight );
- light2->set_transform(Transform().looking_at(Vector3(0,1,0),Vector3(0,0,1)));
- light2->set_color(Light::COLOR_DIFFUSE,Color(0.7,0.7,0.7));
- light2->set_color(Light::COLOR_SPECULAR,Color(0.7,0.7,0.7));
+ light2 = memnew(DirectionalLight);
+ light2->set_transform(Transform().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
+ light2->set_color(Color(0.7, 0.7, 0.7));
viewport->add_child(light2);
- mesh_instance = memnew( MeshInstance );
- viewport->add_child(mesh_instance);
-
-
+ rotation = memnew(Spatial);
+ viewport->add_child(rotation);
+ mesh_instance = memnew(MeshInstance);
+ rotation->add_child(mesh_instance);
- set_custom_minimum_size(Size2(1,150)*EDSCALE);
+ set_custom_minimum_size(Size2(1, 150) * EDSCALE);
- HBoxContainer *hb = memnew( HBoxContainer );
+ HBoxContainer *hb = memnew(HBoxContainer);
add_child(hb);
hb->set_area_as_parent_rect(2);
hb->add_spacer();
- VBoxContainer *vb_light = memnew( VBoxContainer );
+ VBoxContainer *vb_light = memnew(VBoxContainer);
hb->add_child(vb_light);
- light_1_switch = memnew( TextureButton );
+ light_1_switch = memnew(TextureButton);
light_1_switch->set_toggle_mode(true);
vb_light->add_child(light_1_switch);
- light_1_switch->connect("pressed",this,"_button_pressed",varray(light_1_switch));
+ light_1_switch->connect("pressed", this, "_button_pressed", varray(light_1_switch));
- light_2_switch = memnew( TextureButton );
+ light_2_switch = memnew(TextureButton);
light_2_switch->set_toggle_mode(true);
vb_light->add_child(light_2_switch);
- light_2_switch->connect("pressed",this,"_button_pressed",varray(light_2_switch));
-
- first_enter=true;
-
- rot_x=0;
- rot_y=0;
+ light_2_switch->connect("pressed", this, "_button_pressed", varray(light_2_switch));
+ first_enter = true;
+ rot_x = 0;
+ rot_y = 0;
}
-
void MeshEditorPlugin::edit(Object *p_object) {
- Mesh * s = p_object->cast_to<Mesh>();
+ Mesh *s = p_object->cast_to<Mesh>();
if (!s)
return;
@@ -212,7 +196,7 @@ void MeshEditorPlugin::edit(Object *p_object) {
bool MeshEditorPlugin::handles(Object *p_object) const {
- return p_object->is_type("Mesh");
+ return p_object->is_class("Mesh");
}
void MeshEditorPlugin::make_visible(bool p_visible) {
@@ -225,22 +209,15 @@ void MeshEditorPlugin::make_visible(bool p_visible) {
mesh_editor->hide();
//mesh_editor->set_process(false);
}
-
}
MeshEditorPlugin::MeshEditorPlugin(EditorNode *p_node) {
- editor=p_node;
- mesh_editor = memnew( MeshEditor );
- add_control_to_container(CONTAINER_PROPERTY_EDITOR_BOTTOM,mesh_editor);
+ editor = p_node;
+ mesh_editor = memnew(MeshEditor);
+ add_control_to_container(CONTAINER_PROPERTY_EDITOR_BOTTOM, mesh_editor);
mesh_editor->hide();
-
-
-
}
-
-MeshEditorPlugin::~MeshEditorPlugin()
-{
+MeshEditorPlugin::~MeshEditorPlugin() {
}
-#endif
diff --git a/editor/plugins/mesh_editor_plugin.h b/editor/plugins/mesh_editor_plugin.h
index 1d89448ed8..72d93c4126 100644
--- a/editor/plugins/mesh_editor_plugin.h
+++ b/editor/plugins/mesh_editor_plugin.h
@@ -30,8 +30,6 @@
#ifndef MESH_EDITOR_PLUGIN_H
#define MESH_EDITOR_PLUGIN_H
-#if 0
-
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/camera.h"
@@ -39,51 +37,48 @@
#include "scene/3d/mesh_instance.h"
#include "scene/resources/material.h"
-class MeshEditor : public Control {
-
- GDCLASS(MeshEditor, Control);
-
+class MeshEditor : public ViewportContainer {
+ GDCLASS(MeshEditor, ViewportContainer);
float rot_x;
float rot_y;
Viewport *viewport;
MeshInstance *mesh_instance;
+ Spatial *rotation;
DirectionalLight *light1;
DirectionalLight *light2;
Camera *camera;
Ref<Mesh> mesh;
-
TextureButton *light_1_switch;
TextureButton *light_2_switch;
- void _button_pressed(Node* p_button);
+ void _button_pressed(Node *p_button);
bool first_enter;
void _update_rotation();
+
protected:
void _notification(int p_what);
- void _gui_input(InputEvent p_event);
+ void _gui_input(Ref<InputEvent> p_event);
static void _bind_methods();
-public:
+public:
void edit(Ref<Mesh> p_mesh);
MeshEditor();
};
-
class MeshEditorPlugin : public EditorPlugin {
- GDCLASS( MeshEditorPlugin, EditorPlugin );
+ GDCLASS(MeshEditorPlugin, EditorPlugin);
MeshEditor *mesh_editor;
EditorNode *editor;
public:
-
virtual String get_name() const { return "Mesh"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_node);
@@ -92,8 +87,6 @@ public:
MeshEditorPlugin(EditorNode *p_node);
~MeshEditorPlugin();
-
};
-#endif // MESH_EDITOR_PLUGIN_H
#endif
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index aeb16f13ee..fef7f07abb 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -32,13 +32,13 @@
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/script_editor_debugger.h"
-#include "project_settings.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
#include "os/file_access.h"
#include "os/input.h"
#include "os/keyboard.h"
#include "os/os.h"
+#include "project_settings.h"
#include "scene/main/viewport.h"
/*** SCRIPT EDITOR ****/
@@ -518,6 +518,9 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save) {
_add_recent_script(help->get_class());
}
+ // roll back to previous tab
+ _history_back();
+
//remove from history
history.resize(history_pos + 1);
@@ -793,10 +796,10 @@ Ref<Script> ScriptEditor::_get_current_script() {
}
}
-Array ScriptEditor::_get_opened_script_list() const {
+Array ScriptEditor::_get_open_scripts() const {
Array ret;
- Vector<Ref<Script> > scripts = get_opened_scripts();
+ Vector<Ref<Script> > scripts = get_open_scripts();
int scrits_amount = scripts.size();
for (int idx_script = 0; idx_script < scrits_amount; idx_script++) {
ret.push_back(scripts[idx_script]);
@@ -1159,7 +1162,7 @@ void ScriptEditor::notify_script_close(const Ref<Script> &p_script) {
}
void ScriptEditor::notify_script_changed(const Ref<Script> &p_script) {
- emit_signal("script_changed", p_script);
+ emit_signal("editor_script_changed", p_script);
}
static const Node *_find_node_with_script(const Node *p_node, const RefPtr &p_script) {
@@ -1316,7 +1319,8 @@ void ScriptEditor::ensure_focus_current() {
int cidx = tab_container->get_current_tab();
if (cidx < 0 || cidx >= tab_container->get_tab_count())
- ;
+ return;
+
Control *c = tab_container->get_child(cidx)->cast_to<Control>();
if (!c)
return;
@@ -1406,6 +1410,11 @@ struct _ScriptEditorItemData {
};
void ScriptEditor::_update_members_overview_visibility() {
+
+ int selected = tab_container->get_current_tab();
+ if (selected < 0 || selected >= tab_container->get_child_count())
+ return;
+
Node *current = tab_container->get_child(tab_container->get_current_tab());
ScriptEditorBase *se = current->cast_to<ScriptEditorBase>();
if (!se) {
@@ -1423,6 +1432,10 @@ void ScriptEditor::_update_members_overview_visibility() {
void ScriptEditor::_update_members_overview() {
members_overview->clear();
+ int selected = tab_container->get_current_tab();
+ if (selected < 0 || selected >= tab_container->get_child_count())
+ return;
+
Node *current = tab_container->get_child(tab_container->get_current_tab());
ScriptEditorBase *se = current->cast_to<ScriptEditorBase>();
if (!se) {
@@ -2104,7 +2117,7 @@ void ScriptEditor::_history_back() {
}
}
-Vector<Ref<Script> > ScriptEditor::get_opened_scripts() const {
+Vector<Ref<Script> > ScriptEditor::get_open_scripts() const {
Vector<Ref<Script> > out_scripts = Vector<Ref<Script> >();
@@ -2213,9 +2226,9 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_unhandled_input", &ScriptEditor::_unhandled_input);
ClassDB::bind_method(D_METHOD("get_current_script"), &ScriptEditor::_get_current_script);
- ClassDB::bind_method(D_METHOD("get_opened_scripts_list"), &ScriptEditor::_get_opened_script_list);
+ ClassDB::bind_method(D_METHOD("get_open_scripts"), &ScriptEditor::_get_open_scripts);
- ADD_SIGNAL(MethodInfo("script_changed", PropertyInfo(Variant::OBJECT, "script:Script")));
+ ADD_SIGNAL(MethodInfo("editor_script_changed", PropertyInfo(Variant::OBJECT, "script:Script")));
ADD_SIGNAL(MethodInfo("script_close", PropertyInfo(Variant::STRING, "script:String")));
}
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 3d03eb0f49..d8a9415df1 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -322,7 +322,7 @@ class ScriptEditor : public PanelContainer {
void _file_dialog_action(String p_file);
Ref<Script> _get_current_script();
- Array _get_opened_script_list() const;
+ Array _get_open_scripts() const;
static void _open_script_request(const String &p_path);
@@ -357,7 +357,7 @@ public:
void get_window_layout(Ref<ConfigFile> p_layout);
void set_scene_root_script(Ref<Script> p_script);
- Vector<Ref<Script> > get_opened_scripts() const;
+ Vector<Ref<Script> > get_open_scripts() const;
bool script_goto_method(Ref<Script> p_script, const String &p_method);
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 8e6e92d48b..ef7ed5f7f6 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -36,9 +36,9 @@
#include "editor/editor_settings.h"
#include "editor/plugins/animation_player_editor_plugin.h"
#include "editor/spatial_editor_gizmos.h"
-#include "project_settings.h"
#include "os/keyboard.h"
#include "print_string.h"
+#include "project_settings.h"
#include "scene/3d/camera.h"
#include "scene/3d/visual_instance.h"
#include "scene/resources/surface_tool.h"
@@ -518,7 +518,7 @@ void SpatialEditorViewport::_compute_edit(const Point2 &p_point) {
*/
}
-static int _get_key_modifier(const String &p_property) {
+static int _get_key_modifier_setting(const String &p_property) {
switch (EditorSettings::get_singleton()->get(p_property).operator int()) {
@@ -531,6 +531,18 @@ static int _get_key_modifier(const String &p_property) {
return 0;
}
+static int _get_key_modifier(Ref<InputEventWithModifiers> e) {
+ if (e->get_shift())
+ return KEY_SHIFT;
+ if (e->get_alt())
+ return KEY_ALT;
+ if (e->get_control())
+ return KEY_CONTROL;
+ if (e->get_metakey())
+ return KEY_META;
+ return 0;
+}
+
bool SpatialEditorViewport::_gizmo_select(const Vector2 &p_screenpos, bool p_highlight_only) {
if (!spatial_editor->is_gizmo_visible())
@@ -774,7 +786,15 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
set_message(TTR("Transform Aborted."), 3);
}
- freelook_active = b->is_pressed();
+ if (b->is_pressed()) {
+ int mod = _get_key_modifier(b);
+ if (mod == _get_key_modifier_setting("editors/3d/freelook_activation_modifier")) {
+ freelook_active = true;
+ }
+ } else {
+ freelook_active = false;
+ }
+
if (freelook_active && !surface->has_focus()) {
// Focus usually doesn't trigger on right-click, but in case of freelook it should,
// otherwise using keyboard navigation would misbehave
@@ -1297,7 +1317,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (nav_scheme == NAVIGATION_MAYA && m->get_alt()) {
nav_mode = NAVIGATION_ZOOM;
- } else {
+ } else if (freelook_active) {
nav_mode = NAVIGATION_LOOK;
}
@@ -1305,21 +1325,13 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (nav_scheme == NAVIGATION_GODOT) {
- int mod = 0;
- if (m->get_shift())
- mod = KEY_SHIFT;
- if (m->get_alt())
- mod = KEY_ALT;
- if (m->get_control())
- mod = KEY_CONTROL;
- if (m->get_metakey())
- mod = KEY_META;
+ int mod = _get_key_modifier(m);
- if (mod == _get_key_modifier("editors/3d/pan_modifier"))
+ if (mod == _get_key_modifier_setting("editors/3d/pan_modifier"))
nav_mode = NAVIGATION_PAN;
- else if (mod == _get_key_modifier("editors/3d/zoom_modifier"))
+ else if (mod == _get_key_modifier_setting("editors/3d/zoom_modifier"))
nav_mode = NAVIGATION_ZOOM;
- else if (mod == _get_key_modifier("editors/3d/orbit_modifier"))
+ else if (mod == _get_key_modifier_setting("editors/3d/orbit_modifier"))
nav_mode = NAVIGATION_ORBIT;
} else if (nav_scheme == NAVIGATION_MAYA) {
@@ -1329,22 +1341,14 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
} else if (EditorSettings::get_singleton()->get("editors/3d/emulate_3_button_mouse")) {
// Handle trackpad (no external mouse) use case
- int mod = 0;
- if (m->get_shift())
- mod = KEY_SHIFT;
- if (m->get_alt())
- mod = KEY_ALT;
- if (m->get_control())
- mod = KEY_CONTROL;
- if (m->get_metakey())
- mod = KEY_META;
+ int mod = _get_key_modifier(m);
if (mod) {
- if (mod == _get_key_modifier("editors/3d/pan_modifier"))
+ if (mod == _get_key_modifier_setting("editors/3d/pan_modifier"))
nav_mode = NAVIGATION_PAN;
- else if (mod == _get_key_modifier("editors/3d/zoom_modifier"))
+ else if (mod == _get_key_modifier_setting("editors/3d/zoom_modifier"))
nav_mode = NAVIGATION_ZOOM;
- else if (mod == _get_key_modifier("editors/3d/orbit_modifier"))
+ else if (mod == _get_key_modifier_setting("editors/3d/orbit_modifier"))
nav_mode = NAVIGATION_ORBIT;
}
}