1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

[HTML5] Add JavaScriptToolsEditorPlugin.

A new editor plugin, specific to HTML5, that provide some extra features
needed to make the editor usable on that platform.

For now, it adds a "Download project sources" option in the "Tool" menu,
so the user can download the work done as a zip file (from the browser
storage).
This commit is contained in:
Fabio Alessandrelli
2020-09-17 18:01:36 +02:00
parent 294e9752bd
commit 55f04952c5
4 changed files with 158 additions and 6 deletions

View File

@@ -31,30 +31,28 @@
#include "api.h"
#include "core/engine.h"
#include "javascript_eval.h"
#include "javascript_tools_editor_plugin.h"
static JavaScript *javascript_eval;
void register_javascript_api() {
JavaScriptToolsEditorPlugin::initialize();
ClassDB::register_virtual_class<JavaScript>();
javascript_eval = memnew(JavaScript);
Engine::get_singleton()->add_singleton(Engine::Singleton("JavaScript", javascript_eval));
}
void unregister_javascript_api() {
memdelete(javascript_eval);
}
JavaScript *JavaScript::singleton = NULL;
JavaScript *JavaScript::get_singleton() {
return singleton;
}
JavaScript::JavaScript() {
ERR_FAIL_COND_MSG(singleton != NULL, "JavaScript singleton already exist.");
singleton = this;
}
@@ -62,13 +60,11 @@ JavaScript::JavaScript() {
JavaScript::~JavaScript() {}
void JavaScript::_bind_methods() {
ClassDB::bind_method(D_METHOD("eval", "code", "use_global_execution_context"), &JavaScript::eval, DEFVAL(false));
}
#if !defined(JAVASCRIPT_ENABLED) || !defined(JAVASCRIPT_EVAL_ENABLED)
Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) {
return Variant();
}
#endif