diff options
-rw-r--r-- | doc/classes/GridContainer.xml | 3 | ||||
-rw-r--r-- | editor/editor_settings.cpp | 1 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 25 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.h | 1 | ||||
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 5 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | modules/gdscript/editor/gdscript_highlighter.cpp | 2 | ||||
-rw-r--r-- | modules/visual_script/visual_script_editor.cpp | 109 | ||||
-rw-r--r-- | modules/visual_script/visual_script_editor.h | 1 | ||||
-rw-r--r-- | modules/visual_script/visual_script_nodes.cpp | 19 | ||||
-rw-r--r-- | modules/visual_script/visual_script_property_selector.cpp | 38 | ||||
-rw-r--r-- | scene/gui/grid_container.cpp | 35 | ||||
-rw-r--r-- | scene/resources/dynamic_font.cpp | 2 |
14 files changed, 162 insertions, 87 deletions
diff --git a/doc/classes/GridContainer.xml b/doc/classes/GridContainer.xml index 7656a579af..e8c764f412 100644 --- a/doc/classes/GridContainer.xml +++ b/doc/classes/GridContainer.xml @@ -4,7 +4,8 @@ Grid container used to arrange elements in a grid like layout. </brief_description> <description> - Grid container will arrange its children in a grid like structure, the grid columns are specified using the [member columns] property and the number of rows will be equal to the number of children in the container divided by the number of columns. For example, if the container has 5 children, and 2 columns, there will be 3 rows in the container. Notice that grid layout will preserve the columns and rows for every size of the container. + Grid container will arrange its children in a grid like structure, the grid columns are specified using the [member columns] property and the number of rows will be equal to the number of children in the container divided by the number of columns. For example, if the container has 5 children, and 2 columns, there will be 3 rows in the container. + Notice that grid layout will preserve the columns and rows for every size of the container, and that empty columns will be expanded automatically. </description> <tutorials> </tutorials> diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 9d24e443c4..3ea59115b0 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -666,6 +666,7 @@ void EditorSettings::_load_default_text_editor_theme() { _initial_set("text_editor/highlighting/keyword_color", Color(1.0, 1.0, 0.7)); _initial_set("text_editor/highlighting/base_type_color", Color(0.64, 1.0, 0.83)); _initial_set("text_editor/highlighting/engine_type_color", Color(0.51, 0.83, 1.0)); + _initial_set("text_editor/highlighting/user_type_color", Color(0.42, 0.67, 0.93)); _initial_set("text_editor/highlighting/comment_color", Color(0.4, 0.4, 0.4)); _initial_set("text_editor/highlighting/string_color", Color(0.94, 0.43, 0.75)); _initial_set("text_editor/highlighting/background_color", dark_theme ? Color(0.0, 0.0, 0.0, 0.23) : Color(0.2, 0.23, 0.31)); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 93d3ff1e18..0c7c2c6cc3 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -1130,7 +1130,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { const Color symbol_color = Color(0.34, 0.57, 1.0).linear_interpolate(mono_color, dark_theme ? 0.5 : 0.3); const Color keyword_color = Color(1.0, 0.44, 0.52); const Color basetype_color = dark_theme ? Color(0.26, 1.0, 0.76) : Color(0.0, 0.76, 0.38); - const Color type_color = basetype_color.linear_interpolate(mono_color, dark_theme ? 0.7 : 0.5); + const Color type_color = basetype_color.linear_interpolate(mono_color, dark_theme ? 0.4 : 0.3); + const Color usertype_color = basetype_color.linear_interpolate(mono_color, dark_theme ? 0.7 : 0.5); const Color comment_color = dim_color; const Color string_color = (dark_theme ? Color(1.0, 0.85, 0.26) : Color(1.0, 0.82, 0.09)).linear_interpolate(mono_color, dark_theme ? 0.5 : 0.3); @@ -1169,6 +1170,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { setting->set_initial_value("text_editor/highlighting/keyword_color", keyword_color, true); setting->set_initial_value("text_editor/highlighting/base_type_color", basetype_color, true); setting->set_initial_value("text_editor/highlighting/engine_type_color", type_color, true); + setting->set_initial_value("text_editor/highlighting/user_type_color", usertype_color, true); setting->set_initial_value("text_editor/highlighting/comment_color", comment_color, true); setting->set_initial_value("text_editor/highlighting/string_color", string_color, true); setting->set_initial_value("text_editor/highlighting/background_color", te_background_color, true); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 073e6f74e9..9d3c580f02 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -224,6 +224,7 @@ void ScriptTextEditor::_load_theme_settings() { Color keyword_color = EDITOR_GET("text_editor/highlighting/keyword_color"); Color basetype_color = EDITOR_GET("text_editor/highlighting/base_type_color"); Color type_color = EDITOR_GET("text_editor/highlighting/engine_type_color"); + Color usertype_color = EDITOR_GET("text_editor/highlighting/user_type_color"); Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color"); Color string_color = EDITOR_GET("text_editor/highlighting/string_color"); @@ -262,6 +263,7 @@ void ScriptTextEditor::_load_theme_settings() { colors_cache.keyword_color = keyword_color; colors_cache.basetype_color = basetype_color; colors_cache.type_color = type_color; + colors_cache.usertype_color = usertype_color; colors_cache.comment_color = comment_color; colors_cache.string_color = string_color; @@ -325,6 +327,29 @@ void ScriptTextEditor::_set_theme_for_script() { } _update_member_keywords(); + //colorize user types + List<StringName> global_classes; + ScriptServer::get_global_class_list(&global_classes); + + for (List<StringName>::Element *E = global_classes.front(); E; E = E->next()) { + + text_edit->add_keyword_color(E->get(), colors_cache.usertype_color); + } + + //colorize singleton autoloads (as types, just as engine singletons are) + List<PropertyInfo> props; + ProjectSettings::get_singleton()->get_property_list(&props); + for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { + String s = E->get().name; + if (!s.begins_with("autoload/")) { + continue; + } + String path = ProjectSettings::get_singleton()->get(s); + if (path.begins_with("*")) { + text_edit->add_keyword_color(s.get_slice("/", 1), colors_cache.usertype_color); + } + } + //colorize comments List<String> comments; script->get_language()->get_comment_delimiters(&comments); diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index 0ea8726ecc..eba75befd4 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -91,6 +91,7 @@ class ScriptTextEditor : public ScriptEditorBase { Color keyword_color; Color basetype_color; Color type_color; + Color usertype_color; Color comment_color; Color string_color; } colors_cache; diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index ba40fc5612..1e083eff52 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -4062,7 +4062,6 @@ void _update_all_gizmos(Node *p_node) { void SpatialEditor::update_all_gizmos(Node *p_node) { if (!p_node) { - if (!SceneTree::get_singleton()) return; p_node = SceneTree::get_singleton()->get_root(); } _update_all_gizmos(p_node); @@ -6269,5 +6268,7 @@ EditorSpatialGizmoPlugin::~EditorSpatialGizmoPlugin() { current_gizmos[i]->set_plugin(NULL); current_gizmos[i]->get_spatial_node()->set_gizmo(NULL); } - SpatialEditor::get_singleton()->update_all_gizmos(); + if (SpatialEditor::get_singleton()) { + SpatialEditor::get_singleton()->update_all_gizmos(); + } } diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 82baa99da2..30ce2ef6e6 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -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); diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp index 963b40529d..ee7313957c 100644 --- a/modules/gdscript/editor/gdscript_highlighter.cpp +++ b/modules/gdscript/editor/gdscript_highlighter.cpp @@ -247,7 +247,7 @@ Map<int, TextEdit::HighlighterInfo> GDScriptSyntaxHighlighter::_get_line_syntax_ in_function_args = false; } - if (expect_type && prev_is_char) { + if (expect_type && (prev_is_char || str[j] == '=')) { expect_type = false; } diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 0399dbc87c..37f581eec2 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -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() { @@ -1353,6 +1349,8 @@ void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_butt selected = ti->get_text(0); function_name_edit->set_position(Input::get_singleton()->get_mouse_position() - Vector2(60, -10)); function_name_edit->popup(); + function_name_box->set_text(selected); + function_name_box->select_all(); } } @@ -1757,8 +1755,7 @@ void VisualScriptEditor::_members_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> btn = p_event; if (btn.is_valid() && btn->is_doubleclick()) { TreeItem *ti = members->get_selected(); - ERR_FAIL_COND(!ti); - if (ti->get_parent() == members->get_root()->get_children()) // to check if it's a function + if (ti && ti->get_parent() == members->get_root()->get_children()) // to check if it's a function _center_on_node(ti->get_metadata(0), script->get_function_node_id(ti->get_metadata(0))); } } @@ -3907,51 +3904,60 @@ 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; + } - Ref<Theme> tm = EditorNode::get_singleton()->get_theme_base()->get_theme(); + func_input_scroll->add_style_override("bg", get_stylebox("bg", "Tree")); - bool dark_theme = tm->get_constant("dark_theme", "Editor"); + Ref<Theme> tm = EditorNode::get_singleton()->get_theme_base()->get_theme(); - List<Pair<String, Color> > colors; - if (dark_theme) { - colors.push_back(Pair<String, Color>("flow_control", Color(0.96, 0.96, 0.96))); - colors.push_back(Pair<String, Color>("functions", Color(0.96, 0.52, 0.51))); - colors.push_back(Pair<String, Color>("data", Color(0.5, 0.96, 0.81))); - colors.push_back(Pair<String, Color>("operators", Color(0.67, 0.59, 0.87))); - colors.push_back(Pair<String, Color>("custom", Color(0.5, 0.73, 0.96))); - colors.push_back(Pair<String, Color>("constants", Color(0.96, 0.5, 0.69))); - } else { - colors.push_back(Pair<String, Color>("flow_control", Color(0.26, 0.26, 0.26))); - colors.push_back(Pair<String, Color>("functions", Color(0.95, 0.4, 0.38))); - colors.push_back(Pair<String, Color>("data", Color(0.07, 0.73, 0.51))); - colors.push_back(Pair<String, Color>("operators", Color(0.51, 0.4, 0.82))); - colors.push_back(Pair<String, Color>("custom", Color(0.31, 0.63, 0.95))); - colors.push_back(Pair<String, Color>("constants", Color(0.94, 0.18, 0.49))); - } + bool dark_theme = tm->get_constant("dark_theme", "Editor"); - for (List<Pair<String, Color> >::Element *E = colors.front(); E; E = E->next()) { - Ref<StyleBoxFlat> sb = tm->get_stylebox("frame", "GraphNode"); - if (!sb.is_null()) { - Ref<StyleBoxFlat> frame_style = sb->duplicate(); - Color c = sb->get_border_color(); - Color cn = E->get().second; - cn.a = c.a; - frame_style->set_border_color(cn); - node_styles[E->get().first] = frame_style; + List<Pair<String, Color> > colors; + if (dark_theme) { + colors.push_back(Pair<String, Color>("flow_control", Color(0.96, 0.96, 0.96))); + colors.push_back(Pair<String, Color>("functions", Color(0.96, 0.52, 0.51))); + colors.push_back(Pair<String, Color>("data", Color(0.5, 0.96, 0.81))); + colors.push_back(Pair<String, Color>("operators", Color(0.67, 0.59, 0.87))); + colors.push_back(Pair<String, Color>("custom", Color(0.5, 0.73, 0.96))); + colors.push_back(Pair<String, Color>("constants", Color(0.96, 0.5, 0.69))); + } else { + colors.push_back(Pair<String, Color>("flow_control", Color(0.26, 0.26, 0.26))); + colors.push_back(Pair<String, Color>("functions", Color(0.95, 0.4, 0.38))); + colors.push_back(Pair<String, Color>("data", Color(0.07, 0.73, 0.51))); + colors.push_back(Pair<String, Color>("operators", Color(0.51, 0.4, 0.82))); + colors.push_back(Pair<String, Color>("custom", Color(0.31, 0.63, 0.95))); + colors.push_back(Pair<String, Color>("constants", Color(0.94, 0.18, 0.49))); } - } - if (is_visible_in_tree() && script.is_valid()) { - _update_members(); - _update_graph(); - } - } else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { - members_section->set_visible(is_visible_in_tree()); + for (List<Pair<String, Color> >::Element *E = colors.front(); E; E = E->next()) { + Ref<StyleBoxFlat> sb = tm->get_stylebox("frame", "GraphNode"); + if (!sb.is_null()) { + Ref<StyleBoxFlat> frame_style = sb->duplicate(); + Color c = sb->get_border_color(); + Color cn = E->get().second; + cn.a = c.a; + frame_style->set_border_color(cn); + node_styles[E->get().first] = frame_style; + } + } + + if (is_visible_in_tree() && script.is_valid()) { + _update_members(); + _update_graph(); + } + } break; + case NOTIFICATION_VISIBILITY_CHANGED: { + members_section->set_visible(is_visible_in_tree()); + } break; } } @@ -4541,6 +4547,8 @@ void VisualScriptEditor::_member_option(int p_option) { } else if (p_option == MEMBER_EDIT) { selected = members->get_selected()->get_text(0); function_name_edit->popup(); + function_name_box->set_text(selected); + function_name_box->select_all(); } } break; case MEMBER_VARIABLE: { @@ -4762,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"); @@ -4790,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); diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index 0e7783214b..5a00469eea 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -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; diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index dbcd3c19f8..957127fe61 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -4075,6 +4075,14 @@ VisualScriptDeconstruct::VisualScriptDeconstruct() { type = Variant::NIL; } +template <Variant::Type T> +static Ref<VisualScriptNode> create_node_deconst_typed(const String &p_name) { + Ref<VisualScriptDeconstruct> node; + node.instance(); + node->set_deconstruct_type(T); + return node; +} + void register_visual_script_nodes() { VisualScriptLanguage::singleton->add_register_func("data/set_variable", create_node_generic<VisualScriptVariableSet>); @@ -4132,7 +4140,16 @@ void register_visual_script_nodes() { VisualScriptLanguage::singleton->add_register_func("operators/logic/in", create_op_node<Variant::OP_IN>); VisualScriptLanguage::singleton->add_register_func("operators/logic/select", create_node_generic<VisualScriptSelect>); - VisualScriptLanguage::singleton->add_register_func("functions/deconstruct", create_node_generic<VisualScriptDeconstruct>); + VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::VECTOR2), create_node_deconst_typed<Variant::Type::VECTOR2>); + VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::VECTOR3), create_node_deconst_typed<Variant::Type::VECTOR3>); + VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::COLOR), create_node_deconst_typed<Variant::Type::COLOR>); + VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::RECT2), create_node_deconst_typed<Variant::Type::RECT2>); + VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::TRANSFORM2D), create_node_deconst_typed<Variant::Type::TRANSFORM2D>); + VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::PLANE), create_node_deconst_typed<Variant::Type::PLANE>); + VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::QUAT), create_node_deconst_typed<Variant::Type::QUAT>); + VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::AABB), create_node_deconst_typed<Variant::Type::AABB>); + VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::BASIS), create_node_deconst_typed<Variant::Type::BASIS>); + VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::TRANSFORM), create_node_deconst_typed<Variant::Type::TRANSFORM>); VisualScriptLanguage::singleton->add_register_func("functions/compose_array", create_node_generic<VisualScriptComposeArray>); for (int i = 1; i < Variant::VARIANT_MAX; i++) { diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp index 0366801a11..42d4c5e209 100644 --- a/modules/visual_script/visual_script_property_selector.cpp +++ b/modules/visual_script/visual_script_property_selector.cpp @@ -271,6 +271,7 @@ void VisualScriptPropertySelector::_update_search() { get_visual_node_names("flow_control/type_cast", Set<String>(), found, root, search_box); get_visual_node_names("functions/built_in/print", Set<String>(), found, root, search_box); get_visual_node_names("functions/by_type/" + Variant::get_type_name(type), Set<String>(), found, root, search_box); + get_visual_node_names("functions/deconstruct/" + Variant::get_type_name(type), Set<String>(), found, root, search_box); get_visual_node_names("operators/compare/", Set<String>(), found, root, search_box); if (type == Variant::INT) { get_visual_node_names("operators/bitwise/", Set<String>(), found, root, search_box); @@ -324,7 +325,7 @@ void VisualScriptPropertySelector::create_visualscript_item(const String &name, } } -void VisualScriptPropertySelector::get_visual_node_names(const String &root_filter, const Set<String> &filter, bool &found, TreeItem *const root, LineEdit *const search_box) { +void VisualScriptPropertySelector::get_visual_node_names(const String &root_filter, const Set<String> &p_modifiers, bool &found, TreeItem *const root, LineEdit *const search_box) { Map<String, TreeItem *> path_cache; List<String> fnodes; @@ -335,27 +336,34 @@ void VisualScriptPropertySelector::get_visual_node_names(const String &root_filt continue; } Vector<String> path = E->get().split("/"); - bool is_filter = false; - for (Set<String>::Element *F = filter.front(); F; F = F->next()) { - if (path.size() >= 2 && path[1].findn(F->get()) != -1) { - is_filter = true; + + // check if the name has the filter + bool in_filter = false; + Vector<String> tx_filters = search_box->get_text().split(" "); + for (int i = 0; i < tx_filters.size(); i++) { + if (tx_filters[i] == "") { + in_filter = true; + } else { + in_filter = false; + } + if (E->get().findn(tx_filters[i]) != -1) { + in_filter = true; break; } } - if (is_filter) { + if (!in_filter) { continue; } - Vector<String> tx_filters = search_box->get_text().split(" "); - for (int i = 0; i < tx_filters.size(); i++) { - if (tx_filters[i] != String() && E->get().findn(tx_filters[i]) == -1) { - is_filter = true; - break; - } + bool in_modifier = false | p_modifiers.empty(); + for (Set<String>::Element *F = p_modifiers.front(); F && in_modifier; F = F->next()) { + if (E->get().findn(F->get()) != -1) + in_modifier = true; } - if (is_filter) { + if (!in_modifier) { continue; } + TreeItem *item = search_options->create_item(root); Ref<VisualScriptNode> vnode = VisualScriptLanguage::singleton->create_node_from_name(E->get()); Ref<VisualScriptOperator> vnode_operator = vnode; @@ -376,6 +384,10 @@ void VisualScriptPropertySelector::get_visual_node_names(const String &root_filt if (vnode_constructor.is_valid()) { type_name = "Construct "; } + Ref<VisualScriptDeconstruct> vnode_deconstruct = vnode; + if (vnode_deconstruct.is_valid()) { + type_name = "Deconstruct "; + } Vector<String> desc = path[path.size() - 1].replace("(", " ").replace(")", " ").replace(",", " ").split(" "); for (int i = 0; i < desc.size(); i++) { desc.write[i] = desc[i].capitalize(); diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp index d0e2edc7b5..a6842603fd 100644 --- a/scene/gui/grid_container.cpp +++ b/scene/gui/grid_container.cpp @@ -36,20 +36,18 @@ void GridContainer::_notification(int p_what) { case NOTIFICATION_SORT_CHILDREN: { - int valid_controls_index; - - Map<int, int> col_minw; // max of min_width of all controls in each col (indexed by col) - Map<int, int> row_minh; // max of min_height of all controls in each row (indexed by row) - Set<int> col_expanded; // columns which have the SIZE_EXPAND flag set - Set<int> row_expanded; // rows which have the SIZE_EXPAND flag set + Map<int, int> col_minw; // Max of min_width of all controls in each col (indexed by col). + Map<int, int> row_minh; // Max of min_height of all controls in each row (indexed by row). + Set<int> col_expanded; // Columns which have the SIZE_EXPAND flag set. + Set<int> row_expanded; // Rows which have the SIZE_EXPAND flag set. int hsep = get_constant("hseparation"); int vsep = get_constant("vseparation"); int max_col = MIN(get_child_count(), columns); int max_row = get_child_count() / columns; - // Compute the per-column/per-row data - valid_controls_index = 0; + // Compute the per-column/per-row data. + int valid_controls_index = 0; for (int i = 0; i < get_child_count(); i++) { Control *c = Object::cast_to<Control>(get_child(i)); if (!c || !c->is_visible_in_tree()) @@ -77,7 +75,12 @@ void GridContainer::_notification(int p_what) { } } - // Evaluate the remaining space for expanded columns/rows + // Consider all empty columns expanded. + for (int i = valid_controls_index; i < columns; i++) { + col_expanded.insert(i); + } + + // Evaluate the remaining space for expanded columns/rows. Size2 remaining_space = get_size(); for (Map<int, int>::Element *E = col_minw.front(); E; E = E->next()) { if (!col_expanded.has(E->key())) @@ -93,7 +96,7 @@ void GridContainer::_notification(int p_what) { bool can_fit = false; while (!can_fit && col_expanded.size() > 0) { - // Check if all minwidth constraints are ok if we use the remaining space + // Check if all minwidth constraints are OK if we use the remaining space. can_fit = true; int max_index = col_expanded.front()->get(); for (Set<int>::Element *E = col_expanded.front(); E; E = E->next()) { @@ -105,7 +108,7 @@ void GridContainer::_notification(int p_what) { } } - // If not, the column with maximum minwidth is not expanded + // If not, the column with maximum minwidth is not expanded. if (!can_fit) { col_expanded.erase(max_index); remaining_space.width -= col_minw[max_index]; @@ -114,7 +117,7 @@ void GridContainer::_notification(int p_what) { can_fit = false; while (!can_fit && row_expanded.size() > 0) { - // Check if all minwidth constraints are ok if we use the remaining space + // Check if all minheight constraints are OK if we use the remaining space. can_fit = true; int max_index = row_expanded.front()->get(); for (Set<int>::Element *E = row_expanded.front(); E; E = E->next()) { @@ -126,14 +129,14 @@ void GridContainer::_notification(int p_what) { } } - // If not, the row with maximum minwidth is not expanded + // If not, the row with maximum minheight is not expanded. if (!can_fit) { row_expanded.erase(max_index); remaining_space.height -= row_minh[max_index]; } } - // Finally, fit the nodes + // Finally, fit the nodes. int col_expand = col_expanded.size() > 0 ? remaining_space.width / col_expanded.size() : 0; int row_expand = row_expanded.size() > 0 ? remaining_space.height / row_expanded.size() : 0; @@ -152,11 +155,11 @@ void GridContainer::_notification(int p_what) { if (col == 0) { col_ofs = 0; if (row > 0) - row_ofs += ((row_expanded.has(row - 1)) ? row_expand : row_minh[row - 1]) + vsep; + row_ofs += (row_expanded.has(row - 1) ? row_expand : row_minh[row - 1]) + vsep; } Point2 p(col_ofs, row_ofs); - Size2 s((col_expanded.has(col)) ? col_expand : col_minw[col], (row_expanded.has(row)) ? row_expand : row_minh[row]); + Size2 s(col_expanded.has(col) ? col_expand : col_minw[col], row_expanded.has(row) ? row_expand : row_minh[row]); fit_child_in_rect(c, Rect2(p, s)); diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 5704212831..99a2881d58 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -192,7 +192,7 @@ Error DynamicFontAtSize::_load() { ERR_FAIL_V_MSG(ERR_FILE_CANT_OPEN, "Error loading font."); } - if (FT_HAS_COLOR(face)) { + if (FT_HAS_COLOR(face) && face->num_fixed_sizes > 0) { int best_match = 0; int diff = ABS(id.size - ((int64_t)face->available_sizes[0].width)); scale_color_font = float(id.size) / face->available_sizes[0].width; |