Fixes add script button update
This commit is contained in:
parent
9a62829759
commit
ff8fe3d875
2 changed files with 16 additions and 13 deletions
|
@ -350,8 +350,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||||
if (existing.is_valid()) {
|
if (existing.is_valid()) {
|
||||||
const RefPtr empty;
|
const RefPtr empty;
|
||||||
selected->set_script(empty);
|
selected->set_script(empty);
|
||||||
button_create_script->show();
|
_update_script_button();
|
||||||
button_clear_script->hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
@ -1211,8 +1210,7 @@ void SceneTreeDock::_script_created(Ref<Script> p_script) {
|
||||||
return;
|
return;
|
||||||
selected->set_script(p_script.get_ref_ptr());
|
selected->set_script(p_script.get_ref_ptr());
|
||||||
editor->push_item(p_script.operator->());
|
editor->push_item(p_script.operator->());
|
||||||
button_create_script->hide();
|
_update_script_button();
|
||||||
button_clear_script->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneTreeDock::_delete_confirm() {
|
void SceneTreeDock::_delete_confirm() {
|
||||||
|
@ -1299,15 +1297,8 @@ void SceneTreeDock::_delete_confirm() {
|
||||||
EditorNode::get_singleton()->call("_prepare_history");
|
EditorNode::get_singleton()->call("_prepare_history");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneTreeDock::_selection_changed() {
|
void SceneTreeDock::_update_script_button() {
|
||||||
|
if (EditorNode::get_singleton()->get_editor_selection()->get_selection().size() == 1) {
|
||||||
int selection_size = EditorNode::get_singleton()->get_editor_selection()->get_selection().size();
|
|
||||||
if (selection_size > 1) {
|
|
||||||
//automatically turn on multi-edit
|
|
||||||
_tool_selected(TOOL_MULTI_EDIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selection_size == 1) {
|
|
||||||
if (EditorNode::get_singleton()->get_editor_selection()->get_selection().front()->key()->get_script().is_null()) {
|
if (EditorNode::get_singleton()->get_editor_selection()->get_selection().front()->key()->get_script().is_null()) {
|
||||||
button_create_script->show();
|
button_create_script->show();
|
||||||
button_clear_script->hide();
|
button_clear_script->hide();
|
||||||
|
@ -1321,6 +1312,16 @@ void SceneTreeDock::_selection_changed() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SceneTreeDock::_selection_changed() {
|
||||||
|
|
||||||
|
int selection_size = EditorNode::get_singleton()->get_editor_selection()->get_selection().size();
|
||||||
|
if (selection_size > 1) {
|
||||||
|
//automatically turn on multi-edit
|
||||||
|
_tool_selected(TOOL_MULTI_EDIT);
|
||||||
|
}
|
||||||
|
_update_script_button();
|
||||||
|
}
|
||||||
|
|
||||||
void SceneTreeDock::_create() {
|
void SceneTreeDock::_create() {
|
||||||
|
|
||||||
if (current_option == TOOL_NEW) {
|
if (current_option == TOOL_NEW) {
|
||||||
|
@ -1655,6 +1656,7 @@ void SceneTreeDock::_script_dropped(String p_file, NodePath p_to) {
|
||||||
Node *n = get_node(p_to);
|
Node *n = get_node(p_to);
|
||||||
if (n) {
|
if (n) {
|
||||||
n->set_script(scr.get_ref_ptr());
|
n->set_script(scr.get_ref_ptr());
|
||||||
|
_update_script_button();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,6 +160,7 @@ class SceneTreeDock : public VBoxContainer {
|
||||||
|
|
||||||
bool _validate_no_foreign();
|
bool _validate_no_foreign();
|
||||||
void _selection_changed();
|
void _selection_changed();
|
||||||
|
void _update_script_button();
|
||||||
|
|
||||||
void _fill_path_renames(Vector<StringName> base_path, Vector<StringName> new_base_path, Node *p_node, List<Pair<NodePath, NodePath> > *p_renames);
|
void _fill_path_renames(Vector<StringName> base_path, Vector<StringName> new_base_path, Node *p_node, List<Pair<NodePath, NodePath> > *p_renames);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue