summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/create_dialog.cpp10
-rw-r--r--editor/editor_node.cpp12
-rw-r--r--editor/plugins/script_editor_plugin.cpp7
-rw-r--r--editor/scene_tree_dock.cpp7
-rw-r--r--editor/script_create_dialog.cpp6
-rw-r--r--editor/spatial_editor_gizmos.cpp53
6 files changed, 50 insertions, 45 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index fd607e5b63..1853bf517b 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -244,17 +244,17 @@ void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p
bool is_search_subsequence = search_box->get_text().is_subsequence_ofi(p_type);
String to_select_type = *to_select ? (*to_select)->get_text(0) : "";
to_select_type = to_select_type.split(" ")[0];
- bool current_item_is_preffered;
+ bool current_item_is_preferred;
if (cpp_type) {
- current_item_is_preffered = ClassDB::is_parent_class(p_type, preferred_search_result_type) && !ClassDB::is_parent_class(to_select_type, preferred_search_result_type);
+ current_item_is_preferred = ClassDB::is_parent_class(p_type, preferred_search_result_type) && !ClassDB::is_parent_class(to_select_type, preferred_search_result_type) && search_box->get_text() != to_select_type;
} else {
- current_item_is_preffered = ed.script_class_is_parent(p_type, preferred_search_result_type) && !ed.script_class_is_parent(to_select_type, preferred_search_result_type);
+ current_item_is_preferred = ed.script_class_is_parent(p_type, preferred_search_result_type) && !ed.script_class_is_parent(to_select_type, preferred_search_result_type) && search_box->get_text() != to_select_type;
}
if (*to_select && p_type.length() < (*to_select)->get_text(0).length()) {
- current_item_is_preffered = true;
+ current_item_is_preferred = true;
}
- if (((!*to_select || current_item_is_preffered) && is_search_subsequence) || search_box->get_text() == p_type) {
+ if (((!*to_select || current_item_is_preferred) && is_search_subsequence) || search_box->get_text() == p_type) {
*to_select = item;
}
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 353dce5b20..3eebb73cdb 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1174,6 +1174,16 @@ void EditorNode::_dialog_action(String p_file) {
int scene_idx = (current_option == FILE_SAVE_SCENE || current_option == FILE_SAVE_AS_SCENE) ? -1 : tab_closing;
if (file->get_mode() == EditorFileDialog::MODE_SAVE_FILE) {
+ bool same_open_scene = false;
+ for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
+ if (editor_data.get_scene_path(i) == p_file && i != scene_idx)
+ same_open_scene = true;
+ }
+
+ if (same_open_scene) {
+ show_warning(TTR("Can't overwrite scene that is still open!"));
+ return;
+ }
_save_default_environment();
_save_scene_with_preview(p_file, scene_idx);
@@ -1548,6 +1558,8 @@ void EditorNode::_edit_current() {
editor_plugin_screen->edit(current_obj);
}
+ } else {
+ editor_plugin_screen->edit(current_obj);
}
Vector<EditorPlugin *> sub_plugins = editor_data.get_subeditors(current_obj);
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 70f1789a86..f90863c735 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -504,6 +504,13 @@ void ScriptEditor::_open_recent_script(int p_idx) {
return;
}
// if it's a path then its most likely a deleted file not help
+ } else if (path.find("::") != -1) {
+ // built-in script
+ Ref<Script> script = ResourceLoader::load(path);
+ if (script.is_valid()) {
+ edit(script, true);
+ return;
+ }
} else if (!path.is_resource_file()) {
_help_class_open(path);
return;
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 18de2a6221..5f2841d2c0 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -1816,6 +1816,13 @@ void SceneTreeDock::_new_scene_from(String p_file) {
return;
}
+ if (EditorNode::get_singleton()->is_scene_open(p_file)) {
+ accept->get_ok()->set_text(TTR("OK"));
+ accept->set_text(TTR("Can't overwrite scene that is still open!"));
+ accept->popup_centered_minsize();
+ return;
+ }
+
Node *base = selection.front()->get();
Map<Node *, Node *> reown;
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index 24c4ba4cb7..6f5046616d 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -443,6 +443,12 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
return;
}
+ if (p.get_file().get_basename() == "") {
+ _msg_path_valid(false, TTR("Filename is empty"));
+ _update_dialog();
+ return;
+ }
+
/* All checks passed */
is_path_valid = true;
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index 00067b84f7..50a60ac809 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -55,6 +55,7 @@
#include "scene/3d/visibility_notifier.h"
#include "scene/resources/box_shape.h"
#include "scene/resources/capsule_shape.h"
+#include "scene/resources/concave_polygon_shape.h"
#include "scene/resources/convex_polygon_shape.h"
#include "scene/resources/cylinder_shape.h"
#include "scene/resources/plane_shape.h"
@@ -908,7 +909,6 @@ void LightSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
}
p_gizmo->add_lines(lines, material);
- p_gizmo->add_collision_segments(lines);
p_gizmo->add_unscaled_billboard(icon, 0.05);
}
@@ -939,8 +939,6 @@ void LightSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
}
p_gizmo->add_lines(points, material, true);
- p_gizmo->add_collision_segments(points);
-
p_gizmo->add_unscaled_billboard(icon, 0.05);
Vector<Vector3> handles;
@@ -982,38 +980,14 @@ void LightSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
p_gizmo->add_lines(points, material);
+ float ra = 16 * Math_PI * 2.0 / 64.0;
+ Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * w;
+
Vector<Vector3> handles;
handles.push_back(Vector3(0, 0, -r));
-
- Vector<Vector3> collision_segments;
-
- for (int i = 0; i < 64; i++) {
-
- float ra = i * Math_PI * 2.0 / 64.0;
- float rb = (i + 1) * Math_PI * 2.0 / 64.0;
- Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * w;
- Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * w;
-
- collision_segments.push_back(Vector3(a.x, a.y, -d));
- collision_segments.push_back(Vector3(b.x, b.y, -d));
-
- if (i % 16 == 0) {
-
- collision_segments.push_back(Vector3(a.x, a.y, -d));
- collision_segments.push_back(Vector3());
- }
-
- if (i == 16) {
-
- handles.push_back(Vector3(a.x, a.y, -d));
- }
- }
-
- collision_segments.push_back(Vector3(0, 0, -r));
- collision_segments.push_back(Vector3());
+ handles.push_back(Vector3(a.x, a.y, -d));
p_gizmo->add_handles(handles, get_material("handles"));
- p_gizmo->add_collision_segments(collision_segments);
p_gizmo->add_unscaled_billboard(icon, 0.05);
}
}
@@ -1149,7 +1123,6 @@ void AudioStreamPlayer3DSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo)
}
p_gizmo->add_lines(points, material);
- p_gizmo->add_collision_segments(points);
Vector<Vector3> handles;
float ha = Math::deg2rad(player->get_emission_angle());
@@ -1344,7 +1317,6 @@ void CameraSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
}
p_gizmo->add_lines(lines, material);
- p_gizmo->add_collision_segments(lines);
p_gizmo->add_unscaled_billboard(icon, 0.05);
p_gizmo->add_handles(handles, get_material("handles"));
@@ -1387,7 +1359,6 @@ void CameraSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
}
p_gizmo->add_lines(lines, material);
- p_gizmo->add_collision_segments(lines);
}
}
@@ -2123,12 +2094,10 @@ void SoftBodySpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
Vector<Vector3> points;
soft_body->get_mesh()->generate_debug_mesh_indices(points);
- soft_body->get_mesh()->clear_cache();
Ref<Material> material = get_material("shape_material", p_gizmo);
p_gizmo->add_lines(lines, material);
- p_gizmo->add_collision_segments(lines);
p_gizmo->add_handles(points, get_material("handles"));
p_gizmo->add_collision_triangles(tm);
}
@@ -2445,7 +2414,6 @@ void ParticlesGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
Ref<Material> icon = get_material("particles_icon", p_gizmo);
p_gizmo->add_lines(lines, material);
- p_gizmo->add_collision_segments(lines);
if (p_gizmo->is_selected()) {
Ref<Material> solid_material = get_material("particles_solid_material", p_gizmo);
@@ -2630,7 +2598,6 @@ void ReflectionProbeGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
}
p_gizmo->add_unscaled_billboard(icon, 0.05);
- p_gizmo->add_collision_segments(lines);
p_gizmo->add_handles(handles, get_material("handles"));
}
@@ -2745,7 +2712,6 @@ void GIProbeGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
}
p_gizmo->add_lines(lines, material);
- p_gizmo->add_collision_segments(lines);
lines.clear();
@@ -2915,7 +2881,6 @@ void BakedIndirectLightGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
}
p_gizmo->add_lines(lines, material);
- p_gizmo->add_collision_segments(lines);
Vector<Vector3> handles;
@@ -3506,6 +3471,14 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
}
}
+ if (Object::cast_to<ConcavePolygonShape>(*s)) {
+
+ Ref<ConcavePolygonShape> cs = s;
+ Ref<ArrayMesh> mesh = cs->get_debug_mesh()->duplicate();
+ mesh->surface_set_material(0, material);
+ p_gizmo->add_mesh(mesh);
+ }
+
if (Object::cast_to<RayShape>(*s)) {
Ref<RayShape> rs = s;