summaryrefslogtreecommitdiff
path: root/scene/main/scene_tree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main/scene_tree.cpp')
-rw-r--r--scene/main/scene_tree.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index b81364e2f0..0e7cec57a4 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -105,6 +105,11 @@ void SceneTree::node_removed(Node *p_node) {
call_skip.insert(p_node);
}
+void SceneTree::node_renamed(Node *p_node) {
+
+ emit_signal(node_renamed_name, p_node);
+}
+
SceneTree::Group *SceneTree::add_to_group(const StringName &p_group, Node *p_node) {
Map<StringName, Group>::Element *E = group_map.find(p_group);
@@ -609,6 +614,7 @@ void SceneTree::finish() {
root->_set_tree(NULL);
root->_propagate_after_exit_tree();
memdelete(root); //delete root
+ root = NULL;
}
}
@@ -1239,7 +1245,7 @@ void SceneTree::_update_root_rect() {
root->update_canvas_items(); //force them to update just in case
if (use_font_oversampling) {
- WARN_PRINT("Font oversampling does not work in 'Viewport' stretch mode, only '2D'.")
+ WARN_PRINT("Font oversampling does not work in 'Viewport' stretch mode, only '2D'.");
}
} break;
@@ -1884,6 +1890,7 @@ void SceneTree::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_navigation_hint"), "set_debug_navigation_hint", "is_debugging_navigation_hint");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "paused"), "set_pause", "is_paused");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "refuse_new_network_connections"), "set_refuse_new_network_connections", "is_refusing_new_network_connections");
+ ADD_PROPERTY_DEFAULT("refuse_new_network_connections", false);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_font_oversampling"), "set_use_font_oversampling", "is_using_font_oversampling");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "edited_scene_root", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_edited_scene_root", "get_edited_scene_root");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "current_scene", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_current_scene", "get_current_scene");
@@ -1895,6 +1902,7 @@ void SceneTree::_bind_methods() {
ADD_SIGNAL(MethodInfo("tree_changed"));
ADD_SIGNAL(MethodInfo("node_added", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
ADD_SIGNAL(MethodInfo("node_removed", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
+ ADD_SIGNAL(MethodInfo("node_renamed", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
ADD_SIGNAL(MethodInfo("screen_resized"));
ADD_SIGNAL(MethodInfo("node_configuration_warning_changed", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
@@ -1956,7 +1964,7 @@ bool SceneTree::is_using_font_oversampling() const {
SceneTree::SceneTree() {
- singleton = this;
+ if (singleton == NULL) singleton = this;
_quit = false;
accept_quit = true;
quit_on_go_back = true;
@@ -1983,6 +1991,7 @@ SceneTree::SceneTree() {
tree_changed_name = "tree_changed";
node_added_name = "node_added";
node_removed_name = "node_removed";
+ node_renamed_name = "node_renamed";
ugc_locked = false;
call_lock = 0;
root_lock = 0;
@@ -2100,4 +2109,11 @@ SceneTree::SceneTree() {
}
SceneTree::~SceneTree() {
+ if (root) {
+ root->_set_tree(NULL);
+ root->_propagate_after_exit_tree();
+ memdelete(root);
+ }
+
+ if (singleton == this) singleton = NULL;
}