Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
25d2ee67
Unverified
Commit
25d2ee67
authored
May 24, 2019
by
Rémi Verschelde
Committed by
GitHub
May 24, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #29152 from nekomatata/fix-node-rename-tool-script
Fixed scene tree update after changing node name in tool script
parents
b09ed500
3f174c86
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
6 deletions
+25
-6
scene_tree_editor.cpp
editor/scene_tree_editor.cpp
+14
-6
scene_tree_editor.h
editor/scene_tree_editor.h
+1
-0
node.cpp
scene/main/node.cpp
+1
-0
scene_tree.cpp
scene/main/scene_tree.cpp
+7
-0
scene_tree.h
scene/main/scene_tree.h
+2
-0
No files found.
editor/scene_tree_editor.cpp
View file @
25d2ee67
...
@@ -471,6 +471,17 @@ void SceneTreeEditor::_node_removed(Node *p_node) {
...
@@ -471,6 +471,17 @@ void SceneTreeEditor::_node_removed(Node *p_node) {
emit_signal
(
"node_selected"
);
emit_signal
(
"node_selected"
);
}
}
}
}
void
SceneTreeEditor
::
_node_renamed
(
Node
*
p_node
)
{
emit_signal
(
"node_renamed"
);
if
(
!
tree_dirty
)
{
MessageQueue
::
get_singleton
()
->
push_call
(
this
,
"_update_tree"
);
tree_dirty
=
true
;
}
}
void
SceneTreeEditor
::
_update_tree
()
{
void
SceneTreeEditor
::
_update_tree
()
{
if
(
!
is_inside_tree
())
{
if
(
!
is_inside_tree
())
{
...
@@ -594,6 +605,7 @@ void SceneTreeEditor::_notification(int p_what) {
...
@@ -594,6 +605,7 @@ void SceneTreeEditor::_notification(int p_what) {
get_tree
()
->
connect
(
"tree_changed"
,
this
,
"_tree_changed"
);
get_tree
()
->
connect
(
"tree_changed"
,
this
,
"_tree_changed"
);
get_tree
()
->
connect
(
"node_removed"
,
this
,
"_node_removed"
);
get_tree
()
->
connect
(
"node_removed"
,
this
,
"_node_removed"
);
get_tree
()
->
connect
(
"node_renamed"
,
this
,
"_node_renamed"
);
get_tree
()
->
connect
(
"node_configuration_warning_changed"
,
this
,
"_warning_changed"
);
get_tree
()
->
connect
(
"node_configuration_warning_changed"
,
this
,
"_warning_changed"
);
tree
->
connect
(
"item_collapsed"
,
this
,
"_cell_collapsed"
);
tree
->
connect
(
"item_collapsed"
,
this
,
"_cell_collapsed"
);
...
@@ -604,6 +616,7 @@ void SceneTreeEditor::_notification(int p_what) {
...
@@ -604,6 +616,7 @@ void SceneTreeEditor::_notification(int p_what) {
get_tree
()
->
disconnect
(
"tree_changed"
,
this
,
"_tree_changed"
);
get_tree
()
->
disconnect
(
"tree_changed"
,
this
,
"_tree_changed"
);
get_tree
()
->
disconnect
(
"node_removed"
,
this
,
"_node_removed"
);
get_tree
()
->
disconnect
(
"node_removed"
,
this
,
"_node_removed"
);
get_tree
()
->
disconnect
(
"node_renamed"
,
this
,
"_node_renamed"
);
tree
->
disconnect
(
"item_collapsed"
,
this
,
"_cell_collapsed"
);
tree
->
disconnect
(
"item_collapsed"
,
this
,
"_cell_collapsed"
);
get_tree
()
->
disconnect
(
"node_configuration_warning_changed"
,
this
,
"_warning_changed"
);
get_tree
()
->
disconnect
(
"node_configuration_warning_changed"
,
this
,
"_warning_changed"
);
}
break
;
}
break
;
...
@@ -685,12 +698,6 @@ void SceneTreeEditor::_rename_node(ObjectID p_node, const String &p_name) {
...
@@ -685,12 +698,6 @@ void SceneTreeEditor::_rename_node(ObjectID p_node, const String &p_name) {
n
->
set_name
(
p_name
);
n
->
set_name
(
p_name
);
item
->
set_metadata
(
0
,
n
->
get_path
());
item
->
set_metadata
(
0
,
n
->
get_path
());
item
->
set_text
(
0
,
p_name
);
item
->
set_text
(
0
,
p_name
);
emit_signal
(
"node_renamed"
);
if
(
!
tree_dirty
)
{
MessageQueue
::
get_singleton
()
->
push_call
(
this
,
"_update_tree"
);
tree_dirty
=
true
;
}
}
}
void
SceneTreeEditor
::
_renamed
()
{
void
SceneTreeEditor
::
_renamed
()
{
...
@@ -1025,6 +1032,7 @@ void SceneTreeEditor::_bind_methods() {
...
@@ -1025,6 +1032,7 @@ void SceneTreeEditor::_bind_methods() {
ClassDB
::
bind_method
(
"_tree_changed"
,
&
SceneTreeEditor
::
_tree_changed
);
ClassDB
::
bind_method
(
"_tree_changed"
,
&
SceneTreeEditor
::
_tree_changed
);
ClassDB
::
bind_method
(
"_update_tree"
,
&
SceneTreeEditor
::
_update_tree
);
ClassDB
::
bind_method
(
"_update_tree"
,
&
SceneTreeEditor
::
_update_tree
);
ClassDB
::
bind_method
(
"_node_removed"
,
&
SceneTreeEditor
::
_node_removed
);
ClassDB
::
bind_method
(
"_node_removed"
,
&
SceneTreeEditor
::
_node_removed
);
ClassDB
::
bind_method
(
"_node_renamed"
,
&
SceneTreeEditor
::
_node_renamed
);
ClassDB
::
bind_method
(
"_selected_changed"
,
&
SceneTreeEditor
::
_selected_changed
);
ClassDB
::
bind_method
(
"_selected_changed"
,
&
SceneTreeEditor
::
_selected_changed
);
ClassDB
::
bind_method
(
"_deselect_items"
,
&
SceneTreeEditor
::
_deselect_items
);
ClassDB
::
bind_method
(
"_deselect_items"
,
&
SceneTreeEditor
::
_deselect_items
);
ClassDB
::
bind_method
(
"_renamed"
,
&
SceneTreeEditor
::
_renamed
);
ClassDB
::
bind_method
(
"_renamed"
,
&
SceneTreeEditor
::
_renamed
);
...
...
editor/scene_tree_editor.h
View file @
25d2ee67
...
@@ -78,6 +78,7 @@ class SceneTreeEditor : public Control {
...
@@ -78,6 +78,7 @@ class SceneTreeEditor : public Control {
void
_update_tree
();
void
_update_tree
();
void
_tree_changed
();
void
_tree_changed
();
void
_node_removed
(
Node
*
p_node
);
void
_node_removed
(
Node
*
p_node
);
void
_node_renamed
(
Node
*
p_node
);
TreeItem
*
_find
(
TreeItem
*
p_node
,
const
NodePath
&
p_path
);
TreeItem
*
_find
(
TreeItem
*
p_node
,
const
NodePath
&
p_path
);
void
_notification
(
int
p_what
);
void
_notification
(
int
p_what
);
...
...
scene/main/node.cpp
View file @
25d2ee67
...
@@ -949,6 +949,7 @@ void Node::set_name(const String &p_name) {
...
@@ -949,6 +949,7 @@ void Node::set_name(const String &p_name) {
if
(
is_inside_tree
())
{
if
(
is_inside_tree
())
{
emit_signal
(
"renamed"
);
emit_signal
(
"renamed"
);
get_tree
()
->
node_renamed
(
this
);
get_tree
()
->
tree_changed
();
get_tree
()
->
tree_changed
();
}
}
}
}
...
...
scene/main/scene_tree.cpp
View file @
25d2ee67
...
@@ -105,6 +105,11 @@ void SceneTree::node_removed(Node *p_node) {
...
@@ -105,6 +105,11 @@ void SceneTree::node_removed(Node *p_node) {
call_skip
.
insert
(
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
)
{
SceneTree
::
Group
*
SceneTree
::
add_to_group
(
const
StringName
&
p_group
,
Node
*
p_node
)
{
Map
<
StringName
,
Group
>::
Element
*
E
=
group_map
.
find
(
p_group
);
Map
<
StringName
,
Group
>::
Element
*
E
=
group_map
.
find
(
p_group
);
...
@@ -1895,6 +1900,7 @@ void SceneTree::_bind_methods() {
...
@@ -1895,6 +1900,7 @@ void SceneTree::_bind_methods() {
ADD_SIGNAL
(
MethodInfo
(
"tree_changed"
));
ADD_SIGNAL
(
MethodInfo
(
"tree_changed"
));
ADD_SIGNAL
(
MethodInfo
(
"node_added"
,
PropertyInfo
(
Variant
::
OBJECT
,
"node"
,
PROPERTY_HINT_RESOURCE_TYPE
,
"Node"
)));
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_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
(
"screen_resized"
));
ADD_SIGNAL
(
MethodInfo
(
"node_configuration_warning_changed"
,
PropertyInfo
(
Variant
::
OBJECT
,
"node"
,
PROPERTY_HINT_RESOURCE_TYPE
,
"Node"
)));
ADD_SIGNAL
(
MethodInfo
(
"node_configuration_warning_changed"
,
PropertyInfo
(
Variant
::
OBJECT
,
"node"
,
PROPERTY_HINT_RESOURCE_TYPE
,
"Node"
)));
...
@@ -1983,6 +1989,7 @@ SceneTree::SceneTree() {
...
@@ -1983,6 +1989,7 @@ SceneTree::SceneTree() {
tree_changed_name
=
"tree_changed"
;
tree_changed_name
=
"tree_changed"
;
node_added_name
=
"node_added"
;
node_added_name
=
"node_added"
;
node_removed_name
=
"node_removed"
;
node_removed_name
=
"node_removed"
;
node_renamed_name
=
"node_renamed"
;
ugc_locked
=
false
;
ugc_locked
=
false
;
call_lock
=
0
;
call_lock
=
0
;
root_lock
=
0
;
root_lock
=
0
;
...
...
scene/main/scene_tree.h
View file @
25d2ee67
...
@@ -126,6 +126,7 @@ private:
...
@@ -126,6 +126,7 @@ private:
StringName
tree_changed_name
;
StringName
tree_changed_name
;
StringName
node_added_name
;
StringName
node_added_name
;
StringName
node_removed_name
;
StringName
node_removed_name
;
StringName
node_renamed_name
;
bool
use_font_oversampling
;
bool
use_font_oversampling
;
int64_t
current_frame
;
int64_t
current_frame
;
...
@@ -201,6 +202,7 @@ private:
...
@@ -201,6 +202,7 @@ private:
void
tree_changed
();
void
tree_changed
();
void
node_added
(
Node
*
p_node
);
void
node_added
(
Node
*
p_node
);
void
node_removed
(
Node
*
p_node
);
void
node_removed
(
Node
*
p_node
);
void
node_renamed
(
Node
*
p_node
);
Group
*
add_to_group
(
const
StringName
&
p_group
,
Node
*
p_node
);
Group
*
add_to_group
(
const
StringName
&
p_group
,
Node
*
p_node
);
void
remove_from_group
(
const
StringName
&
p_group
,
Node
*
p_node
);
void
remove_from_group
(
const
StringName
&
p_group
,
Node
*
p_node
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment