diff options
Diffstat (limited to 'scene/main/scene_tree.cpp')
-rw-r--r-- | scene/main/scene_tree.cpp | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 5eeaff6411..617a703855 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -37,7 +37,6 @@ #include "core/os/os.h" #include "core/print_string.h" #include "core/project_settings.h" -#include "editor/editor_node.h" #include "main/input_default.h" #include "node.h" #include "scene/resources/dynamic_font.h" @@ -117,10 +116,7 @@ SceneTree::Group *SceneTree::add_to_group(const StringName &p_group, Node *p_nod E = group_map.insert(p_group, Group()); } - if (E->get().nodes.find(p_node) != -1) { - ERR_EXPLAIN("Already in group: " + p_group); - ERR_FAIL_V(&E->get()); - } + ERR_FAIL_COND_V_MSG(E->get().nodes.find(p_node) != -1, &E->get(), "Already in group: " + p_group + "."); E->get().nodes.push_back(p_node); //E->get().last_tree_version=0; E->get().changed = true; @@ -647,7 +643,8 @@ void SceneTree::_notification(int p_notification) { case NOTIFICATION_WM_MOUSE_ENTER: case NOTIFICATION_WM_MOUSE_EXIT: case NOTIFICATION_WM_FOCUS_IN: - case NOTIFICATION_WM_FOCUS_OUT: { + case NOTIFICATION_WM_FOCUS_OUT: + case NOTIFICATION_WM_ABOUT: { if (p_notification == NOTIFICATION_WM_FOCUS_IN) { InputDefault *id = Object::cast_to<InputDefault>(Input::get_singleton()); @@ -671,19 +668,6 @@ void SceneTree::_notification(int p_notification) { } break; - case NOTIFICATION_WM_ABOUT: { - -#ifdef TOOLS_ENABLED - if (EditorNode::get_singleton()) { - EditorNode::get_singleton()->show_about(); - } else { -#endif - get_root()->propagate_notification(p_notification); -#ifdef TOOLS_ENABLED - } -#endif - } break; - case NOTIFICATION_CRASH: { get_root()->propagate_notification(p_notification); @@ -1089,7 +1073,7 @@ void SceneTree::get_nodes_in_group(const StringName &p_group, List<Node *> *p_li static void _fill_array(Node *p_node, Array &array, int p_level) { - array.push_back(p_level); + array.push_back(p_node->get_child_count()); array.push_back(p_node->get_name()); array.push_back(p_node->get_class()); array.push_back(p_node->get_instance_id()); @@ -1507,8 +1491,11 @@ void SceneTree::_live_edit_instance_node_func(const NodePath &p_parent, const St Node *n2 = n->get_node(p_parent); Node *no = ps->instance(); - no->set_name(p_name); + if (!no) { + continue; + } + no->set_name(p_name); n2->add_child(no); } } @@ -1686,6 +1673,12 @@ void SceneTree::drop_files(const Vector<String> &p_files, int p_from_screen) { MainLoop::drop_files(p_files, p_from_screen); } +void SceneTree::global_menu_action(const Variant &p_id, const Variant &p_meta) { + + emit_signal("global_menu_action", p_id, p_meta); + MainLoop::global_menu_action(p_id, p_meta); +} + Ref<SceneTreeTimer> SceneTree::create_timer(float p_delay_sec, bool p_process_pause) { Ref<SceneTreeTimer> stt; @@ -1907,6 +1900,7 @@ void SceneTree::_bind_methods() { ADD_SIGNAL(MethodInfo("physics_frame")); ADD_SIGNAL(MethodInfo("files_dropped", PropertyInfo(Variant::POOL_STRING_ARRAY, "files"), PropertyInfo(Variant::INT, "screen"))); + ADD_SIGNAL(MethodInfo("global_menu_action", PropertyInfo(Variant::NIL, "id"), PropertyInfo(Variant::NIL, "meta"))); ADD_SIGNAL(MethodInfo("network_peer_connected", PropertyInfo(Variant::INT, "id"))); ADD_SIGNAL(MethodInfo("network_peer_disconnected", PropertyInfo(Variant::INT, "id"))); ADD_SIGNAL(MethodInfo("connected_to_server")); |