Merge pull request #32402 from YeldhamDev/fix_vs_add_function
Fix VS editor's "Create Function" dialog
This commit is contained in:
commit
cd63cc7df1
@ -546,14 +546,14 @@ void VisualShaderEditor::_update_graph() {
|
||||
HBoxContainer *hb2 = memnew(HBoxContainer);
|
||||
|
||||
Button *add_input_btn = memnew(Button);
|
||||
add_input_btn->set_text(TTR("Add input +"));
|
||||
add_input_btn->set_text(TTR("Add Input"));
|
||||
add_input_btn->connect("pressed", this, "_add_input_port", varray(nodes[n_i], group_node->get_free_input_port_id(), VisualShaderNode::PORT_TYPE_VECTOR, "input" + itos(group_node->get_free_input_port_id())), CONNECT_DEFERRED);
|
||||
hb2->add_child(add_input_btn);
|
||||
|
||||
hb2->add_spacer();
|
||||
|
||||
Button *add_output_btn = memnew(Button);
|
||||
add_output_btn->set_text(TTR("Add output +"));
|
||||
add_output_btn->set_text(TTR("Add Output"));
|
||||
add_output_btn->connect("pressed", this, "_add_output_port", varray(nodes[n_i], group_node->get_free_output_port_id(), VisualShaderNode::PORT_TYPE_VECTOR, "output" + itos(group_node->get_free_output_port_id())), CONNECT_DEFERRED);
|
||||
hb2->add_child(add_output_btn);
|
||||
|
||||
|
@ -1166,13 +1166,11 @@ void VisualScriptEditor::_member_edited() {
|
||||
}
|
||||
|
||||
void VisualScriptEditor::_create_function_dialog() {
|
||||
function_create_dialog->popup();
|
||||
function_create_dialog->set_position(graph->get_global_position() + Vector2(55, 80));
|
||||
function_create_dialog->popup_centered();
|
||||
func_name_box->set_text("");
|
||||
func_name_box->grab_focus();
|
||||
for (int i = 0; i < func_input_vbox->get_child_count(); i++) {
|
||||
Node *nd = func_input_vbox->get_child(i);
|
||||
func_input_vbox->remove_child(nd);
|
||||
nd->queue_delete();
|
||||
}
|
||||
}
|
||||
@ -1252,7 +1250,6 @@ void VisualScriptEditor::_add_func_input() {
|
||||
|
||||
func_input_vbox->add_child(hbox);
|
||||
hbox->set_meta("id", hbox->get_position_in_parent());
|
||||
function_create_dialog->set_size(Size2(-1, -1));
|
||||
|
||||
delete_button->connect("pressed", this, "_remove_func_input", varray(hbox));
|
||||
|
||||
@ -1263,7 +1260,6 @@ void VisualScriptEditor::_add_func_input() {
|
||||
void VisualScriptEditor::_remove_func_input(Node *p_node) {
|
||||
func_input_vbox->remove_child(p_node);
|
||||
p_node->queue_delete();
|
||||
function_create_dialog->set_size(Size2(-1, -1));
|
||||
}
|
||||
|
||||
void VisualScriptEditor::_deselect_input_names() {
|
||||
@ -3908,11 +3904,18 @@ void VisualScriptEditor::_hide_timer() {
|
||||
|
||||
void VisualScriptEditor::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_READY || (p_what == NOTIFICATION_THEME_CHANGED && is_visible_in_tree())) {
|
||||
if (p_what == NOTIFICATION_READY) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_READY: {
|
||||
variable_editor->connect("changed", this, "_update_members");
|
||||
signal_editor->connect("changed", this, "_update_members");
|
||||
FALLTHROUGH;
|
||||
}
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
if (p_what != NOTIFICATION_READY && !is_visible_in_tree()) {
|
||||
return;
|
||||
}
|
||||
|
||||
func_input_scroll->add_style_override("bg", get_stylebox("bg", "Tree"));
|
||||
|
||||
Ref<Theme> tm = EditorNode::get_singleton()->get_theme_base()->get_theme();
|
||||
|
||||
@ -3951,8 +3954,10 @@ void VisualScriptEditor::_notification(int p_what) {
|
||||
_update_members();
|
||||
_update_graph();
|
||||
}
|
||||
} else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||
} break;
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
members_section->set_visible(is_visible_in_tree());
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4765,7 +4770,7 @@ VisualScriptEditor::VisualScriptEditor() {
|
||||
add_nds->connect("pressed", this, "_add_node_dialog");
|
||||
|
||||
Button *fn_btn = memnew(Button);
|
||||
fn_btn->set_text("Add Function");
|
||||
fn_btn->set_text("Add Function...");
|
||||
graph_hbc->add_child(fn_btn);
|
||||
fn_btn->connect("pressed", this, "_create_function_dialog");
|
||||
|
||||
@ -4793,17 +4798,20 @@ VisualScriptEditor::VisualScriptEditor() {
|
||||
|
||||
Button *add_input_button = memnew(Button);
|
||||
add_input_button->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
add_input_button->set_text(TTR("Add input +"));
|
||||
add_input_button->set_text(TTR("Add Input"));
|
||||
add_input_button->connect("pressed", this, "_add_func_input");
|
||||
function_vb->add_child(add_input_button);
|
||||
|
||||
func_input_vbox = memnew(VBoxContainer);
|
||||
function_vb->add_child(func_input_vbox);
|
||||
func_input_scroll = memnew(ScrollContainer);
|
||||
func_input_scroll->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
function_vb->add_child(func_input_scroll);
|
||||
|
||||
function_vb->add_child(memnew(HSeparator));
|
||||
func_input_vbox = memnew(VBoxContainer);
|
||||
func_input_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
func_input_scroll->add_child(func_input_vbox);
|
||||
|
||||
function_create_dialog = memnew(ConfirmationDialog);
|
||||
function_create_dialog->set_custom_minimum_size(Size2(450 * EDSCALE, 0));
|
||||
function_create_dialog->set_custom_minimum_size(Size2(450, 300) * EDSCALE);
|
||||
function_create_dialog->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
function_create_dialog->set_title(TTR("Create Function"));
|
||||
function_create_dialog->add_child(function_vb);
|
||||
|
@ -89,6 +89,7 @@ class VisualScriptEditor : public ScriptEditorBase {
|
||||
Button *base_type_select;
|
||||
|
||||
LineEdit *func_name_box;
|
||||
ScrollContainer *func_input_scroll;
|
||||
VBoxContainer *func_input_vbox;
|
||||
ConfirmationDialog *function_create_dialog;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user