Revert accidental commits
This reverts commitfb37284c02
. This reverts commit4db0f51b9a
.
This commit is contained in:
parent
4db0f51b9a
commit
9c3ddf05cb
16 changed files with 6 additions and 662 deletions
|
@ -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() {
|
||||
}
|
|
@ -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
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<FileAccessUnix>(FileAccess::ACCESS_RESOURCES);
|
||||
FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_USERDATA);
|
||||
FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_FILESYSTEM);
|
||||
|
|
|
@ -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 <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
//#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
//#include <sys/mman.h>
|
||||
//#include <sys/stat.h>
|
||||
|
||||
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
|
|
@ -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
|
|
@ -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<String> &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);
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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<Image> img = memnew(Image);
|
||||
img->create(width, height, false, format, pixel_data);
|
||||
|
||||
Ref<ImageTexture> 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<ImageTexture>(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<ViewportTexture> vp_texture = SceneTree::get_singleton()->get_root()->get_texture();
|
||||
Ref<Image> 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);
|
||||
}
|
|
@ -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
|
|
@ -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()) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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'])
|
||||
|
|
Loading…
Reference in a new issue