diff options
-rw-r--r-- | editor/scene_tree_dock.cpp | 29 | ||||
-rw-r--r-- | editor/scene_tree_dock.h | 3 | ||||
-rw-r--r-- | platform/android/java/lib/src/org/godotengine/godot/Godot.java | 4 | ||||
-rw-r--r-- | scene/2d/joint_2d.cpp | 2 | ||||
-rw-r--r-- | scene/3d/joint_3d.cpp | 2 |
5 files changed, 18 insertions, 22 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 2387f65229..c1cc144ff5 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -59,10 +59,7 @@ #endif // MODULE_REGEX_ENABLED void SceneTreeDock::_nodes_drag_begin() { - if (restore_script_editor_on_drag) { - EditorNode::get_singleton()->set_visible_editor(EditorNode::EDITOR_SCRIPT); - restore_script_editor_on_drag = false; - } + pending_click_select = nullptr; } void SceneTreeDock::_quick_open() { @@ -74,8 +71,9 @@ void SceneTreeDock::input(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> mb = p_event; - if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) { - restore_script_editor_on_drag = false; //lost chance + if (pending_click_select && mb.is_valid() && !mb->is_pressed() && (mb->get_button_index() == MouseButton::LEFT || mb->get_button_index() == MouseButton::RIGHT)) { + _push_item(pending_click_select); + pending_click_select = nullptr; } } @@ -1369,8 +1367,14 @@ void SceneTreeDock::_script_open_request(const Ref<Script> &p_script) { } void SceneTreeDock::_push_item(Object *p_object) { - if (!Input::get_singleton()->is_key_pressed(Key::ALT)) { - EditorNode::get_singleton()->push_item(p_object); + EditorNode::get_singleton()->push_item(p_object); +} + +void SceneTreeDock::_handle_select(Node *p_node) { + if ((Input::get_singleton()->get_mouse_button_mask() & (MouseButton::MASK_LEFT | MouseButton::MASK_RIGHT)) != MouseButton::NONE) { + pending_click_select = p_node; + } else { + EditorNode::get_singleton()->push_item(p_node); } } @@ -1380,12 +1384,7 @@ void SceneTreeDock::_node_selected() { if (!node) { return; } - - if (ScriptEditor::get_singleton()->is_visible_in_tree()) { - restore_script_editor_on_drag = true; - } - - _push_item(node); + _handle_select(node); } void SceneTreeDock::_node_renamed() { @@ -2148,7 +2147,7 @@ void SceneTreeDock::_selection_changed() { //automatically turn on multi-edit _tool_selected(TOOL_MULTI_EDIT); } else if (selection_size == 1) { - _push_item(editor_selection->get_selection().begin()->key); + _handle_select(editor_selection->get_selection().begin()->key); } else if (selection_size == 0) { _push_item(nullptr); } diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h index aa64945d81..54e6108d84 100644 --- a/editor/scene_tree_dock.h +++ b/editor/scene_tree_dock.h @@ -105,7 +105,6 @@ class SceneTreeDock : public VBoxContainer { Vector<ObjectID> subresources; - bool restore_script_editor_on_drag = false; bool reset_create_dialog = false; int current_option = 0; @@ -172,6 +171,7 @@ class SceneTreeDock : public VBoxContainer { void _do_create(Node *p_parent); Node *scene_root = nullptr; Node *edited_scene = nullptr; + Node *pending_click_select = nullptr; VBoxContainer *create_root_dialog = nullptr; String selected_favorite_root; @@ -198,6 +198,7 @@ class SceneTreeDock : public VBoxContainer { void _load_request(const String &p_path); void _script_open_request(const Ref<Script> &p_script); void _push_item(Object *p_object); + void _handle_select(Node *p_node); bool _cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node); bool _track_inherit(const String &p_target_scene_path, Node *p_desired_node); diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.java b/platform/android/java/lib/src/org/godotengine/godot/Godot.java index 377881be85..cafae94d62 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.java @@ -463,13 +463,9 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC tts = new GodotTTS(activity); mSensorManager = (SensorManager)activity.getSystemService(Context.SENSOR_SERVICE); mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); - mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_GAME); mGravity = mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY); - mSensorManager.registerListener(this, mGravity, SensorManager.SENSOR_DELAY_GAME); mMagnetometer = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); - mSensorManager.registerListener(this, mMagnetometer, SensorManager.SENSOR_DELAY_GAME); mGyroscope = mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE); - mSensorManager.registerListener(this, mGyroscope, SensorManager.SENSOR_DELAY_GAME); GodotLib.initialize(activity, this, activity.getAssets(), use_apk_expansion); diff --git a/scene/2d/joint_2d.cpp b/scene/2d/joint_2d.cpp index b527a72de6..7b9f7e14ca 100644 --- a/scene/2d/joint_2d.cpp +++ b/scene/2d/joint_2d.cpp @@ -50,6 +50,7 @@ void Joint2D::_disconnect_signals() { void Joint2D::_body_exit_tree() { _disconnect_signals(); _update_joint(true); + update_configuration_warnings(); } void Joint2D::_update_joint(bool p_only_free) { @@ -64,7 +65,6 @@ void Joint2D::_update_joint(bool p_only_free) { if (p_only_free || !is_inside_tree()) { PhysicsServer2D::get_singleton()->joint_clear(joint); warning = String(); - update_configuration_warnings(); return; } diff --git a/scene/3d/joint_3d.cpp b/scene/3d/joint_3d.cpp index c22e3f6d91..b6fc83e599 100644 --- a/scene/3d/joint_3d.cpp +++ b/scene/3d/joint_3d.cpp @@ -49,6 +49,7 @@ void Joint3D::_disconnect_signals() { void Joint3D::_body_exit_tree() { _disconnect_signals(); _update_joint(true); + update_configuration_warnings(); } void Joint3D::_update_joint(bool p_only_free) { @@ -65,7 +66,6 @@ void Joint3D::_update_joint(bool p_only_free) { if (p_only_free || !is_inside_tree()) { PhysicsServer3D::get_singleton()->joint_clear(joint); warning = String(); - update_configuration_warnings(); return; } |