summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/create_dialog.cpp29
-rw-r--r--editor/create_dialog.h3
-rw-r--r--editor/editor_about.cpp3
-rw-r--r--editor/editor_data.cpp10
-rw-r--r--editor/editor_data.h4
-rw-r--r--editor/editor_log.cpp4
-rw-r--r--editor/editor_node.cpp2
-rw-r--r--editor/editor_plugin.cpp10
-rw-r--r--editor/editor_plugin.h3
-rw-r--r--editor/editor_settings.cpp36
-rw-r--r--editor/editor_themes.cpp3
-rw-r--r--editor/plugins/baked_lightmap_editor_plugin.cpp1
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h4
-rw-r--r--editor/plugins/curve_editor_plugin.cpp23
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp29
-rw-r--r--editor/scene_tree_dock.cpp3
-rw-r--r--editor/script_create_dialog.cpp16
18 files changed, 123 insertions, 62 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index a601c8cd2b..96c3a27ea7 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -37,7 +37,7 @@
#include "print_string.h"
#include "scene/gui/box_container.h"
-void CreateDialog::popup_create(bool p_dontclear) {
+void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode) {
recent->clear();
@@ -89,11 +89,12 @@ void CreateDialog::popup_create(bool p_dontclear) {
popup_centered_ratio();
}
- if (p_dontclear)
+ if (p_dont_clear) {
search_box->select_all();
- else {
+ } else {
search_box->clear();
}
+
search_box->grab_focus();
_update_search();
@@ -104,8 +105,19 @@ void CreateDialog::popup_create(bool p_dontclear) {
if (enable_rl) {
search_options->add_constant_override("draw_relationship_lines", 1);
search_options->add_color_override("relationship_line_color", rl_color);
- } else
+ } else {
search_options->add_constant_override("draw_relationship_lines", 0);
+ }
+
+ is_replace_mode = p_replace_mode;
+
+ if (p_replace_mode) {
+ set_title(vformat(TTR("Change %s Type"), base_type));
+ get_ok()->set_text(TTR("Change"));
+ } else {
+ set_title(vformat(TTR("Create New %s"), base_type));
+ get_ok()->set_text(TTR("Create"));
+ }
}
void CreateDialog::_text_changed(const String &p_newtext) {
@@ -369,7 +381,11 @@ void CreateDialog::_notification(int p_what) {
void CreateDialog::set_base_type(const String &p_base) {
base_type = p_base;
- set_title(vformat(TTR("Create New %s"), p_base));
+ if (is_replace_mode)
+ set_title(vformat(TTR("Change %s Type"), p_base));
+ else
+ set_title(vformat(TTR("Create New %s"), p_base));
+
_update_search();
}
@@ -624,6 +640,8 @@ void CreateDialog::_bind_methods() {
CreateDialog::CreateDialog() {
+ is_replace_mode = false;
+
ClassDB::get_class_list(&type_list);
type_list.sort_custom<StringName::AlphCompare>();
@@ -678,7 +696,6 @@ CreateDialog::CreateDialog() {
search_box->connect("gui_input", this, "_sbox_input");
search_options = memnew(Tree);
vbc->add_margin_child(TTR("Matches:"), search_options, true);
- get_ok()->set_text(TTR("Create"));
get_ok()->set_disabled(true);
register_text_enter(search_box);
set_hide_on_ok(false);
diff --git a/editor/create_dialog.h b/editor/create_dialog.h
index 56ba7f8a3e..ed23fb4ae8 100644
--- a/editor/create_dialog.h
+++ b/editor/create_dialog.h
@@ -52,6 +52,7 @@ class CreateDialog : public ConfirmationDialog {
Button *favorite;
LineEdit *search_box;
Tree *search_options;
+ bool is_replace_mode;
String base_type;
String preferred_search_result_type;
EditorHelpBit *help_bit;
@@ -97,7 +98,7 @@ public:
void set_preferred_search_result_type(const String &p_preferred_type);
String get_preferred_search_result_type();
- void popup_create(bool p_dontclear);
+ void popup_create(bool p_dont_clear, bool p_replace_mode = false);
CreateDialog();
};
diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp
index 1d6d933924..7fa4776141 100644
--- a/editor/editor_about.cpp
+++ b/editor/editor_about.cpp
@@ -131,7 +131,8 @@ EditorAbout::EditorAbout() {
Label *about_text = memnew(Label);
about_text->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
- about_text->set_text(VERSION_FULL_NAME + hash + String::utf8("\n\xc2\xa9 2007-2018 Juan Linietsky, Ariel Manzur.\n\xc2\xa9 2014-2017 ") +
+ about_text->set_text(VERSION_FULL_NAME + hash +
+ String::utf8("\n\xc2\xa9 2007-2018 Juan Linietsky, Ariel Manzur.\n\xc2\xa9 2014-2018 ") +
TTR("Godot Engine contributors") + "\n");
hbc->add_child(about_text);
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 4acee1363c..c12a112fa4 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -880,6 +880,7 @@ void EditorSelection::_bind_methods() {
ClassDB::bind_method(D_METHOD("remove_node", "node"), &EditorSelection::remove_node);
ClassDB::bind_method(D_METHOD("get_selected_nodes"), &EditorSelection::_get_selected_nodes);
ClassDB::bind_method(D_METHOD("get_transformable_selected_nodes"), &EditorSelection::_get_transformable_selected_nodes);
+ ClassDB::bind_method(D_METHOD("_emit_change"), &EditorSelection::_emit_change);
ADD_SIGNAL(MethodInfo("selection_changed"));
}
@@ -923,7 +924,15 @@ void EditorSelection::update() {
if (!changed)
return;
changed = false;
+ if (!emitted) {
+ emitted = true;
+ call_deferred("_emit_change");
+ }
+}
+
+void EditorSelection::_emit_change() {
emit_signal("selection_changed");
+ emitted = false;
}
List<Node *> &EditorSelection::get_selected_node_list() {
@@ -947,6 +956,7 @@ void EditorSelection::clear() {
}
EditorSelection::EditorSelection() {
+ emitted = false;
changed = false;
nl_changed = false;
}
diff --git a/editor/editor_data.h b/editor/editor_data.h
index 2c95c3feea..3bc0e6e75c 100644
--- a/editor/editor_data.h
+++ b/editor/editor_data.h
@@ -210,9 +210,10 @@ class EditorSelection : public Object {
GDCLASS(EditorSelection, Object);
-public:
+private:
Map<Node *, Object *> selection;
+ bool emitted;
bool changed;
bool nl_changed;
@@ -224,6 +225,7 @@ public:
void _update_nl();
Array _get_selected_nodes();
Array _get_transformable_selected_nodes();
+ void _emit_change();
protected:
static void _bind_methods();
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp
index 1b885adf37..79542f3b5c 100644
--- a/editor/editor_log.cpp
+++ b/editor/editor_log.cpp
@@ -66,7 +66,9 @@ void EditorLog::_notification(int p_what) {
Ref<DynamicFont> df_output_code = get_font("output_source", "EditorFonts");
if (df_output_code.is_valid()) {
df_output_code->set_size(int(EDITOR_DEF("run/output/font_size", 13)) * EDSCALE);
- log->add_font_override("normal_font", get_font("output_source", "EditorFonts"));
+ if (log != NULL) {
+ log->add_font_override("normal_font", get_font("output_source", "EditorFonts"));
+ }
}
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index b308d28dba..b52161813d 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -4423,7 +4423,7 @@ void EditorNode::_dropped_files(const Vector<String> &p_files, int p_screen) {
for (int i = 0; i < p_files.size(); i++) {
String from = p_files[i];
- if (!ResourceFormatImporter::get_singleton()->can_be_imported(from) && (just_copy.find(from.get_extension().to_lower()) < 0)) {
+ if (!ResourceFormatImporter::get_singleton()->can_be_imported(from) && (just_copy.find(from.get_extension().to_lower()) != -1)) {
continue;
}
String to = to_path.plus_file(from.get_file());
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index b3ac5e4ce5..16e60edda7 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -200,6 +200,14 @@ ScriptEditor *EditorInterface::get_script_editor() {
return ScriptEditor::get_singleton();
}
+void EditorInterface::select_file(const String &p_file) {
+ return EditorNode::get_singleton()->get_filesystem_dock()->select_file(p_file);
+}
+
+String EditorInterface::get_selected_path() const {
+ return EditorNode::get_singleton()->get_filesystem_dock()->get_selected_path();
+}
+
void EditorInterface::inspect_object(Object *p_obj, const String &p_for_property) {
EditorNode::get_singleton()->push_item(p_obj, p_for_property);
@@ -259,6 +267,8 @@ void EditorInterface::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_resource_filesystem"), &EditorInterface::get_resource_file_system);
ClassDB::bind_method(D_METHOD("get_editor_viewport"), &EditorInterface::get_editor_viewport);
ClassDB::bind_method(D_METHOD("make_mesh_previews", "meshes", "preview_size"), &EditorInterface::_make_mesh_previews);
+ ClassDB::bind_method(D_METHOD("select_file", "p_file"), &EditorInterface::select_file);
+ ClassDB::bind_method(D_METHOD("get_selected_path"), &EditorInterface::get_selected_path);
ClassDB::bind_method(D_METHOD("save_scene"), &EditorInterface::save_scene);
ClassDB::bind_method(D_METHOD("save_scene_as", "path", "with_preview"), &EditorInterface::save_scene_as, DEFVAL(true));
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index 4bfa1fa7cf..887e599208 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -76,6 +76,9 @@ public:
Array get_open_scenes() const;
ScriptEditor *get_script_editor();
+ void select_file(const String &p_file);
+ String get_selected_path() const;
+
void inspect_object(Object *p_obj, const String &p_for_property = String());
EditorSelection *get_selection();
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index dc82a02f46..a5001cb1ac 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -1329,8 +1329,44 @@ Ref<ShortCut> ED_GET_SHORTCUT(const String &p_path) {
return sc;
}
+struct ShortCutMapping {
+ const char *path;
+ uint32_t keycode;
+};
+
Ref<ShortCut> ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p_keycode) {
+#ifdef OSX_ENABLED
+ static const ShortCutMapping macos_mappings[] = {
+ { "editor/play", KEY_MASK_CMD | KEY_B },
+ { "editor/play_scene", KEY_MASK_CMD | KEY_R },
+ { "editor/pause_scene", KEY_MASK_CMD | KEY_MASK_CTRL | KEY_Y },
+ { "editor/stop", KEY_MASK_CMD | KEY_PERIOD },
+ { "editor/play_custom_scene", KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_R },
+ { "editor/editor_2d", KEY_MASK_ALT | KEY_1 },
+ { "editor/editor_3d", KEY_MASK_ALT | KEY_2 },
+ { "editor/editor_script", KEY_MASK_ALT | KEY_3 },
+ { "editor/editor_help", KEY_MASK_ALT | KEY_SPACE },
+ { "editor/fullscreen_mode", KEY_MASK_CMD | KEY_MASK_CTRL | KEY_F },
+ { "editor/distraction_free_mode", KEY_MASK_CMD | KEY_MASK_CTRL | KEY_D },
+ { "script_text_editor/contextual_help", KEY_MASK_ALT | KEY_MASK_SHIFT | KEY_SPACE },
+ { "script_text_editor/find_next", KEY_MASK_CMD | KEY_G },
+ { "script_text_editor/find_previous", KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_G },
+ { "script_text_editor/toggle_breakpoint", KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B }
+ };
+
+ if (p_keycode == KEY_DELETE) {
+ p_keycode = KEY_MASK_CMD | KEY_BACKSPACE;
+ } else {
+ for (int i = 0; i < sizeof(macos_mappings) / sizeof(ShortCutMapping); i++) {
+ if (p_path == macos_mappings[i].path) {
+ p_keycode = macos_mappings[i].keycode;
+ break;
+ }
+ }
+ }
+#endif
+
Ref<InputEventKey> ie;
if (p_keycode) {
ie.instance();
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index b19d015455..8a3e7e6716 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -332,6 +332,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const Color font_color = mono_color.linear_interpolate(base_color, 0.25);
const Color font_color_hl = mono_color.linear_interpolate(base_color, 0.15);
const Color font_color_disabled = Color(mono_color.r, mono_color.g, mono_color.b, 0.3);
+ const Color font_color_selection = Color::html("#7d7d7d");
const Color color_disabled = mono_color.inverted().linear_interpolate(base_color, 0.7);
const Color color_disabled_bg = mono_color.inverted().linear_interpolate(base_color, 0.9);
@@ -790,6 +791,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("read_only", "LineEdit", font_color_disabled);
theme->set_color("font_color", "LineEdit", font_color);
theme->set_color("cursor_color", "LineEdit", font_color);
+ theme->set_color("selection_color", "LineEdit", font_color_selection);
// TextEdit
theme->set_stylebox("normal", "TextEdit", style_widget);
@@ -799,6 +801,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("tab", "TextEdit", theme->get_icon("GuiTab", "EditorIcons"));
theme->set_color("font_color", "TextEdit", font_color);
theme->set_color("caret_color", "TextEdit", highlight_color);
+ theme->set_color("selection_color", "TextEdit", font_color_selection);
// H/VSplitContainer
theme->set_stylebox("bg", "VSplitContainer", make_stylebox(theme->get_icon("GuiVsplitBg", "EditorIcons"), 1, 1, 1, 1));
diff --git a/editor/plugins/baked_lightmap_editor_plugin.cpp b/editor/plugins/baked_lightmap_editor_plugin.cpp
index 08f4d06ef7..6849563ae2 100644
--- a/editor/plugins/baked_lightmap_editor_plugin.cpp
+++ b/editor/plugins/baked_lightmap_editor_plugin.cpp
@@ -20,7 +20,6 @@ void BakedLightmapEditorPlugin::_bake() {
case BakedLightmap::BAKE_ERROR_CANT_CREATE_IMAGE:
EditorNode::get_singleton()->show_warning(TTR("Failed creating lightmap images, make sure path is writable."));
break;
- defaut : {}
}
}
}
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 052817f40a..a52c914096 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -641,7 +641,7 @@ void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_no
_SelectResult res;
res.item = c;
- res.z = node ? node->get_z() : 0;
+ res.z_index = node ? node->get_z_index() : 0;
res.has_z = node;
r_items.push_back(res);
}
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index f14f1a92a6..0866fe77aa 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -252,10 +252,10 @@ class CanvasItemEditor : public VBoxContainer {
struct _SelectResult {
CanvasItem *item;
- float z;
+ float z_index;
bool has_z;
_FORCE_INLINE_ bool operator<(const _SelectResult &p_rr) const {
- return has_z && p_rr.has_z ? p_rr.z < z : p_rr.has_z;
+ return has_z && p_rr.has_z ? p_rr.z_index < z_index : p_rr.has_z;
}
};
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index c865ddd4b0..3be68f21af 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -347,7 +347,8 @@ void CurveEditor::open_context_menu(Vector2 pos) {
_context_menu->set_item_checked(_context_menu->get_item_index(CONTEXT_LINEAR), is_linear);
} else {
- _context_menu->add_separator();
+ if (_selected_point > 0 || _selected_point + 1 < _curve_ref->get_point_count())
+ _context_menu->add_separator();
if (_selected_point > 0) {
_context_menu->add_check_item(TTR("Left linear"), CONTEXT_LEFT_LINEAR);
@@ -367,6 +368,7 @@ void CurveEditor::open_context_menu(Vector2 pos) {
_context_menu->add_submenu_item(TTR("Load preset"), _presets_menu->get_name());
+ _context_menu->set_size(Size2(0, 0));
_context_menu->popup();
}
@@ -566,7 +568,6 @@ static void plot_curve_accurate(const Curve &curve, float step, T plot_func) {
Vector2 prev_pos = a;
float len = b.x - a.x;
- //float step = 4.f / view_size.x;
for (float x = step; x < len; x += step) {
pos.x = a.x + x;
@@ -694,24 +695,6 @@ void CurveEditor::_draw() {
CanvasItemPlotCurve plot_func(*this, line_color, edge_line_color);
plot_curve_accurate(curve, 4.f / view_size.x, plot_func);
- /*// TEST draw baked curve
- {
- Vector2 pos = Vector2(0, curve.interpolate_baked(0));
- Vector2 prev_pos = pos;
-
- float len = 1.0;
- float step = 4.f / view_size.x;
-
- for(float x = step; x < len; x += step) {
- pos.x = x;
- pos.y = curve.interpolate_baked(x);
- draw_line(get_point_view_pos(prev_pos), get_point_view_pos(pos), Color(0,1,0));
- prev_pos = pos;
- }
-
- draw_line(get_point_view_pos(prev_pos), get_point_view_pos(Vector2(1, curve.interpolate_baked(1))), Color(0,1,0));
- }//*/
-
// Draw points
draw_set_transform_matrix(Transform2D());
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index eccb11ba12..50db80ba01 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -238,19 +238,16 @@ void TileSetEditor::_bind_methods() {
TileSetEditor::TileSetEditor(EditorNode *p_editor) {
- Panel *panel = memnew(Panel);
- panel->set_anchors_and_margins_preset(Control::PRESET_WIDE);
- add_child(panel);
- MenuButton *options = memnew(MenuButton);
- panel->add_child(options);
- options->set_position(Point2(1, 1));
- options->set_text(TTR("Tile Set"));
- options->get_popup()->add_item(TTR("Add Item"), MENU_OPTION_ADD_ITEM);
- options->get_popup()->add_item(TTR("Remove Item"), MENU_OPTION_REMOVE_ITEM);
- options->get_popup()->add_separator();
- options->get_popup()->add_item(TTR("Create from Scene"), MENU_OPTION_CREATE_FROM_SCENE);
- options->get_popup()->add_item(TTR("Merge from Scene"), MENU_OPTION_MERGE_FROM_SCENE);
- options->get_popup()->connect("id_pressed", this, "_menu_cbk");
+ menu = memnew(MenuButton);
+ CanvasItemEditor::get_singleton()->add_control_to_menu_panel(menu);
+ menu->hide();
+ menu->set_text(TTR("Tile Set"));
+ menu->get_popup()->add_item(TTR("Add Item"), MENU_OPTION_ADD_ITEM);
+ menu->get_popup()->add_item(TTR("Remove Item"), MENU_OPTION_REMOVE_ITEM);
+ menu->get_popup()->add_separator();
+ menu->get_popup()->add_item(TTR("Create from Scene"), MENU_OPTION_CREATE_FROM_SCENE);
+ menu->get_popup()->add_item(TTR("Merge from Scene"), MENU_OPTION_MERGE_FROM_SCENE);
+ menu->get_popup()->connect("id_pressed", this, "_menu_cbk");
editor = p_editor;
cd = memnew(ConfirmationDialog);
add_child(cd);
@@ -286,6 +283,7 @@ void TileSetEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
tileset_editor->show();
+ tileset_editor->menu->show();
autotile_button->show();
autotile_editor->side_panel->show();
if (autotile_button->is_pressed()) {
@@ -293,6 +291,7 @@ void TileSetEditorPlugin::make_visible(bool p_visible) {
}
} else {
tileset_editor->hide();
+ tileset_editor->menu->hide();
autotile_editor->side_panel->hide();
autotile_editor->hide();
autotile_button->hide();
@@ -345,7 +344,7 @@ AutotileEditor::AutotileEditor(EditorNode *p_editor) {
helper = memnew(AutotileEditorHelper(this));
property_editor->edit(helper);
- // Editor
+ //Editor
dragging_point = -1;
creating_shape = false;
@@ -420,8 +419,6 @@ AutotileEditor::AutotileEditor(EditorNode *p_editor) {
p.push_back((int)SHAPE_DELETE);
tools[SHAPE_DELETE]->connect("pressed", this, "_on_tool_clicked", p);
tool_containers[TOOLBAR_SHAPE]->add_child(tools[SHAPE_DELETE]);
- //tools[SHAPE_CREATE_FROM_NOT_BITMASKED] = memnew(ToolButton);
- //tool_containers[TOOLBAR_SHAPE]->add_child(tools[SHAPE_CREATE_FROM_NOT_BITMASKED]);
tool_containers[TOOLBAR_SHAPE]->add_change_receptor(memnew(VSeparator));
tools[SHAPE_KEEP_INSIDE_TILE] = memnew(ToolButton);
tools[SHAPE_KEEP_INSIDE_TILE]->set_toggle_mode(true);
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 7e8a6fcb6d..e7da78a35c 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -307,7 +307,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
} break;
case TOOL_REPLACE: {
- create_dialog->popup_create(false);
+ create_dialog->popup_create(false, true);
} break;
case TOOL_ATTACH_SCRIPT: {
@@ -417,7 +417,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
if (editor_selection->is_selected(edited_scene)) {
current_option = -1;
- //accept->get_cancel()->hide();
accept->get_ok()->set_text(TTR("I see.."));
accept->set_text(TTR("This operation can't be done on the tree root."));
accept->popup_centered_minsize();
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index ad6ea2180f..96863a59d2 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -232,7 +232,7 @@ void ScriptCreateDialog::_lang_changed(int l) {
String path = file_path->get_text();
String extension = "";
if (path != "") {
- if (path.find(".") >= 0) {
+ if (path.find(".") != -1) {
extension = path.get_extension();
}
@@ -359,16 +359,14 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
return;
}
- if (p.find("/") || p.find("\\")) {
- DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- if (d->change_dir(p.get_base_dir()) != OK) {
- _msg_path_valid(false, TTR("Invalid base path"));
- memdelete(d);
- _update_dialog();
- return;
- }
+ DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ if (d->change_dir(p.get_base_dir()) != OK) {
+ _msg_path_valid(false, TTR("Invalid base path"));
memdelete(d);
+ _update_dialog();
+ return;
}
+ memdelete(d);
/* Does file already exist */