summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/code_editor.cpp4
-rw-r--r--editor/editor_fonts.cpp4
-rw-r--r--editor/editor_help.cpp29
-rw-r--r--editor/editor_node.cpp30
-rw-r--r--editor/editor_settings.cpp46
-rw-r--r--editor/editor_themes.cpp16
-rw-r--r--editor/import/resource_importer_obj.cpp172
-rw-r--r--editor/import/resource_importer_obj.h22
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp12
-rw-r--r--editor/plugins/script_text_editor.cpp6
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp2
-rw-r--r--editor/project_manager.cpp2
-rw-r--r--editor/property_editor.cpp2
13 files changed, 210 insertions, 137 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index a7516c091f..985b336d20 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1010,7 +1010,7 @@ void CodeTextEditor::_reset_zoom() {
Ref<DynamicFont> font = text_editor->get_font("font"); // reset source font size to default
if (font.is_valid()) {
- EditorSettings::get_singleton()->set("interface/source_font_size", 14);
+ EditorSettings::get_singleton()->set("interface/editor/source_font_size", 14);
font->set_size(14);
}
}
@@ -1066,7 +1066,7 @@ void CodeTextEditor::_font_resize_timeout() {
if (font.is_valid()) {
int new_size = CLAMP(font->get_size() + font_resize_val, 8 * EDSCALE, 96 * EDSCALE);
if (new_size != font->get_size()) {
- EditorSettings::get_singleton()->set("interface/source_font_size", new_size / EDSCALE);
+ EditorSettings::get_singleton()->set("interface/editor/source_font_size", new_size / EDSCALE);
font->set_size(new_size);
}
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index 110b2a6a8c..cf6259bede 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -122,7 +122,7 @@ void editor_register_fonts(Ref<Theme> p_theme) {
dfmono->set_font_ptr(_font_Hack_Regular, _font_Hack_Regular_size);
//dfd->set_force_autohinter(true); //just looks better..i think?
- MAKE_DEFAULT_FONT(df, int(EditorSettings::get_singleton()->get("interface/font_size")) * EDSCALE);
+ MAKE_DEFAULT_FONT(df, int(EditorSettings::get_singleton()->get("interface/editor/font_size")) * EDSCALE);
p_theme->set_default_theme_font(df);
@@ -142,7 +142,7 @@ void editor_register_fonts(Ref<Theme> p_theme) {
Ref<DynamicFont> df_code;
df_code.instance();
- df_code->set_size(int(EditorSettings::get_singleton()->get("interface/source_font_size")) * EDSCALE);
+ df_code->set_size(int(EditorSettings::get_singleton()->get("interface/editor/source_font_size")) * EDSCALE);
df_code->set_font_data(dfmono);
MAKE_FALLBACKS(df_code);
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index f2452df9f0..cb94ea72d1 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -650,8 +650,8 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
// Colors
const Color title_color = get_color("accent_color", "Editor");
- const Color text_color = get_color("font_color", "RichTextLabel");
- const Color highlight_color = get_color("highlight_color", "RichTextLabel");
+ const Color text_color = get_color("default_color", "RichTextLabel");
+ const Color headline_color = get_color("headline_color", "EditorHelp");
const Color base_type_color = title_color.linear_interpolate(text_color, 0.5);
const Color comment_color = Color(text_color.r, text_color.g, text_color.b, 0.6);
const Color symbol_color = comment_color;
@@ -669,7 +669,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->push_font(doc_title_font);
class_desc->push_color(title_color);
class_desc->add_text(TTR("Class:") + " ");
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
_add_text(p_class);
class_desc->pop();
class_desc->pop();
@@ -812,7 +812,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
}
class_desc->push_font(doc_code_font);
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
_add_text(cd.properties[i].name);
if (describe) {
@@ -883,7 +883,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
method_descr = true;
class_desc->push_meta("@" + methods[i].name);
}
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
_add_text(methods[i].name);
class_desc->pop();
if (methods[i].description != "")
@@ -969,7 +969,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->push_cell();
class_desc->push_font(doc_code_font);
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
_add_text(cd.theme_properties[i].name);
class_desc->pop();
class_desc->pop();
@@ -1015,7 +1015,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->push_font(doc_code_font); // monofont
//_add_type("void");
//class_desc->add_text(" ");
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
_add_text(cd.signals[i].name);
class_desc->pop();
class_desc->push_color(symbol_color);
@@ -1102,7 +1102,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
e = e.get_slice(".", 1);
}
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
class_desc->add_text(e);
class_desc->pop();
class_desc->pop();
@@ -1117,7 +1117,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
for (int i = 0; i < enum_list.size(); i++) {
class_desc->push_font(doc_code_font);
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
_add_text(enum_list[i].name);
class_desc->pop();
class_desc->push_color(symbol_color);
@@ -1165,7 +1165,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
constant_line[constants[i].name] = class_desc->get_line_count() - 2;
class_desc->push_font(doc_code_font);
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
_add_text(constants[i].name);
class_desc->pop();
class_desc->push_color(symbol_color);
@@ -1235,7 +1235,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
_add_type(cd.properties[i].type, cd.properties[i].enumeration);
class_desc->add_text(" ");
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
_add_text(cd.properties[i].name);
class_desc->pop(); //color
@@ -1324,7 +1324,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
_add_type(methods[i].return_type, methods[i].return_enum);
class_desc->add_text(" ");
- class_desc->push_color(highlight_color);
+ class_desc->push_color(headline_color);
_add_text(methods[i].name);
class_desc->pop();
class_desc->push_color(symbol_color);
@@ -1456,7 +1456,7 @@ 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_code_font = p_rt->get_font("doc_source", "EditorFonts");
- Color font_color_hl = p_rt->get_color("highlight_color", "RichTextLabel");
+ 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);
String bbcode = p_bbcode.replace("\t", " ").replace("\r", " ").strip_edges();
@@ -1695,9 +1695,6 @@ void EditorHelp::_notification(int p_what) {
//back->set_icon(get_icon("Back","EditorIcons"));
_update_doc();
- class_desc->add_style_override("normal", class_desc->get_stylebox("code_normal", "RichTextLabel"));
- class_desc->add_style_override("focus", class_desc->get_stylebox("code_focus", "RichTextLabel"));
-
} break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index a69d8eda37..a04ded7b5b 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -114,7 +114,7 @@ EditorNode *EditorNode::singleton = NULL;
void EditorNode::_update_scene_tabs() {
- bool show_rb = EditorSettings::get_singleton()->get("interface/show_script_in_scene_tabs");
+ bool show_rb = EditorSettings::get_singleton()->get("interface/editor/show_script_in_scene_tabs");
scene_tabs->clear_tabs();
Ref<Texture> script_icon = gui_base->get_icon("Script", "EditorIcons");
@@ -282,8 +282,8 @@ void EditorNode::_notification(int p_what) {
}
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
- scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
- property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/capitalize_properties", true)));
+ scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/editor/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
+ property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/editor/capitalize_properties", true)));
Ref<Theme> theme = create_editor_theme(theme_base->get_theme());
theme_base->set_theme(theme);
@@ -2244,10 +2244,10 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case RUN_PROJECT_MANAGER: {
if (!p_confirmed) {
- bool save_each = EDITOR_DEF("interface/save_each_scene_on_quit", true);
+ bool save_each = EDITOR_DEF("interface/editor/save_each_scene_on_quit", true);
if (_next_unsaved_scene(!save_each) == -1) {
- bool confirm = EDITOR_DEF("interface/quit_confirmation", true);
+ bool confirm = EDITOR_DEF("interface/editor/quit_confirmation", true);
if (confirm) {
confirmation->get_ok()->set_text(p_option == FILE_QUIT ? TTR("Quit") : TTR("Yes"));
@@ -2572,7 +2572,7 @@ void EditorNode::_editor_select(int p_which) {
editor_data.get_editor_plugin(i)->notify_main_screen_changed(editor_plugin_screen->get_name());
}
- if (EditorSettings::get_singleton()->get("interface/separate_distraction_mode")) {
+ if (EditorSettings::get_singleton()->get("interface/editor/separate_distraction_mode")) {
if (p_which == EDITOR_SCRIPT) {
set_distraction_free_mode(script_distraction);
} else {
@@ -4101,7 +4101,7 @@ bool EditorNode::get_docks_visible() const {
void EditorNode::_toggle_distraction_free_mode() {
- if (EditorSettings::get_singleton()->get("interface/separate_distraction_mode")) {
+ if (EditorSettings::get_singleton()->get("interface/editor/separate_distraction_mode")) {
int screen = -1;
for (int i = 0; i < editor_table.size(); i++) {
if (editor_plugin_screen == editor_table[i]) {
@@ -4385,7 +4385,7 @@ void EditorNode::_open_imported() {
void EditorNode::dim_editor(bool p_dimming) {
static int dim_count = 0;
- bool dim_ui = EditorSettings::get_singleton()->get("interface/dim_editor_on_dialog_popup");
+ bool dim_ui = EditorSettings::get_singleton()->get("interface/editor/dim_editor_on_dialog_popup");
if (p_dimming) {
if (dim_ui) {
if (dim_count == 0) {
@@ -4412,9 +4412,9 @@ void EditorNode::_start_dimming(bool p_dimming) {
void EditorNode::_dim_timeout() {
_dim_time += _dim_timer->get_wait_time();
- float wait_time = EditorSettings::get_singleton()->get("interface/dim_transition_time");
+ float wait_time = EditorSettings::get_singleton()->get("interface/editor/dim_transition_time");
- float c = 1.0f - (float)EditorSettings::get_singleton()->get("interface/dim_amount");
+ float c = 1.0f - (float)EditorSettings::get_singleton()->get("interface/editor/dim_amount");
Color base = _dimming ? Color(1, 1, 1) : Color(c, c, c);
Color final = _dimming ? Color(c, c, c) : Color(1, 1, 1);
@@ -4586,7 +4586,7 @@ EditorNode::EditorNode() {
EditorSettings::create();
{
- int dpi_mode = EditorSettings::get_singleton()->get("interface/hidpi_mode");
+ int dpi_mode = EditorSettings::get_singleton()->get("interface/editor/hidpi_mode");
if (dpi_mode == 0) {
editor_set_scale(OS::get_singleton()->get_screen_dpi(0) >= 192 && OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x > 2000 ? 2.0 : 1.0);
} else if (dpi_mode == 1) {
@@ -4623,6 +4623,10 @@ EditorNode::EditorNode() {
import_wav.instance();
ResourceFormatImporter::get_singleton()->add_importer(import_wav);
+ Ref<ResourceImporterOBJ> import_obj;
+ import_obj.instance();
+ ResourceFormatImporter::get_singleton()->add_importer(import_obj);
+
Ref<ResourceImporterScene> import_scene;
import_scene.instance();
ResourceFormatImporter::get_singleton()->add_importer(import_scene);
@@ -4837,7 +4841,7 @@ EditorNode::EditorNode() {
scene_tabs->add_style_override("tab_bg", gui_base->get_stylebox("SceneTabBG", "EditorStyles"));
scene_tabs->add_tab("unsaved");
scene_tabs->set_tab_align(Tabs::ALIGN_LEFT);
- scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
+ scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/editor/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
scene_tabs->set_min_width(int(EDITOR_DEF("interface/scene_tabs/minimum_width", 50)) * EDSCALE);
scene_tabs->connect("tab_changed", this, "_scene_tab_changed");
scene_tabs->connect("right_button_pressed", this, "_scene_tab_script_edited");
@@ -5291,7 +5295,7 @@ EditorNode::EditorNode() {
property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
property_editor->set_use_doc_hints(true);
property_editor->set_hide_script(false);
- property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/capitalize_properties", true)));
+ property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/editor/capitalize_properties", true)));
property_editor->hide_top_label();
property_editor->register_text_enter(search_box);
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 325f30a453..d8c2d7cca4 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -453,7 +453,7 @@ String EditorSettings::get_settings_path() const {
void EditorSettings::setup_language() {
- String lang = get("interface/editor_language");
+ String lang = get("interface/editor/editor_language");
if (lang == "en")
return; //none to do
@@ -555,29 +555,29 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
best = "en";
}
- _initial_set("interface/editor_language", best);
- hints["interface/editor_language"] = PropertyInfo(Variant::STRING, "interface/editor_language", PROPERTY_HINT_ENUM, lang_hint, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/editor/editor_language", best);
+ hints["interface/editor/editor_language"] = PropertyInfo(Variant::STRING, "interface/editor/editor_language", PROPERTY_HINT_ENUM, lang_hint, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
}
- _initial_set("interface/hidpi_mode", 0);
- hints["interface/hidpi_mode"] = PropertyInfo(Variant::INT, "interface/hidpi_mode", PROPERTY_HINT_ENUM, "Auto,VeryLoDPI,LoDPI,MidDPI,HiDPI", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- _initial_set("interface/show_script_in_scene_tabs", false);
- _initial_set("interface/font_size", 14);
- hints["interface/font_size"] = PropertyInfo(Variant::INT, "interface/font_size", PROPERTY_HINT_RANGE, "10,40,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- _initial_set("interface/source_font_size", 14);
- hints["interface/source_font_size"] = PropertyInfo(Variant::INT, "interface/source_font_size", PROPERTY_HINT_RANGE, "8,96,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- _initial_set("interface/custom_font", "");
- hints["interface/custom_font"] = PropertyInfo(Variant::STRING, "interface/custom_font", PROPERTY_HINT_GLOBAL_FILE, "*.font,*.tres,*.res", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- _initial_set("interface/dim_editor_on_dialog_popup", true);
- _initial_set("interface/dim_amount", 0.6f);
- hints["interface/dim_amount"] = PropertyInfo(Variant::REAL, "interface/dim_amount", PROPERTY_HINT_RANGE, "0,1,0.01", PROPERTY_USAGE_DEFAULT);
- _initial_set("interface/dim_transition_time", 0.08f);
- hints["interface/dim_transition_time"] = PropertyInfo(Variant::REAL, "interface/dim_transition_time", PROPERTY_HINT_RANGE, "0,1,0.001", PROPERTY_USAGE_DEFAULT);
-
- _initial_set("interface/separate_distraction_mode", false);
-
- _initial_set("interface/save_each_scene_on_quit", true); // Regression
- _initial_set("interface/quit_confirmation", true);
+ _initial_set("interface/editor/hidpi_mode", 0);
+ hints["interface/editor/hidpi_mode"] = PropertyInfo(Variant::INT, "interface/editor/hidpi_mode", PROPERTY_HINT_ENUM, "Auto,VeryLoDPI,LoDPI,MidDPI,HiDPI", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/editor/show_script_in_scene_tabs", false);
+ _initial_set("interface/editor/font_size", 14);
+ hints["interface/editor/font_size"] = PropertyInfo(Variant::INT, "interface/editor/font_size", PROPERTY_HINT_RANGE, "10,40,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/editor/source_font_size", 14);
+ hints["interface/editor/source_font_size"] = PropertyInfo(Variant::INT, "interface/editor/source_font_size", PROPERTY_HINT_RANGE, "8,96,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/editor/custom_font", "");
+ hints["interface/editor/custom_font"] = PropertyInfo(Variant::STRING, "interface/editor/custom_font", PROPERTY_HINT_GLOBAL_FILE, "*.font,*.tres,*.res", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/editor/dim_editor_on_dialog_popup", true);
+ _initial_set("interface/editor/dim_amount", 0.6f);
+ hints["interface/editor/dim_amount"] = PropertyInfo(Variant::REAL, "interface/editor/dim_amount", PROPERTY_HINT_RANGE, "0,1,0.01", PROPERTY_USAGE_DEFAULT);
+ _initial_set("interface/editor/dim_transition_time", 0.08f);
+ hints["interface/editor/dim_transition_time"] = PropertyInfo(Variant::REAL, "interface/editor/dim_transition_time", PROPERTY_HINT_RANGE, "0,1,0.001", PROPERTY_USAGE_DEFAULT);
+
+ _initial_set("interface/editor/separate_distraction_mode", false);
+
+ _initial_set("interface/editor/save_each_scene_on_quit", true); // Regression
+ _initial_set("interface/editor/quit_confirmation", true);
_initial_set("interface/theme/preset", 0);
hints["interface/theme/preset"] = PropertyInfo(Variant::INT, "interface/theme/preset", PROPERTY_HINT_ENUM, "Default,Grey,Godot 2,Arc,Light,Custom", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
@@ -610,7 +610,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["filesystem/directories/default_project_path"] = PropertyInfo(Variant::STRING, "filesystem/directories/default_project_path", PROPERTY_HINT_GLOBAL_DIR);
_initial_set("filesystem/directories/default_project_export_path", "");
hints["global/default_project_export_path"] = PropertyInfo(Variant::STRING, "global/default_project_export_path", PROPERTY_HINT_GLOBAL_DIR);
- _initial_set("interface/show_script_in_scene_tabs", false);
+ _initial_set("interface/editor/show_script_in_scene_tabs", false);
_initial_set("text_editor/theme/color_theme", "Adaptive");
hints["text_editor/theme/color_theme"] = PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, "Adaptive,Default");
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 5ac1c84520..08bb976bcc 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -798,21 +798,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("grabber_area", "VSlider", make_flat_stylebox(contrast_color_1, default_margin_size / 2, 0, default_margin_size / 2, 0));
//RichTextLabel
- Color rtl_combined_bg_color = dark_color_1.linear_interpolate(script_bg_color, script_bg_color.a);
- Color rtl_mono_color = (rtl_combined_bg_color.r + rtl_combined_bg_color.g + rtl_combined_bg_color.b > 1.5) ? Color(0, 0, 0) : Color(1, 1, 1);
- Color rtl_font_color = rtl_mono_color.linear_interpolate(rtl_combined_bg_color, 0.25);
- theme->set_color("default_color", "RichTextLabel", rtl_font_color);
+ theme->set_color("default_color", "RichTextLabel", font_color);
theme->set_stylebox("focus", "RichTextLabel", make_empty_stylebox());
theme->set_stylebox("normal", "RichTextLabel", style_tree_bg);
- Ref<StyleBoxFlat> style_code = style_tree_bg->duplicate();
- style_code->set_bg_color(rtl_combined_bg_color);
- theme->set_stylebox("code_normal", "RichTextLabel", style_code);
- Ref<StyleBoxFlat> style_code_focus = style_tree_focus->duplicate();
- style_code_focus->set_bg_color(rtl_combined_bg_color);
- theme->set_stylebox("code_focus", "RichTextLabel", style_code_focus);
- theme->set_color("font_color", "RichTextLabel", rtl_font_color);
- theme->set_color("highlight_color", "RichTextLabel", rtl_mono_color);
+ theme->set_color("headline_color", "EditorHelp", mono_color);
// Panel
theme->set_stylebox("panel", "Panel", make_flat_stylebox(dark_color_1, 6, 4, 6, 4));
@@ -979,7 +969,7 @@ Ref<Theme> create_custom_theme() {
theme = ResourceLoader::load(custom_theme);
}
- String global_font = EditorSettings::get_singleton()->get("interface/custom_font");
+ String global_font = EditorSettings::get_singleton()->get("interface/editor/custom_font");
if (global_font != "") {
Ref<Font> fnt = ResourceLoader::load(global_font);
if (fnt.is_valid()) {
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index 6a936649c3..4541c77085 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -40,12 +40,8 @@ uint32_t EditorOBJImporter::get_import_flags() const {
return IMPORT_SCENE;
}
-void EditorOBJImporter::get_extensions(List<String> *r_extensions) const {
- r_extensions->push_back("obj");
-}
-
-Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<String, Ref<SpatialMaterial> > &material_map, List<String> *r_missing_deps) {
+static Error _parse_material_library(const String &p_path, Map<String, Ref<SpatialMaterial> > &material_map, List<String> *r_missing_deps) {
FileAccessRef f = FileAccess::open(p_path, FileAccess::READ);
ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
@@ -134,7 +130,7 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin
if (texture.is_valid()) {
current->set_texture(SpatialMaterial::TEXTURE_ALBEDO, texture);
- } else {
+ } else if (r_missing_deps) {
r_missing_deps->push_back(path);
}
@@ -149,7 +145,7 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin
if (texture.is_valid()) {
current->set_texture(SpatialMaterial::TEXTURE_METALLIC, texture);
- } else {
+ } else if (r_missing_deps) {
r_missing_deps->push_back(path);
}
@@ -164,7 +160,7 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin
if (texture.is_valid()) {
current->set_texture(SpatialMaterial::TEXTURE_ROUGHNESS, texture);
- } else {
+ } else if (r_missing_deps) {
r_missing_deps->push_back(path);
}
} else if (l.begins_with("map_bump ")) {
@@ -179,7 +175,7 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin
if (texture.is_valid()) {
current->set_feature(SpatialMaterial::FEATURE_NORMAL_MAPPING, true);
current->set_texture(SpatialMaterial::TEXTURE_NORMAL, texture);
- } else {
+ } else if (r_missing_deps) {
r_missing_deps->push_back(path);
}
} else if (f->eof_reached()) {
@@ -190,28 +186,16 @@ Error EditorOBJImporter::_parse_material_library(const String &p_path, Map<Strin
return OK;
}
-Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err) {
+static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p_single_mesh, bool p_generate_tangents, List<String> *r_missing_deps) {
FileAccessRef f = FileAccess::open(p_path, FileAccess::READ);
- if (r_err) {
- *r_err = ERR_CANT_OPEN;
- }
-
- ERR_FAIL_COND_V(!f, NULL);
-
- if (r_err) {
- *r_err = OK;
- }
-
- Spatial *scene = memnew(Spatial);
+ ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
Ref<ArrayMesh> mesh;
mesh.instance();
- Map<String, Ref<Material> > name_map;
-
- bool generate_tangents = p_flags & IMPORT_GENERATE_TANGENT_ARRAYS;
+ bool generate_tangents = p_generate_tangents;
bool flip_faces = false;
//bool flip_faces = p_options["force/flip_faces"];
//bool force_smooth = p_options["force/smooth_shading"];
@@ -239,7 +223,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
if (l.begins_with("v ")) {
//vertex
Vector<String> v = l.split(" ", false);
- ERR_FAIL_COND_V(v.size() < 4, NULL);
+ ERR_FAIL_COND_V(v.size() < 4, ERR_FILE_CORRUPT);
Vector3 vtx;
vtx.x = v[1].to_float();
vtx.y = v[2].to_float();
@@ -248,7 +232,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
} else if (l.begins_with("vt ")) {
//uv
Vector<String> v = l.split(" ", false);
- ERR_FAIL_COND_V(v.size() < 3, NULL);
+ ERR_FAIL_COND_V(v.size() < 3, ERR_FILE_CORRUPT);
Vector2 uv;
uv.x = v[1].to_float();
uv.y = 1.0 - v[2].to_float();
@@ -257,7 +241,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
} else if (l.begins_with("vn ")) {
//normal
Vector<String> v = l.split(" ", false);
- ERR_FAIL_COND_V(v.size() < 4, NULL);
+ ERR_FAIL_COND_V(v.size() < 4, ERR_FILE_CORRUPT);
Vector3 nrm;
nrm.x = v[1].to_float();
nrm.y = v[2].to_float();
@@ -267,19 +251,19 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
//vertex
Vector<String> v = l.split(" ", false);
- ERR_FAIL_COND_V(v.size() < 4, NULL);
+ ERR_FAIL_COND_V(v.size() < 4, ERR_FILE_CORRUPT);
//not very fast, could be sped up
Vector<String> face[3];
face[0] = v[1].split("/");
face[1] = v[2].split("/");
- ERR_FAIL_COND_V(face[0].size() == 0, NULL);
- ERR_FAIL_COND_V(face[0].size() != face[1].size(), NULL);
+ ERR_FAIL_COND_V(face[0].size() == 0, ERR_FILE_CORRUPT);
+ ERR_FAIL_COND_V(face[0].size() != face[1].size(), ERR_FILE_CORRUPT);
for (int i = 2; i < v.size() - 1; i++) {
face[2] = v[i + 1].split("/");
- ERR_FAIL_COND_V(face[0].size() != face[2].size(), NULL);
+ ERR_FAIL_COND_V(face[0].size() != face[2].size(), ERR_FILE_CORRUPT);
for (int j = 0; j < 3; j++) {
int idx = j;
@@ -292,7 +276,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
int norm = face[idx][2].to_int() - 1;
if (norm < 0)
norm += normals.size() + 1;
- ERR_FAIL_INDEX_V(norm, normals.size(), NULL);
+ ERR_FAIL_INDEX_V(norm, normals.size(), ERR_FILE_CORRUPT);
surf_tool->add_normal(normals[norm]);
}
@@ -300,14 +284,14 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
int uv = face[idx][1].to_int() - 1;
if (uv < 0)
uv += uvs.size() + 1;
- ERR_FAIL_INDEX_V(uv, uvs.size(), NULL);
+ ERR_FAIL_INDEX_V(uv, uvs.size(), ERR_FILE_CORRUPT);
surf_tool->add_uv(uvs[uv]);
}
int vtx = face[idx][0].to_int() - 1;
if (vtx < 0)
vtx += vertices.size() + 1;
- ERR_FAIL_INDEX_V(vtx, vertices.size(), NULL);
+ ERR_FAIL_INDEX_V(vtx, vertices.size(), ERR_FILE_CORRUPT);
Vector3 vertex = vertices[vtx];
//if (weld_vertices)
@@ -359,16 +343,13 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
if (l.begins_with("o ") || f->eof_reached()) {
- MeshInstance *mi = memnew(MeshInstance);
- mi->set_name(name);
- mi->set_mesh(mesh);
-
- scene->add_child(mi);
- mi->set_owner(scene);
-
- mesh.instance();
- current_group = "";
- current_material = "";
+ if (!p_single_mesh) {
+ mesh->set_name(name);
+ r_meshes.push_back(mesh);
+ mesh.instance();
+ current_group = "";
+ current_material = "";
+ }
}
if (f->eof_reached()) {
@@ -406,16 +387,40 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
}
}
- /*
- TODO, check existing materials and merge?
- //re-apply materials if exist
- for(int i=0;i<mesh->get_surface_count();i++) {
+ if (p_single_mesh) {
+
+ r_meshes.push_back(mesh);
+ }
+
+ return OK;
+}
+
+Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err) {
+
+ List<Ref<Mesh> > meshes;
+
+ Error err = _parse_obj(p_path, meshes, false, p_flags & IMPORT_GENERATE_TANGENT_ARRAYS, r_missing_deps);
+
+ if (err != OK) {
+ if (r_err) {
+ *r_err = err;
+ }
+ return NULL;
+ }
+
+ Spatial *scene = memnew(Spatial);
+
+ for (List<Ref<Mesh> >::Element *E = meshes.front(); E; E = E->next()) {
+
+ MeshInstance *mi = memnew(MeshInstance);
+ mi->set_name(E->get()->get_name());
+ scene->add_child(mi);
+ mi->set_owner(scene);
+ }
- String n = mesh->surface_get_name(i);
- if (name_map.has(n))
- mesh->surface_set_material(i,name_map[n]);
+ if (r_err) {
+ *r_err = OK;
}
-*/
return scene;
}
@@ -423,5 +428,68 @@ Ref<Animation> EditorOBJImporter::import_animation(const String &p_path, uint32_
return Ref<Animation>();
}
+
+void EditorOBJImporter::get_extensions(List<String> *r_extensions) const {
+
+ r_extensions->push_back("obj");
+}
+
EditorOBJImporter::EditorOBJImporter() {
}
+////////////////////////////////////////////////////
+
+String ResourceImporterOBJ::get_importer_name() const {
+ return "wavefront_obj";
+}
+String ResourceImporterOBJ::get_visible_name() const {
+ return "OBJ As Mesh";
+}
+void ResourceImporterOBJ::get_recognized_extensions(List<String> *p_extensions) const {
+
+ p_extensions->push_back("obj");
+}
+String ResourceImporterOBJ::get_save_extension() const {
+ return "mesh";
+}
+String ResourceImporterOBJ::get_resource_type() const {
+ return "Mesh";
+}
+
+int ResourceImporterOBJ::get_preset_count() const {
+ return 0;
+}
+String ResourceImporterOBJ::get_preset_name(int p_idx) const {
+ return "";
+}
+
+void ResourceImporterOBJ::get_import_options(List<ImportOption> *r_options, int p_preset) const {
+
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "generate_tangents"), true));
+}
+bool ResourceImporterOBJ::get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const {
+
+ return true;
+}
+
+Error ResourceImporterOBJ::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files) {
+
+ List<Ref<Mesh> > meshes;
+
+ Error err = _parse_obj(p_source_file, meshes, true, p_options["generate_tangents"], NULL);
+
+ ERR_FAIL_COND_V(err != OK, err);
+ ERR_FAIL_COND_V(meshes.size() != 1, ERR_BUG);
+
+ String save_path = p_save_path + ".mesh";
+
+ err = ResourceSaver::save(save_path, meshes.front()->get());
+
+ ERR_FAIL_COND_V(err != OK, err);
+
+ r_gen_files->push_back(save_path);
+
+ return OK;
+}
+
+ResourceImporterOBJ::ResourceImporterOBJ() {
+}
diff --git a/editor/import/resource_importer_obj.h b/editor/import/resource_importer_obj.h
index 247d58e148..7eeceeabbe 100644
--- a/editor/import/resource_importer_obj.h
+++ b/editor/import/resource_importer_obj.h
@@ -36,8 +36,6 @@ class EditorOBJImporter : public EditorSceneImporter {
GDCLASS(EditorOBJImporter, EditorSceneImporter);
- Error _parse_material_library(const String &p_path, Map<String, Ref<SpatialMaterial> > &material_map, List<String> *r_missing_deps);
-
public:
virtual uint32_t get_import_flags() const;
virtual void get_extensions(List<String> *r_extensions) const;
@@ -47,4 +45,24 @@ public:
EditorOBJImporter();
};
+class ResourceImporterOBJ : public ResourceImporter {
+ GDCLASS(ResourceImporterOBJ, ResourceImporter)
+public:
+ virtual String get_importer_name() const;
+ virtual String get_visible_name() const;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const;
+ virtual String get_save_extension() const;
+ virtual String get_resource_type() const;
+
+ virtual int get_preset_count() const;
+ virtual String get_preset_name(int p_idx) const;
+
+ virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
+ virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
+
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL);
+
+ ResourceImporterOBJ();
+};
+
#endif // RESOURCEIMPORTEROBJ_H
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index b6b112b905..ff0069efa5 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -2668,13 +2668,13 @@ void CanvasItemEditor::_draw_viewport() {
all_group = false;
} else {
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- if (Object::cast_to<Control>(E->get()) && !Object::cast_to<Control>(E->get())->has_meta("_edit_lock_")) {
+ if (Object::cast_to<CanvasItem>(E->get()) && !Object::cast_to<CanvasItem>(E->get())->has_meta("_edit_lock_")) {
all_locked = false;
break;
}
}
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- if (Object::cast_to<Control>(E->get()) && !Object::cast_to<Control>(E->get())->has_meta("_edit_group_")) {
+ if (Object::cast_to<CanvasItem>(E->get()) && !Object::cast_to<CanvasItem>(E->get())->has_meta("_edit_group_")) {
all_group = false;
break;
}
@@ -4181,7 +4181,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String &
editor_data->get_undo_redo().add_do_property(child, property, texture);
// make visible for certain node type
- if (default_type == "Patch9Rect") {
+ if (default_type == "NinePatchRect") {
editor_data->get_undo_redo().add_do_property(child, "rect/size", texture_size);
} else if (default_type == "Polygon2D") {
PoolVector<Vector2> list;
@@ -4199,7 +4199,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String &
}
Transform2D trans = canvas->get_canvas_transform();
Point2 target_position = (p_point - trans.get_origin()) / trans.get_scale().x - pos;
- if (default_type == "Polygon2D" || default_type == "TouchScreenButton" || default_type == "TextureRect" || default_type == "Patch9Rect") {
+ if (default_type == "Polygon2D" || default_type == "TouchScreenButton" || default_type == "TextureRect" || default_type == "NinePatchRect") {
target_position -= texture_size / 2;
}
// there's nothing to be used as source position so snapping will work as absolute if enabled
@@ -4275,7 +4275,7 @@ void CanvasItemEditorViewport::_perform_drop_data() {
child = memnew(TouchScreenButton);
else if (default_type == "TextureRect")
child = memnew(TextureRect);
- else if (default_type == "Patch9Rect")
+ else if (default_type == "NinePatchRect")
child = memnew(NinePatchRect);
else
child = memnew(Sprite); // default
@@ -4437,7 +4437,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte
types.push_back("TouchScreenButton");
// Control
types.push_back("TextureRect");
- types.push_back("Patch9Rect");
+ types.push_back("NinePatchRect");
target_node = NULL;
editor = p_node;
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 47443b81ce..b66e9598f9 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1557,11 +1557,7 @@ ScriptTextEditor::ScriptTextEditor() {
static ScriptEditorBase *create_editor(const Ref<Script> &p_script) {
- if (p_script->has_source_code()) {
- return memnew(ScriptTextEditor);
- }
-
- return NULL;
+ return memnew(ScriptTextEditor);
}
void ScriptTextEditor::register_editor() {
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 3370ce51fd..0a7f3ff8f9 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -907,7 +907,7 @@ void TextureRegionEditorPlugin::edit(Object *p_object) {
}
bool TextureRegionEditorPlugin::handles(Object *p_object) const {
- return p_object->is_class("Sprite") || p_object->is_class("Patch9Rect") || p_object->is_class("StyleBoxTexture") || p_object->is_class("AtlasTexture");
+ return p_object->is_class("Sprite") || p_object->is_class("NinePatchRect") || p_object->is_class("StyleBoxTexture") || p_object->is_class("AtlasTexture");
}
void TextureRegionEditorPlugin::make_visible(bool p_visible) {
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index c679b44342..1a767dad05 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -1418,7 +1418,7 @@ ProjectManager::ProjectManager() {
EditorSettings::get_singleton()->set_optimize_save(false); //just write settings as they came
{
- int dpi_mode = EditorSettings::get_singleton()->get("interface/hidpi_mode");
+ int dpi_mode = EditorSettings::get_singleton()->get("interface/editor/hidpi_mode");
if (dpi_mode == 0) {
editor_set_scale(OS::get_singleton()->get_screen_dpi(0) >= 192 && OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x > 2000 ? 2.0 : 1.0);
} else if (dpi_mode == 1) {
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index fcae4c04fb..9665f48e42 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -4257,7 +4257,7 @@ PropertyEditor::PropertyEditor() {
use_filter = false;
subsection_selectable = false;
property_selectable = false;
- show_type_icons = EDITOR_DEF("interface/show_type_icons", false);
+ show_type_icons = EDITOR_DEF("interface/editor/show_type_icons", false);
}
PropertyEditor::~PropertyEditor() {