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
62bf8b4d
Unverified
Commit
62bf8b4d
authored
May 11, 2020
by
Rémi Verschelde
Committed by
GitHub
May 11, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #38594 from Calinou/rename-clear-script-action
Rename the Clear Script editor action to Detach Script
parents
845e2111
7fc0e38e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
24 deletions
+24
-24
scene_tree_dock.cpp
editor/scene_tree_dock.cpp
+22
-22
scene_tree_dock.h
editor/scene_tree_dock.h
+2
-2
No files found.
editor/scene_tree_dock.cpp
View file @
62bf8b4d
...
...
@@ -97,8 +97,8 @@ void SceneTreeDock::_unhandled_key_input(Ref<InputEvent> p_event) {
_tool_selected
(
TOOL_DUPLICATE
);
}
else
if
(
ED_IS_SHORTCUT
(
"scene_tree/attach_script"
,
p_event
))
{
_tool_selected
(
TOOL_ATTACH_SCRIPT
);
}
else
if
(
ED_IS_SHORTCUT
(
"scene_tree/
clear
_script"
,
p_event
))
{
_tool_selected
(
TOOL_
CLEAR
_SCRIPT
);
}
else
if
(
ED_IS_SHORTCUT
(
"scene_tree/
detach
_script"
,
p_event
))
{
_tool_selected
(
TOOL_
DETACH
_SCRIPT
);
}
else
if
(
ED_IS_SHORTCUT
(
"scene_tree/move_up"
,
p_event
))
{
_tool_selected
(
TOOL_MOVE_UP
);
}
else
if
(
ED_IS_SHORTCUT
(
"scene_tree/move_down"
,
p_event
))
{
...
...
@@ -426,7 +426,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
case
TOOL_ATTACH_SCRIPT
:
{
attach_script_to_selected
(
false
);
}
break
;
case
TOOL_
CLEAR
_SCRIPT
:
{
case
TOOL_
DETACH
_SCRIPT
:
{
if
(
!
profile_allow_script_editing
)
{
break
;
...
...
@@ -437,7 +437,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
if
(
selection
.
empty
())
return
;
editor_data
->
get_undo_redo
().
create_action
(
TTR
(
"
Clear
Script"
));
editor_data
->
get_undo_redo
().
create_action
(
TTR
(
"
Detach
Script"
));
editor_data
->
get_undo_redo
().
add_do_method
(
editor
,
"push_item"
,
(
Script
*
)
nullptr
);
for
(
int
i
=
0
;
i
<
selection
.
size
();
i
++
)
{
...
...
@@ -1071,7 +1071,7 @@ void SceneTreeDock::_notification(int p_what) {
button_add
->
set_icon
(
get_theme_icon
(
"Add"
,
"EditorIcons"
));
button_instance
->
set_icon
(
get_theme_icon
(
"Instance"
,
"EditorIcons"
));
button_create_script
->
set_icon
(
get_theme_icon
(
"ScriptCreate"
,
"EditorIcons"
));
button_
clear
_script
->
set_icon
(
get_theme_icon
(
"ScriptRemove"
,
"EditorIcons"
));
button_
detach
_script
->
set_icon
(
get_theme_icon
(
"ScriptRemove"
,
"EditorIcons"
));
filter
->
set_right_icon
(
get_theme_icon
(
"Search"
,
"EditorIcons"
));
filter
->
set_clear_button_enabled
(
true
);
...
...
@@ -1148,7 +1148,7 @@ void SceneTreeDock::_notification(int p_what) {
button_add
->
set_icon
(
get_theme_icon
(
"Add"
,
"EditorIcons"
));
button_instance
->
set_icon
(
get_theme_icon
(
"Instance"
,
"EditorIcons"
));
button_create_script
->
set_icon
(
get_theme_icon
(
"ScriptCreate"
,
"EditorIcons"
));
button_
clear
_script
->
set_icon
(
get_theme_icon
(
"ScriptRemove"
,
"EditorIcons"
));
button_
detach
_script
->
set_icon
(
get_theme_icon
(
"ScriptRemove"
,
"EditorIcons"
));
filter
->
set_right_icon
(
get_theme_icon
(
"Search"
,
"EditorIcons"
));
filter
->
set_clear_button_enabled
(
true
);
...
...
@@ -1883,18 +1883,18 @@ void SceneTreeDock::_update_script_button() {
if
(
!
profile_allow_script_editing
)
{
button_create_script
->
hide
();
button_
clear
_script
->
hide
();
button_
detach
_script
->
hide
();
}
else
if
(
EditorNode
::
get_singleton
()
->
get_editor_selection
()
->
get_selection
().
size
()
==
0
)
{
button_create_script
->
hide
();
button_
clear
_script
->
hide
();
button_
detach
_script
->
hide
();
}
else
if
(
EditorNode
::
get_singleton
()
->
get_editor_selection
()
->
get_selection
().
size
()
==
1
)
{
Node
*
n
=
EditorNode
::
get_singleton
()
->
get_editor_selection
()
->
get_selected_node_list
()[
0
];
if
(
n
->
get_script
().
is_null
())
{
button_create_script
->
show
();
button_
clear
_script
->
hide
();
button_
detach
_script
->
hide
();
}
else
{
button_create_script
->
hide
();
button_
clear
_script
->
show
();
button_
detach
_script
->
show
();
}
}
else
{
button_create_script
->
hide
();
...
...
@@ -1902,11 +1902,11 @@ void SceneTreeDock::_update_script_button() {
for
(
int
i
=
0
;
i
<
selection
.
size
();
i
++
)
{
Node
*
n
=
Object
::
cast_to
<
Node
>
(
selection
[
i
]);
if
(
!
n
->
get_script
().
is_null
())
{
button_
clear
_script
->
show
();
button_
detach
_script
->
show
();
return
;
}
}
button_
clear
_script
->
hide
();
button_
detach
_script
->
hide
();
}
}
...
...
@@ -2458,7 +2458,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
}
if
(
existing_script
.
is_valid
()
&&
existing_script_removable
)
{
add_separator
=
true
;
menu
->
add_icon_shortcut
(
get_theme_icon
(
"ScriptRemove"
,
"EditorIcons"
),
ED_GET_SHORTCUT
(
"scene_tree/
clear_script"
),
TOOL_CLEAR
_SCRIPT
);
menu
->
add_icon_shortcut
(
get_theme_icon
(
"ScriptRemove"
,
"EditorIcons"
),
ED_GET_SHORTCUT
(
"scene_tree/
detach_script"
),
TOOL_DETACH
_SCRIPT
);
}
else
if
(
full_selection
.
size
()
>
1
)
{
bool
script_exists
=
false
;
for
(
List
<
Node
*>::
Element
*
E
=
full_selection
.
front
();
E
;
E
=
E
->
next
())
{
...
...
@@ -2470,7 +2470,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
if
(
script_exists
)
{
add_separator
=
true
;
menu
->
add_icon_shortcut
(
get_theme_icon
(
"ScriptRemove"
,
"EditorIcons"
),
ED_GET_SHORTCUT
(
"scene_tree/
clear_script"
),
TOOL_CLEAR
_SCRIPT
);
menu
->
add_icon_shortcut
(
get_theme_icon
(
"ScriptRemove"
,
"EditorIcons"
),
ED_GET_SHORTCUT
(
"scene_tree/
detach_script"
),
TOOL_DETACH
_SCRIPT
);
}
}
...
...
@@ -2816,7 +2816,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
ED_SHORTCUT
(
"scene_tree/change_node_type"
,
TTR
(
"Change Type"
));
ED_SHORTCUT
(
"scene_tree/attach_script"
,
TTR
(
"Attach Script"
));
ED_SHORTCUT
(
"scene_tree/extend_script"
,
TTR
(
"Extend Script"
));
ED_SHORTCUT
(
"scene_tree/
clear_script"
,
TTR
(
"Clear
Script"
));
ED_SHORTCUT
(
"scene_tree/
detach_script"
,
TTR
(
"Detach
Script"
));
ED_SHORTCUT
(
"scene_tree/move_up"
,
TTR
(
"Move Up"
),
KEY_MASK_CMD
|
KEY_UP
);
ED_SHORTCUT
(
"scene_tree/move_down"
,
TTR
(
"Move Down"
),
KEY_MASK_CMD
|
KEY_DOWN
);
ED_SHORTCUT
(
"scene_tree/duplicate"
,
TTR
(
"Duplicate"
),
KEY_MASK_CMD
|
KEY_D
);
...
...
@@ -2851,17 +2851,17 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
button_create_script
=
memnew
(
ToolButton
);
button_create_script
->
connect
(
"pressed"
,
callable_mp
(
this
,
&
SceneTreeDock
::
_tool_selected
),
make_binds
(
TOOL_ATTACH_SCRIPT
,
false
));
button_create_script
->
set_tooltip
(
TTR
(
"Attach a new or existing script
for
the selected node."
));
button_create_script
->
set_tooltip
(
TTR
(
"Attach a new or existing script
to
the selected node."
));
button_create_script
->
set_shortcut
(
ED_GET_SHORTCUT
(
"scene_tree/attach_script"
));
filter_hbc
->
add_child
(
button_create_script
);
button_create_script
->
hide
();
button_
clear
_script
=
memnew
(
ToolButton
);
button_
clear_script
->
connect
(
"pressed"
,
callable_mp
(
this
,
&
SceneTreeDock
::
_tool_selected
),
make_binds
(
TOOL_CLEAR
_SCRIPT
,
false
));
button_
clear_script
->
set_tooltip
(
TTR
(
"Clear a script for
the selected node."
));
button_
clear_script
->
set_shortcut
(
ED_GET_SHORTCUT
(
"scene_tree/clear
_script"
));
filter_hbc
->
add_child
(
button_
clear
_script
);
button_
clear
_script
->
hide
();
button_
detach
_script
=
memnew
(
ToolButton
);
button_
detach_script
->
connect
(
"pressed"
,
callable_mp
(
this
,
&
SceneTreeDock
::
_tool_selected
),
make_binds
(
TOOL_DETACH
_SCRIPT
,
false
));
button_
detach_script
->
set_tooltip
(
TTR
(
"Detach the script from
the selected node."
));
button_
detach_script
->
set_shortcut
(
ED_GET_SHORTCUT
(
"scene_tree/detach
_script"
));
filter_hbc
->
add_child
(
button_
detach
_script
);
button_
detach
_script
->
hide
();
button_hb
=
memnew
(
HBoxContainer
);
vbc
->
add_child
(
button_hb
);
...
...
editor/scene_tree_dock.h
View file @
62bf8b4d
...
...
@@ -66,7 +66,7 @@ class SceneTreeDock : public VBoxContainer {
TOOL_REPLACE
,
TOOL_EXTEND_SCRIPT
,
TOOL_ATTACH_SCRIPT
,
TOOL_
CLEAR
_SCRIPT
,
TOOL_
DETACH
_SCRIPT
,
TOOL_MOVE_UP
,
TOOL_MOVE_DOWN
,
TOOL_DUPLICATE
,
...
...
@@ -110,7 +110,7 @@ class SceneTreeDock : public VBoxContainer {
ToolButton
*
button_add
;
ToolButton
*
button_instance
;
ToolButton
*
button_create_script
;
ToolButton
*
button_
clear
_script
;
ToolButton
*
button_
detach
_script
;
Button
*
button_3d
;
...
...
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