diff --git a/core/os/shared_mem_access.cpp b/core/os/shared_mem_access.cpp deleted file mode 100644 index a953206cdaa..00000000000 --- a/core/os/shared_mem_access.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************/ -/* shared_mem_access.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "shared_mem_access.h" - -#include "core/error_macros.h" - -SharedMemAccess *(*SharedMemAccess::create_func)(const String &p_name) = 0; - -SharedMemAccess *SharedMemAccess::create(const String &p_name) { - - ERR_FAIL_COND_V(!create_func, 0); - - return create_func(p_name); -} - -SharedMemAccess::~SharedMemAccess() { -} diff --git a/core/os/shared_mem_access.h b/core/os/shared_mem_access.h deleted file mode 100644 index 051b94f823c..00000000000 --- a/core/os/shared_mem_access.h +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************/ -/* shared_mem_access.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef SHARED_MEM_ACCESS -#define SHARED_MEM_ACCESS - -#include "core/error_list.h" -#include "core/int_types.h" - -class String; - -class SharedMemAccess { - -protected: - static SharedMemAccess *(*create_func)(const String &p_name); - -public: - static SharedMemAccess *create(const String &p_name); - - virtual Error open() = 0; - virtual Error close() = 0; - virtual bool is_open() = 0; - - virtual void *lock() = 0; - virtual void unlock() = 0; - virtual bool is_locking() = 0; - - virtual void *set_size(uint64_t p_size) = 0; - virtual uint64_t get_size() = 0; - - virtual ~SharedMemAccess(); -}; - -#endif diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index ad7a49451f7..e7ff7a3aefa 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -282,11 +282,6 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script, bool p_can_continue) if (request_scene_tree) request_scene_tree(request_scene_tree_ud); - } else if (command == "request_framebuffer") { - - if (request_framebuffer) - request_framebuffer(request_framebuffer_ud); - } else if (command == "request_video_mem") { _send_video_memory(); @@ -713,10 +708,6 @@ void ScriptDebuggerRemote::_poll_events() { if (request_scene_tree) request_scene_tree(request_scene_tree_ud); - } else if (command == "request_framebuffer") { - - if (request_framebuffer) - request_framebuffer(request_framebuffer_ud); } else if (command == "request_video_mem") { _send_video_memory(); @@ -1018,12 +1009,6 @@ void ScriptDebuggerRemote::set_request_scene_tree_message_func(RequestSceneTreeM request_scene_tree_ud = p_udata; } -void ScriptDebuggerRemote::set_request_framebuffer_message_func(RequestFramebufferMessageFunc p_func, void *p_udata) { - - request_framebuffer = p_func; - request_framebuffer_ud = p_udata; -} - void ScriptDebuggerRemote::set_live_edit_funcs(LiveEditFuncs *p_funcs) { live_edit_funcs = p_funcs; @@ -1094,7 +1079,6 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() : locking(false), poll_every(0), request_scene_tree(NULL), - request_framebuffer(NULL), live_edit_funcs(NULL) { packet_peer_stream->set_stream_peer(tcp_client); diff --git a/core/script_debugger_remote.h b/core/script_debugger_remote.h index bf122abc67a..1fc9d7c7f1f 100644 --- a/core/script_debugger_remote.h +++ b/core/script_debugger_remote.h @@ -113,9 +113,6 @@ class ScriptDebuggerRemote : public ScriptDebugger { RequestSceneTreeMessageFunc request_scene_tree; void *request_scene_tree_ud; - RequestFramebufferMessageFunc request_framebuffer; - void *request_framebuffer_ud; - void _set_object_property(ObjectID p_id, const String &p_property, const Variant &p_value); void _send_object_id(ObjectID p_id); @@ -168,8 +165,6 @@ public: virtual void set_request_scene_tree_message_func(RequestSceneTreeMessageFunc p_func, void *p_udata); virtual void set_live_edit_funcs(LiveEditFuncs *p_funcs); - virtual void set_request_framebuffer_message_func(RequestFramebufferMessageFunc p_func, void *p_udata); - virtual bool is_profiling() const; virtual void add_profiling_frame_data(const StringName &p_name, const Array &p_data); diff --git a/core/script_language.h b/core/script_language.h index 704830d0b06..b6d7bea9c73 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -390,7 +390,6 @@ class ScriptDebugger { public: typedef void (*RequestSceneTreeMessageFunc)(void *); - typedef void (*RequestFramebufferMessageFunc)(void *); struct LiveEditFuncs { @@ -446,8 +445,6 @@ public: virtual void set_request_scene_tree_message_func(RequestSceneTreeMessageFunc p_func, void *p_udata) {} virtual void set_live_edit_funcs(LiveEditFuncs *p_funcs) {} - virtual void set_request_framebuffer_message_func(RequestFramebufferMessageFunc p_func, void *p_udata) {} - virtual bool is_profiling() const = 0; virtual void add_profiling_frame_data(const StringName &p_name, const Array &p_data) = 0; virtual void profiling_start() = 0; diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 292e2d22193..e7550903a8f 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -40,7 +40,6 @@ #include "drivers/unix/net_socket_posix.h" #include "drivers/unix/rw_lock_posix.h" #include "drivers/unix/semaphore_posix.h" -#include "drivers/unix/shared_mem_access_posix.h" #include "drivers/unix/thread_posix.h" #include "servers/visual_server.h" @@ -141,7 +140,6 @@ void OS_Unix::initialize_core() { MutexPosix::make_default(); RWLockPosix::make_default(); #endif - SharedMemAccessPosix::make_default(); FileAccess::make_default(FileAccess::ACCESS_RESOURCES); FileAccess::make_default(FileAccess::ACCESS_USERDATA); FileAccess::make_default(FileAccess::ACCESS_FILESYSTEM); diff --git a/drivers/unix/shared_mem_access_posix.cpp b/drivers/unix/shared_mem_access_posix.cpp deleted file mode 100644 index f50e177a8ba..00000000000 --- a/drivers/unix/shared_mem_access_posix.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/*************************************************************************/ -/* shared_mem_access_posix.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "shared_mem_access_posix.h" - -#if defined(UNIX_ENABLED) - -//#include "core/os/memory.h" -#include -#include -#include -//#include -#include -//#include -//#include - -SharedMemAccess *SharedMemAccessPosix::create_func_posix(const String &p_name) { - - return memnew(SharedMemAccessPosix(p_name)); -} - -void SharedMemAccessPosix::make_default() { - - create_func = create_func_posix; -} - -Error SharedMemAccessPosix::open() { - - ERR_EXPLAIN("Already open."); - ERR_FAIL_COND_V(fd != -1, ERR_ALREADY_IN_USE); - - fd = shm_open(("/" + name).utf8().get_data(), O_CREAT | O_RDWR, 0600); - if (fd == -1) { - ERR_EXPLAIN("Cannot create/open."); - ERR_FAIL_V(ERR_CANT_OPEN); - } - - return OK; -} - -Error SharedMemAccessPosix::close() { - - ERR_EXPLAIN("Not open."); - ERR_FAIL_COND_V(!is_open(), ERR_UNCONFIGURED); - - if (!lock()) { - ERR_EXPLAIN("Cannot lock."); - ERR_FAIL_V(ERR_BUSY); - } - - if (is_allocator) { - shm_unlink(("/" + name).utf8().get_data()); - is_allocator = false; - } - - ::close(fd); - fd = -1; - - unlock(); - - return OK; -} - -_FORCE_INLINE_ bool SharedMemAccessPosix::is_open() { - - return fd != -1; -} - -void *SharedMemAccessPosix::lock() { - - ERR_EXPLAIN("Not open."); - ERR_FAIL_COND_V(!is_open(), NULL); - - ERR_EXPLAIN("Lock already held."); - ERR_FAIL_COND_V(is_locking(), NULL); - - size = lseek(fd, 0, SEEK_END); - - lock_addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (lock_addr == MAP_FAILED) { - ERR_EXPLAIN("Cannot map memory."); - ERR_FAIL_V(NULL); - } - - return lock_addr; -} - -void SharedMemAccessPosix::unlock() { - - ERR_EXPLAIN("Lock not held."); - ERR_FAIL_COND(!is_locking()); - - munmap(lock_addr, size); - lock_addr = NULL; - size = 0; -} - -_FORCE_INLINE_ bool SharedMemAccessPosix::is_locking() { - - return lock_addr; -} - -void *SharedMemAccessPosix::set_size(uint64_t p_size) { - - ERR_EXPLAIN("Lock must be held to set the size."); - ERR_FAIL_COND_V(!is_locking(), NULL); - - if (ftruncate(fd, p_size) == -1) { - ERR_EXPLAIN("Cannot set new size. (Out of memory?)"); - ERR_FAIL_V(NULL); - } - - munmap(lock_addr, size); - - // Try to remap at former address - lock_addr = mmap(lock_addr, p_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (lock_addr == MAP_FAILED) { - unlock(); - - ERR_EXPLAIN("Cannot remap memory. Lock released."); - ERR_FAIL_V(NULL); - } - - return lock_addr; -} - -uint64_t SharedMemAccessPosix::get_size() { - - ERR_EXPLAIN("Lock must be held to get the size."); - ERR_FAIL_COND_V(!is_locking(), 0); - - return size; -} - -SharedMemAccessPosix::SharedMemAccessPosix(const String &p_name) : - name(p_name), - is_allocator(false), - size(0), - fd(-1), - lock_addr(NULL) { -} - -SharedMemAccessPosix::~SharedMemAccessPosix() { - - if (is_open()) { - - if (is_locking()) { - unlock(); - } - - if (close() != OK && is_allocator) { - ERR_PRINTS("Leaking shared memory '" + name + "'."); - } - } -} - -#endif diff --git a/drivers/unix/shared_mem_access_posix.h b/drivers/unix/shared_mem_access_posix.h deleted file mode 100644 index df955e1add6..00000000000 --- a/drivers/unix/shared_mem_access_posix.h +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************/ -/* shared_mem_access_posix.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef SHARED_MEM_ACCESS_POSIX_H -#define SHARED_MEM_ACCESS_POSIX_H - -#include "core/os/shared_mem_access.h" -#include "core/ustring.h" - -#if defined(UNIX_ENABLED) - -class SharedMemAccessPosix : public SharedMemAccess { - - String name; - bool is_allocator; - uint64_t size; - int fd; - void *lock_addr; - - static SharedMemAccess *create_func_posix(const String &p_name); - -public: - static void make_default(); - - virtual Error open(); - virtual Error close(); - virtual bool is_open(); - - virtual void *lock(); - virtual void unlock(); - virtual bool is_locking(); - - virtual void *set_size(uint64_t p_size); - virtual uint64_t get_size(); - - SharedMemAccessPosix(const String &p_name); - virtual ~SharedMemAccessPosix(); -}; - -#endif -#endif diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 1ce45c93f16..6140412a329 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -56,7 +56,6 @@ #include "editor/editor_properties.h" #include "editor/editor_settings.h" #include "editor/editor_themes.h" -#include "editor/live_view.h" #include "editor/import/editor_import_collada.h" #include "editor/import/editor_scene_importer_gltf.h" #include "editor/import/resource_importer_bitmask.h" @@ -1809,8 +1808,6 @@ void EditorNode::_run(bool p_current, const String &p_custom) { return; } - live_view_dock->start(); - emit_signal("play_pressed"); if (p_current) { play_scene_button->set_pressed(true); @@ -2152,7 +2149,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { break; editor_run.stop(); - live_view_dock->stop(); run_custom_filename.clear(); play_button->set_pressed(false); play_button->set_icon(gui_base->get_icon("MainPlay", "EditorIcons")); @@ -3129,10 +3125,6 @@ InspectorDock *EditorNode::get_inspector_dock() { return inspector_dock; } -LiveViewDock *EditorNode::get_live_view_dock() { - - return live_view_dock; -} void EditorNode::_instance_request(const Vector &p_files) { @@ -3225,7 +3217,6 @@ void EditorNode::notify_child_process_exited() { _menu_option_confirm(RUN_STOP, false); stop_button->set_pressed(false); editor_run.stop(); - live_view_dock->stop(); } void EditorNode::add_io_error(const String &p_error) { @@ -5699,7 +5690,6 @@ EditorNode::EditorNode() { scene_tree_dock = memnew(SceneTreeDock(this, scene_root, editor_selection, editor_data)); inspector_dock = memnew(InspectorDock(this, editor_data)); - live_view_dock = memnew(LiveViewDock); import_dock = memnew(ImportDock); node_dock = memnew(NodeDock); @@ -5720,21 +5710,18 @@ EditorNode::EditorNode() { dock_slot[DOCK_SLOT_LEFT_BR]->add_child(filesystem_dock); dock_slot[DOCK_SLOT_LEFT_BR]->set_tab_title(filesystem_dock->get_index(), TTR("FileSystem")); - // Inspector: Right + // Inspector: Full height right dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(inspector_dock); dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(inspector_dock->get_index(), TTR("Inspector")); - // Node: Right, behind Inspector + // Node: Full height right, behind Inspector dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(node_dock); dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(node_dock->get_index(), TTR("Node")); - // Game preview: Bottom right - dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(live_view_dock); - dock_slot[DOCK_SLOT_RIGHT_BL]->set_tab_title(live_view_dock->get_index(), TTR("LiveView")); - // Hide unused dock slots and vsplits dock_slot[DOCK_SLOT_LEFT_UL]->hide(); dock_slot[DOCK_SLOT_LEFT_BL]->hide(); + dock_slot[DOCK_SLOT_RIGHT_BL]->hide(); dock_slot[DOCK_SLOT_RIGHT_UR]->hide(); dock_slot[DOCK_SLOT_RIGHT_BR]->hide(); left_l_vsplit->hide(); @@ -5753,12 +5740,9 @@ EditorNode::EditorNode() { default_layout->set_value(docks_section, "dock_3", "Scene,Import"); default_layout->set_value(docks_section, "dock_4", "FileSystem"); default_layout->set_value(docks_section, "dock_5", "Inspector,Node"); - default_layout->set_value(docks_section, "dock_6", "LiveView"); - default_layout->set_value(docks_section, "dock_split_1", 0); - default_layout->set_value(docks_section, "dock_split_2", 0); - default_layout->set_value(docks_section, "dock_split_3", 160 * EDSCALE); - default_layout->set_value(docks_section, "dock_split_4", 0); + for (int i = 0; i < vsplits.size(); i++) + default_layout->set_value(docks_section, "dock_split_" + itos(i + 1), 0); default_layout->set_value(docks_section, "dock_hsplit_1", 0); default_layout->set_value(docks_section, "dock_hsplit_2", 70 * EDSCALE); default_layout->set_value(docks_section, "dock_hsplit_3", -70 * EDSCALE); diff --git a/editor/editor_node.h b/editor/editor_node.h index 3fcf20d7967..267c70c7737 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -94,7 +94,6 @@ typedef void (*EditorPluginInitializeCallback)(); typedef bool (*EditorBuildCallback)(); class EditorPluginList; -class LiveViewDock; class EditorNode : public Node { @@ -272,7 +271,6 @@ private: PopupMenu *recent_scenes; SceneTreeDock *scene_tree_dock; InspectorDock *inspector_dock; - LiveViewDock *live_view_dock; NodeDock *node_dock; ImportDock *import_dock; FileSystemDock *filesystem_dock; @@ -715,7 +713,6 @@ public: ImportDock *get_import_dock(); SceneTreeDock *get_scene_tree_dock(); InspectorDock *get_inspector_dock(); - LiveViewDock *get_live_view_dock(); static UndoRedo *get_undo_redo() { return &singleton->editor_data.get_undo_redo(); } EditorSelection *get_editor_selection() { return editor_selection; } diff --git a/editor/live_view.cpp b/editor/live_view.cpp deleted file mode 100644 index 951d7dd5b68..00000000000 --- a/editor/live_view.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/*************************************************************************/ -/* live_view.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "editor/live_view.h" -#include "core/os/shared_mem_access.h" -#include "editor/script_editor_debugger.h" -#include "scene/main/scene_tree.h" -#include "scene/main/viewport.h" - -void LiveViewDock::_notification(int p_what) { - - switch (p_what) { - case NOTIFICATION_PROCESS: { - - if (!is_visible_in_tree()) { - waiting = false; - break; - } - if (waiting) { - break; - } - - ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger(); - if (sed) { - Array msg; - msg.push_back("request_framebuffer"); - if (sed->send_message(msg)) { - waiting = true; - } - } - } break; - case NOTIFICATION_VISIBILITY_CHANGED: { - - if (!is_visible_in_tree()) { - waiting = false; - } - } break; - } -} - -void LiveViewDock::start() { - - fb_data->open - - set_process(true); - waiting = false; -} - -void LiveViewDock::stop() { - - fb_data->close(); - - set_process(false); - waiting = false; -} - -void LiveViewDock::update() { - - if (!waiting) { - return; - } - - if (!fb_data->is_open()) { - if (fb_data->open() != OK) { - return; - } - } - - const uint32_t *data = (uint32_t *)fb_data->lock(); - if (data) { - - int width = data[0]; - int height = data[1]; - Image::Format format = (Image::Format)data[2]; - - int data_size = data[3]; - PoolByteArray pixel_data; - pixel_data.resize(data_size); - { - PoolByteArray::Write w = pixel_data.write(); - memcpy(w.ptr(), &data[4], data_size); - } - - Ref img = memnew(Image); - img->create(width, height, false, format, pixel_data); - - Ref tex = get_texture(); - // Create if no texture or recreate if size or format changed - if (!tex.is_valid() || - tex->get_width() != width || - tex->get_height() != height || - tex->get_data()->get_format() != format) { - - tex = Ref(memnew(ImageTexture)); - tex->create(width, height, format, Texture::FLAG_FILTER); - set_texture(tex); - } - - tex->set_data(img); - - fb_data->unlock(); - } - - waiting = false; -} - -LiveViewDock::LiveViewDock() : - waiting(false), - fb_data(SharedMemAccess::create("godot_live_view")) { - - fb_data->open(1); - fb_data->close(); - - set_expand(true); - set_stretch_mode(STRETCH_KEEP_ASPECT_CENTERED); - - set_name("LiveView"); -} - -LiveViewDock::~LiveViewDock() { - - memdelete(fb_data); -} - -void LiveViewDebugHelper::_debugger_request_framebuffer(void *user_data) { - - Ref vp_texture = SceneTree::get_singleton()->get_root()->get_texture(); - Ref framebuffer = vp_texture->get_data(); - - SharedMemAccess *fb_data = SharedMemAccess::create("godot_live_view"); - fb_data-> - - uint32_t data_size = framebuffer->get_data().size(); - - Array result; - result.append(framebuffer->get_width()); - result.append(framebuffer->get_height()); - result.append(framebuffer->get_format()); - result.append(framebuffer->get_data().size()); - result.append(framebuffer->get_data()); - - ScriptDebugger::get_singleton()->send_message("framebuffer", result); -} diff --git a/editor/live_view.h b/editor/live_view.h deleted file mode 100644 index be0b61d0871..00000000000 --- a/editor/live_view.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************/ -/* live_view.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef LIVE_VIEW_H -#define LIVE_VIEW_H - -#include "scene/gui/texture_rect.h" - -class SharedMemAccess; - -class LiveViewDock : public TextureRect { - - GDCLASS(LiveViewDock, TextureRect); - - bool waiting; - SharedMemAccess *fb_data; - -protected: - void _notification(int p_what); - -public: - void start(); - void stop(); - void update(); - - LiveViewDock(); - ~LiveViewDock(); -}; - -class LiveViewDebugHelper { -public: - static void _debugger_request_framebuffer(void *user_data); -}; - -#endif // LIVE_VIEW_H diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 160832305a0..dda46d2414b 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -33,7 +33,6 @@ #include "core/io/marshalls.h" #include "core/project_settings.h" #include "core/ustring.h" -#include "editor/live_view.h" #include "editor_node.h" #include "editor_profiler.h" #include "editor_settings.h" @@ -460,10 +459,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da le_clear->set_disabled(false); le_set->set_disabled(false); - } else if (p_msg == "message:framebuffer") { - - EditorNode::get_singleton()->get_live_view_dock()->update(); - } else if (p_msg == "message:inspect_object") { ScriptEditorDebuggerInspectedObject *debugObj = NULL; @@ -1685,15 +1680,6 @@ void ScriptEditorDebugger::live_debug_reparent_node(const NodePath &p_at, const } } -bool ScriptEditorDebugger::send_message(const Array &p_message) { - - if (!connection.is_valid()) { - return false; - } - ppeer->put_var(p_message); - return true; -} - void ScriptEditorDebugger::set_breakpoint(const String &p_path, int p_line, bool p_enabled) { if (connection.is_valid()) { diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h index 195462090c0..fb1545559c4 100644 --- a/editor/script_editor_debugger.h +++ b/editor/script_editor_debugger.h @@ -230,8 +230,6 @@ public: void set_breakpoint(const String &p_path, int p_line, bool p_enabled); - bool send_message(const Array &p_message); - void update_live_edit_root(); void set_hide_on_stop(bool p_hide); diff --git a/main/main.cpp b/main/main.cpp index 517e71ff764..0871b123380 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -75,7 +75,6 @@ #include "editor/doc/doc_data_class_path.gen.h" #include "editor/editor_node.h" #include "editor/editor_settings.h" -#include "editor/live_view.h" #include "editor/project_manager.h" #endif @@ -812,10 +811,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } #ifdef TOOLS_ENABLED - if (script_debugger) { - script_debugger->set_request_framebuffer_message_func(LiveViewDebugHelper::_debugger_request_framebuffer, NULL); - } - if (editor) { packed_data->set_disabled(true); globals->set_disable_feature_overrides(true); diff --git a/platform/x11/detect.py b/platform/x11/detect.py index c36013a31aa..b5ad59e60a5 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -293,7 +293,7 @@ def configure(env): env.Append(CPPPATH=['#platform/x11']) env.Append(CPPFLAGS=['-DX11_ENABLED', '-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED']) - env.Append(LIBS=['GL', 'pthread', 'rt']) + env.Append(LIBS=['GL', 'pthread']) if (platform.system() == "Linux"): env.Append(LIBS=['dl'])