mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +00:00
Allow adding custom export platforms using scripts / GDExtension.
This commit is contained in:
parent
db24ed4ead
commit
07e986f728
36 changed files with 1668 additions and 184 deletions
|
@ -578,8 +578,8 @@ void ScriptEditor::_clear_breakpoints() {
|
|||
script_editor_cache->get_sections(&cached_editors);
|
||||
for (const String &E : cached_editors) {
|
||||
Array breakpoints = _get_cached_breakpoints_for_script(E);
|
||||
for (int i = 0; i < breakpoints.size(); i++) {
|
||||
EditorDebuggerNode::get_singleton()->set_breakpoint(E, (int)breakpoints[i] + 1, false);
|
||||
for (int breakpoint : breakpoints) {
|
||||
EditorDebuggerNode::get_singleton()->set_breakpoint(E, (int)breakpoint + 1, false);
|
||||
}
|
||||
|
||||
if (breakpoints.size() > 0) {
|
||||
|
@ -1820,7 +1820,8 @@ void ScriptEditor::notify_script_changed(const Ref<Script> &p_script) {
|
|||
emit_signal(SNAME("editor_script_changed"), p_script);
|
||||
}
|
||||
|
||||
void ScriptEditor::get_breakpoints(List<String> *p_breakpoints) {
|
||||
Vector<String> ScriptEditor::_get_breakpoints() {
|
||||
Vector<String> ret;
|
||||
HashSet<String> loaded_scripts;
|
||||
for (int i = 0; i < tab_container->get_tab_count(); i++) {
|
||||
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
|
||||
|
@ -1829,19 +1830,19 @@ void ScriptEditor::get_breakpoints(List<String> *p_breakpoints) {
|
|||
}
|
||||
|
||||
Ref<Script> scr = se->get_edited_resource();
|
||||
if (scr == nullptr) {
|
||||
if (scr.is_null()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String base = scr->get_path();
|
||||
loaded_scripts.insert(base);
|
||||
if (base.begins_with("local://") || base.is_empty()) {
|
||||
if (base.is_empty() || base.begins_with("local://")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
PackedInt32Array bpoints = se->get_breakpoints();
|
||||
for (int j = 0; j < bpoints.size(); j++) {
|
||||
p_breakpoints->push_back(base + ":" + itos((int)bpoints[j] + 1));
|
||||
for (int32_t bpoint : bpoints) {
|
||||
ret.push_back(base + ":" + itos((int)bpoint + 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1854,8 +1855,49 @@ void ScriptEditor::get_breakpoints(List<String> *p_breakpoints) {
|
|||
}
|
||||
|
||||
Array breakpoints = _get_cached_breakpoints_for_script(E);
|
||||
for (int i = 0; i < breakpoints.size(); i++) {
|
||||
p_breakpoints->push_back(E + ":" + itos((int)breakpoints[i] + 1));
|
||||
for (int breakpoint : breakpoints) {
|
||||
ret.push_back(E + ":" + itos((int)breakpoint + 1));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ScriptEditor::get_breakpoints(List<String> *p_breakpoints) {
|
||||
HashSet<String> loaded_scripts;
|
||||
for (int i = 0; i < tab_container->get_tab_count(); i++) {
|
||||
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
|
||||
if (!se) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Ref<Script> scr = se->get_edited_resource();
|
||||
if (scr.is_null()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String base = scr->get_path();
|
||||
loaded_scripts.insert(base);
|
||||
if (base.is_empty() || base.begins_with("local://")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
PackedInt32Array bpoints = se->get_breakpoints();
|
||||
for (int32_t bpoint : bpoints) {
|
||||
p_breakpoints->push_back(base + ":" + itos((int)bpoint + 1));
|
||||
}
|
||||
}
|
||||
|
||||
// Load breakpoints that are in closed scripts.
|
||||
List<String> cached_editors;
|
||||
script_editor_cache->get_sections(&cached_editors);
|
||||
for (const String &E : cached_editors) {
|
||||
if (loaded_scripts.has(E)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Array breakpoints = _get_cached_breakpoints_for_script(E);
|
||||
for (int breakpoint : breakpoints) {
|
||||
p_breakpoints->push_back(E + ":" + itos((int)breakpoint + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2944,8 +2986,8 @@ void ScriptEditor::_files_moved(const String &p_old_file, const String &p_new_fi
|
|||
|
||||
// If Script, update breakpoints with debugger.
|
||||
Array breakpoints = _get_cached_breakpoints_for_script(p_new_file);
|
||||
for (int i = 0; i < breakpoints.size(); i++) {
|
||||
int line = (int)breakpoints[i] + 1;
|
||||
for (int breakpoint : breakpoints) {
|
||||
int line = (int)breakpoint + 1;
|
||||
EditorDebuggerNode::get_singleton()->set_breakpoint(p_old_file, line, false);
|
||||
if (!p_new_file.begins_with("local://") && ResourceLoader::exists(p_new_file, "Script")) {
|
||||
EditorDebuggerNode::get_singleton()->set_breakpoint(p_new_file, line, true);
|
||||
|
@ -2969,8 +3011,8 @@ void ScriptEditor::_file_removed(const String &p_removed_file) {
|
|||
// Check closed.
|
||||
if (script_editor_cache->has_section(p_removed_file)) {
|
||||
Array breakpoints = _get_cached_breakpoints_for_script(p_removed_file);
|
||||
for (int i = 0; i < breakpoints.size(); i++) {
|
||||
EditorDebuggerNode::get_singleton()->set_breakpoint(p_removed_file, (int)breakpoints[i] + 1, false);
|
||||
for (int breakpoint : breakpoints) {
|
||||
EditorDebuggerNode::get_singleton()->set_breakpoint(p_removed_file, (int)breakpoint + 1, false);
|
||||
}
|
||||
script_editor_cache->erase_section(p_removed_file);
|
||||
}
|
||||
|
@ -3425,8 +3467,8 @@ void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) {
|
|||
}
|
||||
|
||||
Array breakpoints = _get_cached_breakpoints_for_script(E);
|
||||
for (int i = 0; i < breakpoints.size(); i++) {
|
||||
EditorDebuggerNode::get_singleton()->set_breakpoint(E, (int)breakpoints[i] + 1, true);
|
||||
for (int breakpoint : breakpoints) {
|
||||
EditorDebuggerNode::get_singleton()->set_breakpoint(E, (int)breakpoint + 1, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3972,6 +4014,7 @@ void ScriptEditor::_bind_methods() {
|
|||
ClassDB::bind_method("_help_tab_goto", &ScriptEditor::_help_tab_goto);
|
||||
ClassDB::bind_method("get_current_editor", &ScriptEditor::_get_current_editor);
|
||||
ClassDB::bind_method("get_open_script_editors", &ScriptEditor::_get_open_script_editors);
|
||||
ClassDB::bind_method("get_breakpoints", &ScriptEditor::_get_breakpoints);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("register_syntax_highlighter", "syntax_highlighter"), &ScriptEditor::register_syntax_highlighter);
|
||||
ClassDB::bind_method(D_METHOD("unregister_syntax_highlighter", "syntax_highlighter"), &ScriptEditor::unregister_syntax_highlighter);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue