Fix the display of the tree diagram and optimize performance

Fix the display of the tree diagram and optimize performance.
This commit is contained in:
kitsdream
2023-09-25 00:17:59 +08:00
parent 2ba3e82826
commit ded87a25ff
2 changed files with 356 additions and 233 deletions

View File

@@ -751,11 +751,6 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
GraphNode *gnode = memnew(GraphNode);
gnode->set_title(node->get_caption());
gnode->set_position_offset(pos * EDSCALE);
if (error_line == E) {
gnode->set_overlay(GraphNode::OVERLAY_POSITION);
} else if (node->is_breakpoint()) {
gnode->set_overlay(GraphNode::OVERLAY_BREAKPOINT);
}
gnode->set_meta("__vnode", node);
gnode->set_name(itos(E));
@@ -764,14 +759,6 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
gnode->connect("close_request",
callable_mp(this, &VisualScriptEditor::_remove_node).bind(E),
CONNECT_DEFERRED);
{
Ref<VisualScriptFunction> v = node;
if (!v.is_valid()) {
gnode->set_show_close_button(true);
}
}
bool has_gnode_text = false;
Ref<VisualScriptLists> nd_list = node;
@@ -2116,7 +2103,7 @@ void VisualScriptEditor::_on_nodes_delete() {
for (int i = 0; i < graph->get_child_count(); i++) {
GraphNode *gn = Object::cast_to<GraphNode>(graph->get_child(i));
if (gn) {
if (gn->is_selected() && gn->is_close_button_visible()) {
if (gn->is_selected()) {
to_erase.push_back(gn->get_name().operator String().to_int());
}
}
@@ -2168,7 +2155,7 @@ void VisualScriptEditor::_on_nodes_duplicate() {
for (int i = 0; i < graph->get_child_count(); i++) {
GraphNode *gn = Object::cast_to<GraphNode>(graph->get_child(i));
if (gn) {
if (gn->is_selected() && gn->is_close_button_visible()) {
if (gn->is_selected()) {
int id = gn->get_name().operator String().to_int();
to_duplicate.insert(id);
}
@@ -3663,7 +3650,12 @@ void VisualScriptEditor::_selected_connect_node(const String &p_text,
Ref<VisualScriptNode> vnode;
Ref<VisualScriptNode> vnode_old;
bool port_node_exists = script->has_node(port_action_node);
bool port_node_exists;
if (script->get_node(port_action_node).is_valid()) {
port_node_exists = script->has_node(port_action_node);
}
if (port_node_exists && p_connecting) {
vnode_old = script->get_node(port_action_node);
}
@@ -4379,7 +4371,7 @@ void VisualScriptEditor::_notification(int p_what) {
func_input_scroll->add_theme_style_override(
"bg", get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
Ref<Theme> tm = EditorNode::get_singleton()-> get_editor_theme();
Ref<Theme> tm = EditorNode::get_singleton()->get_editor_theme();
bool dark_theme = tm->get_constant("dark_theme", "Editor");