summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_node.cpp21
-rw-r--r--editor/editor_node.h2
-rw-r--r--editor/editor_resource_preview.cpp129
-rw-r--r--editor/editor_resource_preview.h2
-rw-r--r--editor/fileserver/editor_file_server.cpp17
-rw-r--r--editor/fileserver/editor_file_server.h2
-rw-r--r--editor/icons/NavigationMeshInstance.svg1
-rw-r--r--editor/icons/NavigationPolygonInstance.svg1
-rw-r--r--editor/icons/NavigationRegion.svg58
-rw-r--r--editor/icons/NavigationRegion2D.svg67
-rw-r--r--editor/icons/PlaneMesh.svg1
-rw-r--r--editor/icons/WorldMarginShape.svg1
-rw-r--r--editor/import/resource_importer_scene.cpp10
-rw-r--r--editor/import/resource_importer_texture.cpp95
-rw-r--r--editor/import/resource_importer_texture.h2
-rw-r--r--editor/plugins/mesh_instance_editor_plugin.cpp4
-rw-r--r--editor/plugins/mesh_library_editor_plugin.cpp6
-rw-r--r--editor/plugins/navigation_polygon_editor_plugin.cpp4
-rw-r--r--editor/plugins/navigation_polygon_editor_plugin.h2
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp4
-rw-r--r--editor/spatial_editor_gizmos.cpp14
21 files changed, 278 insertions, 165 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 9cc6134f27..e889298aa3 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -5554,7 +5554,7 @@ void EditorNode::_print_handler(void *p_this, const String &p_string, bool p_err
static void _execute_thread(void *p_ud) {
EditorNode::ExecuteThreadArgs *eta = (EditorNode::ExecuteThreadArgs *)p_ud;
- Error err = OS::get_singleton()->execute(eta->path, eta->args, true, NULL, &eta->output, &eta->exitcode, true, eta->execute_output_mutex);
+ Error err = OS::get_singleton()->execute(eta->path, eta->args, true, NULL, &eta->output, &eta->exitcode, true, &eta->execute_output_mutex);
print_verbose("Thread exit status: " + itos(eta->exitcode));
if (err != OK) {
eta->exitcode = err;
@@ -5574,7 +5574,6 @@ int EditorNode::execute_and_show_output(const String &p_title, const String &p_p
ExecuteThreadArgs eta;
eta.path = p_path;
eta.args = p_arguments;
- eta.execute_output_mutex = Mutex::create();
eta.exitcode = 255;
eta.done = false;
@@ -5585,20 +5584,20 @@ int EditorNode::execute_and_show_output(const String &p_title, const String &p_p
ERR_FAIL_COND_V(!eta.execute_output_thread, 0);
while (!eta.done) {
- eta.execute_output_mutex->lock();
- if (prev_len != eta.output.length()) {
- String to_add = eta.output.substr(prev_len, eta.output.length());
- prev_len = eta.output.length();
- execute_outputs->add_text(to_add);
- Main::iteration();
- }
- eta.execute_output_mutex->unlock();
+ {
+ MutexLock lock(eta.execute_output_mutex);
+ if (prev_len != eta.output.length()) {
+ String to_add = eta.output.substr(prev_len, eta.output.length());
+ prev_len = eta.output.length();
+ execute_outputs->add_text(to_add);
+ Main::iteration();
+ }
+ }
OS::get_singleton()->delay_usec(1000);
}
Thread::wait_to_finish(eta.execute_output_thread);
memdelete(eta.execute_output_thread);
- memdelete(eta.execute_output_mutex);
execute_outputs->add_text("\nExit Code: " + itos(eta.exitcode));
if (p_close_on_errors && eta.exitcode != 0) {
diff --git a/editor/editor_node.h b/editor/editor_node.h
index a982b9d85f..0b3de5c142 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -107,7 +107,7 @@ public:
List<String> args;
String output;
Thread *execute_output_thread;
- Mutex *execute_output_mutex;
+ Mutex execute_output_mutex;
int exitcode;
volatile bool done;
};
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index c0f58c9aae..40482dc367 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -109,29 +109,28 @@ void EditorResourcePreview::_thread_func(void *ud) {
void EditorResourcePreview::_preview_ready(const String &p_str, const Ref<Texture2D> &p_texture, const Ref<Texture2D> &p_small_texture, ObjectID id, const StringName &p_func, const Variant &p_ud) {
- preview_mutex->lock();
-
+ MutexLock lock(preview_mutex);
String path = p_str;
- uint32_t hash = 0;
- uint64_t modified_time = 0;
-
- if (p_str.begins_with("ID:")) {
- hash = uint32_t(p_str.get_slicec(':', 2).to_int64());
- path = "ID:" + p_str.get_slicec(':', 1);
- } else {
- modified_time = FileAccess::get_modified_time(path);
- }
+ {
+ uint32_t hash = 0;
+ uint64_t modified_time = 0;
- Item item;
- item.order = order++;
- item.preview = p_texture;
- item.small_preview = p_small_texture;
- item.last_hash = hash;
- item.modified_time = modified_time;
+ if (p_str.begins_with("ID:")) {
+ hash = uint32_t(p_str.get_slicec(':', 2).to_int64());
+ path = "ID:" + p_str.get_slicec(':', 1);
+ } else {
+ modified_time = FileAccess::get_modified_time(path);
+ }
- cache[path] = item;
+ Item item;
+ item.order = order++;
+ item.preview = p_texture;
+ item.small_preview = p_small_texture;
+ item.last_hash = hash;
+ item.modified_time = modified_time;
- preview_mutex->unlock();
+ cache[path] = item;
+ }
MessageQueue::get_singleton()->push_call(id, p_func, path, p_texture, p_small_texture, p_ud);
}
@@ -219,7 +218,7 @@ void EditorResourcePreview::_thread() {
while (!exit) {
preview_sem->wait();
- preview_mutex->lock();
+ preview_mutex.lock();
if (queue.size()) {
@@ -235,10 +234,10 @@ void EditorResourcePreview::_thread() {
_preview_ready(path, cache[item.path].preview, cache[item.path].small_preview, item.id, item.function, item.userdata);
- preview_mutex->unlock();
+ preview_mutex.unlock();
} else {
- preview_mutex->unlock();
+ preview_mutex.unlock();
Ref<ImageTexture> texture;
Ref<ImageTexture> small_texture;
@@ -345,7 +344,7 @@ void EditorResourcePreview::_thread() {
}
} else {
- preview_mutex->unlock();
+ preview_mutex.unlock();
}
}
exited = true;
@@ -356,51 +355,54 @@ void EditorResourcePreview::queue_edited_resource_preview(const Ref<Resource> &p
ERR_FAIL_NULL(p_receiver);
ERR_FAIL_COND(!p_res.is_valid());
- preview_mutex->lock();
+ {
+ MutexLock lock(preview_mutex);
- String path_id = "ID:" + itos(p_res->get_instance_id());
+ String path_id = "ID:" + itos(p_res->get_instance_id());
- if (cache.has(path_id) && cache[path_id].last_hash == p_res->hash_edited_version()) {
+ if (cache.has(path_id) && cache[path_id].last_hash == p_res->hash_edited_version()) {
- cache[path_id].order = order++;
- p_receiver->call(p_receiver_func, path_id, cache[path_id].preview, cache[path_id].small_preview, p_userdata);
- preview_mutex->unlock();
- return;
- }
+ cache[path_id].order = order++;
+ p_receiver->call(p_receiver_func, path_id, cache[path_id].preview, cache[path_id].small_preview, p_userdata);
+ preview_mutex.unlock();
+ return;
+ }
- cache.erase(path_id); //erase if exists, since it will be regen
+ cache.erase(path_id); //erase if exists, since it will be regen
- QueueItem item;
- item.function = p_receiver_func;
- item.id = p_receiver->get_instance_id();
- item.resource = p_res;
- item.path = path_id;
- item.userdata = p_userdata;
+ QueueItem item;
+ item.function = p_receiver_func;
+ item.id = p_receiver->get_instance_id();
+ item.resource = p_res;
+ item.path = path_id;
+ item.userdata = p_userdata;
- queue.push_back(item);
- preview_mutex->unlock();
+ queue.push_back(item);
+ }
preview_sem->post();
}
void EditorResourcePreview::queue_resource_preview(const String &p_path, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata) {
ERR_FAIL_NULL(p_receiver);
- preview_mutex->lock();
- if (cache.has(p_path)) {
- cache[p_path].order = order++;
- p_receiver->call(p_receiver_func, p_path, cache[p_path].preview, cache[p_path].small_preview, p_userdata);
- preview_mutex->unlock();
- return;
- }
+ {
+ MutexLock lock(preview_mutex);
+
+ if (cache.has(p_path)) {
+ cache[p_path].order = order++;
+ p_receiver->call(p_receiver_func, p_path, cache[p_path].preview, cache[p_path].small_preview, p_userdata);
+ preview_mutex.unlock();
+ return;
+ }
- QueueItem item;
- item.function = p_receiver_func;
- item.id = p_receiver->get_instance_id();
- item.path = p_path;
- item.userdata = p_userdata;
+ QueueItem item;
+ item.function = p_receiver_func;
+ item.id = p_receiver->get_instance_id();
+ item.path = p_path;
+ item.userdata = p_userdata;
- queue.push_back(item);
- preview_mutex->unlock();
+ queue.push_back(item);
+ }
preview_sem->post();
}
@@ -434,20 +436,19 @@ void EditorResourcePreview::_bind_methods() {
void EditorResourcePreview::check_for_invalidation(const String &p_path) {
- preview_mutex->lock();
-
+ MutexLock lock(preview_mutex);
bool call_invalidated = false;
- if (cache.has(p_path)) {
+ {
+ if (cache.has(p_path)) {
- uint64_t modified_time = FileAccess::get_modified_time(p_path);
- if (modified_time != cache[p_path].modified_time) {
- cache.erase(p_path);
- call_invalidated = true;
+ uint64_t modified_time = FileAccess::get_modified_time(p_path);
+ if (modified_time != cache[p_path].modified_time) {
+ cache.erase(p_path);
+ call_invalidated = true;
+ }
}
}
- preview_mutex->unlock();
-
if (call_invalidated) { //do outside mutex
call_deferred("emit_signal", "preview_invalidated", p_path);
}
@@ -475,7 +476,6 @@ void EditorResourcePreview::stop() {
EditorResourcePreview::EditorResourcePreview() {
thread = NULL;
singleton = this;
- preview_mutex = Mutex::create();
preview_sem = SemaphoreOld::create();
order = 0;
exit = false;
@@ -485,6 +485,5 @@ EditorResourcePreview::EditorResourcePreview() {
EditorResourcePreview::~EditorResourcePreview() {
stop();
- memdelete(preview_mutex);
memdelete(preview_sem);
}
diff --git a/editor/editor_resource_preview.h b/editor/editor_resource_preview.h
index 0a89154243..ae347c0469 100644
--- a/editor/editor_resource_preview.h
+++ b/editor/editor_resource_preview.h
@@ -70,7 +70,7 @@ class EditorResourcePreview : public Node {
List<QueueItem> queue;
- Mutex *preview_mutex;
+ Mutex preview_mutex;
SemaphoreOld *preview_sem;
Thread *thread;
volatile bool exit;
diff --git a/editor/fileserver/editor_file_server.cpp b/editor/fileserver/editor_file_server.cpp
index af7eb0c4c7..fb44c145b2 100644
--- a/editor/fileserver/editor_file_server.cpp
+++ b/editor/fileserver/editor_file_server.cpp
@@ -42,9 +42,10 @@
void EditorFileServer::_close_client(ClientData *cd) {
cd->connection->disconnect_from_host();
- cd->efs->wait_mutex->lock();
- cd->efs->to_wait.insert(cd->thread);
- cd->efs->wait_mutex->unlock();
+ {
+ MutexLock lock(cd->efs->wait_mutex);
+ cd->efs->to_wait.insert(cd->thread);
+ }
while (cd->files.size()) {
memdelete(cd->files.front()->get());
cd->files.erase(cd->files.front());
@@ -295,16 +296,16 @@ void EditorFileServer::_thread_start(void *s) {
}
}
- self->wait_mutex->lock();
+ self->wait_mutex.lock();
while (self->to_wait.size()) {
Thread *w = self->to_wait.front()->get();
self->to_wait.erase(w);
- self->wait_mutex->unlock();
+ self->wait_mutex.unlock();
Thread::wait_to_finish(w);
memdelete(w);
- self->wait_mutex->lock();
+ self->wait_mutex.lock();
}
- self->wait_mutex->unlock();
+ self->wait_mutex.unlock();
OS::get_singleton()->delay_usec(100000);
}
@@ -331,7 +332,6 @@ void EditorFileServer::stop() {
EditorFileServer::EditorFileServer() {
server.instance();
- wait_mutex = Mutex::create();
quit = false;
active = false;
cmd = CMD_NONE;
@@ -346,5 +346,4 @@ EditorFileServer::~EditorFileServer() {
quit = true;
Thread::wait_to_finish(thread);
memdelete(thread);
- memdelete(wait_mutex);
}
diff --git a/editor/fileserver/editor_file_server.h b/editor/fileserver/editor_file_server.h
index 4ce4c0cda6..cc3cb44566 100644
--- a/editor/fileserver/editor_file_server.h
+++ b/editor/fileserver/editor_file_server.h
@@ -62,7 +62,7 @@ class EditorFileServer : public Object {
static void _close_client(ClientData *cd);
static void _subthread_start(void *s);
- Mutex *wait_mutex;
+ Mutex wait_mutex;
Thread *thread;
static void _thread_start(void *);
bool quit;
diff --git a/editor/icons/NavigationMeshInstance.svg b/editor/icons/NavigationMeshInstance.svg
deleted file mode 100644
index 737d9c319d..0000000000
--- a/editor/icons/NavigationMeshInstance.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 1a2 2 0 0 0 -2 2 2 2 0 0 0 1 1.7305v6.541a2 2 0 0 0 -1 1.7285 2 2 0 0 0 2 2 2 2 0 0 0 1.7305-1h2.5078l.75-2h-3.2598a2 2 0 0 0 -.72852-.73047v-5.8555l4.6973 4.6973.77148-2.0566-4.0547-4.0547h5.8574a2 2 0 0 0 .72852.73047v.27148a2.0002 2.0002 0 0 1 .023438 0 2.0002 2.0002 0 0 1 1.8496 1.2969l.12695.33789v-1.9082a2 2 0 0 0 1-1.7285 2 2 0 0 0 -2-2 2 2 0 0 0 -1.7305 1h-6.541a2 2 0 0 0 -1.7285-1zm9 6-3 8 3-2 3 2z" fill="#fc9c9c" fill-opacity=".99608"/></svg> \ No newline at end of file
diff --git a/editor/icons/NavigationPolygonInstance.svg b/editor/icons/NavigationPolygonInstance.svg
deleted file mode 100644
index e16d10614e..0000000000
--- a/editor/icons/NavigationPolygonInstance.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#a5b7f3" fill-opacity=".98824" fill-rule="evenodd" transform="translate(0 -1036.4)"><path d="m2 1a1.0001 1.0001 0 0 0 -1 1v12a1.0001 1.0001 0 0 0 1 1h4.9023a2.1002 2.1002 0 0 1 .13086-.73633l.47461-1.2637h-4.5078v-10h8.5859l-4.293 4.293a1.0001 1.0001 0 0 0 0 1.4141l1.3262 1.3262 1.4141-3.7695a2.1002 2.1002 0 0 1 1.9922-1.3613 2.1002 2.1002 0 0 1 .43555.050781l2.2461-2.2461a1.0001 1.0001 0 0 0 -.70703-1.707h-12z" transform="translate(0 1036.4)"/><path d="m15 1051.4-3-8-3 8 3-2z"/></g></svg> \ No newline at end of file
diff --git a/editor/icons/NavigationRegion.svg b/editor/icons/NavigationRegion.svg
new file mode 100644
index 0000000000..92cc9afd91
--- /dev/null
+++ b/editor/icons/NavigationRegion.svg
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ inkscape:version="1.0beta2 (unknown)"
+ sodipodi:docname="icon_navigation_region.svg"
+ id="svg4"
+ version="1.1"
+ width="16"
+ viewBox="0 0 16 16"
+ height="16">
+ <metadata
+ id="metadata10">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs8" />
+ <sodipodi:namedview
+ inkscape:current-layer="svg4"
+ inkscape:window-maximized="0"
+ inkscape:window-y="18"
+ inkscape:window-x="0"
+ inkscape:cy="6.4771531"
+ inkscape:cx="15.373896"
+ inkscape:zoom="32"
+ showgrid="false"
+ id="namedview6"
+ inkscape:window-height="1041"
+ inkscape:window-width="1916"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0"
+ guidetolerance="10"
+ gridtolerance="10"
+ objecttolerance="10"
+ borderopacity="1"
+ inkscape:document-rotation="0"
+ bordercolor="#666666"
+ pagecolor="#ffffff" />
+ <path
+ sodipodi:nodetypes="ccccccccccccccccccc"
+ inkscape:connector-curvature="0"
+ d="M 3,1 C 1.895431,1 1,1.895431 1,3 v 10 c 0,1.104569 0.895431,2 2,2 L 7.2383,14 C 8.917345,11.151816 9.09393,5.498579 11.99998,5.00198 h 0.02344 c 0.825004,0.0095 1.559551,0.524505 1.8496,1.2969 l 0.12695,0.33789 1,-3.6367 c 0,-1.104569 -0.895431,-2 -2,-2 H 8.20155 2.99997 Z m 9,6 -3,8 3,-2 3,2 z"
+ fill="#fc9c9c"
+ fill-opacity=".99608"
+ id="path2-3" />
+</svg>
diff --git a/editor/icons/NavigationRegion2D.svg b/editor/icons/NavigationRegion2D.svg
new file mode 100644
index 0000000000..a297216cb7
--- /dev/null
+++ b/editor/icons/NavigationRegion2D.svg
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ inkscape:version="1.0beta2 (unknown)"
+ sodipodi:docname="icon_navigation_polygon_instance.svg"
+ id="svg8"
+ version="1.1"
+ width="16"
+ viewBox="0 0 16 16"
+ height="16">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ inkscape:current-layer="svg8"
+ inkscape:window-maximized="0"
+ inkscape:window-y="18"
+ inkscape:window-x="0"
+ inkscape:cy="10.058435"
+ inkscape:cx="5.8836841"
+ inkscape:zoom="19.64431"
+ showgrid="false"
+ id="namedview10"
+ inkscape:window-height="1041"
+ inkscape:window-width="1916"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0"
+ guidetolerance="10"
+ gridtolerance="10"
+ objecttolerance="10"
+ borderopacity="1"
+ inkscape:document-rotation="0"
+ bordercolor="#666666"
+ pagecolor="#ffffff" />
+ <g
+ id="g6"
+ transform="translate(0 -1036.4)"
+ fill-rule="evenodd"
+ fill-opacity=".98824"
+ fill="#a5b7f3">
+ <path
+ sodipodi:nodetypes="cccccccccccccc"
+ inkscape:connector-curvature="0"
+ id="path2"
+ transform="translate(0,1036.4)"
+ d="M 2,1 C 1.4477381,1.0000552 1.0000552,1.4477381 1,2 v 12 c 5.52e-5,0.552262 0.4477381,0.999945 1,1 h 4.9023 c -7.836e-4,-0.251296 0.043539,-0.500692 0.13086,-0.73633 l 0.47461,-1.2637 2.5254,-6.7362 c 0.311135,-0.8280197 1.107723,-1.3723398 1.9922,-1.3613 0.146558,0.00168 0.292536,0.018702 0.43555,0.050781 l 2.2461,-2.2461 c 0.629502,-0.6299963 0.18357,-1.7066217 -0.70703,-1.707 h -12 z" />
+ <path
+ id="path4"
+ d="m15 1051.4-3-8-3 8 3-2z" />
+ </g>
+</svg>
diff --git a/editor/icons/PlaneMesh.svg b/editor/icons/PlaneMesh.svg
deleted file mode 100644
index ddcc623c67..0000000000
--- a/editor/icons/PlaneMesh.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m2 12h12l-3-8h-6z" fill="none" stroke="#ffd684" stroke-linejoin="round" stroke-width="2"/></svg> \ No newline at end of file
diff --git a/editor/icons/WorldMarginShape.svg b/editor/icons/WorldMarginShape.svg
new file mode 100644
index 0000000000..2c90cf6d53
--- /dev/null
+++ b/editor/icons/WorldMarginShape.svg
@@ -0,0 +1 @@
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 1044.4 7 3 7-3-7-3z" fill="#a2d2ff" fill-rule="evenodd" transform="translate(0 -1036.4)"/></svg> \ No newline at end of file
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index 9fb6be50d9..5651197fa3 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -41,10 +41,10 @@
#include "scene/resources/animation.h"
#include "scene/resources/box_shape.h"
#include "scene/resources/packed_scene.h"
-#include "scene/resources/plane_shape.h"
#include "scene/resources/ray_shape.h"
#include "scene/resources/resource_format_text.h"
#include "scene/resources/sphere_shape.h"
+#include "scene/resources/world_margin_shape.h"
uint32_t EditorSceneImporter::get_import_flags() const {
@@ -446,9 +446,9 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
colshape->set_name("RayShape");
Object::cast_to<Spatial>(sb)->rotate_x(Math_PI / 2);
} else if (empty_draw_type == "IMAGE") {
- PlaneShape *planeShape = memnew(PlaneShape);
- colshape->set_shape(planeShape);
- colshape->set_name("PlaneShape");
+ WorldMarginShape *world_margin_shape = memnew(WorldMarginShape);
+ colshape->set_shape(world_margin_shape);
+ colshape->set_name("WorldMarginShape");
} else {
SphereShape *sphereShape = memnew(SphereShape);
sphereShape->set_radius(1);
@@ -559,7 +559,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
Ref<ArrayMesh> mesh = mi->get_mesh();
ERR_FAIL_COND_V(mesh.is_null(), NULL);
- NavigationMeshInstance *nmi = memnew(NavigationMeshInstance);
+ NavigationRegion *nmi = memnew(NavigationRegion);
nmi->set_name(_fixstr(name, "navmesh"));
Ref<NavigationMesh> nmesh = memnew(NavigationMesh);
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index 3254b32dae..92ecda8508 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -38,7 +38,8 @@
void ResourceImporterTexture::_texture_reimport_roughness(const Ref<StreamTexture> &p_tex, const String &p_normal_path, VS::TextureDetectRoughnessChannel p_channel) {
- singleton->mutex->lock();
+ MutexLock lock(singleton->mutex);
+
StringName path = p_tex->get_path();
if (!singleton->make_flags.has(path)) {
@@ -48,13 +49,12 @@ void ResourceImporterTexture::_texture_reimport_roughness(const Ref<StreamTextur
singleton->make_flags[path].flags |= MAKE_ROUGHNESS_FLAG;
singleton->make_flags[path].channel_for_roughness = p_channel;
singleton->make_flags[path].normal_path_for_roughness = p_normal_path;
-
- singleton->mutex->unlock();
}
void ResourceImporterTexture::_texture_reimport_3d(const Ref<StreamTexture> &p_tex) {
- singleton->mutex->lock();
+ MutexLock lock(singleton->mutex);
+
StringName path = p_tex->get_path();
if (!singleton->make_flags.has(path)) {
@@ -62,13 +62,12 @@ void ResourceImporterTexture::_texture_reimport_3d(const Ref<StreamTexture> &p_t
}
singleton->make_flags[path].flags |= MAKE_3D_FLAG;
-
- singleton->mutex->unlock();
}
void ResourceImporterTexture::_texture_reimport_normal(const Ref<StreamTexture> &p_tex) {
- singleton->mutex->lock();
+ MutexLock lock(singleton->mutex);
+
StringName path = p_tex->get_path();
if (!singleton->make_flags.has(path)) {
@@ -76,8 +75,6 @@ void ResourceImporterTexture::_texture_reimport_normal(const Ref<StreamTexture>
}
singleton->make_flags[path].flags |= MAKE_NORMAL_FLAG;
-
- singleton->mutex->unlock();
}
void ResourceImporterTexture::update_imports() {
@@ -85,57 +82,56 @@ void ResourceImporterTexture::update_imports() {
if (EditorFileSystem::get_singleton()->is_scanning() || EditorFileSystem::get_singleton()->is_importing()) {
return; // do nothing for now
}
- mutex->lock();
-
- if (make_flags.empty()) {
- mutex->unlock();
- return;
- }
+ MutexLock lock(mutex);
Vector<String> to_reimport;
- for (Map<StringName, MakeInfo>::Element *E = make_flags.front(); E; E = E->next()) {
+ {
+ if (make_flags.empty()) {
+ return;
+ }
- Ref<ConfigFile> cf;
- cf.instance();
- String src_path = String(E->key()) + ".import";
+ for (Map<StringName, MakeInfo>::Element *E = make_flags.front(); E; E = E->next()) {
- Error err = cf->load(src_path);
- ERR_CONTINUE(err != OK);
+ Ref<ConfigFile> cf;
+ cf.instance();
+ String src_path = String(E->key()) + ".import";
- bool changed = false;
+ Error err = cf->load(src_path);
+ ERR_CONTINUE(err != OK);
- if (E->get().flags & MAKE_NORMAL_FLAG && int(cf->get_value("params", "compress/normal_map")) == 0) {
- cf->set_value("params", "compress/normal_map", 1);
- changed = true;
- }
+ bool changed = false;
- if (E->get().flags & MAKE_ROUGHNESS_FLAG && int(cf->get_value("params", "roughness/mode")) == 0) {
- cf->set_value("params", "roughness/mode", E->get().channel_for_roughness + 2);
- cf->set_value("params", "roughness/src_normal", E->get().normal_path_for_roughness);
- changed = true;
- }
+ if (E->get().flags & MAKE_NORMAL_FLAG && int(cf->get_value("params", "compress/normal_map")) == 0) {
+ cf->set_value("params", "compress/normal_map", 1);
+ changed = true;
+ }
- if (E->get().flags & MAKE_3D_FLAG && bool(cf->get_value("params", "detect_3d/compress_to"))) {
- int compress_to = cf->get_value("params", "detect_3d/compress_to");
- cf->set_value("params", "detect_3d/compress_to", 0);
- if (compress_to == 1) {
- cf->set_value("params", "compress/mode", COMPRESS_VRAM_COMPRESSED);
- } else if (compress_to == 2) {
- cf->set_value("params", "compress/mode", COMPRESS_BASIS_UNIVERSAL);
+ if (E->get().flags & MAKE_ROUGHNESS_FLAG && int(cf->get_value("params", "roughness/mode")) == 0) {
+ cf->set_value("params", "roughness/mode", E->get().channel_for_roughness + 2);
+ cf->set_value("params", "roughness/src_normal", E->get().normal_path_for_roughness);
+ changed = true;
}
- cf->set_value("params", "mipmaps/generate", true);
- changed = true;
- }
- if (changed) {
- cf->save(src_path);
- to_reimport.push_back(E->key());
- }
- }
+ if (E->get().flags & MAKE_3D_FLAG && bool(cf->get_value("params", "detect_3d/compress_to"))) {
+ int compress_to = cf->get_value("params", "detect_3d/compress_to");
+ cf->set_value("params", "detect_3d/compress_to", 0);
+ if (compress_to == 1) {
+ cf->set_value("params", "compress/mode", COMPRESS_VRAM_COMPRESSED);
+ } else if (compress_to == 2) {
+ cf->set_value("params", "compress/mode", COMPRESS_BASIS_UNIVERSAL);
+ }
+ cf->set_value("params", "mipmaps/generate", true);
+ changed = true;
+ }
- make_flags.clear();
+ if (changed) {
+ cf->save(src_path);
+ to_reimport.push_back(E->key());
+ }
+ }
- mutex->unlock();
+ make_flags.clear();
+ }
if (to_reimport.size()) {
EditorFileSystem::get_singleton()->reimport_files(to_reimport);
@@ -642,10 +638,7 @@ ResourceImporterTexture::ResourceImporterTexture() {
StreamTexture::request_3d_callback = _texture_reimport_3d;
StreamTexture::request_roughness_callback = _texture_reimport_roughness;
StreamTexture::request_normal_callback = _texture_reimport_normal;
- mutex = Mutex::create();
}
ResourceImporterTexture::~ResourceImporterTexture() {
-
- memdelete(mutex);
}
diff --git a/editor/import/resource_importer_texture.h b/editor/import/resource_importer_texture.h
index 19d5498b4a..ed0fe1be89 100644
--- a/editor/import/resource_importer_texture.h
+++ b/editor/import/resource_importer_texture.h
@@ -58,7 +58,7 @@ protected:
MAKE_NORMAL_FLAG = 4
};
- Mutex *mutex;
+ Mutex mutex;
struct MakeInfo {
int flags;
diff --git a/editor/plugins/mesh_instance_editor_plugin.cpp b/editor/plugins/mesh_instance_editor_plugin.cpp
index 37cf16de58..c285bb4e1a 100644
--- a/editor/plugins/mesh_instance_editor_plugin.cpp
+++ b/editor/plugins/mesh_instance_editor_plugin.cpp
@@ -32,7 +32,7 @@
#include "editor/editor_scale.h"
#include "scene/3d/collision_shape.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
#include "scene/3d/physics_body.h"
#include "scene/gui/box_container.h"
#include "spatial_editor_plugin.h"
@@ -233,7 +233,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
return;
nmesh->create_from_mesh(mesh);
- NavigationMeshInstance *nmi = memnew(NavigationMeshInstance);
+ NavigationRegion *nmi = memnew(NavigationRegion);
nmi->set_navigation_mesh(nmesh);
Node *owner = node == get_tree()->get_edited_scene_root() ? node : node->get_owner();
diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp
index ea8842a56f..863ea451b5 100644
--- a/editor/plugins/mesh_library_editor_plugin.cpp
+++ b/editor/plugins/mesh_library_editor_plugin.cpp
@@ -34,7 +34,7 @@
#include "editor/editor_settings.h"
#include "main/main.h"
#include "scene/3d/mesh_instance.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
#include "scene/3d/physics_body.h"
#include "scene/main/viewport.h"
#include "scene/resources/packed_scene.h"
@@ -152,9 +152,9 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
Transform navmesh_transform;
for (int j = 0; j < mi->get_child_count(); j++) {
Node *child2 = mi->get_child(j);
- if (!Object::cast_to<NavigationMeshInstance>(child2))
+ if (!Object::cast_to<NavigationRegion>(child2))
continue;
- NavigationMeshInstance *sb = Object::cast_to<NavigationMeshInstance>(child2);
+ NavigationRegion *sb = Object::cast_to<NavigationRegion>(child2);
navmesh = sb->get_navigation_mesh();
navmesh_transform = sb->get_transform();
if (!navmesh.is_null())
diff --git a/editor/plugins/navigation_polygon_editor_plugin.cpp b/editor/plugins/navigation_polygon_editor_plugin.cpp
index c4e61f2488..6671d0b6b4 100644
--- a/editor/plugins/navigation_polygon_editor_plugin.cpp
+++ b/editor/plugins/navigation_polygon_editor_plugin.cpp
@@ -48,7 +48,7 @@ Node2D *NavigationPolygonEditor::_get_node() const {
void NavigationPolygonEditor::_set_node(Node *p_polygon) {
- node = Object::cast_to<NavigationPolygonInstance>(p_polygon);
+ node = Object::cast_to<NavigationRegion2D>(p_polygon);
}
int NavigationPolygonEditor::_get_polygon_count() const {
@@ -127,5 +127,5 @@ NavigationPolygonEditor::NavigationPolygonEditor(EditorNode *p_editor) :
}
NavigationPolygonEditorPlugin::NavigationPolygonEditorPlugin(EditorNode *p_node) :
- AbstractPolygon2DEditorPlugin(p_node, memnew(NavigationPolygonEditor(p_node)), "NavigationPolygonInstance") {
+ AbstractPolygon2DEditorPlugin(p_node, memnew(NavigationPolygonEditor(p_node)), "NavigationRegion2D") {
}
diff --git a/editor/plugins/navigation_polygon_editor_plugin.h b/editor/plugins/navigation_polygon_editor_plugin.h
index 1cab336381..10f8cbc0a5 100644
--- a/editor/plugins/navigation_polygon_editor_plugin.h
+++ b/editor/plugins/navigation_polygon_editor_plugin.h
@@ -38,7 +38,7 @@ class NavigationPolygonEditor : public AbstractPolygon2DEditor {
GDCLASS(NavigationPolygonEditor, AbstractPolygon2DEditor);
- NavigationPolygonInstance *node;
+ NavigationRegion2D *node;
Ref<NavigationPolygon> _ensure_navpoly() const;
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index a61b291029..0d5741d84a 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -109,8 +109,8 @@ void TileSetEditor::_import_node(Node *p_node, Ref<TileSet> p_library) {
Node *child2 = mi->get_child(j);
- if (Object::cast_to<NavigationPolygonInstance>(child2))
- nav_poly = Object::cast_to<NavigationPolygonInstance>(child2)->get_navigation_polygon();
+ if (Object::cast_to<NavigationRegion2D>(child2))
+ nav_poly = Object::cast_to<NavigationRegion2D>(child2)->get_navigation_polygon();
if (Object::cast_to<LightOccluder2D>(child2))
occluder = Object::cast_to<LightOccluder2D>(child2)->get_occluder_polygon();
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index 40e1be665c..c155430eae 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -41,7 +41,7 @@
#include "scene/3d/light.h"
#include "scene/3d/listener.h"
#include "scene/3d/mesh_instance.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
#include "scene/3d/particles.h"
#include "scene/3d/physics_joint.h"
#include "scene/3d/position_3d.h"
@@ -58,11 +58,11 @@
#include "scene/resources/convex_polygon_shape.h"
#include "scene/resources/cylinder_shape.h"
#include "scene/resources/height_map_shape.h"
-#include "scene/resources/plane_shape.h"
#include "scene/resources/primitive_meshes.h"
#include "scene/resources/ray_shape.h"
#include "scene/resources/sphere_shape.h"
#include "scene/resources/surface_tool.h"
+#include "scene/resources/world_margin_shape.h"
#define HANDLE_HALF_SIZE 9.5
@@ -3575,9 +3575,9 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
p_gizmo->add_handles(handles, handles_material);
}
- if (Object::cast_to<PlaneShape>(*s)) {
+ if (Object::cast_to<WorldMarginShape>(*s)) {
- Ref<PlaneShape> ps = s;
+ Ref<WorldMarginShape> ps = s;
Plane p = ps->get_plane();
Vector<Vector3> points;
@@ -3720,11 +3720,11 @@ NavigationMeshSpatialGizmoPlugin::NavigationMeshSpatialGizmoPlugin() {
}
bool NavigationMeshSpatialGizmoPlugin::has_gizmo(Spatial *p_spatial) {
- return Object::cast_to<NavigationMeshInstance>(p_spatial) != NULL;
+ return Object::cast_to<NavigationRegion>(p_spatial) != NULL;
}
String NavigationMeshSpatialGizmoPlugin::get_name() const {
- return "NavigationMeshInstance";
+ return "NavigationRegion";
}
int NavigationMeshSpatialGizmoPlugin::get_priority() const {
@@ -3733,7 +3733,7 @@ int NavigationMeshSpatialGizmoPlugin::get_priority() const {
void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
- NavigationMeshInstance *navmesh = Object::cast_to<NavigationMeshInstance>(p_gizmo->get_spatial_node());
+ NavigationRegion *navmesh = Object::cast_to<NavigationRegion>(p_gizmo->get_spatial_node());
Ref<Material> edge_material = get_material("navigation_edge_material", p_gizmo);
Ref<Material> edge_material_disabled = get_material("navigation_edge_material_disabled", p_gizmo);