diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/code_editor.cpp | 4 | ||||
-rw-r--r-- | editor/editor_fonts.cpp | 4 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 2 | ||||
-rw-r--r-- | editor/import_dock.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/lightmap_gi_editor_plugin.cpp | 12 | ||||
-rw-r--r-- | editor/plugins/lightmap_gi_editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/plugins/material_editor_plugin.cpp | 39 | ||||
-rw-r--r-- | editor/plugins/material_editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 14 | ||||
-rw-r--r-- | editor/script_create_dialog.cpp | 10 |
10 files changed, 78 insertions, 13 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index a1704e37a7..4669e56e20 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1548,7 +1548,9 @@ void CodeTextEditor::set_error_pos(int p_line, int p_column) { void CodeTextEditor::goto_error() { if (!error->get_text().is_empty()) { - text_editor->unfold_line(error_line); + if (text_editor->get_line_count() != error_line) { + text_editor->unfold_line(error_line); + } text_editor->set_caret_line(error_line); text_editor->set_caret_column(error_column); text_editor->center_viewport_to_caret(); diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp index 827eb76db5..d556255a8f 100644 --- a/editor/editor_fonts.cpp +++ b/editor/editor_fonts.cpp @@ -273,8 +273,8 @@ void editor_register_fonts(Ref<Theme> p_theme) { // Default font MAKE_DEFAULT_FONT(df, String()); - p_theme->set_default_theme_font(df); // Default theme font - p_theme->set_default_theme_font_size(default_font_size); + p_theme->set_default_font(df); // Default theme font + p_theme->set_default_font_size(default_font_size); p_theme->set_font_size("main_size", "EditorFonts", default_font_size); p_theme->set_font("main", "EditorFonts", df); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 7b60c4a384..a8a1dc37ab 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -294,7 +294,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { Ref<Theme> theme = Ref<Theme>(memnew(Theme)); // Controls may rely on the scale for their internal drawing logic. - theme->set_default_theme_base_scale(EDSCALE); + theme->set_default_base_scale(EDSCALE); // Theme settings Color accent_color = EDITOR_GET("interface/theme/accent_color"); diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index ab1be7f41b..10654cfe43 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -297,6 +297,8 @@ void ImportDock::set_edit_multiple_paths(const Vector<String> &p_paths) { _set_dirty(false); import_as->set_disabled(false); preset->set_disabled(false); + content->show(); + select_a_resource->hide(); imported->set_text(vformat(TTR("%d Files"), p_paths.size())); diff --git a/editor/plugins/lightmap_gi_editor_plugin.cpp b/editor/plugins/lightmap_gi_editor_plugin.cpp index be17fc238a..2126ca1bc9 100644 --- a/editor/plugins/lightmap_gi_editor_plugin.cpp +++ b/editor/plugins/lightmap_gi_editor_plugin.cpp @@ -33,13 +33,14 @@ void LightmapGIEditorPlugin::_bake_select_file(const String &p_file) { if (lightmap) { LightmapGI::BakeError err; + const uint64_t time_started = OS::get_singleton()->get_ticks_msec(); if (get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root() == lightmap) { err = lightmap->bake(lightmap, p_file, bake_func_step); } else { err = lightmap->bake(lightmap->get_parent(), p_file, bake_func_step); } - bake_func_end(); + bake_func_end(time_started); switch (err) { case LightmapGI::BAKE_ERROR_NO_SAVE_PATH: { @@ -104,11 +105,18 @@ bool LightmapGIEditorPlugin::bake_func_step(float p_progress, const String &p_de return tmp_progress->step(p_description, p_progress * 1000, p_refresh); } -void LightmapGIEditorPlugin::bake_func_end() { +void LightmapGIEditorPlugin::bake_func_end(uint64_t p_time_started) { if (tmp_progress != nullptr) { memdelete(tmp_progress); tmp_progress = nullptr; } + + const int time_taken = (OS::get_singleton()->get_ticks_msec() - p_time_started) * 0.001; + print_line(vformat("Done baking lightmaps in %02d:%02d:%02d.", time_taken / 3600, (time_taken % 3600) / 60, time_taken % 60)); + // Request attention in case the user was doing something else. + // Baking lightmaps is likely the editor task that can take the most time, + // so only request the attention for baking lightmaps. + DisplayServer::get_singleton()->window_request_attention(); } void LightmapGIEditorPlugin::_bind_methods() { diff --git a/editor/plugins/lightmap_gi_editor_plugin.h b/editor/plugins/lightmap_gi_editor_plugin.h index d0edf9f324..5eec972228 100644 --- a/editor/plugins/lightmap_gi_editor_plugin.h +++ b/editor/plugins/lightmap_gi_editor_plugin.h @@ -47,7 +47,7 @@ class LightmapGIEditorPlugin : public EditorPlugin { EditorFileDialog *file_dialog; static EditorProgress *tmp_progress; static bool bake_func_step(float p_progress, const String &p_description, void *, bool p_refresh); - static void bake_func_end(); + static void bake_func_end(uint64_t p_time_started); void _bake_select_file(const String &p_file); void _bake(); diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index 576e91e544..9d45c365a8 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -254,6 +254,43 @@ void EditorInspectorPluginMaterial::parse_begin(Object *p_object) { add_custom_control(editor); } +void EditorInspectorPluginMaterial::_undo_redo_inspector_callback(Object *p_undo_redo, Object *p_edited, String p_property, Variant p_new_value) { + UndoRedo *undo_redo = Object::cast_to<UndoRedo>(p_undo_redo); + if (!undo_redo) { + return; + } + + // For BaseMaterial3D, if a roughness or metallic textures is being assigned to an empty slot, + // set the respective metallic or roughness factor to 1.0 as a convenience feature + BaseMaterial3D *base_material = Object::cast_to<StandardMaterial3D>(p_edited); + if (base_material) { + Texture2D *texture = Object::cast_to<Texture2D>(p_new_value); + if (texture) { + if (p_property == "roughness_texture") { + if (base_material->get_texture(StandardMaterial3D::TEXTURE_ROUGHNESS).is_null() && texture) { + undo_redo->add_do_property(p_edited, "roughness", 1.0); + + bool valid = false; + Variant value = p_edited->get("roughness", &valid); + if (valid) { + undo_redo->add_undo_property(p_edited, "roughness", value); + } + } + } else if (p_property == "metallic_texture") { + if (base_material->get_texture(StandardMaterial3D::TEXTURE_METALLIC).is_null() && texture) { + undo_redo->add_do_property(p_edited, "metallic", 1.0); + + bool valid = false; + Variant value = p_edited->get("metallic", &valid); + if (valid) { + undo_redo->add_undo_property(p_edited, "metallic", value); + } + } + } + } + } +} + EditorInspectorPluginMaterial::EditorInspectorPluginMaterial() { env.instantiate(); Ref<Sky> sky = memnew(Sky()); @@ -261,6 +298,8 @@ EditorInspectorPluginMaterial::EditorInspectorPluginMaterial() { env->set_background(Environment::BG_COLOR); env->set_ambient_source(Environment::AMBIENT_SOURCE_SKY); env->set_reflection_source(Environment::REFLECTION_SOURCE_SKY); + + EditorNode::get_singleton()->get_editor_data().add_undo_redo_inspector_hook_callback(callable_mp(this, &EditorInspectorPluginMaterial::_undo_redo_inspector_callback)); } MaterialEditorPlugin::MaterialEditorPlugin(EditorNode *p_node) { diff --git a/editor/plugins/material_editor_plugin.h b/editor/plugins/material_editor_plugin.h index 36c2df191d..53f4513396 100644 --- a/editor/plugins/material_editor_plugin.h +++ b/editor/plugins/material_editor_plugin.h @@ -92,6 +92,8 @@ public: virtual bool can_handle(Object *p_object) override; virtual void parse_begin(Object *p_object) override; + void _undo_redo_inspector_callback(Object *p_undo_redo, Object *p_edited, String p_property, Variant p_new_value); + EditorInspectorPluginMaterial(); }; diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 8d4e7b444b..7e72777da1 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -726,7 +726,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { dup->set_name(parent->validate_child_name(dup)); - editor_data->get_undo_redo().add_do_method(add_below_node, "add_sibling", dup); + editor_data->get_undo_redo().add_do_method(add_below_node, "add_sibling", dup, true); for (Node *F : owned) { if (!duplimap.has(F)) { @@ -942,6 +942,18 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { break; } + if (tocopy->get_owner() != scene) { + accept->set_text(TTR("Can't save a branch which is a child of an already instantiated scene.\nTo save this branch into its own scene, open the original scene, right click on this branch, and select \"Save Branch as Scene\".")); + accept->popup_centered(); + break; + } + + if (scene->get_scene_inherited_state().is_valid() && scene->get_scene_inherited_state()->find_node_by_path(scene->get_path_to(tocopy)) >= 0) { + accept->set_text(TTR("Can't save a branch which is part of an inherited scene.\nTo save this branch into its own scene, open the original scene, right click on this branch, and select \"Save Branch as Scene\".")); + accept->popup_centered(); + break; + } + new_scene_from_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); List<String> extensions; diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 20c6aafc7f..2098fa2c85 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -353,15 +353,15 @@ void ScriptCreateDialog::_load_exist() { } Vector<String> ScriptCreateDialog::get_hierarchy(String p_object) const { - Vector<String> hierachy; - hierachy.append(p_object); + Vector<String> hierarchy; + hierarchy.append(p_object); String parent_class = ClassDB::get_parent_class(p_object); while (parent_class.is_valid_identifier()) { - hierachy.append(parent_class); + hierarchy.append(parent_class); parent_class = ClassDB::get_parent_class(parent_class); } - return hierachy; + return hierarchy; } void ScriptCreateDialog::_language_changed(int l) { @@ -544,7 +544,7 @@ void ScriptCreateDialog::_update_template_menu() { template_list.clear(); if (is_language_using_templates) { - // Get the lastest templates used for each type of node from project settings then global settings. + // Get the latest templates used for each type of node from project settings then global settings. Dictionary last_local_templates = EditorSettings::get_singleton()->get_project_metadata("script_setup", "templates_dictionary", Dictionary()); Dictionary last_global_templates; if (EditorSettings::get_singleton()->has_meta("script_setup/templates_dictionary")) { |