mirror of
https://github.com/godotengine/godot.git
synced 2025-10-31 21:51:22 +00:00
Merge pull request #16893 from GodotExplorer/debugger-improvement-3
Save runtime node as scene from remote scene tree.
This commit is contained in:
commit
80b9edf0f6
4 changed files with 69 additions and 1 deletions
|
|
@ -37,6 +37,7 @@
|
|||
#include "os/os.h"
|
||||
#include "project_settings.h"
|
||||
#include "scene/main/node.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
|
||||
void ScriptDebuggerRemote::_send_video_memory() {
|
||||
|
||||
|
|
@ -148,6 +149,16 @@ void ScriptDebuggerRemote::_put_variable(const String &p_name, const Variant &p_
|
|||
}
|
||||
}
|
||||
|
||||
void ScriptDebuggerRemote::_save_node(ObjectID id, const String &p_path) {
|
||||
|
||||
Node *node = Object::cast_to<Node>(ObjectDB::get_instance(id));
|
||||
ERR_FAIL_COND(!node);
|
||||
|
||||
Ref<PackedScene> ps = memnew(PackedScene);
|
||||
ps->pack(node);
|
||||
ResourceSaver::save(p_path, ps);
|
||||
}
|
||||
|
||||
void ScriptDebuggerRemote::debug(ScriptLanguage *p_script, bool p_can_continue) {
|
||||
|
||||
//this function is called when there is a debugger break (bug on script)
|
||||
|
|
@ -322,6 +333,8 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script, bool p_can_continue)
|
|||
else
|
||||
remove_breakpoint(cmd[2], cmd[1]);
|
||||
|
||||
} else if (command == "save_node") {
|
||||
_save_node(cmd[1], cmd[2]);
|
||||
} else {
|
||||
_parse_live_edit(cmd);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue