diff options
-rw-r--r-- | demos/misc/autoload/global.gd | 27 | ||||
-rw-r--r-- | demos/misc/autoload/scene_a.gd | 11 | ||||
-rw-r--r-- | demos/misc/autoload/scene_b.gd | 11 | ||||
-rw-r--r-- | scene/gui/slider.cpp | 4 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 14 | ||||
-rw-r--r-- | tools/editor/editor_node.cpp | 4 | ||||
-rw-r--r-- | tools/editor/script_editor_debugger.cpp | 4 | ||||
-rw-r--r-- | tools/editor/script_editor_debugger.h | 1 | ||||
-rw-r--r-- | tools/editor/spatial_editor_gizmos.cpp | 4 |
9 files changed, 24 insertions, 56 deletions
diff --git a/demos/misc/autoload/global.gd b/demos/misc/autoload/global.gd index 2671b6f412..735995e806 100644 --- a/demos/misc/autoload/global.gd +++ b/demos/misc/autoload/global.gd @@ -1,7 +1,9 @@ extends Node -# Member variables -var current_scene = null + +# Changing scenes is most easily done using the functions `change_scene` +# and `change_scene_to` of the SceneTree. This script demonstrates how to +# change scenes without those helpers. func goto_scene(path): @@ -18,20 +20,17 @@ func goto_scene(path): func _deferred_goto_scene(path): - # Immediately free the current scene, - # there is no risk here. - current_scene.free() + # Immediately free the current scene, there is no risk here. + get_tree().get_current_scene().free() # Load new scene - var s = ResourceLoader.load(path) + var packed_scene = ResourceLoader.load(path) # Instance the new scene - current_scene = s.instance() + var instanced_scene = packed_scene.instance() - # Add it to the active scene, as child of root - get_tree().get_root().add_child(current_scene) - - -func _ready(): - # Get the current scene at the time of initialization - current_scene = get_tree().get_current_scene() + # Add it to the scene tree, as direct child of root + get_tree().get_root().add_child(instanced_scene) + + # Set it as the current scene, only after it has been added to the tree + get_tree().set_current_scene(instanced_scene) diff --git a/demos/misc/autoload/scene_a.gd b/demos/misc/autoload/scene_a.gd index f9c39887b0..03da86d9a0 100644 --- a/demos/misc/autoload/scene_a.gd +++ b/demos/misc/autoload/scene_a.gd @@ -1,16 +1,5 @@ - extends Panel -# Member variables here, example: -# var a=2 -# var b="textvar" - - -func _ready(): - # Initalization here - pass - func _on_goto_scene_pressed(): get_node("/root/global").goto_scene("res://scene_b.scn") - pass # Replace with function body diff --git a/demos/misc/autoload/scene_b.gd b/demos/misc/autoload/scene_b.gd index fdf2287a04..dea8c4623f 100644 --- a/demos/misc/autoload/scene_b.gd +++ b/demos/misc/autoload/scene_b.gd @@ -1,16 +1,5 @@ - extends Panel -# Member variables here, example: -# var a=2 -# var b="textvar" - - -func _ready(): - # Initalization here - pass - func _on_goto_scene_pressed(): get_node("/root/global").goto_scene("res://scene_a.scn") - pass # Replace with function body diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp index b6292c544b..78b5dabeb4 100644 --- a/scene/gui/slider.cpp +++ b/scene/gui/slider.cpp @@ -50,9 +50,9 @@ void Slider::_input_event(InputEvent p_event) { grab.pos=orientation==VERTICAL?mb.y:mb.x; double max = orientation==VERTICAL ? get_size().height : get_size().width ; if (orientation==VERTICAL) - set_val( ( ( -(double)grab.pos / max) * ( get_max() - get_min() ) ) + get_max() ); + set_unit_value( 1 - ((double)grab.pos / max) ); else - set_val( ( ( (double)grab.pos / max) * ( get_max() - get_min() ) ) + get_min() ); + set_unit_value((double)grab.pos / max); grab.active=true; grab.uvalue=get_unit_value(); } else { diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index ee7c0724e3..1b204cff65 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1721,6 +1721,7 @@ void Tree::text_editor_enter(String p_text) { text_editor->hide(); + value_editor->hide(); if (!popup_edited_item) return; @@ -2167,18 +2168,9 @@ void Tree::_input_event(InputEvent p_event) { range_drag_enabled=false; Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE); warp_mouse(range_drag_capture_pos); - } else { - text_editor->set_pos(pressing_item_rect.pos); - text_editor->set_size(pressing_item_rect.size); - - text_editor->clear(); - text_editor->set_text( pressing_for_editor_text ); - text_editor->select_all(); + } else + edit_selected(); - text_editor->show_modal(); - text_editor->grab_focus(); - - } pressing_for_editor=false; } diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 35404b0bba..3dbca760f0 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -1816,7 +1816,7 @@ void EditorNode::_run(bool p_current,const String& p_custom) { } play_button->set_pressed(false); - play_button->set_icon(gui_base->get_icon("Play","EditorIcons")); + play_button->set_icon(gui_base->get_icon("MainPlay","EditorIcons")); //pause_button->set_pressed(false); play_scene_button->set_pressed(false); play_scene_button->set_icon(gui_base->get_icon("PlayScene","EditorIcons")); @@ -2688,7 +2688,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { editor_run.stop(); play_button->set_pressed(false); - play_button->set_icon(gui_base->get_icon("Play","EditorIcons")); + play_button->set_icon(gui_base->get_icon("MainPlay","EditorIcons")); play_scene_button->set_pressed(false); play_scene_button->set_icon(gui_base->get_icon("PlayScene","EditorIcons")); //pause_button->set_pressed(false); diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp index 1247760a55..d0bf4faf02 100644 --- a/tools/editor/script_editor_debugger.cpp +++ b/tools/editor/script_editor_debugger.cpp @@ -570,8 +570,7 @@ void ScriptEditorDebugger::_notification(int p_what) { ppeer->set_stream_peer(connection); - if (!always_visible) - show(); + show(); dobreak->set_disabled(false); tabs->set_current_tab(0); @@ -1460,7 +1459,6 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor){ add_child(msgdialog); hide(); - always_visible=false; log_forced_visible=false; p_editor->get_undo_redo()->set_method_notify_callback(_method_changeds,this); diff --git a/tools/editor/script_editor_debugger.h b/tools/editor/script_editor_debugger.h index 906714d13c..43666b37d5 100644 --- a/tools/editor/script_editor_debugger.h +++ b/tools/editor/script_editor_debugger.h @@ -81,7 +81,6 @@ class ScriptEditorDebugger : public Control { TabContainer *tabs; Label *reason; - bool always_visible; bool log_forced_visible; ScriptEditorDebuggerVariables *variables; diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index 5efca44c7d..04a6b1b437 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -2283,6 +2283,8 @@ void NavigationMeshSpatialGizmo::redraw() { } } + if (faces.empty()) + return; Map<_EdgeKey,bool> edge_map; DVector<Vector3> tmeshfaces; @@ -2330,7 +2332,7 @@ void NavigationMeshSpatialGizmo::redraw() { } } - Ref<TriangleMesh> tmesh = memnew( TriangleMesh); + Ref<TriangleMesh> tmesh = memnew( TriangleMesh ); tmesh->create(tmeshfaces); if (lines.size()) |