diff options
-rw-r--r-- | core/config/project_settings.h | 3 | ||||
-rw-r--r-- | editor/editor_node.cpp | 26 | ||||
-rw-r--r-- | editor/editor_node.h | 14 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 1 | ||||
-rw-r--r-- | scene/gui/tab_container.cpp | 11 |
5 files changed, 31 insertions, 24 deletions
diff --git a/core/config/project_settings.h b/core/config/project_settings.h index a9af63ee39..960dfe0395 100644 --- a/core/config/project_settings.h +++ b/core/config/project_settings.h @@ -45,9 +45,10 @@ public: static const String PROJECT_DATA_DIR_NAME_SUFFIX; enum { - //properties that are not for built in values begin from this value, so builtin ones are displayed first + // Properties that are not for built in values begin from this value, so builtin ones are displayed first. NO_BUILTIN_ORDER_BASE = 1 << 16 }; + #ifdef TOOLS_ENABLED const static PackedStringArray get_required_features(); const static PackedStringArray get_unsupported_features(const PackedStringArray &p_project_features); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 893fc6f8f3..cf24195b5b 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2763,18 +2763,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { } } else if (extensions.size()) { String root_name = scene->get_name(); - // Very similar to node naming logic. - switch (ProjectSettings::get_singleton()->get("editor/scene/scene_naming").operator int()) { - case SCENE_NAME_CASING_AUTO: - // Use casing of the root node. - break; - case SCENE_NAME_CASING_PASCAL_CASE: { - root_name = root_name.to_pascal_case(); - } break; - case SCENE_NAME_CASING_SNAKE_CASE: - root_name = root_name.replace("-", "_").to_snake_case(); - break; - } + root_name = EditorNode::adjust_scene_name_casing(root_name); file->set_current_path(root_name + "." + extensions.front()->get().to_lower()); } file->popup_file_dialog(); @@ -3090,6 +3079,19 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { } } +String EditorNode::adjust_scene_name_casing(const String &root_name) { + switch (ProjectSettings::get_singleton()->get("editor/scene/scene_naming").operator int()) { + case SCENE_NAME_CASING_AUTO: + // Use casing of the root node. + break; + case SCENE_NAME_CASING_PASCAL_CASE: + return root_name.to_pascal_case(); + case SCENE_NAME_CASING_SNAKE_CASE: + return root_name.replace("-", "_").to_snake_case(); + } + return root_name; +} + void EditorNode::_request_screenshot() { _screenshot(); } diff --git a/editor/editor_node.h b/editor/editor_node.h index 9b3f052c0e..b0299744f1 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -125,6 +125,12 @@ public: EDITOR_ASSETLIB }; + enum SceneNameCasing { + SCENE_NAME_CASING_AUTO, + SCENE_NAME_CASING_PASCAL_CASE, + SCENE_NAME_CASING_SNAKE_CASE + }; + struct ExecuteThreadArgs { String path; List<String> args; @@ -233,12 +239,6 @@ private: MAX_BUILD_CALLBACKS = 128 }; - enum ScriptNameCasing { - SCENE_NAME_CASING_AUTO, - SCENE_NAME_CASING_PASCAL_CASE, - SCENE_NAME_CASING_SNAKE_CASE - }; - struct BottomPanelItem { String name; Control *control = nullptr; @@ -718,6 +718,8 @@ public: static HBoxContainer *get_menu_hb() { return singleton->menu_hb; } static VSplitContainer *get_top_split() { return singleton->top_split; } + static String adjust_scene_name_casing(const String &root_name); + static bool has_unsaved_changes() { return singleton->unsaved_cache; } static void disambiguate_filenames(const Vector<String> p_full_paths, Vector<String> &r_filenames); static void add_io_error(const String &p_error); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index a437245c57..7714df9c4e 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -916,6 +916,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { String existing; if (extensions.size()) { String root_name(tocopy->get_name()); + root_name = EditorNode::adjust_scene_name_casing(root_name); existing = root_name + "." + extensions.front()->get().to_lower(); } new_scene_from_dialog->set_current_path(existing); diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index f45d132a66..1df698a108 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -838,7 +838,7 @@ Size2 TabContainer::get_minimum_size() const { } Vector<Control *> controls = _get_tab_controls(); - int max_control_height = 0; + Size2 largest_child_min_size; for (int i = 0; i < controls.size(); i++) { Control *c = controls[i]; @@ -847,13 +847,14 @@ Size2 TabContainer::get_minimum_size() const { } Size2 cms = c->get_combined_minimum_size(); - ms.x = MAX(ms.x, cms.x); - max_control_height = MAX(max_control_height, cms.y); + largest_child_min_size.x = MAX(largest_child_min_size.x, cms.x); + largest_child_min_size.y = MAX(largest_child_min_size.y, cms.y); } - ms.y += max_control_height; + ms.y += largest_child_min_size.y; Size2 panel_ms = theme_cache.panel_style->get_minimum_size(); - ms.x = MAX(ms.x, panel_ms.x); + + ms.x = MAX(ms.x, largest_child_min_size.x + panel_ms.x); ms.y += panel_ms.y; return ms; |