diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/array_property_edit.cpp | 8 | ||||
-rw-r--r-- | editor/editor_file_system.cpp | 15 | ||||
-rw-r--r-- | editor/editor_help.cpp | 19 | ||||
-rw-r--r-- | editor/editor_node.cpp | 9 | ||||
-rw-r--r-- | editor/editor_node.h | 2 | ||||
-rw-r--r-- | editor/editor_properties_array_dict.cpp | 8 | ||||
-rw-r--r-- | editor/editor_resource_preview.cpp | 21 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/animation_state_machine_editor.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 14 | ||||
-rw-r--r-- | editor/plugins/texture_region_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/tile_set_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 58 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 3 |
15 files changed, 126 insertions, 49 deletions
diff --git a/editor/array_property_edit.cpp b/editor/array_property_edit.cpp index f2471e80d4..906139e239 100644 --- a/editor/array_property_edit.cpp +++ b/editor/array_property_edit.cpp @@ -267,9 +267,9 @@ void ArrayPropertyEdit::edit(Object *p_obj, const StringName &p_prop, const Stri default_type = p_deftype; if (!p_hint_string.empty()) { - int hint_subtype_seperator = p_hint_string.find(":"); - if (hint_subtype_seperator >= 0) { - String subtype_string = p_hint_string.substr(0, hint_subtype_seperator); + int hint_subtype_separator = p_hint_string.find(":"); + if (hint_subtype_separator >= 0) { + String subtype_string = p_hint_string.substr(0, hint_subtype_separator); int slash_pos = subtype_string.find("/"); if (slash_pos >= 0) { @@ -277,7 +277,7 @@ void ArrayPropertyEdit::edit(Object *p_obj, const StringName &p_prop, const Stri subtype_string = subtype_string.substr(0, slash_pos); } - subtype_hint_string = p_hint_string.substr(hint_subtype_seperator + 1, p_hint_string.size() - hint_subtype_seperator - 1); + subtype_hint_string = p_hint_string.substr(hint_subtype_separator + 1, p_hint_string.size() - hint_subtype_separator - 1); subtype = Variant::Type(subtype_string.to_int()); } } diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 3663bdee27..2467e1f722 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -325,14 +325,12 @@ void EditorFileSystem::_save_filesystem_cache() { String fscache = EditorSettings::get_singleton()->get_project_settings_dir().plus_file(CACHE_FILE_NAME); FileAccess *f = FileAccess::open(fscache, FileAccess::WRITE); - if (f == NULL) { - ERR_PRINTS("Error writing fscache '" + fscache + "'."); - } else { - f->store_line(filesystem_settings_version_for_import); - _save_filesystem_cache(filesystem, f); - f->close(); - memdelete(f); - } + ERR_FAIL_COND_MSG(!f, "Cannot create file '" + fscache + "'. Check user write permissions."); + + f->store_line(filesystem_settings_version_for_import); + _save_filesystem_cache(filesystem, f); + f->close(); + memdelete(f); } void EditorFileSystem::_thread_func(void *_userdata) { @@ -1373,6 +1371,7 @@ void EditorFileSystem::_save_late_updated_files() { //files that already existed, and were modified, need re-scanning for dependencies upon project restart. This is done via saving this special file String fscache = EditorSettings::get_singleton()->get_project_settings_dir().plus_file("filesystem_update4"); FileAccessRef f = FileAccess::open(fscache, FileAccess::WRITE); + ERR_FAIL_COND_MSG(!f, "Cannot create file '" + fscache + "'. Check user write permissions."); for (Set<String>::Element *E = late_update_files.front(); E; E = E->next()) { f->store_line(E->get()); } diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index d2306abfd7..dd49e38d7f 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1224,11 +1224,18 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { Ref<Font> doc_font = p_rt->get_font("doc", "EditorFonts"); Ref<Font> doc_bold_font = p_rt->get_font("doc_bold", "EditorFonts"); Ref<Font> doc_code_font = p_rt->get_font("doc_source", "EditorFonts"); + Color font_color_hl = p_rt->get_color("headline_color", "EditorHelp"); - Color link_color = p_rt->get_color("accent_color", "Editor").linear_interpolate(font_color_hl, 0.8); + Color accent_color = p_rt->get_color("accent_color", "Editor"); + Color link_color = accent_color.linear_interpolate(font_color_hl, 0.8); + Color code_color = accent_color.linear_interpolate(font_color_hl, 0.6); String bbcode = p_bbcode.dedent().replace("\t", "").replace("\r", "").strip_edges(); + // remove extra new lines around code blocks + bbcode = bbcode.replace("[codeblock]\n", "[codeblock]"); + bbcode = bbcode.replace("\n[/codeblock]", "[/codeblock]"); + List<String> tag_stack; bool code_tag = false; @@ -1276,9 +1283,14 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { tag_stack.pop_front(); pos = brk_end + 1; - code_tag = false; - if (tag != "/img") + if (tag != "/img") { p_rt->pop(); + if (code_tag) { + p_rt->pop(); + } + } + code_tag = false; + } else if (code_tag) { p_rt->add_text("["); @@ -1323,6 +1335,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { //use monospace font p_rt->push_font(doc_code_font); + p_rt->push_color(code_color); code_tag = true; pos = brk_end + 1; tag_stack.push_front(tag); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 9fa33044e1..d42345d9a2 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -5171,14 +5171,20 @@ void EditorNode::_open_imported() { } void EditorNode::dim_editor(bool p_dimming, bool p_force_dim) { - // Dimming can be forced regardless of the editor setting, which is useful when quitting the editor + // Dimming can be forced regardless of the editor setting, which is useful when quitting the editor. if ((p_force_dim || EditorSettings::get_singleton()->get("interface/editor/dim_editor_on_dialog_popup")) && p_dimming) { + dimmed = true; gui_base->set_modulate(Color(0.5, 0.5, 0.5)); } else { + dimmed = false; gui_base->set_modulate(Color(1, 1, 1)); } } +bool EditorNode::is_editor_dimmed() const { + return dimmed; +} + void EditorNode::open_export_template_manager() { export_template_manager->popup_manager(); @@ -5487,6 +5493,7 @@ EditorNode::EditorNode() { singleton = this; exiting = false; + dimmed = false; last_checked_version = 0; changing_scene = false; _initializing_addons = false; diff --git a/editor/editor_node.h b/editor/editor_node.h index fb7e81d2d2..b7775b5e83 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -260,6 +260,7 @@ private: int tab_closing; bool exiting; + bool dimmed; int old_split_ofs; VSplitContainer *top_split; @@ -850,6 +851,7 @@ public: void restart_editor(); void dim_editor(bool p_dimming, bool p_force_dim = false); + bool is_editor_dimmed() const; void edit_current() { _edit_current(); }; diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index 8abe91bdc1..c75b66c601 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -475,16 +475,16 @@ void EditorPropertyArray::setup(Variant::Type p_array_type, const String &p_hint array_type = p_array_type; if (array_type == Variant::ARRAY && !p_hint_string.empty()) { - int hint_subtype_seperator = p_hint_string.find(":"); - if (hint_subtype_seperator >= 0) { - String subtype_string = p_hint_string.substr(0, hint_subtype_seperator); + int hint_subtype_separator = p_hint_string.find(":"); + if (hint_subtype_separator >= 0) { + String subtype_string = p_hint_string.substr(0, hint_subtype_separator); int slash_pos = subtype_string.find("/"); if (slash_pos >= 0) { subtype_hint = PropertyHint(subtype_string.substr(slash_pos + 1, subtype_string.size() - slash_pos - 1).to_int()); subtype_string = subtype_string.substr(0, slash_pos); } - subtype_hint_string = p_hint_string.substr(hint_subtype_seperator + 1, p_hint_string.size() - hint_subtype_seperator - 1); + subtype_hint_string = p_hint_string.substr(hint_subtype_separator + 1, p_hint_string.size() - hint_subtype_separator - 1); subtype = Variant::Type(subtype_string.to_int()); } } diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 65a1704770..55f9347045 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -201,9 +201,8 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref< if (has_small_texture) { ResourceSaver::save(cache_base + "_small.png", r_small_texture); } - Error err; - FileAccess *f = FileAccess::open(cache_base + ".txt", FileAccess::WRITE, &err); - ERR_FAIL_COND_MSG(err != OK, "Cannot create file '" + cache_base + ".txt'."); + FileAccess *f = FileAccess::open(cache_base + ".txt", FileAccess::WRITE); + ERR_FAIL_COND_MSG(!f, "Cannot create file '" + cache_base + ".txt'. Check user write permissions."); f->store_line(itos(thumbnail_size)); f->store_line(itos(has_small_texture)); f->store_line(itos(FileAccess::get_modified_time(p_item.path))); @@ -295,11 +294,17 @@ void EditorResourcePreview::_thread() { //update modified time f = FileAccess::open(file, FileAccess::WRITE); - f->store_line(itos(thumbnail_size)); - f->store_line(itos(has_small_texture)); - f->store_line(itos(modtime)); - f->store_line(md5); - memdelete(f); + if (!f) { + // Not returning as this would leave the thread hanging and would require + // some proper cleanup/disabling of resource preview generation. + ERR_PRINTS("Cannot create file '" + file + "'. Check user write permissions."); + } else { + f->store_line(itos(thumbnail_size)); + f->store_line(itos(has_small_texture)); + f->store_line(itos(modtime)); + f->store_line(md5); + memdelete(f); + } } } else { memdelete(f); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index a49c3eac73..f05c7709d4 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -1089,7 +1089,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_icon("port", "GraphNode", theme->get_icon("GuiGraphNodePort", "EditorIcons")); // GridContainer - theme->set_constant("vseperation", "GridContainer", (extra_spacing + default_margin_size) * EDSCALE); + theme->set_constant("vseparation", "GridContainer", (extra_spacing + default_margin_size) * EDSCALE); // FileDialog theme->set_icon("folder", "FileDialog", theme->get_icon("Folder", "EditorIcons")); diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index bc22d9315e..ce400ad6dd 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -1117,15 +1117,17 @@ void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) { undo_redo->add_do_method(this, "_update_graph"); undo_redo->add_undo_method(this, "_update_graph"); undo_redo->commit_action(); + name_edit->hide(); updating = false; state_machine_draw->update(); - - name_edit->hide(); } void AnimationNodeStateMachineEditor::_name_edited_focus_out() { + if (updating) + return; + _name_edited(name_edit->get_text()); } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 12f6628831..119c61deb1 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -137,8 +137,12 @@ public: grid_step_y->set_h_size_flags(SIZE_EXPAND_FILL); child_container->add_child(grid_step_y); + child_container = memnew(GridContainer); + child_container->set_columns(2); + container->add_child(child_container); + label = memnew(Label); - label->set_text(TTR("Primary Line Every")); + label->set_text(TTR("Primary Line Every:")); label->set_h_size_flags(SIZE_EXPAND_FILL); child_container->add_child(label); @@ -147,16 +151,14 @@ public: primary_grid_steps->set_step(1); primary_grid_steps->set_max(100); primary_grid_steps->set_allow_greater(true); + primary_grid_steps->set_suffix(TTR("steps")); primary_grid_steps->set_h_size_flags(SIZE_EXPAND_FILL); child_container->add_child(primary_grid_steps); - label = memnew(Label); - label->set_text(TTR("steps")); - label->set_h_size_flags(SIZE_EXPAND_FILL); - child_container->add_child(label); - container->add_child(memnew(HSeparator)); + // We need to create another GridContainer with the same column count, + // so we can put an HSeparator above child_container = memnew(GridContainer); child_container->set_columns(2); container->add_child(child_container); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 21eebf9ca2..bda3d142fa 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -866,8 +866,8 @@ void TextureRegionEditor::_edit_region() { Vector2 TextureRegionEditor::snap_point(Vector2 p_target) const { if (snap_mode == SNAP_GRID) { - p_target.x = Math::snap_scalar_seperation(snap_offset.x, snap_step.x, p_target.x, snap_separation.x); - p_target.y = Math::snap_scalar_seperation(snap_offset.y, snap_step.y, p_target.y, snap_separation.y); + p_target.x = Math::snap_scalar_separation(snap_offset.x, snap_step.x, p_target.x, snap_separation.x); + p_target.y = Math::snap_scalar_separation(snap_offset.y, snap_step.y, p_target.y, snap_separation.y); } return p_target; diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index e0bf8dfdb2..d81c6d3f96 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -3038,8 +3038,8 @@ Vector2 TileSetEditor::snap_point(const Vector2 &point) { } if (tools[TOOL_GRID_SNAP]->is_pressed()) { - p.x = Math::snap_scalar_seperation(snap_offset.x, snap_step.x, p.x, snap_separation.x); - p.y = Math::snap_scalar_seperation(snap_offset.y, snap_step.y, p.y, snap_separation.y); + p.x = Math::snap_scalar_separation(snap_offset.x, snap_step.x, p.x, snap_separation.x); + p.y = Math::snap_scalar_separation(snap_offset.y, snap_step.y, p.y, snap_separation.y); } if (tools[SHAPE_KEEP_INSIDE_TILE]->is_pressed()) { if (p.x < region.position.x) diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 3a9e48cfdb..e96f2e55c2 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -109,11 +109,12 @@ void VisualShaderEditor::clear_custom_types() { for (int i = 0; i < add_options.size(); i++) { if (add_options[i].is_custom) { add_options.remove(i); + i--; } } } -void VisualShaderEditor::add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, const String &p_sub_category) { +void VisualShaderEditor::add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, const String &p_subcategory) { ERR_FAIL_COND(!p_name.is_valid_identifier()); ERR_FAIL_COND(!p_script.is_valid()); @@ -131,9 +132,25 @@ void VisualShaderEditor::add_custom_type(const String &p_name, const Ref<Script> ao.return_type = p_return_icon_type; ao.description = p_description; ao.category = p_category; - ao.sub_category = p_sub_category; + ao.sub_category = p_subcategory; ao.is_custom = true; + bool begin = false; + + for (int i = 0; i < add_options.size(); i++) { + if (add_options[i].is_custom) { + if (add_options[i].category == p_category) { + if (!begin) { + begin = true; + } + } else { + if (begin) { + add_options.insert(i, ao); + return; + } + } + } + } add_options.push_back(ao); } @@ -184,6 +201,7 @@ void VisualShaderEditor::update_custom_nodes() { clear_custom_types(); List<StringName> class_list; ScriptServer::get_global_class_list(&class_list); + Dictionary added; for (int i = 0; i < class_list.size(); i++) { if (ScriptServer::get_global_class_native_base(class_list[i]) == "VisualShaderNodeCustom") { @@ -222,14 +240,44 @@ void VisualShaderEditor::update_custom_nodes() { category = "Custom"; } - String sub_category = ""; + String subcategory = ""; if (ref->has_method("_get_subcategory")) { - sub_category = (String)ref->call("_get_subcategory"); + subcategory = (String)ref->call("_get_subcategory"); } - add_custom_type(name, script, description, return_icon_type, category, sub_category); + Dictionary dict; + dict["name"] = name; + dict["script"] = script; + dict["description"] = description; + dict["return_icon_type"] = return_icon_type; + dict["category"] = category; + dict["subcategory"] = subcategory; + + String key; + key = category; + key += "/"; + if (subcategory != "") { + key += subcategory; + key += "/"; + } + key += name; + + added[key] = dict; } } + + Array keys = added.keys(); + keys.sort(); + + for (int i = 0; i < keys.size(); i++) { + + const Variant &key = keys.get(i); + + const Dictionary &value = (Dictionary)added[key]; + + add_custom_type(value["name"], value["script"], value["description"], value["return_icon_type"], value["category"], value["subcategory"]); + } + _update_options_menu(); } diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h index 6f77641936..5197f8c77f 100644 --- a/editor/plugins/visual_shader_editor_plugin.h +++ b/editor/plugins/visual_shader_editor_plugin.h @@ -264,7 +264,7 @@ public: static VisualShaderEditor *get_singleton() { return singleton; } void clear_custom_types(); - void add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, const String &p_sub_category); + void add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, const String &p_subcategory); virtual Size2 get_minimum_size() const; void edit(VisualShader *p_visual_shader); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 0884620e5d..beead9e7f1 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -340,8 +340,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (!profile_allow_editing) { break; } - Tree *tree = scene_tree->get_scene_tree(); - if (tree->is_anything_selected()) { + if (editor_selection->get_selected_node_list().size() > 1) { rename_dialog->popup_centered(); } } break; |