feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -88,8 +88,12 @@ static void _restore_treeitem_custom_color(TreeItem *p_item) {
|
|||
}
|
||||
|
||||
void SceneTreeDock::_inspect_hovered_node() {
|
||||
select_node_hovered_at_end_of_drag = true;
|
||||
Tree *tree = scene_tree->get_scene_tree();
|
||||
if (!tree->get_rect().has_point(tree->get_local_mouse_position())) {
|
||||
return;
|
||||
}
|
||||
|
||||
select_node_hovered_at_end_of_drag = true;
|
||||
TreeItem *item = tree->get_item_with_metadata(node_hovered_now->get_path());
|
||||
|
||||
_restore_treeitem_custom_color(tree_item_inspected);
|
||||
|
|
@ -150,7 +154,14 @@ void SceneTreeDock::input(const Ref<InputEvent> &p_event) {
|
|||
}
|
||||
}
|
||||
|
||||
if (tree_clicked && get_viewport()->gui_is_dragging()) {
|
||||
Ref<InputEventMouseMotion> mm = p_event;
|
||||
bool tree_hovered = false;
|
||||
if (mm.is_valid()) {
|
||||
Tree *tree = scene_tree->get_scene_tree();
|
||||
tree_hovered = tree->get_rect().has_point(tree->get_local_mouse_position());
|
||||
}
|
||||
|
||||
if ((tree_clicked || tree_hovered) && get_viewport()->gui_is_dragging()) {
|
||||
_handle_hover_to_inspect();
|
||||
}
|
||||
}
|
||||
|
|
@ -424,7 +435,7 @@ void SceneTreeDock::_perform_create_audio_stream_players(const Vector<String> &p
|
|||
|
||||
void SceneTreeDock::_replace_with_branch_scene(const String &p_file, Node *base) {
|
||||
// `move_child` + `get_index` doesn't really work for internal nodes.
|
||||
ERR_FAIL_COND_MSG(base->get_internal_mode() != INTERNAL_MODE_DISABLED, "Trying to replace internal node, this is not supported.");
|
||||
ERR_FAIL_COND_MSG(base->is_internal(), "Trying to replace internal node, this is not supported.");
|
||||
|
||||
Ref<PackedScene> sdata = ResourceLoader::load(p_file);
|
||||
if (sdata.is_null()) {
|
||||
|
|
@ -549,7 +560,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
if (editor_selection->get_selected_node_list().size() > 1) {
|
||||
if (editor_selection->get_top_selected_node_list().size() > 1) {
|
||||
if (!_validate_no_foreign()) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -647,8 +658,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
break;
|
||||
}
|
||||
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
if (selection.size() == 0) {
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
if (selection.is_empty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -727,8 +738,9 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
}
|
||||
|
||||
Node *selected = scene_tree->get_selected();
|
||||
if (!selected && !editor_selection->get_selected_node_list().is_empty()) {
|
||||
selected = editor_selection->get_selected_node_list().front()->get();
|
||||
const List<Node *> &top_node_list = editor_selection->get_top_selected_node_list();
|
||||
if (!selected && !top_node_list.is_empty()) {
|
||||
selected = top_node_list.front()->get();
|
||||
}
|
||||
|
||||
if (selected) {
|
||||
|
|
@ -804,7 +816,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
bool MOVING_UP = !MOVING_DOWN;
|
||||
|
||||
Node *common_parent = scene_tree->get_selected()->get_parent();
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
selection.sort_custom<Node::Comparator>(); // sort by index
|
||||
if (MOVING_DOWN) {
|
||||
selection.reverse();
|
||||
|
|
@ -814,7 +826,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
int highest_id = 0;
|
||||
for (Node *E : selection) {
|
||||
// `move_child` + `get_index` doesn't really work for internal nodes.
|
||||
ERR_FAIL_COND_MSG(E->get_internal_mode() != INTERNAL_MODE_DISABLED, "Trying to move internal node, this is not supported.");
|
||||
ERR_FAIL_COND_MSG(E->is_internal(), "Trying to move internal node, this is not supported.");
|
||||
int index = E->get_index(false);
|
||||
|
||||
if (index > highest_id) {
|
||||
|
|
@ -874,8 +886,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
break;
|
||||
}
|
||||
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
if (selection.size() == 0) {
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
if (selection.is_empty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -969,7 +981,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
break;
|
||||
}
|
||||
|
||||
List<Node *> nodes = editor_selection->get_selected_node_list();
|
||||
List<Node *> nodes = editor_selection->get_top_selected_node_list();
|
||||
HashSet<Node *> nodeset;
|
||||
for (Node *E : nodes) {
|
||||
nodeset.insert(E);
|
||||
|
|
@ -982,7 +994,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
break;
|
||||
}
|
||||
|
||||
List<Node *> nodes = editor_selection->get_selected_node_list();
|
||||
List<Node *> nodes = editor_selection->get_top_selected_node_list();
|
||||
ERR_FAIL_COND(nodes.size() != 1);
|
||||
|
||||
Node *node = nodes.front()->get();
|
||||
|
|
@ -993,7 +1005,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
}
|
||||
|
||||
// `move_child` + `get_index` doesn't really work for internal nodes.
|
||||
ERR_FAIL_COND_MSG(node->get_internal_mode() != INTERNAL_MODE_DISABLED, "Trying to set internal node as scene root, this is not supported.");
|
||||
ERR_FAIL_COND_MSG(node->is_internal(), "Trying to set internal node as scene root, this is not supported.");
|
||||
|
||||
//check that from node to root, all owners are right
|
||||
|
||||
|
|
@ -1065,7 +1077,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
break;
|
||||
}
|
||||
|
||||
List<Node *> remove_list = editor_selection->get_selected_node_list();
|
||||
List<Node *> remove_list = editor_selection->get_top_selected_node_list();
|
||||
|
||||
if (remove_list.is_empty()) {
|
||||
return;
|
||||
|
|
@ -1135,7 +1147,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
break;
|
||||
}
|
||||
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
|
||||
if (selection.size() != 1) {
|
||||
accept->set_text(vformat(TTR("Saving the branch as a scene requires selecting only one node, but you have selected %d nodes."), selection.size()));
|
||||
|
|
@ -1191,7 +1203,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
new_scene_from_dialog->popup_file_dialog();
|
||||
} break;
|
||||
case TOOL_COPY_NODE_PATH: {
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
Node *node = e->get();
|
||||
|
|
@ -1203,7 +1215,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
}
|
||||
} break;
|
||||
case TOOL_SHOW_IN_FILE_SYSTEM: {
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
const Node *node = e->get();
|
||||
|
|
@ -1213,7 +1225,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
}
|
||||
} break;
|
||||
case TOOL_OPEN_DOCUMENTATION: {
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
for (const Node *node : selection) {
|
||||
String class_name;
|
||||
Ref<Script> script_base = node->get_script();
|
||||
|
|
@ -1237,12 +1249,15 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
case TOOL_HIDE_FILTERED_OUT_PARENTS: {
|
||||
scene_tree->set_hide_filtered_out_parents(!EDITOR_GET("docks/scene_tree/hide_filtered_out_parents"), true);
|
||||
} break;
|
||||
case TOOL_ACCESSIBILITY_WARNINGS: {
|
||||
scene_tree->set_accessibility_warnings(!EDITOR_GET("docks/scene_tree/accessibility_warnings"), true);
|
||||
} break;
|
||||
case TOOL_SCENE_EDITABLE_CHILDREN: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
if (selection.size() != 1) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -1277,7 +1292,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
break;
|
||||
}
|
||||
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
Node *node = e->get();
|
||||
|
|
@ -1312,7 +1327,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
break;
|
||||
}
|
||||
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
Node *node = e->get();
|
||||
|
|
@ -1337,7 +1352,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
}
|
||||
} break;
|
||||
case TOOL_SCENE_OPEN: {
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
Node *node = e->get();
|
||||
|
|
@ -1358,7 +1373,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
break;
|
||||
}
|
||||
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
Node *node = e->get();
|
||||
|
|
@ -1370,7 +1385,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
}
|
||||
} break;
|
||||
case TOOL_SCENE_OPEN_INHERITED: {
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
Node *node = e->get();
|
||||
|
|
@ -1381,14 +1396,14 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
} break;
|
||||
case TOOL_TOGGLE_SCENE_UNIQUE_NAME: {
|
||||
// Enabling/disabling based on the same node based on which the checkbox in the menu is checked/unchecked.
|
||||
List<Node *>::Element *first_selected = editor_selection->get_selected_node_list().front();
|
||||
const List<Node *>::Element *first_selected = editor_selection->get_top_selected_node_list().front();
|
||||
if (first_selected == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (first_selected->get() == EditorNode::get_singleton()->get_edited_scene()) {
|
||||
// Exclude Root Node. It should never be unique name in its own scene!
|
||||
editor_selection->remove_node(first_selected->get());
|
||||
first_selected = editor_selection->get_selected_node_list().front();
|
||||
first_selected = editor_selection->get_top_selected_node_list().front();
|
||||
if (first_selected == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -1515,6 +1530,10 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
|
||||
add_root_node(new_node);
|
||||
|
||||
if (GLOBAL_GET("editor/naming/node_name_casing").operator int() != NAME_CASING_PASCAL_CASE) {
|
||||
new_node->set_name(Node::adjust_name_casing(new_node->get_name()));
|
||||
}
|
||||
|
||||
EditorNode::get_singleton()->edit_node(new_node);
|
||||
editor_selection->clear();
|
||||
editor_selection->add_node(new_node);
|
||||
|
|
@ -1601,6 +1620,7 @@ void SceneTreeDock::_notification(int p_what) {
|
|||
|
||||
node_shortcuts_toggle = memnew(Button);
|
||||
node_shortcuts_toggle->set_flat(true);
|
||||
node_shortcuts_toggle->set_accessibility_name(TTRC("Favorite Nodes"));
|
||||
node_shortcuts_toggle->set_button_icon(get_editor_theme_icon(SNAME("Favorites")));
|
||||
node_shortcuts_toggle->set_toggle_mode(true);
|
||||
node_shortcuts_toggle->set_tooltip_text(TTR("Toggle the display of favorite nodes."));
|
||||
|
|
@ -1663,6 +1683,7 @@ void SceneTreeDock::_notification(int p_what) {
|
|||
clear_inherit_confirm->connect(SceneStringName(confirmed), callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_SCENE_CLEAR_INHERITANCE_CONFIRM, false));
|
||||
scene_tree->set_auto_expand_selected(EDITOR_GET("docks/scene_tree/auto_expand_to_selected"), false);
|
||||
scene_tree->set_hide_filtered_out_parents(EDITOR_GET("docks/scene_tree/hide_filtered_out_parents"), false);
|
||||
scene_tree->set_accessibility_warnings(EDITOR_GET("docks/scene_tree/accessibility_warnings"), false);
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
|
|
@ -1673,6 +1694,7 @@ void SceneTreeDock::_notification(int p_what) {
|
|||
if (EditorSettings::get_singleton()->check_changed_settings_in_group("docks/scene_tree")) {
|
||||
scene_tree->set_auto_expand_selected(EDITOR_GET("docks/scene_tree/auto_expand_to_selected"), false);
|
||||
scene_tree->set_hide_filtered_out_parents(EDITOR_GET("docks/scene_tree/hide_filtered_out_parents"), false);
|
||||
scene_tree->set_accessibility_warnings(EDITOR_GET("docks/scene_tree/accessibility_warnings"), false);
|
||||
}
|
||||
} break;
|
||||
|
||||
|
|
@ -1806,7 +1828,7 @@ void SceneTreeDock::_node_strip_signal_inheritance(Node *p_node) {
|
|||
}
|
||||
|
||||
void SceneTreeDock::_load_request(const String &p_path) {
|
||||
EditorNode::get_singleton()->open_request(p_path);
|
||||
EditorNode::get_singleton()->load_scene(p_path);
|
||||
_local_tree_selected();
|
||||
}
|
||||
|
||||
|
|
@ -2253,7 +2275,7 @@ void SceneTreeDock::_node_prerenamed(Node *p_node, const String &p_new_name) {
|
|||
}
|
||||
|
||||
bool SceneTreeDock::_validate_no_foreign() {
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
|
||||
for (Node *E : selection) {
|
||||
if (E != edited_scene && E->get_owner() != edited_scene) {
|
||||
|
|
@ -2282,7 +2304,7 @@ bool SceneTreeDock::_validate_no_foreign() {
|
|||
}
|
||||
|
||||
bool SceneTreeDock::_validate_no_instance() {
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
|
||||
for (Node *E : selection) {
|
||||
if (E != edited_scene && !E->get_scene_file_path().is_empty()) {
|
||||
|
|
@ -2299,7 +2321,7 @@ void SceneTreeDock::_node_reparent(NodePath p_path, bool p_keep_global_xform) {
|
|||
Node *new_parent = scene_root->get_node(p_path);
|
||||
ERR_FAIL_NULL(new_parent);
|
||||
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
|
||||
if (selection.is_empty()) {
|
||||
return; // Nothing to reparent.
|
||||
|
|
@ -2317,7 +2339,7 @@ void SceneTreeDock::_node_reparent(NodePath p_path, bool p_keep_global_xform) {
|
|||
void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, Vector<Node *> p_nodes, bool p_keep_global_xform) {
|
||||
ERR_FAIL_NULL(p_new_parent);
|
||||
|
||||
if (p_nodes.size() == 0) {
|
||||
if (p_nodes.is_empty()) {
|
||||
return; // Nothing to reparent.
|
||||
}
|
||||
|
||||
|
|
@ -2331,7 +2353,7 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V
|
|||
return; // Attempt to reparent to itself.
|
||||
}
|
||||
// `move_child` + `get_index` doesn't really work for internal nodes.
|
||||
ERR_FAIL_COND_MSG(p_nodes[ni]->get_internal_mode() != INTERNAL_MODE_DISABLED, "Trying to move internal node, this is not supported.");
|
||||
ERR_FAIL_COND_MSG(p_nodes[ni]->is_internal(), "Trying to move internal node, this is not supported.");
|
||||
|
||||
if (p_nodes[ni]->get_index(false) < first_idx) {
|
||||
nodes_before--;
|
||||
|
|
@ -2521,7 +2543,7 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V
|
|||
}
|
||||
|
||||
void SceneTreeDock::_script_created(Ref<Script> p_script) {
|
||||
List<Node *> selected = editor_selection->get_selected_node_list();
|
||||
List<Node *> selected = editor_selection->get_top_selected_node_list();
|
||||
|
||||
if (selected.is_empty()) {
|
||||
return;
|
||||
|
|
@ -2582,7 +2604,7 @@ void SceneTreeDock::_shader_creation_closed() {
|
|||
}
|
||||
|
||||
void SceneTreeDock::_toggle_editable_children_from_selection() {
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
List<Node *>::Element *e = selection.front();
|
||||
|
||||
if (e) {
|
||||
|
|
@ -2591,7 +2613,7 @@ void SceneTreeDock::_toggle_editable_children_from_selection() {
|
|||
}
|
||||
|
||||
void SceneTreeDock::_toggle_placeholder_from_selection() {
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
List<Node *>::Element *e = selection.front();
|
||||
|
||||
if (e) {
|
||||
|
|
@ -2726,7 +2748,7 @@ void SceneTreeDock::_toggle_editable_children(Node *p_node) {
|
|||
}
|
||||
|
||||
void SceneTreeDock::_delete_confirm(bool p_cut) {
|
||||
List<Node *> remove_list = editor_selection->get_selected_node_list();
|
||||
List<Node *> remove_list = editor_selection->get_top_selected_node_list();
|
||||
|
||||
if (remove_list.is_empty()) {
|
||||
return;
|
||||
|
|
@ -2744,7 +2766,7 @@ void SceneTreeDock::_delete_confirm(bool p_cut) {
|
|||
if (!entire_scene) {
|
||||
for (const Node *E : remove_list) {
|
||||
// `move_child` + `get_index` doesn't really work for internal nodes.
|
||||
ERR_FAIL_COND_MSG(E->get_internal_mode() != INTERNAL_MODE_DISABLED, "Trying to remove internal node, this is not supported.");
|
||||
ERR_FAIL_COND_MSG(E->is_internal(), "Trying to remove internal node, this is not supported.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2961,7 +2983,7 @@ void SceneTreeDock::_create() {
|
|||
_do_create(parent);
|
||||
|
||||
} else if (current_option == TOOL_REPLACE) {
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
ERR_FAIL_COND(selection.is_empty());
|
||||
|
||||
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
|
||||
|
|
@ -2980,7 +3002,7 @@ void SceneTreeDock::_create() {
|
|||
|
||||
ur->commit_action(false);
|
||||
} else if (current_option == TOOL_REPARENT_TO_NEW_NODE) {
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
ERR_FAIL_COND(selection.is_empty());
|
||||
|
||||
// Find top level node in selection
|
||||
|
|
@ -3181,7 +3203,7 @@ void SceneTreeDock::_replace_node(Node *p_node, Node *p_by_node, bool p_keep_pro
|
|||
|
||||
List<Node *> to_erase;
|
||||
for (int i = 0; i < oldnode->get_child_count(); i++) {
|
||||
if (oldnode->get_child(i)->get_owner() == nullptr && oldnode->is_owned_by_parent()) {
|
||||
if (oldnode->get_child(i)->get_owner() == nullptr && oldnode->is_internal()) {
|
||||
to_erase.push_back(oldnode->get_child(i));
|
||||
}
|
||||
}
|
||||
|
|
@ -3277,7 +3299,7 @@ bool SceneTreeDock::_check_node_recursive(Variant &r_variant, Node *p_node, Node
|
|||
bool updated = false;
|
||||
for (int i = 0; i < a.size(); i++) {
|
||||
Variant value = a[i];
|
||||
if (_check_node_recursive(value, p_node, p_by_node, type_hint.get_slice(":", 1), r_warn_message)) {
|
||||
if (_check_node_recursive(value, p_node, p_by_node, type_hint.get_slicec(':', 1), r_warn_message)) {
|
||||
if (!updated) {
|
||||
a = a.duplicate(); // Need to duplicate for undo-redo to work.
|
||||
updated = true;
|
||||
|
|
@ -3329,7 +3351,7 @@ void SceneTreeDock::set_selected(Node *p_node, bool p_emit_selected) {
|
|||
}
|
||||
|
||||
void SceneTreeDock::_new_scene_from(const String &p_file) {
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
|
||||
if (selection.size() != 1) {
|
||||
accept->set_text(TTR("This operation requires a single selected node."));
|
||||
|
|
@ -3507,7 +3529,7 @@ void SceneTreeDock::_normalize_drop(Node *&to_node, int &to_pos, int p_type) {
|
|||
}
|
||||
|
||||
Array SceneTreeDock::_get_selection_array() {
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
TypedArray<Node> array;
|
||||
array.resize(selection.size());
|
||||
|
||||
|
|
@ -3656,7 +3678,7 @@ void SceneTreeDock::_nodes_dragged(const Array &p_nodes, NodePath p_to, int p_ty
|
|||
return;
|
||||
}
|
||||
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
|
||||
if (selection.is_empty()) {
|
||||
return; //nothing to reparent
|
||||
|
|
@ -3729,10 +3751,10 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
|
|||
return;
|
||||
}
|
||||
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
List<Node *> full_selection = editor_selection->get_full_selected_node_list(); // Above method only returns nodes with common parent.
|
||||
|
||||
if (selection.size() == 0) {
|
||||
if (selection.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3792,7 +3814,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
|
|||
menu->add_icon_shortcut(get_editor_theme_icon(SNAME("ScriptCreate")), ED_GET_SHORTCUT("scene_tree/attach_script"), TOOL_ATTACH_SCRIPT);
|
||||
}
|
||||
|
||||
if (existing_script.is_valid()) {
|
||||
if (existing_script.is_valid() && !existing_script->is_built_in()) {
|
||||
menu->add_icon_shortcut(get_editor_theme_icon(SNAME("ScriptExtend")), ED_GET_SHORTCUT("scene_tree/extend_script"), TOOL_EXTEND_SCRIPT);
|
||||
}
|
||||
}
|
||||
|
|
@ -3880,8 +3902,9 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
|
|||
menu->add_separator();
|
||||
}
|
||||
Node *node = full_selection.front()->get();
|
||||
menu->add_icon_shortcut(get_editor_theme_icon(SNAME("SceneUniqueName")), ED_GET_SHORTCUT("scene_tree/toggle_unique_name"), TOOL_TOGGLE_SCENE_UNIQUE_NAME);
|
||||
menu->set_item_text(menu->get_item_index(TOOL_TOGGLE_SCENE_UNIQUE_NAME), node->is_unique_name_in_owner() ? TTR("Revoke Unique Name") : TTR("Access as Unique Name"));
|
||||
menu->add_icon_check_item(get_editor_theme_icon(SNAME("SceneUniqueName")), TTRC("Access as Unique Name"), TOOL_TOGGLE_SCENE_UNIQUE_NAME);
|
||||
menu->set_item_shortcut(menu->get_item_index(TOOL_TOGGLE_SCENE_UNIQUE_NAME), ED_GET_SHORTCUT("scene_tree/toggle_unique_name"));
|
||||
menu->set_item_checked(menu->get_item_index(TOOL_TOGGLE_SCENE_UNIQUE_NAME), node->is_unique_name_in_owner());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3965,6 +3988,9 @@ void SceneTreeDock::_update_tree_menu() {
|
|||
tree_menu->set_item_checked(-1, EDITOR_GET("docks/scene_tree/hide_filtered_out_parents"));
|
||||
|
||||
tree_menu->add_separator();
|
||||
tree_menu->add_check_item(TTR("Show Accessibility Warnings"), TOOL_ACCESSIBILITY_WARNINGS);
|
||||
tree_menu->set_item_checked(tree_menu->get_item_index(TOOL_ACCESSIBILITY_WARNINGS), EDITOR_GET("docks/scene_tree/accessibility_warnings"));
|
||||
|
||||
PopupMenu *resource_list = memnew(PopupMenu);
|
||||
resource_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
||||
resource_list->connect("about_to_popup", callable_mp(this, &SceneTreeDock::_list_all_subresources).bind(resource_list));
|
||||
|
|
@ -4069,7 +4095,7 @@ void SceneTreeDock::attach_script_to_selected(bool p_extend) {
|
|||
return;
|
||||
}
|
||||
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
if (selection.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -4199,7 +4225,7 @@ List<Node *> SceneTreeDock::paste_nodes(bool p_paste_as_sibling) {
|
|||
Node *paste_parent = edited_scene;
|
||||
Node *paste_sibling = nullptr;
|
||||
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
if (selection.size() > 0) {
|
||||
paste_parent = selection.back()->get();
|
||||
}
|
||||
|
|
@ -4268,7 +4294,7 @@ List<Node *> SceneTreeDock::paste_nodes(bool p_paste_as_sibling) {
|
|||
// and added to the node_clipboard_edited_scene_owned list.
|
||||
if (d != dup && E2.key->get_owner() == nullptr) {
|
||||
if (node_clipboard_edited_scene_owned.find(const_cast<Node *>(E2.key))) {
|
||||
ur->add_do_method(d, "set_owner", edited_scene);
|
||||
ur->add_do_method(d, "set_owner", owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4658,6 +4684,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec
|
|||
button_add->set_theme_type_variation("FlatMenuButton");
|
||||
button_add->connect(SceneStringName(pressed), callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_NEW, false));
|
||||
button_add->set_tooltip_text(TTRC("Add/Create a New Node."));
|
||||
button_add->set_accessibility_name(TTRC("Add/Create"));
|
||||
button_add->set_shortcut(ED_GET_SHORTCUT("scene_tree/add_child_node"));
|
||||
filter_hbc->add_child(button_add);
|
||||
|
||||
|
|
@ -4665,6 +4692,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec
|
|||
button_instance->set_theme_type_variation("FlatMenuButton");
|
||||
button_instance->connect(SceneStringName(pressed), callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_INSTANTIATE, false));
|
||||
button_instance->set_tooltip_text(TTRC("Instantiate a scene file as a Node. Creates an inherited scene if no root node exists."));
|
||||
button_instance->set_accessibility_name(TTRC("Instantiate Scene File"));
|
||||
button_instance->set_shortcut(ED_GET_SHORTCUT("scene_tree/instantiate_scene"));
|
||||
filter_hbc->add_child(button_instance);
|
||||
vbc->add_child(filter_hbc);
|
||||
|
|
@ -4673,6 +4701,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec
|
|||
filter = memnew(LineEdit);
|
||||
filter->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
filter->set_placeholder(TTR("Filter: name, t:type, g:group"));
|
||||
filter->set_accessibility_name(TTRC("Filter"));
|
||||
filter->set_tooltip_text(TTR("Filter nodes by entering a part of their name, type (if prefixed with \"type:\" or \"t:\")\nor group (if prefixed with \"group:\" or \"g:\"). Filtering is case-insensitive."));
|
||||
filter_hbc->add_child(filter);
|
||||
filter->add_theme_constant_override("minimum_character_width", 0);
|
||||
|
|
@ -4690,6 +4719,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec
|
|||
button_create_script->set_theme_type_variation("FlatMenuButton");
|
||||
button_create_script->connect(SceneStringName(pressed), callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_ATTACH_SCRIPT, false));
|
||||
button_create_script->set_tooltip_text(TTRC("Attach a new or existing script to the selected node."));
|
||||
button_create_script->set_accessibility_name(TTRC("Attach Script"));
|
||||
button_create_script->set_shortcut(ED_GET_SHORTCUT("scene_tree/attach_script"));
|
||||
filter_hbc->add_child(button_create_script);
|
||||
button_create_script->hide();
|
||||
|
|
@ -4698,6 +4728,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec
|
|||
button_detach_script->set_theme_type_variation("FlatMenuButton");
|
||||
button_detach_script->connect(SceneStringName(pressed), callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_DETACH_SCRIPT, false));
|
||||
button_detach_script->set_tooltip_text(TTRC("Detach the script from the selected node."));
|
||||
button_detach_script->set_accessibility_name(TTRC("Detach Script"));
|
||||
button_detach_script->set_shortcut(ED_GET_SHORTCUT("scene_tree/detach_script"));
|
||||
filter_hbc->add_child(button_detach_script);
|
||||
button_detach_script->hide();
|
||||
|
|
@ -4706,6 +4737,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec
|
|||
button_extend_script->set_flat(true);
|
||||
button_extend_script->connect(SceneStringName(pressed), callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_EXTEND_SCRIPT, false));
|
||||
button_extend_script->set_tooltip_text(TTRC("Extend the script of the selected node."));
|
||||
button_extend_script->set_accessibility_name(TTRC("Extend Script"));
|
||||
button_extend_script->set_shortcut(ED_GET_SHORTCUT("scene_tree/extend_script"));
|
||||
filter_hbc->add_child(button_extend_script);
|
||||
button_extend_script->hide();
|
||||
|
|
@ -4714,6 +4746,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec
|
|||
button_tree_menu->set_flat(false);
|
||||
button_tree_menu->set_theme_type_variation("FlatMenuButton");
|
||||
button_tree_menu->set_tooltip_text(TTR("Extra scene options."));
|
||||
button_tree_menu->set_accessibility_name(TTRC("Scene Options"));
|
||||
button_tree_menu->connect("about_to_popup", callable_mp(this, &SceneTreeDock::_update_tree_menu));
|
||||
filter_hbc->add_child(button_tree_menu);
|
||||
|
||||
|
|
@ -4764,6 +4797,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec
|
|||
scene_tree->connect("files_dropped", callable_mp(this, &SceneTreeDock::_files_dropped));
|
||||
scene_tree->connect("script_dropped", callable_mp(this, &SceneTreeDock::_script_dropped));
|
||||
scene_tree->connect("nodes_dragged", callable_mp(this, &SceneTreeDock::_nodes_drag_begin));
|
||||
scene_tree->get_scene_tree()->get_vscroll_bar()->connect("value_changed", callable_mp(this, &SceneTreeDock::_reset_hovering_timer).unbind(1));
|
||||
|
||||
scene_tree->get_scene_tree()->connect(SceneStringName(gui_input), callable_mp(this, &SceneTreeDock::_scene_tree_gui_input));
|
||||
scene_tree->get_scene_tree()->connect("item_icon_double_clicked", callable_mp(this, &SceneTreeDock::_focus_node));
|
||||
|
|
@ -4775,6 +4809,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec
|
|||
|
||||
inspect_hovered_node_delay = memnew(Timer);
|
||||
inspect_hovered_node_delay->connect("timeout", callable_mp(this, &SceneTreeDock::_inspect_hovered_node));
|
||||
inspect_hovered_node_delay->set_wait_time(.5);
|
||||
inspect_hovered_node_delay->set_one_shot(true);
|
||||
add_child(inspect_hovered_node_delay);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue