From 256ba62e05d8e6a0a0a7722eff7aff595c414db6 Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Fri, 28 Mar 2025 03:05:46 +1100 Subject: [PATCH 1/6] fix: ensure TScopedPointer lock is released when reassigned w/ move --- internal/jsb_sarray.h | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/jsb_sarray.h b/internal/jsb_sarray.h index db925357..e51d4b9a 100644 --- a/internal/jsb_sarray.h +++ b/internal/jsb_sarray.h @@ -142,6 +142,7 @@ namespace jsb::internal { if (this != &p_other) { + if (container_) container_->unlock_address(); container_ = p_other.container_; ptr_ = p_other.ptr_; p_other.container_ = nullptr; From 3e6c145ba2ff85d0f9b09e6e0c96d26162a15355 Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Fri, 28 Mar 2025 03:15:55 +1100 Subject: [PATCH 2/6] fix: exported properties no longer leak into the base class. feat: inherited properties now class categorized in the Editor. Previously sub-classes were reusing the same [[ClassProperties]] and [[ClassSignals]] as super classes. Thus sub-classes were exporting properties against super-classes. This also meant that classes with a shared parent were receiving each others' properties. Each class no longer looks up the prototype chain for these objects. Consequently, to ensure properties are exported and appear in the Editor, we now recurse in a similar fashion to GDScript. Fortunately, we don't need to worry about the cycle detection logic that GDScript implements, since TypeScript handles this for us and cycles won't compile. Added benefit is now that properties appear in the editor categorized appropriately by class. --- bridge/jsb_bridge_module_loader.cpp | 36 ++++++++++++++------------ bridge/jsb_class_info.cpp | 3 --- weaver/jsb_script.cpp | 39 ++++++++++++++++++++++------- weaver/jsb_script.h | 2 +- 4 files changed, 51 insertions(+), 29 deletions(-) diff --git a/bridge/jsb_bridge_module_loader.cpp b/bridge/jsb_bridge_module_loader.cpp index ecb02515..215f63f1 100644 --- a/bridge/jsb_bridge_module_loader.cpp +++ b/bridge/jsb_bridge_module_loader.cpp @@ -305,24 +305,27 @@ namespace jsb v8::Local target = info[0].As(); v8::Local details = info[1].As(); + jsb_check(target->IsObject()); + jsb_check(details->IsObject()); + Environment* environment = Environment::wrap(isolate); v8::Local symbol = jsb_symbol(environment, ClassProperties); v8::Local collection; - v8::Local val_test; uint32_t index; - if (v8::MaybeLocal maybe = target->Get(context, symbol); !maybe.ToLocal(&val_test) || val_test->IsUndefined()) + if (target->HasOwnProperty(context, symbol).ToChecked()) + { + v8::Local collection_val = target->Get(context, symbol).ToLocalChecked(); + jsb_check(collection_val->IsArray()); + collection = collection_val.As(); + index = collection->Length(); + } + else { index = 0; collection = v8::Array::New(isolate); jsb_quickjs_check(collection->IsArray()); target->Set(context, symbol, collection).Check(); } - else - { - jsb_check(val_test->IsArray()); - collection = val_test.As(); - index = collection->Length(); - } collection->Set(context, index, details).Check(); JSB_LOG(VeryVerbose, "script %s define property(export) %s", @@ -403,19 +406,20 @@ namespace jsb Environment* environment = Environment::wrap(isolate); v8::Local symbol = jsb_symbol(environment, ClassSignals); v8::Local collection; - v8::Local val_test; uint32_t index; - if (v8::MaybeLocal maybe = target->Get(context, symbol); !maybe.ToLocal(&val_test) || val_test->IsUndefined()) + if (target->HasOwnProperty(context, symbol).ToChecked()) { - index = 0; - collection = v8::Array::New(isolate); - target->Set(context, symbol, collection).Check(); + v8::Local collection_val = target->Get(context, symbol).ToLocalChecked(); + jsb_check(collection_val->IsArray()); + collection = collection_val.As(); + index = collection->Length(); } else { - jsb_check(val_test->IsArray()); - collection = val_test.As(); - index = collection->Length(); + index = 0; + collection = v8::Array::New(isolate); + jsb_quickjs_check(collection->IsArray()); + target->Set(context, symbol, collection).Check(); } collection->Set(context, index, signal).Check(); diff --git a/bridge/jsb_class_info.cpp b/bridge/jsb_class_info.cpp index 07e71f90..eead4367 100644 --- a/bridge/jsb_class_info.cpp +++ b/bridge/jsb_class_info.cpp @@ -180,7 +180,6 @@ namespace jsb // signals (@signal_) { v8::Local val_test; - //TODO does prototype chain introduce unexpected behaviour if signal is decalred in super class? if (prototype->Get(p_context, jsb_symbol(environment, ClassSignals)).ToLocal(&val_test) && val_test->IsArray()) { v8::Local collection = val_test.As(); @@ -205,9 +204,7 @@ namespace jsb // detect all exported properties (which annotated with @export_) { v8::Local val_test; - //TODO does prototype chain introduce unexpected behaviour if signal is decalred in super class? if (prototype->Get(p_context, jsb_symbol(environment, ClassProperties)).ToLocal(&val_test) && val_test->IsArray()) - // if (prototype->Get(p_context, jsb_symbol(environment, ClassProperties)).ToLocal(&val_test) && val_test->IsArray()) { const v8::Local collection = val_test.As(); const uint32_t len = collection->Length(); diff --git a/weaver/jsb_script.cpp b/weaver/jsb_script.cpp index 38d53f8c..ed467bd7 100644 --- a/weaver/jsb_script.cpp +++ b/weaver/jsb_script.cpp @@ -350,8 +350,6 @@ void GodotJSScript::get_script_signal_list(List* r_signals) const { if (!is_valid()) return; - //TODO include items from base class - for (const auto& it : script_class_info_.signals) { //TODO details? @@ -359,6 +357,11 @@ void GodotJSScript::get_script_signal_list(List* r_signals) const item.name = it.key; r_signals->push_back(item); } + + if (base.is_valid()) + { + base->get_script_signal_list(r_signals); + } } void GodotJSScript::get_script_method_list(List* p_list) const @@ -374,7 +377,7 @@ void GodotJSScript::get_script_method_list(List* p_list) const p_list->push_back(item); } - if (base.is_valid()) + if (base.is_valid() && base->is_valid()) { base->get_script_method_list(p_list); } @@ -385,8 +388,6 @@ void GodotJSScript::get_script_property_list(List* p_list) const ensure_module_loaded(); jsb_check(loaded_); - //TODO include items from base class - #ifdef TOOLS_ENABLED p_list->push_back(get_class_category()); #endif @@ -394,6 +395,11 @@ void GodotJSScript::get_script_property_list(List* p_list) const { p_list->push_back((PropertyInfo) it.value); } + + if (base.is_valid() && base->is_valid()) + { + base->get_script_property_list(p_list); + } } bool GodotJSScript::get_property_default_value(const StringName& p_property, Variant& r_value) const @@ -404,7 +410,10 @@ bool GodotJSScript::get_property_default_value(const StringName& p_property, Var r_value = it->value; return true; } - return false; + + return base.is_valid() && base->is_valid() + ? base->get_property_default_value(p_property, r_value) + : false; } #if GODOT_4_4_OR_NEWER @@ -591,18 +600,23 @@ void GodotJSScript::_update_exports_values(List& r_props, HashMap< { r_props.push_back(E); } + + if (base.is_valid() && base->is_valid()) + { + base->_update_exports_values(r_props, r_values); + } } -void GodotJSScript::_update_exports(PlaceHolderScriptInstance* p_instance_to_update, bool p_base_exports_changed) +bool GodotJSScript::_update_exports(PlaceHolderScriptInstance* p_instance_to_update) { // do not crash the engine if the script not loaded successfully if (!is_valid()) { JSB_LOG(Error, "the script not properly loaded (%s)", get_path()); - return; + return false; } - bool changed = p_base_exports_changed; + bool changed = false; if (source_changed_cache) { @@ -652,6 +666,11 @@ void GodotJSScript::_update_exports(PlaceHolderScriptInstance* p_instance_to_upd } } + if (base.is_valid() && base->_update_exports(p_instance_to_update)) + { + changed = true; + } + if ((changed || p_instance_to_update) && placeholders.size()) { List props; @@ -670,6 +689,8 @@ void GodotJSScript::_update_exports(PlaceHolderScriptInstance* p_instance_to_upd p_instance_to_update->update(props, values); } } + + return changed; } void GodotJSScript::reload_from_file() diff --git a/weaver/jsb_script.h b/weaver/jsb_script.h index 285b3a98..62824250 100644 --- a/weaver/jsb_script.h +++ b/weaver/jsb_script.h @@ -47,7 +47,7 @@ class GodotJSScript : public Script jsb_force_inline void ensure_module_loaded() const { if (jsb_unlikely(!loaded_)) const_cast(this)->load_module_immediately(); } jsb_force_inline bool _is_valid() const { return jsb::internal::VariantUtil::is_valid_name(script_class_info_.module_id); } - void _update_exports(PlaceHolderScriptInstance *p_instance_to_update, bool p_base_exports_changed = false); + bool _update_exports(PlaceHolderScriptInstance *p_instance_to_update); void _update_exports_values(List& r_props, HashMap& r_values); public: From a58ad4a6399ac00a1278b35d063339e8808061c3 Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Fri, 28 Mar 2025 03:23:29 +1100 Subject: [PATCH 3/6] fix: Improved TypeScript class matching regex. It was failing in the presence of generics which contain an extends clause e.g. export default class GameNode = {}> extends Node3D The regex will now look for the last extends on the line in order to detect the base class. This is only an improvement, it's not fool-proof and will fail if the base class has a generic that contains a conditional type expression. Since we only have access to PCRE2, this is probably the best we can do with just regex. --- weaver/jsb_script_language.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/weaver/jsb_script_language.cpp b/weaver/jsb_script_language.cpp index 32b599c2..8fbffb46 100644 --- a/weaver/jsb_script_language.cpp +++ b/weaver/jsb_script_language.cpp @@ -53,10 +53,10 @@ GodotJSScriptLanguage::GodotJSScriptLanguage() JSB_BENCHMARK_SCOPE(GodotJSScriptLanguage, Construct); jsb_check(!singleton_); singleton_ = this; - js_class_name_matcher1_ = RegEx::create_from_string(R"(\s*exports.default\s*=\s*class\s*(\w+)\s*extends\s*(\w+)\s*\{?)"); + js_class_name_matcher1_ = RegEx::create_from_string(R"(\s*exports.default\s*=\s*class\s*(\w+)\s+extends\s+(\w+))"); js_class_name_matcher2_ = RegEx::create_from_string(R"(\s*exports.default\s*=\s*(\w+)\s*;?)"); - ts_class_name_matcher_ = RegEx::create_from_string(R"(\s*export\s+default\s+class\s+(\w+)\s+extends\s+(\w+))"); - ts_class_name_tool_matcher_ = RegEx::create_from_string(R"(\s*@tool\s*\(\s*\)\s*\n*\s*export\s+default\s+class\s+(\w+)\s+extends\s+(\w+))"); + ts_class_name_matcher_ = RegEx::create_from_string(R"(\s*export\s+default\s+class\s+(\w+)[^\n]*(?:>|\s+)extends\s+(\w+))"); + ts_class_name_tool_matcher_ = RegEx::create_from_string(R"(\s*@tool\s*\(\s*\)\s*\n*\s*export\s+default\s+class\s+(\w+)[^\n]*(?:>|\s+)extends\s+(\w+))"); jsb::internal::StringNames::create(); } From 23affea830dccb05b06a50d987bfc6acb0e36954 Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Fri, 28 Mar 2025 03:36:57 +1100 Subject: [PATCH 4/6] fix: runtime script typechecking during build --- scripts/jsb.editor/tsconfig.json | 6 +++--- scripts/jsb.runtime/tsconfig.json | 2 +- scripts/jsb.static/tsconfig.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/jsb.editor/tsconfig.json b/scripts/jsb.editor/tsconfig.json index 248aeaae..cfaf222f 100644 --- a/scripts/jsb.editor/tsconfig.json +++ b/scripts/jsb.editor/tsconfig.json @@ -1,4 +1,5 @@ { + "include": ["src/**/*", "../typings/**/*"], "compilerOptions": { /* Visit https://aka.ms/tsconfig to read more about this file */ @@ -27,16 +28,15 @@ /* Modules */ "module": "AMD", /* Specify what module code is generated. */ "rootDir": "./src", /* Specify the root folder within your source files. */ - // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + //"moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ "typeRoots": [ /* Specify multiple folders that act like './node_modules/@types'. */ - "./typings", "./node_modules/@types" ], "types": [ - "node" + "node", ], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ diff --git a/scripts/jsb.runtime/tsconfig.json b/scripts/jsb.runtime/tsconfig.json index acbb2c7e..97f2c8bd 100644 --- a/scripts/jsb.runtime/tsconfig.json +++ b/scripts/jsb.runtime/tsconfig.json @@ -1,4 +1,5 @@ { + "include": ["src/**/*", "../typings/**/*"], "compilerOptions": { /* Visit https://aka.ms/tsconfig to read more about this file */ @@ -32,7 +33,6 @@ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ "typeRoots": [ /* Specify multiple folders that act like './node_modules/@types'. */ - "./typings", "./node_modules/@types" ], "types": [ diff --git a/scripts/jsb.static/tsconfig.json b/scripts/jsb.static/tsconfig.json index 4cbdd00d..3e63e1aa 100644 --- a/scripts/jsb.static/tsconfig.json +++ b/scripts/jsb.static/tsconfig.json @@ -1,4 +1,5 @@ { + "include": ["src/**/*", "../typings/**/*"], "compilerOptions": { /* Visit https://aka.ms/tsconfig to read more about this file */ @@ -32,7 +33,6 @@ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ "typeRoots": [ /* Specify multiple folders that act like './node_modules/@types'. */ - "./typings", "./node_modules/@types" ], "types": [ From 0b3544b447fa920b5aa6fcbdcd02ee77d12adecf Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Fri, 28 Mar 2025 04:00:02 +1100 Subject: [PATCH 5/6] feat: Improved type conversion error messages --- bridge/jsb_object_bindings.cpp | 16 +++++-- bridge/jsb_type_convert.cpp | 83 ++++++++++++++++++++++++++++++---- bridge/jsb_type_convert.h | 7 +++ 3 files changed, 92 insertions(+), 14 deletions(-) diff --git a/bridge/jsb_object_bindings.cpp b/bridge/jsb_object_bindings.cpp index 2c016071..1cccdcb6 100644 --- a/bridge/jsb_object_bindings.cpp +++ b/bridge/jsb_object_bindings.cpp @@ -228,7 +228,9 @@ namespace jsb : !TypeConvert::js_to_gd_var(isolate, context, info[index], args[index])) { // revert all constructors - const String error_message = jsb_errorf("bad argument: %d", index); + const String error_message = index < known_argc + ? jsb_errorf("Bad argument: %d. Unable to convert JS %s to Godot %s", index, TypeConvert::js_debug_typeof(isolate, info[index]), Variant::get_type_name(method_info.argument_types[index])) + : jsb_errorf("Bad argument: %d. Unable to convert JS %s", index, TypeConvert::js_debug_typeof(isolate, info[index])); while (index >= 0) { args[index--].~Variant(); } impl::Helper::throw_error(isolate, error_message); return; @@ -251,7 +253,8 @@ namespace jsb info.GetReturnValue().Set(jrval); return; } - jsb_throw(isolate, "failed to translate godot variant to v8 value"); + const String error_message = jsb_errorf("Failed to translate returned Godot %s to a JS value", Variant::get_type_name(crval.get_type())); + impl::Helper::throw_error(isolate, error_message); } void ObjectReflectBindingUtil::_godot_object_method(const v8::FunctionCallbackInfo& info) @@ -294,7 +297,7 @@ namespace jsb if (!TypeConvert::js_to_gd_var(isolate, context, info[index], type, args[index])) { // revert all constructors - const String error_message = jsb_errorf("bad argument: %d", index); + const String error_message = jsb_errorf("Failed to call: %s. Bad argument: %d. Unable to convert JS %s to Godot %s", method_bind->get_name(), index, TypeConvert::js_debug_typeof(isolate, info[index]), Variant::get_type_name(type)); while (index >= 0) { args[index--].~Variant(); } impl::Helper::throw_error(isolate, error_message); return; @@ -324,7 +327,8 @@ namespace jsb info.GetReturnValue().Set(jrval); return; } - jsb_throw(isolate, "failed to translate godot variant to v8 value"); + const String error_message = jsb_errorf("Failed to return from call: %s. Failed to translate returned Godot %s to a JS value", method_bind->get_name(), index, Variant::get_type_name(crval.get_type())); + impl::Helper::throw_error(isolate, error_message); } void ObjectReflectBindingUtil::_godot_object_get2(const v8::FunctionCallbackInfo& info) @@ -369,7 +373,9 @@ namespace jsb info.GetReturnValue().Set(jrval); return; } - jsb_throw(isolate, "failed to translate godot variant to v8 value"); + const String error_message = jsb_errorf("Failed to get property: %s. Failed to translate returned Godot %s to a JS value", + property_info.getter_func->get_name(), index, Variant::get_type_name(crval.get_type())); + impl::Helper::throw_error(isolate, error_message); } void ObjectReflectBindingUtil::_godot_object_set2(const v8::FunctionCallbackInfo& info) diff --git a/bridge/jsb_type_convert.cpp b/bridge/jsb_type_convert.cpp index 5acc69b5..00e27347 100644 --- a/bridge/jsb_type_convert.cpp +++ b/bridge/jsb_type_convert.cpp @@ -81,6 +81,63 @@ namespace jsb #endif } + String TypeConvert::js_debug_typeof(v8::Isolate* isolate, const v8::Local& p_jval) + { + if (p_jval.IsEmpty()) + { + return ""; + } + if (p_jval->IsUndefined()) + { + return "undefined"; + } + if (p_jval->IsNull()) + { + return "null"; + } + if (p_jval->IsBoolean()) + { + return "boolean"; + } + if (p_jval->IsNumber()) + { + return "number"; + } + if (p_jval->IsString()) + { + return "string"; + } + if (p_jval->IsObject()) + { + v8::Local object = p_jval.As(); + + if (is_variant(object)) + { + const Variant* variant = (Variant*) object->GetAlignedPointerFromInternalField(IF_Pointer); + return jsb_format("variant (%s)", Variant::get_type_name(variant->get_type())); + } + + v8::Local constructor_name = object->GetConstructorName(); + + if (constructor_name.IsEmpty()) + { + return "object"; + } + + return jsb_format("object (%s)", impl::Helper::to_string(isolate, constructor_name)); + } + if (p_jval->IsFunction()) + { + return "function"; + } + if (p_jval->IsArray()) + { + return "array"; + } + + return ""; + } + // translate js val into gd variant with an expected type bool TypeConvert::js_to_gd_var(v8::Isolate* isolate, const v8::Local& context, const v8::Local& p_jval, Variant::Type p_type, Variant& r_cvar) { @@ -92,7 +149,7 @@ namespace jsb r_cvar = p_jval.As()->Value(); return true; } - return false; + break; case Variant::INT: // strict? if (int64_t val; impl::Helper::to_int64(p_jval, val)) @@ -100,7 +157,7 @@ namespace jsb r_cvar = val; return true; } - return false; + break; case Variant::OBJECT: { if (!p_jval->IsObject()) @@ -111,12 +168,13 @@ namespace jsb r_cvar = (Object*) nullptr; return true; } - return false; + break; } const v8::Local self = p_jval.As(); + if (!TypeConvert::is_object(self)) { - return false; + break; } void* pointer = self->GetAlignedPointerFromInternalField(IF_Pointer); @@ -125,8 +183,12 @@ namespace jsb } case Variant::BOOL: // strict? - if (p_jval->IsBoolean()) { r_cvar = p_jval->BooleanValue(isolate); return true; } - return false; + if (p_jval->IsBoolean()) + { + r_cvar = p_jval->BooleanValue(isolate); + return true; + } + break; case Variant::STRING: if (p_jval->IsString()) { @@ -139,7 +201,7 @@ namespace jsb r_cvar = impl::Helper::to_string(isolate, p_jval); return true; } - return false; + break; case Variant::STRING_NAME: // cache the JSValue and StringName pair because the expected type is StringName if (p_jval->IsString()) @@ -199,12 +261,12 @@ namespace jsb if (!p_jval->IsObject()) { //TODO should auto convert a null/undefined value to a default (variant) counterpart? - return false; + break; } const v8::Local self = p_jval.As(); if (!is_variant(self)) { - return false; + break; } void* pointer = self->GetAlignedPointerFromInternalField(IF_Pointer); @@ -216,6 +278,9 @@ namespace jsb return js_to_gd_var(isolate, context, p_jval, r_cvar); default: return false; } + + JSB_LOG(Warning, "Failed to convert JS variable to Variant. Expected: %s. Found: %s", Variant::get_type_name(p_type), js_debug_typeof(isolate, p_jval)); + return false; } bool TypeConvert::gd_var_to_js(v8::Isolate* isolate, const v8::Local& context, const Variant& p_cvar, Variant::Type p_type, v8::Local& r_jval) diff --git a/bridge/jsb_type_convert.h b/bridge/jsb_type_convert.h index 3b2c359b..a6150e92 100644 --- a/bridge/jsb_type_convert.h +++ b/bridge/jsb_type_convert.h @@ -9,6 +9,13 @@ namespace jsb { struct TypeConvert { + /** + * Returns a string representation of a JavaScript type. For primitives, equivalent to the typeof operator in + * JS. For JS objects, we perform additional inspections and display if the object is an array, the Godot + * variant type, or the constructor name, when available. + */ + static String js_debug_typeof(v8::Isolate* isolate, const v8::Local& p_jval); + /** * Translate a Godot object into a javascript object. The type of `p_object_obj` will be automatically exposed to the context if not existed. * @param p_godot_obj non-null godot object pointer From 0f084e780b0b72c1d6c9f888b180deccbad89d87 Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Fri, 28 Mar 2025 04:13:56 +1100 Subject: [PATCH 6/6] feat: Ergonomics overhaul. Camel-case, TS types, codegen + more. - There's now a project setting which can be toggle to swap to a more idiomatic JS naming scheme for Godot bindings. We use camel and pascal case to more closely align with typical JavaScript/TypeScript conventions. For @Decorators we've gone with pascal case, which is used in libraries like Angular. Camel case is perhaps more popular, but pascal case allows us to avoid reserved names and thus we can cleanly write @Export, instead of needing to include the trailing underscore on @export_. - TypeScript types have been improved. Particularly Signal<> and Callable<>. Signal1, Signal2, etc. are now deprecated as are AnySignal and AnyCallable, since the Signal and Callable types now handle an arbitrary number of parameters. Importantly, Callable.bind(...) is now accurately typed, so you'll receive type errors when connecting to signals. - GArray and GDictionary now have a static .create() method which allows you to create nested data structures from literals and benefit from full type checking. When a GArray or GDictionary is expected as a property, a .proxy() can be provided in its place. - Partially worked around https://github.com/microsoft/TypeScript/issues/43826 whereby or proxied GArray and GDictionary always return proxied nested values, but will accept non-proxied values when mutating a property. Basically there's now GArrayReadProxy and GDictionaryReadProxy, these aren't runtime types, they're just TS types that make it easier to work with proxies. Under normal circumstances, users won't need to know they exist. - Codegen leveled up. Any TS module can now export a function named `codegen` with the type CodeGenHandler. This function will be called during codegen to allow users to optionally augment type generation involving user defined types. Consider for example the SceneNodes codegen which previously only knew how to handle Godot/native types in the scene hierarchy. When a user type was encountered, it'd write the native type, which is still useful, but it'd be nice to be able to include user types. The reason we don't by default is user types are not required to follow our generic parameter convention where each node is passed a Map argument. Let's see an example: export default class CardCollection extends GameNode the type above does not take a Map. Perhaps more interesting, it takes a different generic parameter, a CardNode. If we encounter a CardCollection script attached to a node in the scene somewhere GodotJS' internal codegen can't possibly know what that generic parameter ought to be. So we can help it out. In the same file where CardCollection is defined, we could provide a codegen handler like so: export const codegen: CodeGenHandler = rawRequest => { const request = rawRequest.proxy(); switch (request.type) { case CodeGenType.ScriptNodeTypeDescriptor: { const cardNodeScript = request.node.get('cardNodeScript'); return GDictionary.create({ type: DescriptorType.User, name: 'CardCollection', resource: 'res://src/card-collection.ts', arguments: GArray.create([ GDictionary.create({ type: DescriptorType.User, name: cardNodeScript?.getGlobalName() ?? 'CardNode', resource: cardNodeScript?.resourcePath ?? 'res://src/card-node.ts', }), ]), }); } } return undefined; }; Above we handle the codegen request to determine the node type of the provided `request.node`. What's *really* neat here is we don't need to hard-code that generic. We've instead exported a a configurable Script reference for use in the editor: @ExportObject(Script) cardNodeScript: Script = ResourceLoader.load('res://src/card-node.ts') as Script; So the codegen logic simply grabs the type exported from the chosen script provides it as a generic argument to CardCollection<>. One thing worth noting, your class does NOT need to be a @Tool. In the above example, CardCollection is not a @Tool, and hence the node script is not instantiated during codegen, which is why we've used `request.node.get('cardNodeScript')` rather than trying to access the property directly. That said, if you want, codegen can be combined with @Tool. Right now we only have the one type of codegen request. However, in my example above you may have noted I had to cast the return value of ResourceLoader.load() to a Script. That's another area that's ripe for codegen; string literal paths ought to result in a known resource type. If someone doesn't beat me to it, I'll contribute this too. - There's also a bunch of logging/error reporting improvements. --- bridge/jsb_bridge_helper.h | 2 +- bridge/jsb_bridge_module_loader.cpp | 1 + bridge/jsb_editor_utility_funcs.cpp | 114 +- bridge/jsb_environment.cpp | 21 +- bridge/jsb_environment.h | 16 +- bridge/jsb_godot_module_loader.cpp | 44 +- bridge/jsb_object_bindings.cpp | 84 +- bridge/jsb_primitive_bindings_reflect.cpp | 44 +- bridge/jsb_reflect_binding_util.h | 2 +- bridge/jsb_type_convert.cpp | 16 +- impl/v8/jsb_v8_class_builder.h | 12 + internal/jsb_internal.h | 1 + internal/jsb_naming_util.cpp | 320 +++ internal/jsb_naming_util.h | 87 + internal/jsb_settings.cpp | 8 + internal/jsb_settings.h | 2 + internal/jsb_string_names.cpp | 9 - internal/jsb_string_names.def.h | 6 + internal/jsb_string_names.h | 8 +- scripts/jsb.editor/src/jsb.editor.codegen.ts | 1184 ++++++++--- scripts/jsb.runtime/src/godot.annotations.ts | 167 +- scripts/jsb.runtime/src/jsb.core.ts | 4 +- scripts/jsb.runtime/src/jsb.inject.ts | 176 +- scripts/jsb.static/src/jsb.static.ts | 79 +- scripts/out/jsb.editor.bundle.d.ts | 12 +- scripts/out/jsb.editor.bundle.js | 714 ++----- scripts/out/jsb.editor.bundle.js.map | 2 +- scripts/out/jsb.runtime.bundle.d.ts | 178 +- scripts/out/jsb.runtime.bundle.js | 1854 ++++++++---------- scripts/out/jsb.runtime.bundle.js.map | 2 +- scripts/typings/godot.generated.d.ts | 831 +++++++- scripts/typings/godot.minimal.d.ts | 101 +- scripts/typings/godot.mix.d.ts | 308 ++- weaver-editor/jsb_editor_helper.cpp | 126 +- weaver-editor/jsb_editor_helper.h | 2 +- weaver/jsb_script.h | 2 + 36 files changed, 3933 insertions(+), 2606 deletions(-) create mode 100644 internal/jsb_naming_util.cpp create mode 100644 internal/jsb_naming_util.h diff --git a/bridge/jsb_bridge_helper.h b/bridge/jsb_bridge_helper.h index 0e74709f..1ca24771 100644 --- a/bridge/jsb_bridge_helper.h +++ b/bridge/jsb_bridge_helper.h @@ -35,7 +35,7 @@ namespace jsb const v8::Local enumeration = v8::Object::New(isolate); for (const KeyValue& kv : enum_values) { - const v8::Local name = impl::Helper::new_string(isolate, kv.key); + const v8::Local name = impl::Helper::new_string(isolate, internal::NamingUtil::get_enum_value_name(kv.key)); const v8::Local value = impl::Helper::new_integer(isolate, kv.value); enumeration->Set(context, name, value).Check(); // represents the value back to string for convenient uses, such as MyColor[MyColor.White] => 'White' diff --git a/bridge/jsb_bridge_module_loader.cpp b/bridge/jsb_bridge_module_loader.cpp index 215f63f1..9c3f7f27 100644 --- a/bridge/jsb_bridge_module_loader.cpp +++ b/bridge/jsb_bridge_module_loader.cpp @@ -456,6 +456,7 @@ namespace jsb #else jsb_obj->Set(context, impl::Helper::new_string_ascii(isolate, "DEBUG_ENABLED"), v8::Boolean::New(isolate, false)).Check(); #endif + jsb_obj->Set(context, impl::Helper::new_string_ascii(isolate, "CAMEL_CASE_BINDINGS_ENABLED"), v8::Boolean::New(isolate, internal::Settings::get_camel_case_bindings_enabled())).Check(); jsb_obj->Set(context, impl::Helper::new_string_ascii(isolate, "version"), impl::Helper::new_string(isolate, JSB_STRINGIFY(JSB_MAJOR_VERSION) "." JSB_STRINGIFY(JSB_MINOR_VERSION) "." JSB_STRINGIFY(JSB_PATCH_VERSION))).Check(); jsb_obj->Set(context, impl::Helper::new_string_ascii(isolate, "impl"), impl::Helper::new_string(isolate, JSB_IMPL_VERSION_STRING)).Check(); jsb_obj->Set(context, impl::Helper::new_string_ascii(isolate, "callable"), JSB_NEW_FUNCTION(context, _new_callable, {})).Check(); diff --git a/bridge/jsb_editor_utility_funcs.cpp b/bridge/jsb_editor_utility_funcs.cpp index 11df6b97..74728a37 100644 --- a/bridge/jsb_editor_utility_funcs.cpp +++ b/bridge/jsb_editor_utility_funcs.cpp @@ -85,11 +85,14 @@ namespace jsb set_field(isolate, context, obj, field_name, impl::Helper::new_integer(isolate, field_value)); } - void build_property_info(v8::Isolate* isolate, const v8::Local& context, const PropertyInfo& property_info, const v8::Local& object) + void build_property_info(v8::Isolate* isolate, const v8::Local& context, const PropertyInfo& property_info, const v8::Local& object, bool method) { - set_field(isolate, context, object, "name", property_info.name); + String name = method + ? internal::NamingUtil::get_parameter_name(property_info.name) + : internal::NamingUtil::get_member_name(property_info.name); + set_field(isolate, context, object, "name", name); set_field(isolate, context, object, "type", property_info.type); - set_field(isolate, context, object, "class_name", property_info.class_name); + set_field(isolate, context, object, "class_name", internal::NamingUtil::get_class_name(property_info.class_name)); set_field(isolate, context, object, "hint", property_info.hint); set_field(isolate, context, object, "hint_string", property_info.hint_string); set_field(isolate, context, object, "usage", property_info.usage); @@ -132,17 +135,17 @@ namespace jsb void build_property_info(v8::Isolate* isolate, const v8::Local& context, const StringName& property_name, const FPrimitiveGetSetInfo& property_info, const v8::Local& object) { - set_field(isolate, context, object, "name", property_name); + set_field(isolate, context, object, "name", internal::NamingUtil::get_member_name(property_name)); set_field(isolate, context, object, "type", property_info.type); } void build_property_info(v8::Isolate* isolate, const v8::Local& context, const StringName& property_name, const ClassDB::PropertySetGet& getset_info, const v8::Local& object) { - set_field(isolate, context, object, "name", property_name); + set_field(isolate, context, object, "name", internal::NamingUtil::get_member_name(property_name)); set_field(isolate, context, object, "type", getset_info.type); set_field(isolate, context, object, "index", getset_info.index); - set_field(isolate, context, object, "setter", getset_info.setter); - set_field(isolate, context, object, "getter", getset_info.getter); + set_field(isolate, context, object, "setter", internal::NamingUtil::get_member_name(getset_info.setter)); + set_field(isolate, context, object, "getter", internal::NamingUtil::get_member_name(getset_info.getter)); } void build_constructor_info(v8::Isolate* isolate, const v8::Local& context, const FConstructorInfo& constructor_info, const v8::Local& object) @@ -153,7 +156,7 @@ namespace jsb { const FArgumentInfo& argument_info = constructor_info.arguments[index]; v8::Local arg_obj = v8::Object::New(isolate); - set_field(isolate, context, arg_obj, "name", argument_info.name); + set_field(isolate, context, arg_obj, "name", internal::NamingUtil::get_parameter_name(argument_info.name)); set_field(isolate, context, arg_obj, "type", argument_info.type); args_obj->Set(context, index, arg_obj).Check(); } @@ -163,7 +166,7 @@ namespace jsb void build_method_info(v8::Isolate* isolate, const v8::Local& context, MethodBind const* method_bind, const v8::Local& object) { set_field(isolate, context, object, "id", method_bind->get_method_id()); - set_field(isolate, context, object, "name", method_bind->get_name()); + set_field(isolate, context, object, "name", internal::NamingUtil::get_member_name(method_bind->get_name())); set_field(isolate, context, object, "hint_flags", method_bind->get_hint_flags()); set_field(isolate, context, object, "is_static", method_bind->is_static()); set_field(isolate, context, object, "is_const", method_bind->is_const()); @@ -175,7 +178,7 @@ namespace jsb { const PropertyInfo& return_info = method_bind->get_return_info(); v8::Local property_info_obj = v8::Object::New(isolate); - build_property_info(isolate, context, return_info, property_info_obj); + build_property_info(isolate, context, return_info, property_info_obj, true); set_field(isolate, context, object, "return_", property_info_obj); } @@ -186,7 +189,7 @@ namespace jsb { const PropertyInfo& arg_info = method_bind->get_argument_info(index); v8::Local property_info_obj = v8::Object::New(isolate); - build_property_info(isolate, context, arg_info, property_info_obj); + build_property_info(isolate, context, arg_info, property_info_obj, true); args_obj->Set(context, index, property_info_obj).Check(); } set_field(isolate, context, object, "args_", args_obj); @@ -220,7 +223,7 @@ namespace jsb void build_method_info(v8::Isolate* isolate, const v8::Local& context, const MethodInfo& method_info, bool has_return_value, const v8::Local& object) { set_field(isolate, context, object, "id", method_info.id); - set_field(isolate, context, object, "name", method_info.name); + set_field(isolate, context, object, "name", internal::NamingUtil::get_member_name(method_info.name)); set_field(isolate, context, object, "hint_flags", method_info.flags); set_field(isolate, context, object, "is_static", method_info.flags & METHOD_FLAG_STATIC); set_field(isolate, context, object, "is_const", method_info.flags & METHOD_FLAG_CONST); @@ -233,7 +236,7 @@ namespace jsb { const PropertyInfo& return_info = method_info.return_val; v8::Local property_info_obj = v8::Object::New(isolate); - build_property_info(isolate, context, return_info, property_info_obj); + build_property_info(isolate, context, return_info, property_info_obj, true); set_field(isolate, context, object, "return_", property_info_obj); } @@ -250,7 +253,7 @@ namespace jsb jsb_check(index < argument_num); const PropertyInfo& arg_info = *it; v8::Local property_info_obj = v8::Object::New(isolate); - build_property_info(isolate, context, arg_info, property_info_obj); + build_property_info(isolate, context, arg_info, property_info_obj, true); argument_types.write[index] = arg_info.type; args_obj->Set(context, index++, property_info_obj).Check(); } @@ -273,17 +276,32 @@ namespace jsb } } - void build_enum_info(v8::Isolate* isolate, const v8::Local& context, const ClassDB::ClassInfo::EnumInfo& enum_info, const v8::Local& object) + void build_enum_info(v8::Isolate* isolate, const v8::Local& context, const Variant::Type variant, const StringName &enum_name, const ClassDB::ClassInfo::EnumInfo& enum_info, const v8::Local& object) { - const int num = enum_info.constants.size(); - v8::Local elements_array = v8::Array::New(isolate, num); + v8::Local values_object = v8::Object::New(isolate); int index = 0; for (List::ConstIterator it = enum_info.constants.begin(); it != enum_info.constants.end(); ++it, ++index) { - const StringName& name = *it; - elements_array->Set(context, index, impl::Helper::new_string(isolate, name)).Check(); + const String name = internal::NamingUtil::get_enum_value_name(*it); + bool valid = true; + int value = Variant::get_enum_value(variant, enum_name, *it, &valid); + values_object->Set(context, impl::Helper::new_string(isolate, name), v8::Number::New(isolate, value)).Check(); } - set_field(isolate, context, object, "literals", elements_array); + set_field(isolate, context, object, "literals", values_object); + set_field(isolate, context, object, JSB_GET_FIELD_NAME_PRESET(enum_info, is_bitfield)); + } + + void build_enum_info(v8::Isolate* isolate, const v8::Local& context, const HashMap& constants, const StringName &enum_name, const ClassDB::ClassInfo::EnumInfo& enum_info, const v8::Local& object) + { + v8::Local values_object = v8::Object::New(isolate); + int index = 0; + for (List::ConstIterator it = enum_info.constants.begin(); it != enum_info.constants.end(); ++it, ++index) + { + int64_t value = constants.get(*it); + const String name = internal::NamingUtil::get_enum_value_name(*it); + values_object->Set(context, impl::Helper::new_string(isolate, name), v8::Number::New(isolate, value)).Check(); + } + set_field(isolate, context, object, "literals", values_object); set_field(isolate, context, object, JSB_GET_FIELD_NAME_PRESET(enum_info, is_bitfield)); } @@ -302,8 +320,9 @@ namespace jsb jsb_check(class_it != ClassDB::classes.end()); const ClassDB::ClassInfo& class_info = class_it->value; - set_field(isolate, context, class_info_obj, "name", class_name); - set_field(isolate, context, class_info_obj, "super", class_info.inherits); + set_field(isolate, context, class_info_obj, "name", internal::NamingUtil::get_class_name(class_name)); + set_field(isolate, context, class_info_obj, "internal_name", class_name); + set_field(isolate, context, class_info_obj, "super", internal::NamingUtil::get_class_name(class_info.inherits)); #if JSB_EXCLUDE_GETSET_METHODS HashSet omitted_methods; @@ -327,7 +346,7 @@ namespace jsb v8::Local getset_info_obj = v8::Object::New(isolate); v8::Local property_info_obj = v8::Object::New(isolate); set_field(isolate, context, getset_info_obj, "info", property_info_obj); - build_property_info(isolate, context, property_info, property_info_obj); + build_property_info(isolate, context, property_info, property_info_obj, false); build_property_info(isolate, context, property_name, getset_info, getset_info_obj); properties_obj->Set(context, index++, getset_info_obj).Check(); if (pair.value.index >= 0) @@ -392,13 +411,14 @@ namespace jsb v8::Local enums_obj = v8::Array::New(isolate, (int) class_info.enum_map.size()); set_field(isolate, context, class_info_obj, "enums", enums_obj); int index = 0; + HashMap constants = class_info.constant_map; for (const KeyValue& pair : class_info.enum_map) { JSB_HANDLE_SCOPE(isolate); const ClassDB::ClassInfo::EnumInfo& enum_info = pair.value; v8::Local enum_info_obj = v8::Object::New(isolate); - set_field(isolate, context, enum_info_obj, "name", pair.key); - build_enum_info(isolate, context, enum_info, enum_info_obj); + set_field(isolate, context, enum_info_obj, "name", internal::NamingUtil::get_enum_name(pair.key)); + build_enum_info(isolate, context, constants, pair.key, enum_info, enum_info_obj); enums_obj->Set(context, index++, enum_info_obj).Check(); } } @@ -414,7 +434,7 @@ namespace jsb { JSB_HANDLE_SCOPE(isolate); v8::Local constant_info_obj = v8::Object::New(isolate); - set_field(isolate, context, constant_info_obj, "name", pair.key); + set_field(isolate, context, constant_info_obj, "name", internal::NamingUtil::get_constant_name(pair.key)); set_field(isolate, context, constant_info_obj, "value", pair.value); constants_obj->Set(context, index++, constant_info_obj).Check(); } @@ -431,7 +451,7 @@ namespace jsb { JSB_HANDLE_SCOPE(isolate); v8::Local signal_info_obj = v8::Object::New(isolate); - set_field(isolate, context, signal_info_obj, "name", pair.key); + set_field(isolate, context, signal_info_obj, "name", internal::NamingUtil::get_member_name(pair.key)); build_signal_info(isolate, context, pair.value, signal_info_obj); signals_obj->Set(context, index++, signal_info_obj).Check(); } @@ -518,7 +538,7 @@ namespace jsb { constexpr static Variant::Type TYPE = GetTypeInfo::VARIANT_TYPE; v8::Local class_info_obj = v8::Object::New(isolate); - set_field(isolate, context, class_info_obj, "name", Variant::get_type_name(TYPE)); + set_field(isolate, context, class_info_obj, "name", internal::NamingUtil::get_class_name(Variant::get_type_name(TYPE))); set_field(isolate, context, class_info_obj, "type", TYPE); if (Variant::has_indexing(TYPE)) { @@ -637,7 +657,7 @@ namespace jsb } v8::Local enum_info_obj = v8::Object::New(isolate); set_field(isolate, context, enum_info_obj, "name", enum_name); - build_enum_info(isolate, context, enum_info, enum_info_obj); + build_enum_info(isolate, context, TYPE, enum_name, enum_info, enum_info_obj); enums_obj->Set(context, index++, enum_info_obj).Check(); } } @@ -758,32 +778,20 @@ namespace jsb static void _get_classes(const v8::FunctionCallbackInfo& info) { v8::Isolate* isolate = info.GetIsolate(); + v8::HandleScope handle_scope(isolate); v8::Local context = isolate->GetCurrentContext(); - List list; - ClassDB::get_class_list(&list); - - v8::Local array = v8::Array::New(isolate); + List exposed_class_list = internal::NamingUtil::get_exposed_class_list(); + v8::Local array = v8::Array::New(isolate, exposed_class_list.size()); int index = 0; - const PackedStringArray ignored_classes = internal::Settings::get_ignored_classes(); - const int ignored_classes_num = (int) ignored_classes.size(); - HashSet ignored_classes_set(ignored_classes_num); - for (int i = 0; i < ignored_classes_num; ++i) - { - ignored_classes_set.insert(ignored_classes[i]); - } - for (auto it = list.begin(); it != list.end(); ++it) - { - if (ignored_classes_set.has(*it)) - { - JSB_LOG(Verbose, "ignoring %s", *it); - continue; - } + for (auto it = exposed_class_list.begin(); it != exposed_class_list.end(); ++it) + { JSB_HANDLE_SCOPE(isolate); array->Set(context, index++, build_class_info(isolate, context, *it)).Check(); } + info.GetReturnValue().Set(array); } @@ -810,15 +818,15 @@ namespace jsb v8::Local enum_obj = v8::Object::New(isolate); v8::Local values_obj = v8::Object::New(isolate); HashMap map; - const StringName expose_name = internal::StringNames::get_singleton().get_replaced_name(enum_name); - set_field(isolate, context, enum_obj, "name", expose_name); + const StringName exposed_enum_name = internal::NamingUtil::get_enum_name(enum_name); + set_field(isolate, context, enum_obj, "name", exposed_enum_name); set_field(isolate, context, enum_obj, "values", values_obj); CoreConstants::get_enum_values(enum_name, &map); for (const KeyValue& kv : map) { JSB_HANDLE_SCOPE(isolate); values_obj->Set(context, - impl::Helper::new_string(isolate, kv.key), + impl::Helper::new_string(isolate, internal::NamingUtil::get_enum_value_name(kv.key)), impl::Helper::new_integer(isolate, kv.value)).Check(); } array->Set(context, array_index++, enum_obj).Check(); @@ -885,11 +893,11 @@ namespace jsb if (!internal::VariantUtil::is_valid_name(singleton.class_name)) { singleton.class_name = class_name; - JSB_LOG(Verbose, "singleton (%s) hides the clas_name, restoring with '%s'", singleton.name, class_name); + JSB_LOG(Verbose, "singleton (%s) has a hidden class_name, restoring with '%s'", singleton.name, class_name); } - set_field(isolate, context, constant_obj, "name", singleton.name); - set_field(isolate, context, constant_obj, "class_name", singleton.class_name); + set_field(isolate, context, constant_obj, "name", internal::NamingUtil::get_class_name(singleton.name)); + set_field(isolate, context, constant_obj, "class_name", internal::NamingUtil::get_class_name(singleton.class_name)); set_field(isolate, context, constant_obj, "user_created", singleton.user_created); set_field(isolate, context, constant_obj, "editor_only", singleton.editor_only); array->Set(context, index, constant_obj).Check(); diff --git a/bridge/jsb_environment.cpp b/bridge/jsb_environment.cpp index 0ea68c48..798283fc 100644 --- a/bridge/jsb_environment.cpp +++ b/bridge/jsb_environment.cpp @@ -311,6 +311,21 @@ namespace jsb module_cache_.init(isolate_, cache_obj); } + // Populate StringNames replacement list so that classes can be lazily loaded by their exposed class name. + { + List exposed_class_list = internal::NamingUtil::get_exposed_class_list(); + + for (auto it = exposed_class_list.begin(); it != exposed_class_list.end(); ++it) + { + String exposed_name = internal::NamingUtil::get_class_name(*it); + + if (exposed_name != *it) + { + internal::StringNames::get_singleton().add_replacement(*it, exposed_name); + } + } + } + #if !JSB_WITH_WEB && !JSB_WITH_JAVASCRIPTCORE Worker::register_(context, global); #endif @@ -1308,12 +1323,14 @@ namespace jsb return nullptr; } - if (const NativeClassID* it = godot_classes_index_.getptr(p_class_info->name)) + String class_name = internal::NamingUtil::get_class_name(p_class_info->name); + + if (const NativeClassID* it = godot_classes_index_.getptr(class_name)) { if (r_class_id) *r_class_id = *it; NativeClassInfoPtr class_info = native_classes_.get_value_scoped(*it); JSB_LOG(VeryVerbose, "return cached native class %s (%d) addr:%s", class_info->name, *it, class_info.ptr()); - jsb_check(class_info->name == p_class_info->name); + jsb_check(internal::NamingUtil::get_class_name(class_info->name) == class_name); jsb_check(!class_info->clazz.IsEmpty()); return class_info; } diff --git a/bridge/jsb_environment.h b/bridge/jsb_environment.h index 56a776ea..43b78ab4 100644 --- a/bridge/jsb_environment.h +++ b/bridge/jsb_environment.h @@ -249,16 +249,24 @@ namespace jsb void add_class_register(const Variant::Type p_type, const ClassRegisterFunc p_func) { jsb_check(!internal::VariantUtil::is_valid_name(godot_primitive_map_[p_type])); - const StringName type_name = Variant::get_type_name(p_type); + const String original_name = Variant::get_type_name(p_type); + const StringName type_name = internal::NamingUtil::get_class_name(original_name); + + if (type_name != original_name) + { + internal::StringNames::get_singleton().add_replacement(original_name, type_name); + } + godot_primitive_map_[p_type] = type_name; add_class_register(type_name, p_func); } void add_class_register(const StringName& p_type_name, const ClassRegisterFunc p_func) { - jsb_check(internal::VariantUtil::is_valid_name(p_type_name)); - jsb_check(!class_register_map_.has(p_type_name)); - class_register_map_.insert(p_type_name, { {}, p_func }); + String name = internal::NamingUtil::get_class_name(p_type_name); + jsb_check(internal::VariantUtil::is_valid_name(name)); + jsb_check(!class_register_map_.has(name)); + class_register_map_.insert(name, { {}, p_func }); } //TODO temp, get C++ function pointer (include class methods) diff --git a/bridge/jsb_godot_module_loader.cpp b/bridge/jsb_godot_module_loader.cpp index ef431f0b..ae547214 100644 --- a/bridge/jsb_godot_module_loader.cpp +++ b/bridge/jsb_godot_module_loader.cpp @@ -30,16 +30,16 @@ namespace jsb "please use replaced name '%s' for '%s' in scripts (regenerate d.ts files)", p_type_name, internal::StringNames::get_singleton().get_replaced_name(p_type_name)); } - const StringName type_name = internal::StringNames::get_singleton().get_original_name(p_type_name); + const StringName original_name = internal::StringNames::get_singleton().get_original_name(p_type_name); //NOTE do not break the order in `GDScriptLanguage::init()` // (1) singletons have the top priority (in GDScriptLanguage::init, singletons will overwrite the globals slot even if a type/const has the same name) // check before getting to avoid error prints in `get_singleton_object` - if (Engine::get_singleton()->has_singleton(type_name)) - if (Object* gd_singleton = Engine::get_singleton()->get_singleton_object(type_name)) + if (Engine::get_singleton()->has_singleton(original_name)) + if (Object* gd_singleton = Engine::get_singleton()->get_singleton_object(original_name)) { - JSB_LOG(VeryVerbose, "exposing singleton object %s", (String) type_name); + JSB_LOG(VeryVerbose, "exposing singleton object %s", (String) original_name); if (v8::Local rval; TypeConvert::gd_obj_to_js(isolate, context, gd_singleton, rval) && !rval.IsEmpty()) { @@ -52,7 +52,7 @@ namespace jsb } // (2) (global) utility functions. - if (Variant::has_utility_function(type_name)) + if (Variant::has_utility_function(original_name)) { //TODO check static bindings at first, and dynamic bindings as a fallback @@ -62,19 +62,19 @@ namespace jsb env->get_variant_info_collection().utility_funcs.append({}); internal::FUtilityMethodInfo& method_info = env->get_variant_info_collection().utility_funcs.write[utility_func_index]; - const int argument_count = Variant::get_utility_function_argument_count(type_name); + const int argument_count = Variant::get_utility_function_argument_count(original_name); method_info.argument_types.resize(argument_count); for (int index = 0, num = argument_count; index < num; ++index) { - method_info.argument_types.write[index] = Variant::get_utility_function_argument_type(type_name, index); + method_info.argument_types.write[index] = Variant::get_utility_function_argument_type(original_name, index); } //NOTE currently, utility functions have no default argument. // method_info.default_arguments = ... - method_info.return_type = Variant::get_utility_function_return_type(type_name); - method_info.is_vararg = Variant::is_utility_function_vararg(type_name); - method_info.set_debug_name(type_name); - method_info.utility_func = Variant::get_validated_utility_function(type_name); - JSB_LOG(VeryVerbose, "expose godot utility function %s (%d)", type_name, utility_func_index); + method_info.return_type = Variant::get_utility_function_return_type(original_name); + method_info.is_vararg = Variant::is_utility_function_vararg(original_name); + method_info.set_debug_name(internal::NamingUtil::get_member_name(original_name)); + method_info.utility_func = Variant::get_validated_utility_function(original_name); + JSB_LOG(VeryVerbose, "expose godot utility function %s (%d)", original_name, utility_func_index); jsb_check(method_info.utility_func); info.GetReturnValue().Set(JSB_NEW_FUNCTION(context, ObjectReflectBindingUtil::_godot_utility_func, v8::Int32::New(isolate, utility_func_index))); @@ -82,9 +82,9 @@ namespace jsb } // (3) global_constants - if (CoreConstants::is_global_constant(type_name)) + if (CoreConstants::is_global_constant(original_name)) { - const int constant_index = CoreConstants::get_global_constant_index(type_name); + const int constant_index = CoreConstants::get_global_constant_index(original_name); const int64_t constant_value = CoreConstants::get_global_constant_value(constant_index); info.GetReturnValue().Set(impl::Helper::new_integer(isolate, constant_value)); return; @@ -92,18 +92,18 @@ namespace jsb // (4) classes in ClassDB/PrimitiveTypes { - if (const NativeClassInfoPtr class_info = env->expose_class(type_name)) + if (const NativeClassInfoPtr class_info = env->expose_class(p_type_name)) { - jsb_check(class_info->name == type_name); + jsb_check(class_info->name == p_type_name); jsb_check(!class_info->clazz.IsEmpty()); info.GetReturnValue().Set(class_info->clazz.Get(isolate)); return; } // dynamic binding: godot class types - if (const NativeClassInfoPtr class_info = env->expose_godot_object_class(ClassDB::classes.getptr(type_name))) + if (const NativeClassInfoPtr class_info = env->expose_godot_object_class(ClassDB::classes.getptr(original_name))) { - jsb_check(class_info->name == type_name); + jsb_check(class_info->name == original_name); jsb_check(!class_info->clazz.IsEmpty()); info.GetReturnValue().Set(class_info->clazz.Get(isolate)); return; @@ -111,10 +111,10 @@ namespace jsb } // (5) global_enums - if (CoreConstants::is_global_enum(type_name)) + if (CoreConstants::is_global_enum(original_name)) { HashMap enum_values; - CoreConstants::get_enum_values(type_name, &enum_values); + CoreConstants::get_enum_values(original_name, &enum_values); info.GetReturnValue().Set(BridgeHelper::to_global_enum(isolate, context, enum_values)); return; } @@ -124,7 +124,7 @@ namespace jsb // VARIANT_ENUM_CAST(Variant::Type); // VARIANT_ENUM_CAST(Variant::Operator); // they are exposed as `Variant.Type` in global constants in godot - if (type_name == jsb_string_name(Variant)) + if (original_name == jsb_string_name(Variant)) { const v8::Local obj = v8::Object::New(isolate); obj->Set(context, impl::Helper::new_string(isolate, "Type"), BridgeHelper::to_global_enum(isolate, context, "Variant.Type")).Check(); @@ -133,7 +133,7 @@ namespace jsb return; } - impl::Helper::throw_error(isolate, jsb_format("godot class not found '%s'", type_name)); + impl::Helper::throw_error(isolate, jsb_format("godot class not found '%s'", original_name)); } v8::Local GodotModuleLoader::_get_loader_proxy(Environment* p_env) diff --git a/bridge/jsb_object_bindings.cpp b/bridge/jsb_object_bindings.cpp index 1cccdcb6..6fa9ffd0 100644 --- a/bridge/jsb_object_bindings.cpp +++ b/bridge/jsb_object_bindings.cpp @@ -11,8 +11,9 @@ namespace jsb jsb_check(p_class_info); - const NativeClassID class_id = p_env->add_native_class(NativeClassType::GodotObject, p_class_info->name); - JSB_LOG(VeryVerbose, "expose godot type %s(%d)", p_class_info->name, class_id); + String class_name = internal::NamingUtil::get_class_name(p_class_info->name); + const NativeClassID class_id = p_env->add_native_class(NativeClassType::GodotObject, class_name); + JSB_LOG(VeryVerbose, "expose godot type %s(%d) as %s", p_class_info->name, class_id, class_name); // construct type template { @@ -31,7 +32,7 @@ namespace jsb { if (internal::StringNames::get_singleton().is_ignored(pair.key)) continue; - const StringName& property_name = pair.key; + const StringName& property_name = internal::NamingUtil::get_member_name(pair.key); const ::ClassDB::PropertySetGet& getset_info = pair.value; if (pair.value.index >= 0) @@ -68,7 +69,7 @@ namespace jsb #if JSB_EXCLUDE_GETSET_METHODS if (omitted_methods.has(pair.key)) continue; #endif - const StringName& method_name = pair.key; + const StringName& method_name = internal::NamingUtil::get_member_name(pair.key); const MethodBind* method_bind = pair.value; if (method_bind->is_static()) @@ -90,9 +91,9 @@ namespace jsb // class: signals for (const KeyValue& pair : p_class_info->signal_map) { - const StringName& name_str = pair.key; - const StringNameID string_id = p_env->get_string_name_cache().get_string_id(name_str); - class_builder.Instance().Property(pair.key, _godot_object_signal, *string_id); + const StringName& signal_name = internal::NamingUtil::get_member_name(pair.key); + const StringNameID string_id = p_env->get_string_name_cache().get_string_id(pair.key); + class_builder.Instance().Property(signal_name, _godot_object_signal, *string_id); } HashSet enum_consts; @@ -101,15 +102,15 @@ namespace jsb for (const KeyValue& pair : p_class_info->enum_map) { v8::HandleScope handle_scope_for_enum(isolate); - impl::ClassBuilder::EnumDeclaration enumeration = static_builder.Enum(pair.key); - for (const StringName& enum_name : pair.value.constants) + impl::ClassBuilder::EnumDeclaration enumeration = static_builder.Enum(internal::NamingUtil::get_enum_name(pair.key)); + for (const StringName& enum_value_name : pair.value.constants) { - const String& enum_name_str = (String) enum_name; - jsb_not_implemented(enum_name_str.contains("."), "hierarchically nested definition is currently not supported"); - const auto& const_it = p_class_info->constant_map.find(enum_name); + const String& js_enum_name = internal::NamingUtil::get_enum_value_name(enum_value_name); + jsb_not_implemented(js_enum_name.contains("."), "hierarchically nested definition is currently not supported"); + const auto& const_it = p_class_info->constant_map.find(enum_value_name); jsb_check(const_it); - enumeration.Value(enum_name_str, const_it->value); - enum_consts.insert(enum_name); + enumeration.Value(js_enum_name, const_it->value); + enum_consts.insert(enum_value_name); } } @@ -117,8 +118,8 @@ namespace jsb for (const KeyValue& pair : p_class_info->constant_map) { if (enum_consts.has(pair.key)) continue; - const String& const_name_str = (String) pair.key; - jsb_not_implemented(const_name_str.contains("."), "hierarchically nested definition is currently not supported"); + const String& js_const_name = (String) internal::NamingUtil::get_constant_name(pair.key); + jsb_not_implemented(js_const_name.contains("."), "hierarchically nested definition is currently not supported"); static_builder.Value(pair.key, pair.value); } @@ -142,8 +143,8 @@ namespace jsb class_info->clazz = class_builder.Build(); jsb_check(!class_info->clazz.IsEmpty()); - jsb_check(class_info->name == p_class_info->name); - JSB_LOG(VeryVerbose, "build class info %s (%d) addr: %s", class_info->name, class_id, class_info.ptr()); + jsb_check(class_info->name == internal::NamingUtil::get_class_name(p_class_info->name)); + JSB_LOG(VeryVerbose, "build class info %s (%d) exposed as %s, addr: %s", p_class_info->name, class_id, class_info->name, class_info.ptr()); if (r_class_id) *r_class_id = class_id; return class_info; } @@ -156,7 +157,7 @@ namespace jsb const v8::Local context = isolate->GetCurrentContext(); Environment* environment = Environment::wrap(isolate); - const StringName name = environment->get_string_name_cache().get_string_name((const StringNameID) info.Data().As()->Value()); + const StringName gd_signal_name = environment->get_string_name_cache().get_string_name((const StringNameID) info.Data().As()->Value()); const v8::Local self = info.This(); // (assume) debugger may trigger the property getter of signal without an instance @@ -168,18 +169,20 @@ namespace jsb void* pointer = environment->get_verified_object(self, NativeClassType::GodotObject); if (!pointer) { - jsb_throw(isolate, "signal owner is undefined or dead"); + const String error_message = jsb_errorf("failure obtaining signal: %s. signal owner is undefined or dead", gd_signal_name); + impl::Helper::throw_error(isolate, error_message); return; } // signal must be instance-owned const Object* gd_object = (Object*) pointer; - if (v8::Local rval; TypeConvert::gd_var_to_js(isolate, context, Signal(gd_object, name), rval)) + if (v8::Local rval; TypeConvert::gd_var_to_js(isolate, context, Signal(gd_object, gd_signal_name), rval)) { info.GetReturnValue().Set(rval); return; } - jsb_throw(isolate, "bad signal"); + const String error_message = jsb_errorf("failure obtaining signal: %s. bad signal", gd_signal_name); + impl::Helper::throw_error(isolate, error_message); } void ObjectReflectBindingUtil::_godot_object_free(const v8::FunctionCallbackInfo& info) @@ -213,7 +216,8 @@ namespace jsb // prepare argv if (!method_info.check_argc(argc)) { - jsb_throw(isolate, "num of arguments does not meet the requirement"); + const String error_message = jsb_errorf("%d arguments are required", method_info.argument_types.size()); + impl::Helper::throw_error(isolate, error_message); return; } const Variant** argv = jsb_stackalloc(const Variant*, argc); @@ -272,7 +276,8 @@ namespace jsb { if (!TypeConvert::js_to_gd_obj(isolate, context, info.This(), gd_object) || !gd_object) { - jsb_throw(isolate, "bad this"); + const String error_message = jsb_errorf("Failed to call: %s. Bad this", method_bind->get_name()); + impl::Helper::throw_error(isolate, error_message); return; } } @@ -282,7 +287,8 @@ namespace jsb const bool method_is_vararg = method_bind->is_vararg(); if (!internal::VariantUtil::check_argc(method_is_vararg, argc, method_bind->get_default_argument_count(), method_argc)) { - jsb_throw(isolate, "num of arguments does not meet the requirement"); + const String error_message = jsb_errorf("Failed to call: %s. %d arguments are required", method_bind->get_name(), method_argc - method_bind->get_default_argument_count()); + impl::Helper::throw_error(isolate, error_message); return; } const Variant** argv = jsb_stackalloc(const Variant*, argc); @@ -316,7 +322,8 @@ namespace jsb if (error.error != Callable::CallError::CALL_OK) { - jsb_throw(isolate, "failed to call"); + const String error_message = jsb_errorf("Failed to call: %s", method_bind->get_name()); + impl::Helper::throw_error(isolate, error_message); return; } v8::Local jrval; @@ -342,14 +349,16 @@ namespace jsb // prepare argv if (info.Length() != 0) { - jsb_throw(isolate, "num of arguments does not meet the requirement"); + const String error_message = jsb_errorf("Failed to get property: %s. Arguments unexpectedly provided", property_info.getter_func->get_name()); + impl::Helper::throw_error(isolate, error_message); return; } Object* gd_object = nullptr; if (!property_info.getter_func->is_static() && (!TypeConvert::js_to_gd_obj(isolate, context, info.This(), gd_object) || !gd_object)) { - jsb_throw(isolate, "bad this"); + const String error_message = jsb_errorf("Failed to get property: %s. Bad this", property_info.getter_func->get_name()); + impl::Helper::throw_error(isolate, error_message); return; } @@ -362,7 +371,8 @@ namespace jsb if (error.error != Callable::CallError::CALL_OK) { - jsb_throw(isolate, "failed to call"); + const String error_message = jsb_errorf("Failed to get property: %s. Execution failed", property_info.getter_func->get_name()); + impl::Helper::throw_error(isolate, error_message); return; } v8::Local jrval; @@ -374,7 +384,7 @@ namespace jsb return; } const String error_message = jsb_errorf("Failed to get property: %s. Failed to translate returned Godot %s to a JS value", - property_info.getter_func->get_name(), index, Variant::get_type_name(crval.get_type())); + property_info.getter_func->get_name(), Variant::get_type_name(crval.get_type())); impl::Helper::throw_error(isolate, error_message); } @@ -389,21 +399,26 @@ namespace jsb // prepare argv if (info.Length() != 1) { - jsb_throw(isolate, "num of arguments does not meet the requirement"); + const String error_message = jsb_errorf("Failed to set property: %s. 1 argument is required", property_info.setter_func->get_name()); + impl::Helper::throw_error(isolate, error_message); return; } Object* gd_object = nullptr; if (!property_info.setter_func->is_static() && (!TypeConvert::js_to_gd_obj(isolate, context, info.This(), gd_object) || !gd_object)) { - jsb_throw(isolate, "bad this"); + const String error_message = jsb_errorf("Failed to set property: %s. Bad this", property_info.setter_func->get_name()); + impl::Helper::throw_error(isolate, error_message); return; } Variant cvar; if (!TypeConvert::js_to_gd_var(isolate, context, info[0], property_info.setter_func->get_argument_type(1), cvar)) { - jsb_throw(isolate, "bad argument"); + const String error_message = jsb_errorf("Failed to set property: %s. Unable to convert provided JS %s to Godot %s", + property_info.setter_func->get_name(), TypeConvert::js_debug_typeof(isolate, info[0]), + Variant::get_type_name(property_info.setter_func->get_argument_type(1))); + impl::Helper::throw_error(isolate, error_message); return; } @@ -416,7 +431,8 @@ namespace jsb if (error.error != Callable::CallError::CALL_OK) { - jsb_throw(isolate, "failed to call"); + const String error_message = jsb_errorf("Failed to set property: %s. Execution failed", property_info.setter_func->get_name()); + impl::Helper::throw_error(isolate, error_message); return; } } diff --git a/bridge/jsb_primitive_bindings_reflect.cpp b/bridge/jsb_primitive_bindings_reflect.cpp index 4b1e9a31..53a5b450 100644 --- a/bridge/jsb_primitive_bindings_reflect.cpp +++ b/bridge/jsb_primitive_bindings_reflect.cpp @@ -629,7 +629,13 @@ namespace jsb // called in Environment::expose_class static NativeClassInfoPtr reflect_bind(const ClassRegister& p_env, NativeClassID* r_class_id = nullptr) { - const StringName& class_name = p_env.type_name; + const StringName& class_name = internal::NamingUtil::get_class_name(p_env.type_name); + + if (class_name != p_env.type_name) + { + internal::StringNames::get_singleton().add_replacement(p_env.type_name, class_name); + } + const NativeClassID class_id = p_env->add_native_class(NativeClassType::GodotPrimitive, class_name); impl::ClassBuilder class_builder = get_class_builder(p_env, class_id, class_name); @@ -651,22 +657,22 @@ namespace jsb Variant::get_member_validated_getter(TYPE, name), member_type}); - class_builder.Instance().Property(name, _getter, _setter, collection_index); + class_builder.Instance().Property(internal::NamingUtil::get_member_name(name), _getter, _setter, collection_index); } } // indexed accessor if (Variant::has_indexing(TYPE)) { - class_builder.Instance().Method("set_indexed", _set_indexed); - class_builder.Instance().Method("get_indexed", _get_indexed); + class_builder.Instance().Method(internal::NamingUtil::get_member_name("set_indexed"), _set_indexed); + class_builder.Instance().Method(internal::NamingUtil::get_member_name("get_indexed"), _get_indexed); } // keyed accessor if (Variant::is_keyed(TYPE)) { - class_builder.Instance().Method("set_keyed", _set_keyed); - class_builder.Instance().Method("get_keyed", _get_keyed); + class_builder.Instance().Method(internal::NamingUtil::get_member_name("set_keyed"), _set_keyed); + class_builder.Instance().Method(internal::NamingUtil::get_member_name("get_keyed"), _get_keyed); } // methods @@ -678,6 +684,7 @@ namespace jsb const int argument_count = Variant::get_builtin_method_argument_count(TYPE, name); const bool has_return_value = Variant::has_builtin_method_return_value(TYPE, name); const Variant::Type return_type = Variant::get_builtin_method_return_type(TYPE, name); + const String member_name = internal::NamingUtil::get_member_name(name); #if JSB_FAST_REFLECTION if (!Variant::is_builtin_method_vararg(TYPE, name)) @@ -690,11 +697,11 @@ namespace jsb { if (Variant::is_builtin_method_static(TYPE, name)) { - class_builder.Static().Method(name, ReflectBuiltinMethodPointerCall::_call, (void*) Variant::get_ptr_builtin_method(TYPE, name)); + class_builder.Static().Method(member_name, ReflectBuiltinMethodPointerCall::_call, (void*) Variant::get_ptr_builtin_method(TYPE, name)); } else { - class_builder.Instance().Method(name, ReflectBuiltinMethodPointerCall::_call, (void*) Variant::get_ptr_builtin_method(TYPE, name)); + class_builder.Instance().Method(member_name, ReflectBuiltinMethodPointerCall::_call, (void*) Variant::get_ptr_builtin_method(TYPE, name)); } continue; } @@ -706,11 +713,11 @@ namespace jsb { if (Variant::is_builtin_method_static(TYPE, name)) { - class_builder.Static().Method(name, ReflectBuiltinMethodPointerCall::_call, (void*) Variant::get_ptr_builtin_method(TYPE, name)); + class_builder.Static().Method(member_name, ReflectBuiltinMethodPointerCall::_call, (void*) Variant::get_ptr_builtin_method(TYPE, name)); } else { - class_builder.Instance().Method(name, ReflectBuiltinMethodPointerCall::_call, (void*) Variant::get_ptr_builtin_method(TYPE, name)); + class_builder.Instance().Method(member_name, ReflectBuiltinMethodPointerCall::_call, (void*) Variant::get_ptr_builtin_method(TYPE, name)); } continue; } @@ -723,7 +730,7 @@ namespace jsb const int collection_index = (int) GetVariantInfoCollection(p_env.env).methods.size(); GetVariantInfoCollection(p_env.env).methods.append({}); internal::FBuiltinMethodInfo& method_info = GetVariantInfoCollection(p_env.env).methods.write[collection_index]; - method_info.set_debug_name(name); + method_info.set_debug_name(member_name); method_info.builtin_func = Variant::get_validated_builtin_method(TYPE, name); method_info.return_type = return_type; method_info.default_arguments = Variant::get_builtin_method_default_arguments(TYPE, name); @@ -740,22 +747,22 @@ namespace jsb { if (Variant::is_builtin_method_static(TYPE, name)) { - class_builder.Static().Method(name, _static_method, collection_index); + class_builder.Static().Method(member_name, _static_method, collection_index); } else { - class_builder.Instance().Method(name, _instance_method, collection_index); + class_builder.Instance().Method(member_name, _instance_method, collection_index); } } else { if (Variant::is_builtin_method_static(TYPE, name)) { - class_builder.Static().Method(name, _static_method, collection_index); + class_builder.Static().Method(member_name, _static_method, collection_index); } else { - class_builder.Instance().Method(name, _instance_method, collection_index); + class_builder.Instance().Method(member_name, _instance_method, collection_index); } } } @@ -773,15 +780,16 @@ namespace jsb Variant::get_enums_for_type(TYPE, &enums); for (const StringName& enum_name : enums) { + String exposed_enum_name = internal::NamingUtil::get_enum_name(enum_name); + auto enum_decl = class_builder.Static().Enum(exposed_enum_name); List enumerations; - auto enum_decl = class_builder.Static().Enum(enum_name); Variant::get_enumerations_for_enum(TYPE, enum_name, &enumerations); for (const StringName& enumeration : enumerations) { bool r_valid; const int enum_value = Variant::get_enum_value(TYPE, enum_name, enumeration, &r_valid); jsb_check(r_valid); - enum_decl.Value(enumeration, enum_value); + enum_decl.Value(internal::NamingUtil::get_enum_value_name(enumeration), enum_value); enum_constants.insert(enumeration); } } @@ -795,7 +803,7 @@ namespace jsb { // exclude all enum constants if (enum_constants.has(constant)) continue; - class_builder.Static().LazyProperty(constant, _get_constant_value_lazy); + class_builder.Static().LazyProperty(internal::NamingUtil::get_constant_name(constant), _get_constant_value_lazy); } } diff --git a/bridge/jsb_reflect_binding_util.h b/bridge/jsb_reflect_binding_util.h index 492b1ad3..3c394e47 100644 --- a/bridge/jsb_reflect_binding_util.h +++ b/bridge/jsb_reflect_binding_util.h @@ -21,7 +21,7 @@ namespace jsb { static void register_(impl::ClassBuilder& class_builder) { - class_builder.Instance().Method("to_array_buffer", &_to_array_buffer); + class_builder.Instance().Method(internal::NamingUtil::get_member_name("to_array_buffer"), &_to_array_buffer); } static void _to_array_buffer(const v8::FunctionCallbackInfo& info) diff --git a/bridge/jsb_type_convert.cpp b/bridge/jsb_type_convert.cpp index 00e27347..321487aa 100644 --- a/bridge/jsb_type_convert.cpp +++ b/bridge/jsb_type_convert.cpp @@ -107,6 +107,14 @@ namespace jsb { return "string"; } + if (p_jval->IsArray()) + { + return "array"; + } + if (p_jval->IsFunction()) + { + return "function"; + } if (p_jval->IsObject()) { v8::Local object = p_jval.As(); @@ -126,14 +134,6 @@ namespace jsb return jsb_format("object (%s)", impl::Helper::to_string(isolate, constructor_name)); } - if (p_jval->IsFunction()) - { - return "function"; - } - if (p_jval->IsArray()) - { - return "array"; - } return ""; } diff --git a/impl/v8/jsb_v8_class_builder.h b/impl/v8/jsb_v8_class_builder.h index a1d406e5..38765146 100644 --- a/impl/v8/jsb_v8_class_builder.h +++ b/impl/v8/jsb_v8_class_builder.h @@ -97,6 +97,18 @@ namespace jsb::impl else builder_->template_->Set(key, value); } + void Method(const String& name, const v8::FunctionCallback callback) + { + jsb_check(builder_->state_ == State::Building); + v8::HandleScope handle_scope(builder_->isolate_); + + const v8::Local key = Helper::new_string(builder_->isolate_, name); + const v8::Local value = v8::FunctionTemplate::New(builder_->isolate_, callback); + + if (is_instance_method) builder_->prototype_template_->Set(key, value); + else builder_->template_->Set(key, value); + } + template void Method(const String& name, const v8::FunctionCallback callback, T data) { diff --git a/internal/jsb_internal.h b/internal/jsb_internal.h index c989d2be..4acc7b07 100644 --- a/internal/jsb_internal.h +++ b/internal/jsb_internal.h @@ -7,6 +7,7 @@ #include "jsb_double_buffered.h" #include "jsb_format.h" #include "jsb_logger.h" +#include "jsb_naming_util.h" #include "jsb_string_names.h" #include "jsb_source_reader.h" #include "jsb_source_map.h" diff --git a/internal/jsb_naming_util.cpp b/internal/jsb_naming_util.cpp new file mode 100644 index 00000000..5ebf2f63 --- /dev/null +++ b/internal/jsb_naming_util.cpp @@ -0,0 +1,320 @@ +#include "jsb_macros.h" +#include "jsb_internal.h" + +#include + +#include "core/string/ucaps.h" +#include "core/templates/hash_map.h" +#include "core/templates/hash_set.h" + +// Logic is largely derived from mono/utils/naming_utils.cpp so that our naming conventions remain similar to .NET. +namespace jsb::internal +{ + HashMap _create_hashmap_from_vector(Vector> vector) { + HashMap hashmap = HashMap(vector.size()); + for (const Pair &pair : vector) { + hashmap.insert(pair.first, pair.second); + } + return hashmap; + } + + // Hardcoded collection of PascalCase name conversions. + const HashMap pascal_case_name_overrides = _create_hashmap_from_vector({ + { "BitMap", "Bitmap" }, + { "JSONRPC", "JsonRpc" }, + { "Object", "GObject" }, + { "Dictionary", "GDictionary" }, + { "Error", "GError" }, + { "Array", "GArray" }, + { "OpenXRIPBinding", "OpenXRIPBinding" }, + { "SkeletonModification2DCCDIK", "SkeletonModification2DCcdik" }, + { "SkeletonModification2DFABRIK", "SkeletonModification2DFabrik" }, + { "SkeletonModification3DCCDIK", "SkeletonModification3DCcdik" }, + { "SkeletonModification3DFABRIK", "SkeletonModification3DFabrik" }, + }); + + // Hardcoded collection of PascalCase part conversions. + const HashMap pascal_case_part_overrides = _create_hashmap_from_vector({ + { "AA", "AA" }, // Anti Aliasing + { "AO", "AO" }, // Ambient Occlusion + { "FILENAME", "FileName" }, + { "FADEIN", "FadeIn" }, + { "FADEOUT", "FadeOut" }, + { "FX", "FX" }, + { "GI", "GI" }, // Global Illumination + { "GZIP", "GZip" }, + { "HBOX", "HBox" }, // Horizontal Box + { "ID", "Id" }, + { "IO", "IO" }, // Input/Output + { "IP", "IP" }, // Internet Protocol + { "IV", "IV" }, // Initialization Vector + { "MACOS", "MacOS" }, + { "NODEPATH", "NodePath" }, + { "SPIRV", "SpirV" }, + { "STDIN", "StdIn" }, + { "STDOUT", "StdOut" }, + { "USERNAME", "UserName" }, + { "UV", "UV" }, + { "UV2", "UV2" }, + { "VBOX", "VBox" }, // Vertical Box + { "WHITESPACE", "WhiteSpace" }, + { "WM", "WM" }, + { "XR", "XR" }, + { "XRAPI", "XRApi" }, + }); + + String _get_pascal_case_part_override(String p_part, bool p_input_is_upper = true) { + if (!p_input_is_upper) { + for (int i = 0; i < p_part.length(); i++) { + p_part[i] = _find_upper(p_part[i]); + } + } + + if (pascal_case_part_overrides.has(p_part)) { + return pascal_case_part_overrides.get(p_part); + } + + return String(); + } + + Vector _split_pascal_case(const String &p_identifier) { + Vector parts; + int current_part_start = 0; + bool prev_was_upper = is_ascii_upper_case(p_identifier[0]); + for (int i = 1; i < p_identifier.length(); i++) { + if (prev_was_upper) { + if (is_digit(p_identifier[i]) || is_ascii_lower_case(p_identifier[i])) { + if (!is_digit(p_identifier[i])) { + // These conditions only apply when the separator is not a digit. + if (i - current_part_start == 1) { + // Upper character was only the beginning of a word. + prev_was_upper = false; + continue; + } + if (i != p_identifier.length()) { + // If this is not the last character, the last uppercase + // character is the start of the next word. + i--; + } + } + if (i - current_part_start > 0) { + parts.append(p_identifier.substr(current_part_start, i - current_part_start)); + current_part_start = i; + prev_was_upper = false; + } + } + } else { + if (is_digit(p_identifier[i]) || is_ascii_upper_case(p_identifier[i])) { + parts.append(p_identifier.substr(current_part_start, i - current_part_start)); + current_part_start = i; + prev_was_upper = true; + } + } + } + + // Add the rest of the identifier as the last part. + if (current_part_start != p_identifier.length()) { + parts.append(p_identifier.substr(current_part_start)); + } + + return parts; + } + + String NamingUtil::pascal_to_pascal_case(const String &p_identifier) { + if (p_identifier.length() == 0) { + return p_identifier; + } + + if (p_identifier.length() <= 2) { + return p_identifier.to_upper(); + } + + if (pascal_case_name_overrides.has(p_identifier)) { + // Use hardcoded value for the identifier. + return pascal_case_name_overrides.get(p_identifier); + } + + Vector parts = _split_pascal_case(p_identifier); + + String ret; + + for (String &part : parts) { + String part_override = _get_pascal_case_part_override(part); + if (!part_override.is_empty()) { + // Use hardcoded value for part. + ret += part_override; + continue; + } + + if (part.length() <= 2 && part.to_upper() == part) { + // Acronym of length 1 or 2. + for (int j = 0; j < part.length(); j++) { + part[j] = _find_upper(part[j]); + } + ret += part; + continue; + } + + part[0] = _find_upper(part[0]); + for (int i = 1; i < part.length(); i++) { + if (is_digit(part[i - 1])) { + // Use uppercase after digits. + part[i] = _find_upper(part[i]); + continue; + } + + part[i] = _find_lower(part[i]); + } + ret += part; + } + + return ret; + } + + String NamingUtil::snake_to_pascal_case(const String &p_identifier, bool p_input_is_upper) { + String ret; + Vector parts = p_identifier.split("_", true); + + for (int i = 0; i < parts.size(); i++) { + String part = parts[i]; + + String part_override = _get_pascal_case_part_override(part, p_input_is_upper); + if (!part_override.is_empty()) { + // Use hardcoded value for part. + ret += part_override; + continue; + } + + if (!part.is_empty()) { + part[0] = _find_upper(part[0]); + for (int j = 1; j < part.length(); j++) { + if (is_digit(part[j - 1])) { + // Use uppercase after digits. + part[j] = _find_upper(part[j]); + continue; + } + + if (p_input_is_upper) { + part[j] = _find_lower(part[j]); + } + } + ret += part; + } else { + if (i == 0 || i == (parts.size() - 1)) { + // Preserve underscores at the beginning and end + ret += "_"; + } else { + // Preserve contiguous underscores + if (parts[i - 1].length()) { + ret += "__"; + } else { + ret += "_"; + } + } + } + } + + return ret; + } + + String NamingUtil::snake_to_camel_case(const String &p_identifier, bool p_input_is_upper) { + String ret; + Vector parts = p_identifier.split("_", true); + + for (int i = 0; i < parts.size(); i++) { + String part = parts[i]; + + String part_override = _get_pascal_case_part_override(part, p_input_is_upper); + if (!part_override.is_empty()) { + // Use hardcoded value for part. + if (i == 0 || (i == 1 && parts[0].is_empty())) { + part_override[i] = _find_lower(part_override[i]); + } + ret += part_override; + continue; + } + + if (!part.is_empty()) { + if (i == 0 || (i == 1 && parts[0].is_empty())) { + part[i] = _find_lower(part[i]); + } else { + part[0] = _find_upper(part[0]); + } + for (int j = 1; j < part.length(); j++) { + if (is_digit(part[j - 1])) { + // Use uppercase after digits. + part[j] = _find_upper(part[j]); + continue; + } + + if (p_input_is_upper) { + part[j] = _find_lower(part[j]); + } + } + ret += part; + } else { + if (i == 0 || i == (parts.size() - 1)) { + // Preserve underscores at the beginning and end + ret += "_"; + } else { + // Preserve contiguous underscores + if (parts[i - 1].length()) { + ret += "__"; + } else { + ret += "_"; + } + } + } + } + + return ret; + } + + List NamingUtil::get_exposed_class_list() + { + const PackedStringArray ignored_classes = internal::Settings::get_ignored_classes(); + const int ignored_classes_num = (int) ignored_classes.size(); + HashSet ignored_classes_set(ignored_classes_num); + + for (int i = 0; i < ignored_classes_num; ++i) + { + ignored_classes_set.insert(ignored_classes[i]); + } + + List all_class_names; + ClassDB::get_class_list(&all_class_names); + + List exposed_class_names; + + for (auto it = all_class_names.begin(); it != all_class_names.end(); ++it) + { + StringName class_name = *it; + + if (ignored_classes_set.has(class_name)) + { + JSB_LOG(Verbose, "Ignoring class '%s' because it's in the ignored classes list", class_name); + continue; + } + + ClassDB::APIType api_type = ClassDB::get_api_type(class_name); + + if (api_type == ClassDB::API_NONE) { + continue; + } + + if (!ClassDB::is_class_exposed(class_name)) { + JSB_LOG(Verbose, "Ignoring class '%s' because it's not exposed", class_name); + continue; + } + + if (!ClassDB::is_class_enabled(class_name)) { + JSB_LOG(Verbose, "Ignoring class '%s' because it's not enabled", class_name); + continue; + } + + exposed_class_names.push_back(class_name); + } + + return exposed_class_names; + } +} \ No newline at end of file diff --git a/internal/jsb_naming_util.h b/internal/jsb_naming_util.h new file mode 100644 index 00000000..b8391d06 --- /dev/null +++ b/internal/jsb_naming_util.h @@ -0,0 +1,87 @@ +#ifndef GODOTJS_NAMING_UTIL_H +#define GODOTJS_NAMING_UTIL_H + +#include "core/string/ustring.h" +#include "jsb_settings.h" + +namespace jsb::internal +{ + class NamingUtil + { + public: + static String pascal_to_pascal_case(const String &p_identifier); + + static String snake_to_pascal_case(const String &p_identifier, bool p_input_is_upper = false); + + static String snake_to_camel_case(const String &p_identifier, bool p_input_is_upper = false); + + static List get_exposed_class_list(); + + static String get_class_name(const String& p_original_name) + { + if (Settings::get_camel_case_bindings_enabled()) + { + return pascal_to_pascal_case(p_original_name); + } + + if (p_original_name == Variant::get_type_name(Variant::DICTIONARY)) + { + return "GDictionary"; + } + + if (p_original_name == Variant::get_type_name(Variant::ARRAY)) + { + return "GArray"; + } + + return p_original_name; + } + + static String get_constant_name(const String& p_original_name) + { + return p_original_name; + } + + static String get_enum_name(const String& p_original_name) + { + if (Settings::get_camel_case_bindings_enabled()) + { + return pascal_to_pascal_case(p_original_name); + } + + return p_original_name; + } + + static String get_enum_value_name(const String& p_original_value_name) + { + if (Settings::get_camel_case_bindings_enabled()) + { + return snake_to_pascal_case(p_original_value_name, true); + } + + return p_original_value_name; + } + + static String get_member_name(const String& p_original_name) + { + if (Settings::get_camel_case_bindings_enabled()) + { + return snake_to_camel_case(p_original_name); + } + + return p_original_name; + } + + static String get_parameter_name(const String& p_original_name) + { + if (Settings::get_camel_case_bindings_enabled()) + { + return snake_to_camel_case(p_original_name); + } + + return p_original_name; + } + }; +} + +#endif diff --git a/internal/jsb_settings.cpp b/internal/jsb_settings.cpp index 155b75c4..d8c1801c 100644 --- a/internal/jsb_settings.cpp +++ b/internal/jsb_settings.cpp @@ -24,6 +24,7 @@ namespace jsb::internal static constexpr char kRtSourceMapEnabled[] = JSB_MODULE_NAME_STRING "/runtime/logger/source_map_enabled"; static constexpr char kRtAdditionalSearchPaths[] = JSB_MODULE_NAME_STRING "/runtime/core/additional_search_paths"; static constexpr char kRtEntryScriptPath[] = JSB_MODULE_NAME_STRING "/runtime/core/entry_script_path"; + static constexpr char kRtCamelCaseBindingsEnabled[] = JSB_MODULE_NAME_STRING "/runtime/core/camel_case_bindings_enabled"; // editor specific settings, but we need it configured as project-wise instead of global-wise static constexpr char kRtPackagingWithSourceMap[] = JSB_MODULE_NAME_STRING "/editor/packaging/source_map_included"; @@ -77,6 +78,7 @@ namespace jsb::internal _GLOBAL_DEF(kRtDebuggerPort, 9229, JSB_SET_RESTART(true), JSB_SET_IGNORE_DOCS(false), JSB_SET_BASIC(false), JSB_SET_INTERNAL(false)); _GLOBAL_DEF(kRtSourceMapEnabled, true, JSB_SET_RESTART(false), JSB_SET_IGNORE_DOCS(false), JSB_SET_BASIC(true), JSB_SET_INTERNAL(false)); _GLOBAL_DEF(kRtAdditionalSearchPaths, PackedStringArray(), JSB_SET_RESTART(false), JSB_SET_IGNORE_DOCS(false), JSB_SET_BASIC(true), JSB_SET_INTERNAL(false)); + _GLOBAL_DEF(kRtCamelCaseBindingsEnabled, false, JSB_SET_RESTART(true), JSB_SET_IGNORE_DOCS(false), JSB_SET_BASIC(true), JSB_SET_INTERNAL(false)); { PropertyInfo EntryScriptPath; @@ -185,6 +187,12 @@ namespace jsb::internal return GLOBAL_GET(kRtEntryScriptPath); } + bool Settings::get_camel_case_bindings_enabled() + { + init_settings(); + return GLOBAL_GET(kRtCamelCaseBindingsEnabled); + } + String Settings::get_indentation() { #ifdef TOOLS_ENABLED diff --git a/internal/jsb_settings.h b/internal/jsb_settings.h index 56adf546..0346334a 100644 --- a/internal/jsb_settings.h +++ b/internal/jsb_settings.h @@ -35,6 +35,8 @@ namespace jsb::internal static String get_entry_script_path(); + static bool get_camel_case_bindings_enabled(); + static bool is_packaging_with_source_map(); static PackedStringArray get_packaging_include_files(); diff --git a/internal/jsb_string_names.cpp b/internal/jsb_string_names.cpp index 96e99052..94eca44a 100644 --- a/internal/jsb_string_names.cpp +++ b/internal/jsb_string_names.cpp @@ -3,12 +3,6 @@ namespace jsb::internal { StringNames* StringNames::singleton_ = nullptr; - void StringNames::add_replacement(const StringName& name, const StringName& replacement) - { - replacements_.insert(name, replacement); - replacements_inv_.insert(replacement, name); - } - StringNames::StringNames() { #pragma push_macro("DEF") @@ -20,9 +14,6 @@ namespace jsb::internal sn_godot_postbind = _scs_create("_post_bind_"); ignored_.insert(sn_name); - add_replacement(Variant::get_type_name(Variant::DICTIONARY), "GDictionary"); - add_replacement(Variant::get_type_name(Variant::ARRAY), "GArray"); - add_replacement(GetTypeInfo::get_class_info().class_name, "GError"); } } diff --git a/internal/jsb_string_names.def.h b/internal/jsb_string_names.def.h index abdabb70..8d0e4e39 100644 --- a/internal/jsb_string_names.def.h +++ b/internal/jsb_string_names.def.h @@ -59,3 +59,9 @@ DEF(onerror) DEF(postMessage) DEF(transfer) DEF(close) + +// editor +DEF(arguments) +DEF(codegen) +DEF(node) +DEF(properties) diff --git a/internal/jsb_string_names.h b/internal/jsb_string_names.h index a28ce620..3778a466 100644 --- a/internal/jsb_string_names.h +++ b/internal/jsb_string_names.h @@ -34,8 +34,6 @@ namespace jsb::internal StringNames(); - void add_replacement(const StringName& name, const StringName& replacement); - public: jsb_force_inline static StringNames& get_singleton() { return *singleton_; } @@ -55,6 +53,12 @@ namespace jsb::internal return p_name; } + void add_replacement(const StringName& name, const StringName& replacement) + { + replacements_.insert(name, replacement); + replacements_inv_.insert(replacement, name); + } + StringName sn_godot_typeloader; StringName sn_godot_postbind; diff --git a/scripts/jsb.editor/src/jsb.editor.codegen.ts b/scripts/jsb.editor/src/jsb.editor.codegen.ts index 8d9ab7e9..2afea1eb 100644 --- a/scripts/jsb.editor/src/jsb.editor.codegen.ts +++ b/scripts/jsb.editor/src/jsb.editor.codegen.ts @@ -1,16 +1,78 @@ - import { DirAccess, FileAccess, + GArray, GDictionary, + GReadProxyValueWrap, + MethodFlags, + Node, PropertyHint, + PropertyInfo, Variant, str as gd_to_string, type_string, - MethodFlags, GodotJSEditorHelper as helper, } from 'godot'; import * as jsb from "godot-jsb"; -import { ClassInfo } from 'godot-jsb'; + +type UpperSnakeToPascalCase = + S extends `${infer T}_${infer U}` + ? `${Capitalize>}${UpperSnakeToPascalCase>>}` + : Capitalize>; + +function upper_snake_to_pascal_case(input: T): UpperSnakeToPascalCase { + return input + .toLowerCase() + .split('_') + .map(word => word.charAt(0).toUpperCase() + word.slice(1)) + .join('') as UpperSnakeToPascalCase; +} + +type SnakeToCamelCase = + S extends `${infer T}_${infer U}${infer Rest}` + ? `${T}${Capitalize}${SnakeToCamelCase}` + : S; + +function snake_to_camel_case(input: T): SnakeToCamelCase { + return input + .toLowerCase() + .split('_') + .map((word, index) => index === 0 ? word : word.charAt(0).toUpperCase() + word.slice(1)) + .join('') as SnakeToCamelCase; +} + +function camel_property_overrides(overrides: undefined | Record string)>) { + return overrides && Object.fromEntries( + Object.entries(overrides).map(([name, value]) => { + const camel_case_name = snake_to_camel_case(name); + return [ + camel_case_name, + Array.isArray(value) + ? value.map(line => line.replace(new RegExp(`${name}( *[<(:])`), `${camel_case_name}$1`)) + : value + ]; + }) + ) +} + +const member_name = jsb.CAMEL_CASE_BINDINGS_ENABLED + ? snake_to_camel_case + : (name: string) => name; + +const enum_value_name = jsb.CAMEL_CASE_BINDINGS_ENABLED + ? upper_snake_to_pascal_case + : (name: string) => name; + +// Godot's runtime can be toggled between snake case and camel case naming schemes. In this script we use upper camel +// case value names. If the camel-case naming scheme is enabled, then we must convert to pascal case. +function enum_value(enum_map: E, name: N): E[N] { + return enum_map[enum_value_name(name) as keyof E] as E[N]; +} + +// Godot's runtime can be toggled between snake case and camel case naming schemes. In this script we use lower snake +// case method names. If the camel-case naming scheme is enabled, then we must convert to camel case. +function gd_method(obj: O, name: N): O[N] { + return (obj[member_name(name) as keyof O] as Function).bind(obj) as O[N]; +} if (!jsb.TOOLS_ENABLED) { throw new Error("codegen is only allowed in editor mode") @@ -24,39 +86,17 @@ interface GenericParameter { default?: string; } +type Intro = string[] | ((types: TypeDB) => string[]); type PropertyOverrides = Record string)>; interface TypeMutation { generic_parameters?: Record; super?: string; super_generic_arguments?: string[]; - intro?: string[]; + intro?: Intro; property_overrides?: PropertyOverrides; } -const CallableBind = { - description: "Create a callable object with a bound object `self`", - methods: [ - "static create(self: Object, fn: () => R): Callable0", - "static create(self: Object, fn: (v1: T1) => R): Callable1", - "static create(self: Object, fn: (v1: T1, v2: T2) => R): Callable2", - "static create(self: Object, fn: (v1: T1, v2: T2, v3: T3) => R): Callable3", - "static create(self: Object, fn: (v1: T1, v2: T2, v3: T3, v4: T4) => R): Callable4", - "static create(self: Object, fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => R): Callable5", - ] -}; -const CallableFuncBind = { - description: "Create godot Callable without a bound object", - methods: [ - "static create(fn: () => R): Callable0", - "static create(fn: (v1: T1) => R): Callable1", - "static create(fn: (v1: T1, v2: T2) => R): Callable2", - "static create(fn: (v1: T1, v2: T2, v3: T3) => R): Callable3", - "static create(fn: (v1: T1, v2: T2, v3: T3, v4: T4) => R): Callable4", - "static create(fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => R): Callable5", - ] -}; - function chain_mutators(...mutators: Array<(line: string) => string>) { return function(line: string) { return mutators.reduce((line, mutator) => mutator(line), line); @@ -64,42 +104,70 @@ function chain_mutators(...mutators: Array<(line: string) => string>) { } function mutate_parameter_type(name: string, type: string) { return function(line: string) { - return line.replace(new RegExp(`([,(] *)${name}: .+?([,)])`, 'g'), `$1${name}: ${type}$2`); + const replaced = line.replace(new RegExp(`([,(] *)${name.replace(/\./g, "\\.")}: .+?( ?[,)=])`, 'g'), `$1${name}: ${type}$2`); + if (replaced === line) { + throw new Error(`Failed to mutate "${name}" parameter's type: ${line}`); + } + return replaced; }; } function mutate_return_type(type: string) { return function(line: string) { - return line.replace(/: [^:]+$/g, `: ${type}`); + const replaced = line.replace(/: [^:]+$/g, `: ${type}`); + if (replaced === line) { + throw new Error(`Failed to mutate return type: ${line}`); + } + return replaced; }; } function mutate_template(template: string) { return function(line: string) { - return line.replace(/([^(]+)(<[^>]+> *)?\(/, `$1$2<${template}>(`); + const replaced = line.replace(/([^(]+)(<[^>]+> *)?\(/, `$1$2<${template}>(`); + if (replaced === line) { + throw new Error(`Failed to mutate template: ${line}`); + } + return replaced; }; } const TypeMutations: Record = { Signal: { - super: "AnySignal", + generic_parameters: { + T: { + extends: "(...args: any[]) => void", + default: "(...args: any[]) => void", + }, + }, + property_overrides: { + connect: mutate_parameter_type("callable", "Callable"), + disconnect: mutate_parameter_type("callable", "Callable"), + is_connected: mutate_parameter_type("callable", "Callable"), + emit: ["emit: T"], + } }, Callable: { - super: "AnyCallable", intro: [ - ...CallableBind.methods.reduce((lines: string[], method: string) => { - return [ - ...lines, - `/** ${CallableBind.description} */`, - method, - ]; - }, []), - ...CallableFuncBind.methods.reduce((lines: string[], method: string) => { - return [ - ...lines, - `/** ${CallableBind.description} */`, - method, - ]; - }, []), + "/**", + " * Create godot Callable without a bound object.", + " */", + "static create(fn: F): Callable", + "/**", + " * Create godot Callable with a bound object `self`.", + " */", + "static create any>(self: S, fn: F): Callable", + "", + `${member_name("as_promise")}(): Parameters extends [] ? Promise : Parameters extends [infer R] ? Promise : Promise>`, ], + generic_parameters: { + T: { + extends: "Function", + default: "Function", + }, + }, + property_overrides: { + bind: chain_mutators(mutate_template("A extends any[]"), mutate_parameter_type("...varargs", "A"), mutate_return_type("Callable>")), + call: ["call: T"], + }, }, GArray: { generic_parameters: { @@ -108,12 +176,14 @@ const TypeMutations: Record = { }, }, intro: [ + "/** Builder function that returns a GArray populated with elements from a JS array. */", + "static create(elements: [T] extends [GArray] ? Array> : Array>): [T] extends [GArray] ? GArray : GArray", "[Symbol.iterator](): IteratorObject", "/** Returns a Proxy that targets this GArray but behaves similar to a JavaScript array. */", - `proxy(): GArrayProxy`, + "proxy(): Write extends true ? GArrayProxy : GArrayReadProxy", "", - "set_indexed(index: number, value: T): void", - "get_indexed(index: number): T", + `${member_name("set_indexed")}(index: number, value: T): void`, + `${member_name("get_indexed")}(index: number): T`, ], property_overrides: { set: mutate_parameter_type("value", "T"), @@ -155,12 +225,14 @@ const TypeMutations: Record = { }, }, intro: [ + "/** Builder function that returns a GDictionary with properties populated from a source JS object. */", + "static create(properties: T extends GDictionary ? GDictionaryProxy : GDictionaryProxy): T extends GDictionary ? GDictionary : GDictionary", "[Symbol.iterator](): IteratorObject<{ key: any, value: any }>", "/** Returns a Proxy that targets this GDictionary but behaves similar to a regular JavaScript object. Values are exposed as enumerable properties, so Object.keys(), Object.entries() etc. will work. */", - "proxy(): GDictionaryProxy", + "proxy(): Write extends true ? GDictionaryProxy : GDictionaryReadProxy", "", - "set_keyed(key: K, value: T[K]): void", - "get_keyed(key: K): T[K]", + `${member_name("set_keyed")}(key: K, value: T[K]): void`, + `${member_name("get_keyed")}(key: K): T[K]`, ], property_overrides: { assign: mutate_parameter_type("dictionary", "T"), @@ -174,7 +246,7 @@ const TypeMutations: Record = { values: mutate_return_type("GArray"), duplicate: mutate_return_type("GDictionary"), get: chain_mutators(mutate_parameter_type("key", "K"), mutate_return_type("T[K]"), mutate_template("K extends keyof T")), - get_or_add: chain_mutators(mutate_parameter_type("key", "K"), mutate_parameter_type("default", "T[K]"), mutate_parameter_type("default", "T[K]"), mutate_template("K extends keyof T")), + get_or_add: chain_mutators(mutate_parameter_type("key", "K"), mutate_parameter_type("default_", "T[K]"), mutate_template("K extends keyof T")), set: chain_mutators(mutate_parameter_type("key", "K"), mutate_parameter_type("value", "T[K]"), mutate_template("K extends keyof T")), } }, @@ -194,19 +266,20 @@ const TypeMutations: Record = { ], property_overrides: { get_node: [ - "get_node>(path: Path): ResolveNodePath", + "get_node, Default = never>(path: Path): ResolveNodePath", "get_node(path: NodePath | string): Node", ], get_node_or_null: [ - "get_node_or_null>(path: Path): null | ResolveNodePath", + "get_node_or_null, Default = never>(path: Path): null | ResolveNodePath", "get_node_or_null(path: NodePath | string): null | Node", ], + validate_property: mutate_parameter_type("property", "GDictionary"), }, }, PackedByteArray: { intro: [ "/** [jsb utility method] Converts a PackedByteArray to a JavaScript ArrayBuffer. */", - "to_array_buffer(): ArrayBuffer" + `${member_name("to_array_buffer")}(): ArrayBuffer`, ], }, }; @@ -216,23 +289,27 @@ const InheritedTypeMutations: Record = { generic_parameters: { Map: { extends: "Record", - default: "Record", + default: "{}", }, }, super_generic_arguments: ["Map"], }, }; -function class_type_mutation(cls: ClassInfo): TypeMutation { +function is_primitive_class_info(cls: jsb.editor.BasicClassInfo): cls is jsb.editor.PrimitiveClassInfo { + return 'type' in cls; +} + +function class_type_mutation(cls: jsb.editor.BasicClassInfo): TypeMutation { const intro: string[] = [] - if (typeof cls.element_type !== "undefined") { + if (is_primitive_class_info(cls) && typeof cls.element_type !== "undefined") { const element_type_name = get_primitive_type_name(cls.element_type); intro.push(`set_indexed(index: number, value: ${element_type_name}): void`); intro.push(`get_indexed(index: number): ${element_type_name}`); } - if (cls.is_keyed) { + if (is_primitive_class_info(cls) && cls.is_keyed) { intro.push("set_keyed(index: any, value: any): void"); intro.push("get_keyed(index: any): any"); } @@ -277,27 +354,33 @@ interface CodeWriter { get size(): number; get lineno(): number; + add_import(name: string, script_resource: string, export_name?: string): void; + get_imports(): Record>; // Record> + resolve_import(script_resource: string): string; + line(text: string): void; + concatenate(text: string): void; + append(newLine: boolean, text: string): void; enum_(name: string): EnumWriter; namespace_(name: string, class_doc?: jsb.editor.ClassDoc): NamespaceWriter; interface_( - name: string, - generic_parameters?: undefined | Record, - super_?: undefined | string, - super_generic_arguments?: undefined | string[], - intro?: undefined | string[], - property_overrides?: undefined | PropertyOverrides + name: string, + generic_parameters?: undefined | Record, + super_?: undefined | string, + super_generic_arguments?: undefined | string[], + intro?: undefined | string[], + property_overrides?: undefined | PropertyOverrides ): InterfaceWriter; class_( - name: string, - generic_parameters: undefined | Record, - super_: undefined | string, - super_generic_arguments: undefined | string[], - property_overrides: undefined | PropertyOverrides, - intro: undefined | string[], - singleton_mode: boolean, - class_doc?: jsb.editor.ClassDoc + name: string, + generic_parameters: undefined | Record, + super_: undefined | string, + super_generic_arguments: undefined | string[], + property_overrides: undefined | PropertyOverrides, + intro: undefined | Intro, + singleton_mode: boolean, + class_doc?: jsb.editor.ClassDoc ): ClassWriter; generic_(name: string): GenericWriter; property_(name: string): PropertyWriter; @@ -322,7 +405,7 @@ function frame_step() { function toast(msg: string) { let helper = require("godot").GodotJSEditorHelper; - helper.show_toast(msg, 0); // 0: info, 1: warning, 2: error + gd_method(helper, 'show_toast')(msg, 0); // 0: info, 1: warning, 2: error } interface CodegenTaskInfo { @@ -346,7 +429,7 @@ class CodegenTasks { const EditorProgress = require("godot").GodotJSEditorProgress; const progress = new EditorProgress(); let force_wait = 24; - progress.init(`codegen-${this._name}`, `Generating ${this._name}`, this.tasks.length); + gd_method(progress, 'init')(`codegen-${this._name}`, `Generating ${this._name}`, this.tasks.length); try { for (let i = 0; i < this.tasks.length; ++i) { @@ -354,24 +437,25 @@ class CodegenTasks { const result = task.execute(); if (typeof result === "object" && result instanceof Promise) { - progress.set_state_name(task.name); - progress.set_current(i); + gd_method(progress, 'set_state_name')(task.name); + gd_method(progress, 'set_current')(i); await result; } else { if (!(i % force_wait)) { - progress.set_state_name(task.name); - progress.set_current(i); + gd_method(progress, 'set_state_name')(task.name); + gd_method(progress, 'set_current')(i); await frame_step(); } } } - progress.finish(); + gd_method(progress, 'finish')(); toast(`${this._name} generated successfully`); } catch (e) { console.error("CodegenTasks error:", e); toast(`${this._name} failed!`); - progress.finish(); + console.error(`${this._name} failed!`, e); + gd_method(progress, 'finish')(); } } } @@ -407,15 +491,15 @@ const KeywordReplacement: { [name: string]: string } = { ["function"]: "function_", // a special item which used as the name of variadic arguments placement - ["vargargs"]: "vargargs_", + ["varargs"]: "varargs_", } const PrimitiveTypeNames: { [type: number]: string } = { - [Variant.Type.TYPE_NIL]: "any", - [Variant.Type.TYPE_BOOL]: "boolean", - [Variant.Type.TYPE_INT]: "int64", - [Variant.Type.TYPE_FLOAT]: "float64", - [Variant.Type.TYPE_STRING]: "string", + [enum_value(Variant.Type, "TYPE_NIL")]: "any", + [enum_value(Variant.Type, "TYPE_BOOL")]: "boolean", + [enum_value(Variant.Type, "TYPE_INT")]: "int64", + [enum_value(Variant.Type, "TYPE_FLOAT")]: "float64", + [enum_value(Variant.Type, "TYPE_STRING")]: "string", } const RemapTypes: { [name: string]: string } = { @@ -506,16 +590,16 @@ function get_primitive_type_name_as_input(type: Variant.Type): string | undefine const primitive_name = get_primitive_type_name(type); switch (type) { - case Variant.Type.TYPE_PACKED_COLOR_ARRAY: return join_type_name(primitive_name, get_js_array_type_name(get_primitive_type_name(Variant.Type.TYPE_COLOR))); - case Variant.Type.TYPE_PACKED_VECTOR2_ARRAY: return join_type_name(primitive_name, get_js_array_type_name(get_primitive_type_name(Variant.Type.TYPE_VECTOR2))); - case Variant.Type.TYPE_PACKED_VECTOR3_ARRAY: return join_type_name(primitive_name, get_js_array_type_name(get_primitive_type_name(Variant.Type.TYPE_VECTOR3))); - case Variant.Type.TYPE_PACKED_STRING_ARRAY: return join_type_name(primitive_name, get_js_array_type_name("string")); - case Variant.Type.TYPE_PACKED_FLOAT32_ARRAY: return join_type_name(primitive_name, get_js_array_type_name("float32")); - case Variant.Type.TYPE_PACKED_FLOAT64_ARRAY: return join_type_name(primitive_name, get_js_array_type_name("float64")); - case Variant.Type.TYPE_PACKED_INT32_ARRAY: return join_type_name(primitive_name, get_js_array_type_name("int32")); - case Variant.Type.TYPE_PACKED_INT64_ARRAY: return join_type_name(primitive_name, get_js_array_type_name("int64")); - case Variant.Type.TYPE_PACKED_BYTE_ARRAY: return join_type_name(primitive_name, get_js_array_type_name("byte"), "ArrayBuffer"); - case Variant.Type.TYPE_NODE_PATH: return join_type_name(primitive_name, "string"); + case enum_value(Variant.Type, "TYPE_PACKED_COLOR_ARRAY"): return join_type_name(primitive_name, get_js_array_type_name(get_primitive_type_name(enum_value(Variant.Type, "TYPE_COLOR")))); + case enum_value(Variant.Type, "TYPE_PACKED_VECTOR2_ARRAY"): return join_type_name(primitive_name, get_js_array_type_name(get_primitive_type_name(enum_value(Variant.Type, "TYPE_VECTOR2")))); + case enum_value(Variant.Type, "TYPE_PACKED_VECTOR3_ARRAY"): return join_type_name(primitive_name, get_js_array_type_name(get_primitive_type_name(enum_value(Variant.Type, "TYPE_VECTOR3")))); + case enum_value(Variant.Type, "TYPE_PACKED_STRING_ARRAY"): return join_type_name(primitive_name, get_js_array_type_name("string")); + case enum_value(Variant.Type, "TYPE_PACKED_FLOAT32_ARRAY"): return join_type_name(primitive_name, get_js_array_type_name("float32")); + case enum_value(Variant.Type, "TYPE_PACKED_FLOAT64_ARRAY"): return join_type_name(primitive_name, get_js_array_type_name("float64")); + case enum_value(Variant.Type, "TYPE_PACKED_INT32_ARRAY"): return join_type_name(primitive_name, get_js_array_type_name("int32")); + case enum_value(Variant.Type, "TYPE_PACKED_INT64_ARRAY"): return join_type_name(primitive_name, get_js_array_type_name("int64")); + case enum_value(Variant.Type, "TYPE_PACKED_BYTE_ARRAY"): return join_type_name(primitive_name, get_js_array_type_name("byte"), "ArrayBuffer"); + case enum_value(Variant.Type, "TYPE_NODE_PATH"): return join_type_name(primitive_name, "string"); default: return primitive_name; } } @@ -527,10 +611,15 @@ function replace_var_name(name: string) { abstract class AbstractWriter implements ScopeWriter { abstract line(text: string): void; + abstract concatenate(text: string): void; abstract get size(): number; abstract get lineno(): number; abstract finish(): void; abstract get types(): TypeDB; + abstract add_import(preferred_name: string, script_resource: string, export_name?: string): void; + abstract get_imports(): Record>; + abstract resolve_import(script_resource: string): string; + get class_doc(): jsb.editor.ClassDoc | undefined { return undefined; } constructor() { } @@ -562,7 +651,7 @@ abstract class AbstractWriter implements ScopeWriter { super_: string, super_generic_arguments: undefined | string[], property_overrides: undefined | PropertyOverrides, - intro: undefined | string[], + intro: undefined | Intro, singleton_mode: boolean, class_doc?: jsb.editor.ClassDoc ): ClassWriter { @@ -583,6 +672,13 @@ abstract class AbstractWriter implements ScopeWriter { line_comment_(text: string) { this.line(`// ${text}`); } + append(newLine: boolean, text: string) { + if (newLine) { + this.line(text); + } else { + this.concatenate(text); + } + } } class Description { @@ -702,30 +798,526 @@ class DocCommentHelper { } -class IndentWriter extends AbstractWriter { - protected _base: ScopeWriter; - protected _lines: string[]; - protected _size: number = 0; - - constructor(base: ScopeWriter) { - super(); - this._base = base; - this._lines = []; - } - - get size() { return this._size; } - get lineno() { return this._lines.length; } - get types() { return this._base.types; } +abstract class BufferingWriter extends AbstractWriter { + protected _base: ScopeWriter; + protected _lines: string[]; + protected _size: number = 0; + protected _concatenate_first_line = false; + + constructor(base: ScopeWriter, concatenate_first_line = false) { + super(); + this._base = base; + this._lines = []; + this._concatenate_first_line = concatenate_first_line; + } + + get size() { return this._size; } + get lineno() { return this._lines.length; } + get types() { return this._base.types; } + + add_import(preferred_name: string, script_resource: string, export_name: string = "default") { + this._base.add_import(preferred_name, script_resource, export_name); + } + + get_imports(): Record> { + return this._base.get_imports(); + } + + resolve_import(script_resource: string): string { + return this._base.resolve_import(script_resource); + } + + abstract bufferedSize(text: string, newLine: boolean): number; + + line(text: string): void { + this._lines.push(text); + this._size += this.bufferedSize(text, this._lines.length > 1 || !this._concatenate_first_line); + } + + concatenate(text: string): void { + if (this._lines.length > 0) { + this._lines[this._lines.length - 1] += text; + this._size += this.bufferedSize(text, false); + } else { + this.line(text); + } + } +} +class IndentWriter extends BufferingWriter { finish() { - for (var line of this._lines) { - this._base.line(tab + line); + const lines = this._lines; + for (let i = 0, l = lines.length; i < l; i++) { + if (i === 0 && this._concatenate_first_line) { + this._base.concatenate(lines[i]); + } else { + this._base.line(tab + lines[i]); + } } } - line(text: string): void { - this._lines.push(text); - this._size += tab.length + text.length; + bufferedSize(text: string, newLine: boolean): number { + return text.length + (newLine ? tab.length + 1 : 0); + } +} + +export enum DescriptorType { + Godot, + User, + FunctionLiteral, + ObjectLiteral, + StringLiteral, + NumericLiteral, + BooleanLiteral, + Union, + Intersection, + Conditional, + Tuple, + Infer, + Mapped, +} + +/** + * Reference to a built-in type, either declared in the 'godot' namespace, or available as part of the standard library. + */ +export type GodotTypeDescriptor = GDictionary<{ + type: DescriptorType.Godot; + name: string; + /** + * Generic arguments. + */ + arguments?: GArray; +}>; + +/** + * Reference to a user defined type. A path must be specified so that the generated code is able to import the file + * where the type is declared/exported. + */ +export type UserTypeDescriptor = GDictionary<{ + type: DescriptorType.User; + /** + * res:// style path to the TypeScript module where this type is exported. + */ + resource: string; + /** + * Preferred type name to use when importing. + */ + name: string; + /** + * Named module export that is being imported. When omitted, the default export is imported. + */ + export?: string; + /** + * Generic arguments. + */ + arguments?: GArray; +}>; + +export type GenericParameterDescriptor = GDictionary<{ + name: string; + extends?: TypeDescriptor; + default?: TypeDescriptor; +}>; + +export type ParameterDescriptor = GDictionary<{ + name: string; + type: TypeDescriptor; + default?: TypeDescriptor; +}>; + +export type FunctionLiteralTypeDescriptor = GDictionary<{ + type: DescriptorType.FunctionLiteral; + generics?: GArray; + parameters?: GArray; + returns?: TypeDescriptor; +}>; + +export type ObjectLiteralTypeDescriptor = GDictionary<{ + type: DescriptorType.ObjectLiteral; + properties: GDictionary>>; + index?: GDictionary<{ + key: TypeDescriptor; + value: TypeDescriptor; + }>; +}>; + +export type StringLiteralTypeDescriptor = GDictionary<{ + type: DescriptorType.StringLiteral; + value: string; + template: boolean; // Indicates whether the literal represents a template literal denoted by backticks. +}>; + +export type NumberLiteralTypeDescriptor = GDictionary<{ + type: DescriptorType.NumericLiteral; + value: number; +}>; + +export type BooleanLiteralTypeDescriptor = GDictionary<{ + type: DescriptorType.BooleanLiteral; + value: boolean; +}>; + +export type TupleElementDescriptor = GDictionary<{ + name?: string; // Optional name for the tuple element. + type: TypeDescriptor; +}>; + +export type TupleTypeDescriptor = GDictionary<{ + type: DescriptorType.Tuple; + elements: GArray; // Represents the types and optional names of each element in the tuple. +}>; + +export type UnionTypeDescriptor = GDictionary<{ + type: DescriptorType.Union; + types: GArray; +}>; + +export type IntersectionTypeDescriptor = GDictionary<{ + type: DescriptorType.Intersection; + types: GArray; +}>; + +export type InferTypeDescriptor = GDictionary<{ + type: DescriptorType.Infer; + name: string; // The name of the inferred type (e.g., `U` in `infer U`). +}>; + +export type ConditionalTypeDescriptor = GDictionary<{ + type: DescriptorType.Conditional; + check: TypeDescriptor; + extends: TypeDescriptor; + true: TypeDescriptor; + false: TypeDescriptor; +}>; + +export type MappedTypeDescriptor = GDictionary<{ + type: DescriptorType.Mapped; + key: string; + in: TypeDescriptor; + as?: TypeDescriptor; + value: TypeDescriptor; +}>; + +export type TypeDescriptor = + | GodotTypeDescriptor + | UserTypeDescriptor + | FunctionLiteralTypeDescriptor + | ObjectLiteralTypeDescriptor + | StringLiteralTypeDescriptor + | NumberLiteralTypeDescriptor + | BooleanLiteralTypeDescriptor + | TupleTypeDescriptor + | UnionTypeDescriptor + | IntersectionTypeDescriptor + | InferTypeDescriptor + | ConditionalTypeDescriptor + | MappedTypeDescriptor; + +/** + * Codegen analogue of NodePathMap. + */ +export type NodeTypeDescriptorPathMap = GDictionary>>; + +export enum CodeGenType { + ScriptNodeTypeDescriptor, +} + +/** + * Handle a NodeTypeDescriptorCodeGenRequest to overwrite the generated type for node's using this script. + */ +export type ScriptNodeTypeDescriptorCodeGenRequest = GDictionary<{ + type: CodeGenType.ScriptNodeTypeDescriptor; + node: Node; + children: NodeTypeDescriptorPathMap; +}>; + +export type CodeGenRequest = ScriptNodeTypeDescriptorCodeGenRequest; + +/** + * You can manipulate GodotJS' codegen by exporting a function from your script/module called `codegen`. + */ +export type CodeGenHandler = (request: CodeGenRequest) => undefined | TypeDescriptor; + +class TypeDescriptorWriter extends BufferingWriter { + bufferedSize(text: string, newLine: boolean): number { + return text.length + (newLine ? 1 : 0); + } + + finish() { + const lines = this._lines; + for (let i = 0, l = lines.length; i < l; i++) { + if (i === 0 && this._concatenate_first_line) { + this._base.concatenate(lines[i]); + } else { + this._base.line(lines[i]); + } + } + } + + serialize_type_descriptor(descriptor: GReadProxyValueWrap): void { + switch (descriptor.type) { + case DescriptorType.Godot: { + if (descriptor.arguments) { + this.line(`${descriptor.name}<`); + const indent = descriptor.arguments.length > 1 ? new IndentWriter(this) : null; + const args = new TypeDescriptorWriter(indent ?? this, descriptor.arguments.length === 1); + descriptor.arguments.forEach((arg, index) => { + if (index > 0) { + args.concatenate(", "); + } + + args.serialize_type_descriptor(arg); + }); + args.finish(); + indent?.finish(); + this.append(descriptor.arguments.length !== 1, `>`); + } else { + this.line(descriptor.name); + } + break; + } + case DescriptorType.User: { + if (descriptor.arguments) { + this.line(`${descriptor.name}<`); + const indent = descriptor.arguments.length > 1 ? new IndentWriter(this) : null; + const args = new TypeDescriptorWriter(indent ?? this, descriptor.arguments.length === 1); + descriptor.arguments.forEach((arg, index) => { + if (index > 0) { + args.concatenate(", "); + } + + args.serialize_type_descriptor(arg); + }); + args.finish(); + indent?.finish(); + this.append(descriptor.arguments.length !== 1, `>`); + } else { + this.line(descriptor.name); + } + + this.add_import(descriptor.name, descriptor.resource, descriptor.export); + break; + } + + case DescriptorType.FunctionLiteral: { + const generic_count = descriptor.generics ? Object.entries(descriptor.generics).length : 0; + + if (generic_count > 0) { + descriptor.generics!.forEach((generic, index) => { + if (index > 0) { + this.concatenate(", "); + this.line(generic.name); + } else { + this.append(generic_count === 1, generic.name); + } + + if (generic.extends) { + this.concatenate(" extends "); + const extends_writer = new TypeDescriptorWriter(this, true); + extends_writer.serialize_type_descriptor(generic.extends); + extends_writer.finish(); + } + + if (generic.default) { + this.concatenate(" = "); + const default_writer = new TypeDescriptorWriter(this, true); + default_writer.serialize_type_descriptor(generic.default); + default_writer.finish(); + } + }); + } + + this.append(generic_count == 0, `(`); + + const multiline = (descriptor.parameters?.length ?? 0) > 1; + + if (descriptor.parameters) { + descriptor.parameters.forEach((param, index) => { + if (index > 0) { + this.concatenate(", "); + } + + this.line(`${param.name}: `); + + const param_writer = new TypeDescriptorWriter(this, !multiline); + param_writer.serialize_type_descriptor(param.type); + param_writer.finish(); + + if (param.default) { + this.concatenate(` = `); + const default_writer = new TypeDescriptorWriter(this, true); + default_writer.serialize_type_descriptor(param.default); + default_writer.finish(); + } + }); + } + + this.append(multiline, ") => "); + + if (descriptor.returns) { + const return_writer = new TypeDescriptorWriter(this, true); + return_writer.serialize_type_descriptor(descriptor.returns); + return_writer.finish(); + } else { + this.concatenate("void"); + } + + break; + } + + case DescriptorType.ObjectLiteral: { + const properties = Object.entries(descriptor.properties); + + if (properties.length === 0 && !descriptor.index) { + this.line("{}"); + break; + } + + this.line("{"); + const indent = new IndentWriter(this); + properties.forEach(([key, value]) => { + if (!value) { + return; + } + + indent.line(`${key}: `); + const prop_writer = new TypeDescriptorWriter(indent, true); + prop_writer.serialize_type_descriptor(value); + prop_writer.finish(); + indent.concatenate(";"); + }); + + if (descriptor.index) { + indent.line("[key: "); + const key_writer = new TypeDescriptorWriter(indent, true); + key_writer.serialize_type_descriptor(descriptor.index.key); + key_writer.finish(); + indent.concatenate("]: "); + const value_writer = new TypeDescriptorWriter(indent, true); + value_writer.serialize_type_descriptor(descriptor.index.value); + value_writer.finish(); + indent.concatenate(";"); + } + + indent.finish(); + this.line("}"); + break; + } + + case DescriptorType.StringLiteral: { + this.line(descriptor.template + ? `\`${descriptor.value.replace(/`/g, "\\`")}\`` + : `"${descriptor.value.replace(/"/g, '\\"')}"`); + break; + } + + case DescriptorType.NumericLiteral: { + this.line(`${descriptor.value}`); + break; + } + + case DescriptorType.BooleanLiteral: { + this.line(`${descriptor.value}`); + break; + } + + case DescriptorType.Tuple: { + this.line(`[`); + const multiline = descriptor.elements.length > 1; + descriptor.elements.forEach((element, index) => { + if (index > 0) { + this.line(", "); + } + + if (element.name) { + this.append(multiline, `${element.name}: `); + } + + const tuple_writer = new TypeDescriptorWriter(this, !multiline || !!element.name); + tuple_writer.serialize_type_descriptor(element.type); + tuple_writer.finish(); + }); + this.append(multiline, "]"); + break; + } + + case DescriptorType.Union: { + descriptor.types.forEach((type, index) => { + if (index > 0) { + this.line(" | "); + } + + const union_writer = new TypeDescriptorWriter(this, index > 0); + union_writer.serialize_type_descriptor(type); + union_writer.finish(); + }); + break; + } + + case DescriptorType.Intersection: { + descriptor.types.forEach((type, index) => { + if (index > 0) { + this.line(" & "); + } + + const intersection_writer = new TypeDescriptorWriter(this, index > 0); + intersection_writer.serialize_type_descriptor(type); + intersection_writer.finish(); + }); + break; + } + + case DescriptorType.Infer: { + this.line(`infer ${descriptor.name}`); + break; + } + + case DescriptorType.Conditional: { + const check_writer = new TypeDescriptorWriter(this); + check_writer.serialize_type_descriptor(descriptor.check); + check_writer.finish(); + + this.line("extends "); + const extends_writer = new TypeDescriptorWriter(this, true); + extends_writer.serialize_type_descriptor(descriptor.extends); + extends_writer.finish(); + + this.line("? "); + const true_writer = new TypeDescriptorWriter(this, true); + true_writer.serialize_type_descriptor(descriptor.true); + true_writer.finish(); + + this.line(": "); + const false_writer = new TypeDescriptorWriter(this, true); + false_writer.serialize_type_descriptor(descriptor.false); + false_writer.finish(); + + break; + } + + case DescriptorType.Mapped: { + this.line(`{ [${descriptor.key} in `); + const in_writer = new TypeDescriptorWriter(this, true); + in_writer.serialize_type_descriptor(descriptor.in); + in_writer.finish(); + + if (descriptor.as) { + const as_writer = new TypeDescriptorWriter(this, true); + as_writer.serialize_type_descriptor(descriptor.as); + as_writer.finish(); + } + + this.concatenate(`]: `); + + const value_start_line = this.lineno; + const value_writer = new TypeDescriptorWriter(this, true); + value_writer.serialize_type_descriptor(descriptor.value); + value_writer.finish(); + this.append(this.lineno === value_start_line, "}"); + + break; + } + } } } @@ -738,6 +1330,35 @@ class ModuleWriter extends IndentWriter { } finish() { + for (const [script_resource, script_import_map] of Object.entries(this.get_imports())) { + const script_imports = Object.entries(script_import_map); + const default_import = script_import_map["default"]; + const resolved_path = this.resolve_import(script_resource).replace(/"/g, '"'); + const explicit_imports = script_imports.length > (default_import ? 1 : 0); + + if (default_import) { + if (explicit_imports) { + this._base.line(`import ${default_import}, {`); + } else { + this._base.line(`import ${default_import} from "${resolved_path}";`); + } + } else { + this._base.line(`import ${default_import}, {`); + } + + if (explicit_imports) { + for (const [name, as] of script_imports) { + if (name === as) { + this._base.line(`${tab}${name},`); + } else { + this._base.line(`${tab}${name} as ${as},`); + } + } + + this._base.line(`} from "${resolved_path}";`); + } + } + this._base.line(`declare module "${this._name}" {`); super.finish(); this._base.line('}'); @@ -784,7 +1405,7 @@ class ClassWriter extends IndentWriter { protected _generic_parameters?: Record; protected _super?: string; protected _super_generic_arguments?: string[]; - protected _intro?: string[]; + protected _intro?: Intro; protected _property_overrides?: Record string)>; protected _singleton_mode: boolean; protected _doc?: jsb.editor.ClassDoc; @@ -798,7 +1419,7 @@ class ClassWriter extends IndentWriter { generic_parameters: undefined | Record, super_: undefined | string, super_generic_arguments: undefined | string[], - intro: undefined | string[], + intro: undefined | Intro, property_overrides: undefined | PropertyOverrides, singleton_mode: boolean, class_doc?: jsb.editor.ClassDoc @@ -809,7 +1430,7 @@ class ClassWriter extends IndentWriter { this._super = super_; this._super_generic_arguments = super_generic_arguments; this._intro = intro; - this._property_overrides = property_overrides; + this._property_overrides = jsb.CAMEL_CASE_BINDINGS_ENABLED ? camel_property_overrides(property_overrides) : property_overrides; this._singleton_mode = singleton_mode; this._doc = class_doc; } @@ -838,7 +1459,11 @@ class ClassWriter extends IndentWriter { return } - for (const line of this._intro) { + const lines = Array.isArray(this._intro) + ? this._intro + : this._intro(this.types); + + for (const line of lines) { this._base.line(tab + line); } } @@ -915,7 +1540,7 @@ class ClassWriter extends IndentWriter { constructor_(constructor_info: jsb.editor.ConstructorInfo) { this._separator_line = true; const args = constructor_info.arguments.map(it => - `${replace_var_name(it.name)}: ${this.types.replace_type_inplace(get_primitive_type_name_as_input(it.type), this.get_scoped_type_replacer())}` + `${replace_var_name(it.name)}: ${this.types.replace_type_inplace(get_primitive_type_name_as_input(it.type))}` ).join(", "); this.line(`constructor(${args})`); } @@ -926,12 +1551,12 @@ class ClassWriter extends IndentWriter { operator_(operator_info: jsb.editor.OperatorInfo) { this._separator_line = true; - const return_type_name = this.types.replace_type_inplace(get_primitive_type_name(operator_info.return_type), this.get_scoped_type_replacer()); - const left_type_name = this.types.replace_type_inplace(get_primitive_type_name_as_input(operator_info.left_type), this.get_scoped_type_replacer()); - if (operator_info.right_type == Variant.Type.TYPE_NIL) { + const return_type_name = this.types.replace_type_inplace(get_primitive_type_name(operator_info.return_type)); + const left_type_name = this.types.replace_type_inplace(get_primitive_type_name_as_input(operator_info.left_type)); + if (operator_info.right_type == enum_value(Variant.Type, "TYPE_NIL")) { this.line(`static ${operator_info.name}(left: ${left_type_name}): ${return_type_name}`); } else { - const right_type_name = this.types.replace_type_inplace(get_primitive_type_name_as_input(operator_info.right_type), this.get_scoped_type_replacer()); + const right_type_name = this.types.replace_type_inplace(get_primitive_type_name_as_input(operator_info.right_type)); this.line(`static ${operator_info.name}(left: ${left_type_name}, right: ${right_type_name}): ${return_type_name}`); } } @@ -944,24 +1569,6 @@ class ClassWriter extends IndentWriter { this.method_(method_info, ""); } - //TODO gtPlaceholder (Optional) Generic type argument placeholder, return the generic typed version if in a generic type context. - private get_scoped_type_replacer(gtPlaceholder?: string) { - const replaceClasses = ["Signal", "Callable", "GArray"]; - if (replaceClasses.includes(this._name)) { - // specialized type name in the declaration scope of this type itself - return function (type_name: string): string { - if (type_name == "Signal") return "AnySignal"; - if (type_name == "Callable") return "AnyCallable"; - return type_name; - } - } else { - // type name in the declaration scope of other types - return function (type_name: string): string { - return type_name; - } - } - } - method_(method_info: jsb.editor.MethodBind, category: string) { DocCommentHelper.write(this, this._doc?.methods[method_info.name]?.description, this._separator_line); this._separator_line = true; @@ -975,8 +1582,8 @@ class ClassWriter extends IndentWriter { } const line = (line: string) => this.line(property_override?.(line) ?? line); - let args = this.types.make_args(method_info, this.get_scoped_type_replacer()); - let rval = this.types.make_return(method_info, this.get_scoped_type_replacer()); + let args = this.types.make_args(method_info); + let rval = this.types.make_return(method_info); const prefix = this.make_method_prefix(method_info); let template = ""; @@ -1062,7 +1669,7 @@ class InterfaceWriter extends IndentWriter { this._super = super_; this._super_generic_arguments = super_generic_arguments; this._intro = intro; - this._property_overrides = property_overrides; + this._property_overrides = jsb.CAMEL_CASE_BINDINGS_ENABLED ? camel_property_overrides(property_overrides) : property_overrides; } protected head() { @@ -1118,24 +1725,15 @@ class InterfaceWriter extends IndentWriter { } } -class GenericWriter extends AbstractWriter { - private _name: string; - private _base: ScopeWriter; - private _lines: string[]; - private _size: number; +class GenericWriter extends IndentWriter { + private _name: string; constructor(base: AbstractWriter, name: string) { - super(); - this._base = base; - this._name = name; - this._lines = []; - this._size = name.length + 2; + super(base); + this._name = name; + this._size += name.length + 2; } - get size() { return this._size; } - get lineno() { return this._lines.length; } - get types() { return this._base.types; } - finish(): void { if (this._lines.length < 2) { this._base.line(`${this._name}<${this._lines[0] ?? ""}>`); @@ -1143,18 +1741,9 @@ class GenericWriter extends AbstractWriter { } this._base.line(`${this._name}<`); - const indented = new IndentWriter(this._base); - for (const line of this._lines) { - indented.line(line); - } - indented.finish(); + super.finish(); this._base.line(">"); } - - line(text: string): void { - this._lines.push(text); - this._size += text.length + 1; // + 1 due to the line break, tabs? - } } class ObjectWriter extends IndentWriter { @@ -1168,7 +1757,7 @@ class ObjectWriter extends IndentWriter { ) { super(base); this._intro = intro; - this._property_overrides = property_overrides; + this._property_overrides = jsb.CAMEL_CASE_BINDINGS_ENABLED ? camel_property_overrides(property_overrides) : property_overrides; } intro() { @@ -1213,47 +1802,35 @@ class ObjectWriter extends IndentWriter { } } -class PropertyWriter extends AbstractWriter { - private _name: string; - private _base: ScopeWriter; - private _lines: string[]; - private _size: number = 0; +class PropertyWriter extends BufferingWriter { + private _key: string; - constructor(base: AbstractWriter, name: string) { - super(); - this._base = base; - this._name = name; - this._lines = []; + constructor(base: ScopeWriter, name: string, concatenate_first_line = false) { + super(base, concatenate_first_line); + this._key = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name) + ? name + : `"${name.replace("\"", "\\\"")}"`; + this._size += this._key.length + 3; } - get size() { return this._size; } - get lineno() { return this._lines.length; } - get types() { return this._base.types; } + finish() { + if (this._lines.length === 0) { + return; + } - finish(): void { - if (this._lines.length === 0) { - return; - } + this._base.append(!this._concatenate_first_line, `${this._key}: `); - this._lines[this._lines.length - 1] += ","; + const lines = this._lines; + for (let i = 0, l = lines.length; i < l; i++) { + this._base.append(i > 0, lines[i]); + } - for (const line of this._lines) { - this._base.line(line); - } - } + this._base.concatenate(";"); + } - line(text: string): void { - if (this._lines.length === 0) { - const key = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(this._name) - ? this._name - : `"${this._name.replace("\"", "\\\"")}"`; - text = `${key}: ${text}`; - this._size = 1; // trailing comma - } - - this._lines.push(text); - this._size += text.length; - } + bufferedSize(text: string, newLine: boolean): number { + return text.length + (newLine ? 1 : 0); + } } class FileWriter extends AbstractWriter { @@ -1261,25 +1838,79 @@ class FileWriter extends AbstractWriter { private _size = 0; private _lineno = 0; private _types: TypeDB; + private _path: string; + private _import_map: Record> = {}; + private _import_names = new Set(); + + private get_import_name(preferred_name: string): string { + if (!preferred_name) { + return this.get_import_name("MyType"); + } + + if (this._import_names.has(preferred_name)) { + return this.get_import_name(preferred_name + "_"); + } + + this._import_names.add(preferred_name); + return preferred_name; + } - constructor(types: TypeDB, file: FileAccess) { + constructor(path: string, types: TypeDB, file: FileAccess) { super(); + this._path = path; this._types = types; this._file = file; } + add_import(preferred_name: string, script_resource: string, export_name = 'default'): void { + const resource_imports = this._import_map[script_resource] ??= {}; + resource_imports[export_name] ??= this.get_import_name(preferred_name); + } + + get_imports(): Record> { + return this._import_map; + } + + resolve_import(destination: string): string { + const source = this._path.replace(/^\.?\/?/, "res://"); + const source_length = source.length; + const destination_length = destination.length; + + let last_slash_index = -1; + + for (let i = 0; i < source_length && i < destination_length && source[i] === destination[i]; i++) { + if (source[i] === '/') { + last_slash_index = i; + } + } + + let up = ''; + for (let i = last_slash_index + 1; i < source_length; i++) { + if (source[i] === '/') { + up += '../'; + } + } + + return (up || './') + destination.slice(last_slash_index + 1).replace(/\.[jt]sx?$/, ""); + } + get size() { return this._size; } get lineno() { return this._lineno; } get types() { return this._types; } line(text: string): void { - this._file.store_line(text); - this._size += text.length; + gd_method(this._file, 'store_line')(text); + this._size += text.length + 1; this._lineno += 1; } + concatenate(text: string): void { + gd_method(this._file, 'store_string')(text); + this._size += text.length; + } + finish(): void { - this._file.flush(); + gd_method(this._file, 'flush')(); } } @@ -1288,19 +1919,19 @@ class FileSplitter { private _toplevel: ModuleWriter; private _types: TypeDB; - constructor(types: TypeDB, filePath: string) { + constructor(types: TypeDB, path: string) { this._types = types; - this._file = FileAccess.open(filePath, FileAccess.ModeFlags.WRITE); - this._toplevel = new ModuleWriter(new FileWriter(this._types, this._file), "godot"); + this._file = gd_method(FileAccess, 'open')(path, enum_value(FileAccess.ModeFlags, "WRITE")); + this._toplevel = new ModuleWriter(new FileWriter(path, this._types, this._file), "godot"); - this._file.store_line("// AUTO-GENERATED"); - this._file.store_line('/// '); + gd_method(this._file, 'store_line')("// AUTO-GENERATED"); + gd_method(this._file, 'store_line')('/// '); } close() { this._toplevel.finish(); - this._file.flush(); - this._file.close(); + gd_method(this._file, 'flush')(); + gd_method(this._file, 'close')(); } get_writer() { @@ -1318,6 +1949,7 @@ export class TypeDB { primitive_type_names: { [type: number /* Variant.Type */]: string } = {}; globals: { [name: string]: jsb.editor.GlobalConstantInfo } = {}; utilities: { [name: string]: jsb.editor.MethodBind } = {}; + internal_class_name_map: { [name: string]: string } = {}; // `class_doc` is loaded lazily once used, and be cached in `class_docs` class_docs: { [name: string]: jsb.editor.ClassDoc | false } = {}; @@ -1330,6 +1962,7 @@ export class TypeDB { const utilities = jsb.editor.get_utility_functions(); for (let cls of classes) { this.classes[cls.name] = cls; + this.internal_class_name_map[cls.internal_name] = cls.name; } for (let cls of primitive_types) { this.primitive_types[cls.name] = cls; @@ -1409,8 +2042,8 @@ export class TypeDB { } } - make_typename(info: jsb.editor.PropertyInfo, used_as_input: boolean): string { - if (info.hint == PropertyHint.PROPERTY_HINT_RESOURCE_TYPE) { + make_typename(info: PropertyInfo, used_as_input: boolean): string { + if (info.hint == enum_value(PropertyHint, "PROPERTY_HINT_RESOURCE_TYPE")) { console.assert(info.hint_string.length != 0, "at least one valid class_name expected"); return info.hint_string.split(",").map(class_name => this.make_classname(class_name, used_as_input)).join(" | ") } @@ -1427,7 +2060,7 @@ export class TypeDB { return this.make_classname(info.class_name, used_as_input); } - make_arg(info: jsb.editor.PropertyInfo, type_replacer?: (name: string) => string): string { + make_arg(info: PropertyInfo, type_replacer?: (name: string) => string): string { return `${replace_var_name(info.name)}: ${this.replace_type_inplace(this.make_typename(info, true), type_replacer)}` } @@ -1435,21 +2068,21 @@ export class TypeDB { // plain types const type_name = get_primitive_type_name(value.type); switch (value.type) { - case Variant.Type.TYPE_BOOL: return value.value == null ? "false" : `${value.value}`; - case Variant.Type.TYPE_FLOAT: - case Variant.Type.TYPE_INT: return value.value == null ? "0" : `${value.value}`; - case Variant.Type.TYPE_STRING: - case Variant.Type.TYPE_STRING_NAME: return value.value == null ? "''" : `'${value.value}'`; - case Variant.Type.TYPE_NODE_PATH: return value.value == null ? "''" : `'${gd_to_string(value.value)}'`; - case Variant.Type.TYPE_ARRAY: return value.value == null || value.value.is_empty() ? "[]" : `${gd_to_string(value.value)}`; - case Variant.Type.TYPE_OBJECT: return value.value == null ? "undefined" : " {}"; - case Variant.Type.TYPE_NIL: return " {}"; - case Variant.Type.TYPE_CALLABLE: - case Variant.Type.TYPE_RID: return `new ${type_name}()`; + case enum_value(Variant.Type, "TYPE_BOOL"): return value.value == null ? "false" : `${value.value}`; + case enum_value(Variant.Type, "TYPE_FLOAT"): + case enum_value(Variant.Type, "TYPE_INT"): return value.value == null ? "0" : `${value.value}`; + case enum_value(Variant.Type, "TYPE_STRING"): + case enum_value(Variant.Type, "TYPE_STRING_NAME"): return value.value == null ? "''" : `'${value.value}'`; + case enum_value(Variant.Type, "TYPE_NODE_PATH"): return value.value == null ? "''" : `'${gd_to_string(value.value)}'`; + case enum_value(Variant.Type, "TYPE_ARRAY"): return value.value == null || gd_method(value.value, 'is_empty')() ? "[]" : `${gd_to_string(value.value)}`; + case enum_value(Variant.Type, "TYPE_OBJECT"): return value.value == null ? "undefined" : " {}"; + case enum_value(Variant.Type, "TYPE_NIL"): return " {}"; + case enum_value(Variant.Type, "TYPE_CALLABLE"): + case enum_value(Variant.Type, "TYPE_RID"): return `new ${type_name}()`; default: break; } // make them more readable? - if (value.type == Variant.Type.TYPE_VECTOR2 || value.type == Variant.Type.TYPE_VECTOR2I) { + if (value.type == enum_value(Variant.Type, "TYPE_VECTOR2") || value.type == enum_value(Variant.Type, "TYPE_VECTOR2I")) { if (value == null) return `new ${type_name}()`; if (value.value.x == value.value.y) { if (value.value.x == 0) return `${type_name}.ZERO`; @@ -1457,7 +2090,7 @@ export class TypeDB { } return `new ${type_name}(${value.value.x}, ${value.value.y})`; } - if (value.type == Variant.Type.TYPE_VECTOR3 || value.type == Variant.Type.TYPE_VECTOR3I) { + if (value.type == enum_value(Variant.Type, "TYPE_VECTOR3") || value.type == enum_value(Variant.Type, "TYPE_VECTOR3I")) { if (value == null) return `new ${type_name}()`; if (value.value.x == value.value.y == value.value.z) { if (value.value.x == 0) return `${type_name}.ZERO`; @@ -1465,25 +2098,25 @@ export class TypeDB { } return `new ${type_name}(${value.value.x}, ${value.value.y}, ${value.value.z})`; } - if (value.type == Variant.Type.TYPE_COLOR) { + if (value.type == enum_value(Variant.Type, "TYPE_COLOR")) { if (value == null) return `new ${type_name}()`; return `new ${type_name}(${value.value.r}, ${value.value.g}, ${value.value.b}, ${value.value.a})`; } - if (value.type == Variant.Type.TYPE_RECT2 || value.type == Variant.Type.TYPE_RECT2I) { + if (value.type == enum_value(Variant.Type, "TYPE_RECT2") || value.type == enum_value(Variant.Type, "TYPE_RECT2I")) { if (value.value == null) return `new ${type_name}()`; return `new ${type_name}(${value.value.position.x}, ${value.value.position.y}, ${value.value.size.x}, ${value.value.size.y})` } // it's tedious to repeat all types :( - if ((value.type >= Variant.Type.TYPE_PACKED_BYTE_ARRAY && value.type <= Variant.Type.TYPE_PACKED_COLOR_ARRAY)) { - if (value.value == null || value.value.is_empty()) { + if ((value.type >= enum_value(Variant.Type, "TYPE_PACKED_BYTE_ARRAY") && value.type <= enum_value(Variant.Type, "TYPE_PACKED_COLOR_ARRAY"))) { + if (value.value == null || gd_method(value.value, 'is_empty')()) { return "[]"; } } - if (value.type == Variant.Type.TYPE_DICTIONARY) { - if (value.value == null || value.value.is_empty()) return `new ${type_name}()`; + if (value.type == enum_value(Variant.Type, "TYPE_DICTIONARY")) { + if (value.value == null || gd_method(value.value, 'is_empty')()) return `new ${type_name}()`; } //NOTE hope all default value for Transform2D/Transform3D is IDENTITY - if (value.type == Variant.Type.TYPE_TRANSFORM2D || value.type == Variant.Type.TYPE_TRANSFORM3D) { + if (value.type == enum_value(Variant.Type, "TYPE_TRANSFORM2D") || value.type == enum_value(Variant.Type, "TYPE_TRANSFORM3D")) { return `new ${type_name}()`; } @@ -1504,8 +2137,8 @@ export class TypeDB { make_args(method_info: jsb.editor.MethodBind, type_replacer?: (name: string) => string): string { //TODO consider default arguments - const varargs = "...vargargs: any[]"; - const is_vararg = !!(method_info.hint_flags & MethodFlags.METHOD_FLAG_VARARG); + const varargs = "...varargs: any[]"; + const is_vararg = !!(method_info.hint_flags & enum_value(MethodFlags, "METHOD_FLAG_VARARG")); if (method_info.args_.length == 0) { return is_vararg ? varargs : ""; } @@ -1525,20 +2158,12 @@ export class TypeDB { } make_signal_type(method_info: jsb.editor.MethodBind): string { - const is_vararg = !!(method_info.hint_flags & MethodFlags.METHOD_FLAG_VARARG); - if (is_vararg || method_info.args_.length > 5) { - // too difficult to declare as strongly typed, just fallback to raw signal type - return "Signal"; - } - - const base_name = "Signal" + method_info.args_.length; - if (method_info.args_.length == 0) { - return base_name; + const args = method_info.args_.map((arg => `${arg.name}: ${this.make_typename(arg, true)}`)); + if (method_info.hint_flags & enum_value(MethodFlags, "METHOD_FLAG_VARARG")) { + args.push("...varargs: any[]"); } - const args = method_info.args_.map((it, index) => this.make_typename(method_info.args_[index], true)).join(", "); - return `${base_name}<${args}>`; + return `Signal<(${args.join(", ")}) => void>`; } - } // d.ts generator @@ -1594,7 +2219,7 @@ export class TSDCodeGen { private cleanup() { while (true) { const path = this.make_path(this._split_index++); - if (!FileAccess.file_exists(path)) { + if (!gd_method(FileAccess, 'file_exists')(path)) { break; } console.log("delete file", path); @@ -1693,7 +2318,7 @@ export class TSDCodeGen { if (GodotAnyType != "any") { let gd_variant_alias = `type ${GodotAnyType} = `; - for (let i = Variant.Type.TYPE_NIL + 1; i < Variant.Type.TYPE_MAX; ++i) { + for (let i = enum_value(Variant.Type, "TYPE_NIL") + 1; i < enum_value(Variant.Type, "TYPE_MAX"); ++i) { const type_name = get_primitive_type_name(i); if (type_name == GodotAnyType || type_name == "any") continue; gd_variant_alias += type_name + " | "; @@ -1722,15 +2347,12 @@ export class TSDCodeGen { if (cls.enums) { for (let enum_info of cls.enums) { const enum_cg = class_ns_cg.enum_(enum_info.name); - let previousValue = -1; - for (let enumeration_name of enum_info.literals) { - const constant = cls.constants!.find(v => v.name == enumeration_name); - const value = constant?.value ?? previousValue + 1; - enum_cg.element_(enumeration_name, value); + for (let [name, value] of Object.entries(enum_info.literals)) { + const constant = cls.constants!.find(v => v.name == name); + enum_cg.element_(name, value); if (constant) { - ignored_consts.add(enumeration_name); + ignored_consts.add(name); } - previousValue = value; } enum_cg.finish(); } @@ -1743,7 +2365,7 @@ export class TSDCodeGen { const class_cg = cg.class_(type_name, type_mutation.generic_parameters, super_, type_mutation.super_generic_arguments, type_mutation.property_overrides, type_mutation.intro, false, class_doc); if (cls.constants) { for (let constant of cls.constants) { - if (!ignored_consts.has(constant.name)) { + if (!ignored_consts.has(constant.name) && !ignored_consts.has(upper_snake_to_pascal_case(constant.name))) { class_cg.primitive_constant_(constant); } } @@ -1772,10 +2394,9 @@ export class TSDCodeGen { if (cls.enums) { for (let enum_info of cls.enums) { const enum_cg = class_ns_cg.enum_(enum_info.name); - for (let enumeration_name of enum_info.literals) { - const value = cls.constants!.find(v => v.name == enumeration_name)!.value; - enum_cg.element_(enumeration_name, value) - ignored_consts.add(enumeration_name); + for (let [name, value] of Object.entries(enum_info.literals)) { + enum_cg.element_(name, value) + ignored_consts.add(name); } enum_cg.finish(); } @@ -1863,13 +2484,17 @@ export class SceneTSDCodeGen { return tasks.submit(); } - private emit_children_node_types(writer: ScopeWriter, children: Record) { + private emit_children_node_types(writer: ScopeWriter, children: GReadProxyValueWrap) { const child_writer = writer.object_(); for (const [key, value] of Object.entries(children)) { + if (!value) { + continue; + } + const property = child_writer.property_(key); - const generic = property.generic_(value.class); - this.emit_children_node_types(generic, value.children); - generic.finish(); + const descriptor = new TypeDescriptorWriter(property, true); + descriptor.serialize_type_descriptor(value); + descriptor.finish(); property.finish(); } child_writer.finish(); @@ -1878,31 +2503,32 @@ export class SceneTSDCodeGen { private emit_scene_node_types(scene_path: string) { try { const helper = require('godot').GodotJSEditorHelper; - const result = helper.get_scene_nodes(scene_path)?.proxy(); + const children = (gd_method(helper, 'get_scene_nodes')(scene_path) as undefined | NodeTypeDescriptorPathMap)?.proxy(); - if (!result) { + if (typeof children !== 'object') { throw new Error(`root node children unavailable: ${scene_path}`); } const dir_path = this.make_path(scene_path, false); - const dir_error = DirAccess.make_dir_recursive_absolute(dir_path); + const dir_error = gd_method(DirAccess, 'make_dir_recursive_absolute')(dir_path); if (dir_error !== 0) { console.error(`failed to create directory (error: ${dir_error}): ${dir_path}`); } - const file = FileAccess.open(this.make_path(scene_path), FileAccess.ModeFlags.WRITE); + const file_path = this.make_path(scene_path); + const file = gd_method(FileAccess, 'open')(file_path, enum_value(FileAccess.ModeFlags, "WRITE")); if (!file) { throw new Error(`failed to open file for writing: ${dir_path}`); } try { - const file_writer = new FileWriter(this._types, file); + const file_writer = new FileWriter(file_path, this._types, file); const module = new ModuleWriter(file_writer, 'godot'); const scene_nodes_interface = new InterfaceWriter(module, 'SceneNodes'); const scene_property = scene_nodes_interface.property_(scene_path.replace(/^res:\/\//, '')); - this.emit_children_node_types(scene_property, result.children); + this.emit_children_node_types(scene_property, children); scene_property.finish(); scene_nodes_interface.finish(); module.finish(); diff --git a/scripts/jsb.runtime/src/godot.annotations.ts b/scripts/jsb.runtime/src/godot.annotations.ts index a19fa28d..5d9a1b4e 100644 --- a/scripts/jsb.runtime/src/godot.annotations.ts +++ b/scripts/jsb.runtime/src/godot.annotations.ts @@ -2,10 +2,29 @@ import { PropertyHint, PropertyUsageFlags, Variant, MultiplayerAPI, MultiplayerPeer } from "godot"; import * as jsb from "godot-jsb"; +type UpperSnakeToPascalCase = + S extends `${infer T}_${infer U}` + ? `${Capitalize>}${UpperSnakeToPascalCase>>}` + : Capitalize>; + +function upperSnakeToPascalCase(input: T): UpperSnakeToPascalCase { + return input + .toLowerCase() + .split('_') + .map(word => word.charAt(0).toUpperCase() + word.slice(1)) + .join('') as UpperSnakeToPascalCase; +} + +// Godot's runtime can be toggled between snake case and camel case naming schemes. The types we're building against +// use snake case, but if the user has camel case enabled, use of snake case would fail at runtime. We just try both. +function enum_value(enum_map: E, name: N): E[N] { + return (enum_map[name as keyof E] ?? enum_map[upperSnakeToPascalCase(name) as any as keyof E]) as E[N]; +} + function guess_type_name(type: any) { if (typeof type === "function") { return type.name; - } + } if (typeof type === "object") { if (typeof type.constructor === "function") { return type.constructor.name; @@ -51,68 +70,86 @@ export function signal() { } } +export const ExportSignal = signal; + export function export_multiline() { - return export_(Variant.Type.TYPE_STRING, { hint: PropertyHint.PROPERTY_HINT_MULTILINE_TEXT }); + return export_(enum_value(Variant.Type, "TYPE_STRING"), { hint: enum_value(PropertyHint, "PROPERTY_HINT_MULTILINE_TEXT") }); } +export const ExportMultiline = export_multiline; + function __export_range(type: Variant.Type, min: number, max: number, step: number = 1, ...extra_hints: string[]) { let hint_string = `${min},${max},${step}`; if (typeof extra_hints !== "undefined") { hint_string += "," + extra_hints.join(","); } - return export_(type, { hint: PropertyHint.PROPERTY_HINT_RANGE, hint_string: hint_string }); + return export_(type, { hint: enum_value(PropertyHint, "PROPERTY_HINT_RANGE"), hint_string: hint_string }); } export function export_range(min: number, max: number, step: number = 1, ...extra_hints: string[]) { - return __export_range(Variant.Type.TYPE_FLOAT, min, max, step, ...extra_hints); + return __export_range(enum_value(Variant.Type, "TYPE_FLOAT"), min, max, step, ...extra_hints); } +export const ExportRange = export_range; + export function export_range_i(min: number, max: number, step: number = 1, ...extra_hints: string[]) { - return __export_range(Variant.Type.TYPE_INT, min, max, step, ...extra_hints); + return __export_range(enum_value(Variant.Type, "TYPE_INT"), min, max, step, ...extra_hints); } +export const ExportIntRange = export_range_i; + /** String as a path to a file, custom filter provided as hint. */ export function export_file(filter: string) { - return export_(Variant.Type.TYPE_STRING, { hint: PropertyHint.PROPERTY_HINT_FILE, hint_string: filter }); + return export_(enum_value(Variant.Type, "TYPE_STRING"), { hint: enum_value(PropertyHint, "PROPERTY_HINT_FILE"), hint_string: filter }); } +export const ExportFile = export_file; + export function export_dir(filter: string) { - return export_(Variant.Type.TYPE_STRING, { hint: PropertyHint.PROPERTY_HINT_DIR, hint_string: filter }); + return export_(enum_value(Variant.Type, "TYPE_STRING"), { hint: enum_value(PropertyHint, "PROPERTY_HINT_DIR"), hint_string: filter }); } export function export_global_file(filter: string) { - return export_(Variant.Type.TYPE_STRING, { hint: PropertyHint.PROPERTY_HINT_GLOBAL_FILE, hint_string: filter }); + return export_(enum_value(Variant.Type, "TYPE_STRING"), { hint: enum_value(PropertyHint, "PROPERTY_HINT_GLOBAL_FILE"), hint_string: filter }); } +export const ExportGlobalFile = export_global_file; + export function export_global_dir(filter: string) { - return export_(Variant.Type.TYPE_STRING, { hint: PropertyHint.PROPERTY_HINT_GLOBAL_DIR, hint_string: filter }); + return export_(enum_value(Variant.Type, "TYPE_STRING"), { hint: enum_value(PropertyHint, "PROPERTY_HINT_GLOBAL_DIR"), hint_string: filter }); } +export const ExportGlobalDir = export_global_dir; + export function export_exp_easing(hint?: "" | "attenuation" | "positive_only" | "attenuation,positive_only") { - return export_(Variant.Type.TYPE_FLOAT, { hint: PropertyHint.PROPERTY_HINT_EXP_EASING, hint_string: hint }); + return export_(enum_value(Variant.Type, "TYPE_FLOAT"), { hint: enum_value(PropertyHint, "PROPERTY_HINT_EXP_EASING"), hint_string: hint }); } +// TODO: Godot's property hints make for a poor API. We should provide convenience methods to build them. +export const ExportExpEasing = export_exp_easing; + /** - * A Shortcut for `export_(Variant.Type.TYPE_ARRAY, { class_: clazz })` + * A Shortcut for `export_(enum_value(Variant.Type, "TYPE_ARRAY"), { class_: clazz })` */ export function export_array(clazz: ClassDescriptor) { - return export_(Variant.Type.TYPE_ARRAY, { class_: clazz }); + return export_(enum_value(Variant.Type, "TYPE_ARRAY"), { class_: clazz }); } +export const ExportArray = export_array; + /** - * A Shortcut for `export_(Variant.Type.TYPE_DICTIONARY, { class_: [key_class, value_class] })` + * A Shortcut for exporting a dictionary { class_: [key_class, value_class] })` */ export function export_dictionary(key_class: ClassDescriptor, value_class: ClassDescriptor) { - return export_(Variant.Type.TYPE_DICTIONARY, { class_: TypePair(key_class, value_class) }); + return export_(enum_value(Variant.Type, "TYPE_DICTIONARY"), { class_: TypePair(key_class, value_class) }); } +export const ExportDictionary = export_dictionary; + function get_hint_string_for_enum(enum_type: any): string { - let enum_vs: Array = []; - for (let c in enum_type) { - const v = enum_type[c]; - if (typeof v === "string") { - enum_vs.push(v + ":" + c); - } + const enum_vs: Array = []; + for (const key in enum_type) { + enum_vs.push(`${key}:${enum_type[key]}`); } return enum_vs.join(","); } @@ -121,29 +158,29 @@ function get_hint_string(clazz: any): string { let gd = require("godot"); if (typeof clazz === "symbol") { if (clazz === gd.IntegerType) { - return Variant.Type.TYPE_INT + ":"; + return enum_value(Variant.Type, "TYPE_INT") + ":"; } if (clazz === gd.FloatType) { - return Variant.Type.TYPE_FLOAT + ":"; + return enum_value(Variant.Type, "TYPE_FLOAT") + ":"; } } if (typeof clazz === "function" && typeof clazz.prototype !== "undefined") { if (clazz.prototype instanceof gd.Resource) { - return `${Variant.Type.TYPE_OBJECT}/${PropertyHint.PROPERTY_HINT_RESOURCE_TYPE}:${clazz.name}`; + return `${enum_value(Variant.Type, "TYPE_OBJECT")}/${enum_value(PropertyHint, "PROPERTY_HINT_RESOURCE_TYPE")}:${clazz.name}`; } else if (clazz.prototype instanceof gd.Node) { - return `${Variant.Type.TYPE_OBJECT}/${PropertyHint.PROPERTY_HINT_NODE_TYPE}:${clazz.name}`; + return `${enum_value(Variant.Type, "TYPE_OBJECT")}/${enum_value(PropertyHint, "PROPERTY_HINT_NODE_TYPE")}:${clazz.name}`; } else { // other than Resource and Node, only primitive types and enum types are supported in gdscript //TODO but we barely know anything about the enum types and int/float/StringName/... in JS if (clazz === Boolean) { - return Variant.Type.TYPE_BOOL + ":"; + return enum_value(Variant.Type, "TYPE_BOOL") + ":"; } else if (clazz === Number) { // we can only guess the type is float - return Variant.Type.TYPE_FLOAT + ":"; + return enum_value(Variant.Type, "TYPE_FLOAT") + ":"; } else if (clazz === String) { - return Variant.Type.TYPE_STRING + ":"; + return enum_value(Variant.Type, "TYPE_STRING") + ":"; } else { if (typeof (clazz).__builtin_type__ === "number") { return (clazz).__builtin_type__ + ":"; @@ -153,16 +190,16 @@ function get_hint_string(clazz: any): string { } } } - + if (typeof clazz === "object") { if (clazz instanceof EnumPlaceholderImpl) { - return `${Variant.Type.TYPE_INT}/${Variant.Type.TYPE_INT}:${get_hint_string_for_enum(clazz.target)}`; + return `${enum_value(Variant.Type, "TYPE_INT")}/${enum_value(Variant.Type, "TYPE_INT")}:${get_hint_string_for_enum(clazz.target)}`; } - + // probably an Array (as key-value type descriptor for a Dictionary) if (clazz instanceof TypePairPlaceholderImpl) { // special case for dictionary, int is preferred for key type of a dictionary - const key_type = clazz.key === Number ? Variant.Type.TYPE_INT + ":" : get_hint_string(clazz.key); + const key_type = clazz.key === Number ? enum_value(Variant.Type, "TYPE_INT") + ":" : get_hint_string(clazz.key); const value_type = get_hint_string(clazz.value); if (key_type.length === 0 || value_type.length === 0) { @@ -175,15 +212,17 @@ function get_hint_string(clazz: any): string { } export function export_object(class_: ClassDescriptor) { - return export_(Variant.Type.TYPE_OBJECT, { class_: class_ }); + return export_(enum_value(Variant.Type, "TYPE_OBJECT"), { class_: class_ }); } +export const ExportObject = export_object; + /** * [low level export] */ export function export_(type: Variant.Type, details?: { class_?: ClassDescriptor, hint?: PropertyHint, hint_string?: string, usage?: PropertyUsageFlags }) { return function (target: any, key: string) { - let ebd = { name: key, type: type, hint: PropertyHint.PROPERTY_HINT_NONE, hint_string: "", usage: PropertyUsageFlags.PROPERTY_USAGE_DEFAULT }; + let ebd = { name: key, type: type, hint: enum_value(PropertyHint, "PROPERTY_HINT_NONE"), hint_string: "", usage: enum_value(PropertyUsageFlags, "PROPERTY_USAGE_DEFAULT") }; if (typeof details === "object") { if (typeof details.hint === "number") ebd.hint = details.hint; @@ -194,62 +233,76 @@ export function export_(type: Variant.Type, details?: { class_?: ClassDescriptor try { //TODO more general and unified way to handle all types - if (type === Variant.Type.TYPE_OBJECT) { + if (type === enum_value(Variant.Type, "TYPE_OBJECT")) { const clazz = details.class_; const gd = require("godot"); if (typeof clazz === "function" && typeof clazz.prototype !== "undefined") { if (clazz.prototype instanceof gd.Resource) { - ebd.hint = PropertyHint.PROPERTY_HINT_RESOURCE_TYPE; + ebd.hint = enum_value(PropertyHint, "PROPERTY_HINT_RESOURCE_TYPE"); ebd.hint_string = clazz.name; - ebd.usage |= PropertyUsageFlags.PROPERTY_USAGE_SCRIPT_VARIABLE; + ebd.usage |= enum_value(PropertyUsageFlags, "PROPERTY_USAGE_SCRIPT_VARIABLE"); } else if (clazz.prototype instanceof gd.Node) { - ebd.hint = PropertyHint.PROPERTY_HINT_NODE_TYPE; + ebd.hint = enum_value(PropertyHint, "PROPERTY_HINT_NODE_TYPE"); ebd.hint_string = clazz.name; - ebd.usage |= PropertyUsageFlags.PROPERTY_USAGE_SCRIPT_VARIABLE; - } + ebd.usage |= enum_value(PropertyUsageFlags, "PROPERTY_USAGE_SCRIPT_VARIABLE"); + } } - + jsb.internal.add_script_property(target, ebd); return; } let hint_string = get_hint_string(details.class_); if (hint_string.length > 0) { - ebd.hint = PropertyHint.PROPERTY_HINT_TYPE_STRING; + ebd.hint = enum_value(PropertyHint, "PROPERTY_HINT_TYPE_STRING"); ebd.hint_string = hint_string; - ebd.usage |= PropertyUsageFlags.PROPERTY_USAGE_SCRIPT_VARIABLE; + ebd.usage |= enum_value(PropertyUsageFlags, "PROPERTY_USAGE_SCRIPT_VARIABLE"); } } catch (e) { - if (ebd.hint === PropertyHint.PROPERTY_HINT_NONE) { + if (ebd.hint === enum_value(PropertyHint, "PROPERTY_HINT_NONE")) { console.warn("the given parameters are not supported or not implemented (you need to give hint/hint_string/usage manually)", `class:${guess_type_name(Object.getPrototypeOf(target))} prop:${key} type:${type} class_:${guess_type_name(details.class_)}`); } } - } + } jsb.internal.add_script_property(target, ebd); } } +export function Export(type: Variant.Type, details?: { class?: ClassDescriptor, hint?: PropertyHint, hintString?: string, usage?: PropertyUsageFlags }) { + const { hintString, class: cls, ...consistent } = details ?? {}; + + return export_(type, { + ...consistent, + hint_string: hintString, + class_: cls, + }); +} + /** - * In Godot, class members can be exported. + * In Godot, class members can be exported. * This means their value gets saved along with the resource (such as the scene) they're attached to. - * They will also be available for editing in the property editor. + * They will also be available for editing in the property editor. * Exporting is done by using the `@export_var` (or `@export_`) annotation. */ export function export_var(type: Variant.Type, details?: { class_?: ClassDescriptor, hint?: PropertyHint, hint_string?: string, usage?: PropertyUsageFlags }) { return export_(type, details); } +export const ExportVar = export_var; + /** * NOTE only int value enums are allowed */ export function export_enum(enum_type: any) { return function (target: any, key: string) { let hint_string = get_hint_string_for_enum(enum_type); - let ebd = { name: key, type: Variant.Type.TYPE_INT, hint: PropertyHint.PROPERTY_HINT_ENUM, hint_string: hint_string, usage: PropertyUsageFlags.PROPERTY_USAGE_DEFAULT }; + let ebd = { name: key, type: enum_value(Variant.Type, "TYPE_INT"), hint: enum_value(PropertyHint, "PROPERTY_HINT_ENUM"), hint_string: hint_string, usage: enum_value(PropertyUsageFlags, "PROPERTY_USAGE_DEFAULT") }; jsb.internal.add_script_property(target, ebd); } } +export const ExportEnum = export_enum; + /** * NOTE only int value enums are allowed */ @@ -262,11 +315,13 @@ export function export_flags(enum_type: any) { enum_vs.push(v + ":" + c); } } - let ebd = { name: key, type: Variant.Type.TYPE_INT, hint: PropertyHint.PROPERTY_HINT_FLAGS, hint_string: enum_vs.join(","), usage: PropertyUsageFlags.PROPERTY_USAGE_DEFAULT }; + let ebd = { name: key, type: enum_value(Variant.Type, "TYPE_INT"), hint: enum_value(PropertyHint, "PROPERTY_HINT_FLAGS"), hint_string: enum_vs.join(","), usage: enum_value(PropertyUsageFlags, "PROPERTY_USAGE_DEFAULT") }; jsb.internal.add_script_property(target, ebd); } } +export const ExportFlags = export_flags; + export interface RPCConfig { mode?: MultiplayerAPI.RPCMode, sync?: "call_remote" | "call_local", @@ -278,7 +333,7 @@ export function rpc(config?: RPCConfig) { return function (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) { if (typeof propertyKey !== "string") { throw new Error("only string is allowed as propertyKey for rpc config"); - return; + return; } if (typeof config !== "undefined") { @@ -294,6 +349,8 @@ export function rpc(config?: RPCConfig) { } } +export const Rpc = rpc; + /** * auto initialized on ready (before _ready called) * @param evaluator for now, only string is accepted @@ -305,18 +362,24 @@ export function onready(evaluator: string | jsb.internal.OnReadyEvaluatorFunc) { } } +export const OnReady = onready; + export function tool() { return function (target: any) { jsb.internal.add_script_tool(target); } } +export const Tool = tool; + export function icon(path: string) { return function (target: any) { jsb.internal.add_script_icon(target, path); } } +export const Icon = icon; + export function deprecated(message?: string) { return function (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) { if (typeof propertyKey === "undefined") { @@ -328,6 +391,8 @@ export function deprecated(message?: string) { } } +export const Deprecated = deprecated; + export function experimental(message?: string) { return function (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) { if (typeof propertyKey === "undefined") { @@ -339,6 +404,8 @@ export function experimental(message?: string) { } } +export const Experimental = experimental; + export function help(message?: string) { return function (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) { if (typeof propertyKey === "undefined") { @@ -349,3 +416,5 @@ export function help(message?: string) { jsb.internal.set_script_doc(target, propertyKey, 2, message ?? ""); } } + +export const Help = help; diff --git a/scripts/jsb.runtime/src/jsb.core.ts b/scripts/jsb.runtime/src/jsb.core.ts index d1f14b6c..16bdaeba 100644 --- a/scripts/jsb.runtime/src/jsb.core.ts +++ b/scripts/jsb.runtime/src/jsb.core.ts @@ -23,7 +23,7 @@ exports.$wait = function (signal: any) { resolve(arguments[0]); return; } - // return as javascript array if more than one + // return as javascript array if more than one resolve(Array.from(arguments)); jsb.internal.notify_microtasks_run(); }); @@ -210,7 +210,7 @@ exports.rpc = function (config?: RPCConfig) { return function (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) { if (typeof propertyKey !== "string") { throw new Error("only string is allowed as propertyKey for rpc config"); - return; + return; } if (typeof config !== "undefined") { diff --git a/scripts/jsb.runtime/src/jsb.inject.ts b/scripts/jsb.runtime/src/jsb.inject.ts index 57442b6c..cbf0df35 100644 --- a/scripts/jsb.runtime/src/jsb.inject.ts +++ b/scripts/jsb.runtime/src/jsb.inject.ts @@ -21,41 +21,67 @@ const proxy_wrap = function(value: any) { : value; }; -require("godot.typeloader").on_type_loaded("Array", function (type: any) { +require("godot.typeloader").on_type_loaded("GArray", function (type: any) { + const camel_case_bindings = require("godot-jsb").CAMEL_CASE_BINDINGS_ENABLED; + proxyable_prototypes.push(type.prototype); - type.prototype[Symbol.iterator] = function* (this: any /* GArray */) { - for (let i = 0; i < this.size(); ++i) { - yield this.get_indexed(i); + type.prototype[Symbol.iterator] = camel_case_bindings + ? function* (this: any /* GArray */) { + for (let i = 0; i < this.size(); ++i) { + yield this.getIndexed(i); + } } - }; + : function* (this: any /* GArray */) { + for (let i = 0; i < this.size(); ++i) { + yield this.get_indexed(i); + } + }; // We're not going to try expose the whole Array API, we'll just be super minimalistic. If the user is after // something more complex, it'll likely be more performant to spread the GArray into a JS array anyway. + const array_api = { + forEach: function (this: any /* GArrayProxy */, callback: (value: any, index: number) => void, thisArg?: any) { + const target = this[ProxyTarget]; + let i = 0; + for (const value of target) { + callback.call(thisArg ?? this, proxy_wrap(value), i++); + } + }, + includes: function (this: any /* GArrayProxy */, value: any) { + const target = this[ProxyTarget]; + return target.has(proxy_unwrap(value)); + }, + indexOf: function (this: any /* GArrayProxy */, value: any, fromIndex?: number) { + const target = this[ProxyTarget]; + return target.find(proxy_unwrap(value), fromIndex); + }, + pop: function (this: any /* GArrayProxy */) { + const target = this[ProxyTarget]; + const pop = camel_case_bindings ? target.popBack : target.pop_back; + const result = pop.call(target); + return result == null ? result : proxy_wrap(result); + }, + push: function (this: any /* GArrayProxy */, ...values: any[]) { + const target = this[ProxyTarget]; + const push = camel_case_bindings ? target.pushBack : target.push_back; + for (const value of values) { + push.call(target, proxy_unwrap(value)); + } + return target.size(); + }, + toJSON: function (this: any /* GArrayProxy */, key = ""): any { + return [...this]; + }, + toString: function (this: any /* GArrayProxy */, index?: number): any { + return [...this].map(v => v?.toString?.() ?? v).join(","); + }, + } as const; - const method_mapping: Partial> = { - pop: "pop_back", - indexOf: "find", - includes: "has", - }; - - const iterator = function* (this: any /* GArrayProxy */) { + const array_iterator = function* (this: any /* GArrayProxy */) { for (let i = 0; i < this.length; ++i) { yield this[i]; } - } - const push = function(this: any /* GArrayProxy */, ...values: any[]) { - const target = this[ProxyTarget]; - for (const value of values) { - target.push_back(proxy_unwrap(value)); - } - return target.size(); - }; - const toJSON = function(this: any /* GArrayProxy */, key = ""): any { - return [...this]; - }; - const toString = function(this: any /* GArrayProxy */, index?: number): any { - return [...this].map(v => v?.toString?.() ?? v).join(","); }; const handler: ProxyHandler = { @@ -64,26 +90,18 @@ require("godot.typeloader").on_type_loaded("Array", function (type: any) { return p === ProxyTarget ? target : p === Symbol.iterator - ? iterator + ? array_iterator : undefined; } const num = Number.parseInt(p); if (!Number.isFinite(num)) { - switch (p) { - case "length": - return target.size(); - case "push": - return push; - case "toJSON": - return toJSON; - case "toString": - return toString; + if (p === 'length') { + return target.size(); } - const mapped = method_mapping[p]; - return mapped && Reflect.get(target, mapped).bind(target); + return array_api[p as keyof typeof array_api]; } if (num < 0 || num >= target.size()) { @@ -118,14 +136,7 @@ require("godot.typeloader").on_type_loaded("Array", function (type: any) { const num = Number.parseInt(p); if (!(num >= 0)) { - switch (p) { - case "length": - case "push": - case "toJSON": - case "toString": - return true; - } - return !!method_mapping[p]; + return p === 'length' || !!array_api[p as keyof typeof array_api]; } return num >= 0 && num < target.size(); @@ -165,19 +176,35 @@ require("godot.typeloader").on_type_loaded("Array", function (type: any) { type.prototype.proxy = function(this: any) { return new Proxy(this, handler); }; + + type.create = function(values: any[]) { + const arr = new type(); + const proxy = arr.proxy(); + proxy.push.apply(proxy, values); + return arr; + }; }); -require("godot.typeloader").on_type_loaded("Dictionary", function (type: any) { +require("godot.typeloader").on_type_loaded("GDictionary", function (type: any) { + const camel_case_bindings = require("godot-jsb").CAMEL_CASE_BINDINGS_ENABLED; + proxyable_prototypes.push(type.prototype); - type.prototype[Symbol.iterator] = function* () { - let self = this; - let keys = self.keys(); - for (let i = 0; i < keys.size(); ++i) { - const key = keys.get_indexed(i); - yield { key: key, value: self.get_keyed(key) }; + type.prototype[Symbol.iterator] = camel_case_bindings + ? function* (this: any) { + let keys = this.keys(); + for (let i = 0; i < keys.size(); ++i) { + const key = keys.getIndexed(i); + yield { key: key, value: this.getKeyed(key) }; + } } - }; + : function* (this: any) { + let keys = this.keys(); + for (let i = 0; i < keys.size(); ++i) { + const key = keys.get_indexed(i); + yield { key: key, value: this.get_keyed(key) }; + } + }; const handler: ProxyHandler = { defineProperty(target, property, attributes) { @@ -251,10 +278,19 @@ require("godot.typeloader").on_type_loaded("Dictionary", function (type: any) { type.prototype.proxy = function(this: any) { return new Proxy(this, handler); }; + + type.create = function(entries: any /*Record*/) { + const arr = new type(); + const proxy = arr.proxy(); + for (const [key, value] of Object.entries(entries)) { + proxy[key] = value; + } + return arr; + }; }); require("godot.typeloader").on_type_loaded("Callable", function (type: any) { - const orignal_cc = type.create; + const original_cc = type.create; const custom_cc = require("godot-jsb").callable; type.create = function () { @@ -267,7 +303,7 @@ require("godot.typeloader").on_type_loaded("Callable", function (type: any) { } if (argc == 2) { if (typeof arguments[1] !== "function") { - return orignal_cc(arguments[0], arguments[1]); + return original_cc(arguments[0], arguments[1]); } return custom_cc(arguments[0], arguments[1]); } @@ -276,7 +312,9 @@ require("godot.typeloader").on_type_loaded("Callable", function (type: any) { }); require("godot.typeloader").on_type_loaded("Signal", function (type: any) { - type.prototype.as_promise = function () { + const camel_case_bindings = require("godot-jsb").CAMEL_CASE_BINDINGS_ENABLED; + + type.prototype[camel_case_bindings ? 'asPromise' : 'as_promise'] = function () { let self = this; return new Promise(function (resolve, reject) { let fn: any = null; @@ -301,16 +339,22 @@ require("godot.typeloader").on_type_loaded("Signal", function (type: any) { } }); -Object.defineProperty(require("godot"), "GLOBAL_GET", { - value: function (entry_path: string): any { - return require("godot").ProjectSettings.get_setting_with_override(entry_path); - } -}) +(function() { + const camel_case_bindings = require("godot-jsb").CAMEL_CASE_BINDINGS_ENABLED; + const get_setting_with_override = camel_case_bindings ? 'getSettingWithOverride' : 'get_setting_with_override'; + const get_editor_settings = camel_case_bindings ? 'getEditorSettings' : 'get_editor_settings'; -Object.defineProperty(require("godot"), "EDITOR_GET", { - value: function (entry_path: string): any { - return require("godot").EditorInterface.get_editor_settings().get(entry_path); - } -}); + Object.defineProperty(require("godot"), "GLOBAL_GET", { + value: function (entry_path: string): any { + return require("godot").ProjectSettings[get_setting_with_override](entry_path); + } + }) + + Object.defineProperty(require("godot"), "EDITOR_GET", { + value: function (entry_path: string): any { + return require("godot").EditorInterface[get_editor_settings]().get(entry_path); + } + }); +}()); console.debug("jsb.inject loaded successfully"); diff --git a/scripts/jsb.static/src/jsb.static.ts b/scripts/jsb.static/src/jsb.static.ts index eea31c9b..706a47d8 100644 --- a/scripts/jsb.static/src/jsb.static.ts +++ b/scripts/jsb.static/src/jsb.static.ts @@ -1,4 +1,3 @@ - // NOT IMPLEMENTED // JS implementation of essential primitive types with least binding code @@ -169,8 +168,8 @@ export class Vector3 { return Math.sqrt(dx * dx + dy * dy + dz * dz); } - /** Returns the squared distance between this vector and [param to]. - * This method runs faster than [method distance_to], so prefer it if you need to compare vectors or need the squared distance for some formula. + /** Returns the squared distance between this vector and [param to]. + * This method runs faster than [method distance_to], so prefer it if you need to compare vectors or need the squared distance for some formula. */ distance_squared_to(to: Vector3): number { const dx = to.x - this.x; @@ -187,8 +186,8 @@ export class Vector3 { return Math.sqrt(x * x + y * y + z * z); } - /** Returns the squared length (squared magnitude) of this vector. - * This method runs faster than [method length], so prefer it if you need to compare vectors or need the squared distance for some formula. + /** Returns the squared length (squared magnitude) of this vector. + * This method runs faster than [method length], so prefer it if you need to compare vectors or need the squared distance for some formula. */ length_squared(): number { const x = this.x; @@ -212,9 +211,9 @@ export class Vector3 { return v; } - /** Returns the result of scaling the vector to unit length. Equivalent to `v / v.length()`. Returns `(0, 0, 0)` if `v.length() == 0`. See also [method is_normalized]. - * - * **Note:** This function may return incorrect values if the input vector length is near zero. + /** Returns the result of scaling the vector to unit length. Equivalent to `v / v.length()`. Returns `(0, 0, 0)` if `v.length() == 0`. See also [method is_normalized]. + * + * **Note:** This function may return incorrect values if the input vector length is near zero. */ normalized(): Vector3 { let v = new Vector3(this); @@ -246,8 +245,8 @@ export class Vector3 { return is_equal_approx(this.x, to.x) && is_equal_approx(this.y, to.y) && is_equal_approx(this.z, to.z); } - /** Returns `true` if this vector's values are approximately zero, by running [method @GlobalScope.is_zero_approx] on each component. - * This method is faster than using [method is_equal_approx] with one value as a zero vector. + /** Returns `true` if this vector's values are approximately zero, by running [method @GlobalScope.is_zero_approx] on each component. + * This method is faster than using [method is_equal_approx] with one value as a zero vector. */ is_zero_approx(): boolean { return is_zero_approx(this.x) && is_zero_approx(this.y) && is_zero_approx(this.z); @@ -311,16 +310,16 @@ export class Vector3 { return new Vector3(lerp(this.x, to.x, weight), lerp(this.y, to.y, weight), lerp(this.z, to.z, weight)); } - // /** Returns the result of spherical linear interpolation between this vector and [param to], by amount [param weight]. [param weight] is on the range of 0.0 to 1.0, representing the amount of interpolation. - // * This method also handles interpolating the lengths if the input vectors have different lengths. For the special case of one or both input vectors having zero length, this method behaves like [method lerp]. + // /** Returns the result of spherical linear interpolation between this vector and [param to], by amount [param weight]. [param weight] is on the range of 0.0 to 1.0, representing the amount of interpolation. + // * This method also handles interpolating the lengths if the input vectors have different lengths. For the special case of one or both input vectors having zero length, this method behaves like [method lerp]. // */ // slerp(to: Vector3, weight: number): Vector3 // /** Performs a cubic interpolation between this vector and [param b] using [param pre_a] and [param post_b] as handles, and returns the result at position [param weight]. [param weight] is on the range of 0.0 to 1.0, representing the amount of interpolation. */ // cubic_interpolate(b: Vector3, pre_a: Vector3, post_b: Vector3, weight: number): Vector3 - // /** Performs a cubic interpolation between this vector and [param b] using [param pre_a] and [param post_b] as handles, and returns the result at position [param weight]. [param weight] is on the range of 0.0 to 1.0, representing the amount of interpolation. - // * It can perform smoother interpolation than [method cubic_interpolate] by the time values. + // /** Performs a cubic interpolation between this vector and [param b] using [param pre_a] and [param post_b] as handles, and returns the result at position [param weight]. [param weight] is on the range of 0.0 to 1.0, representing the amount of interpolation. + // * It can perform smoother interpolation than [method cubic_interpolate] by the time values. // */ // cubic_interpolate_in_time(b: Vector3, pre_a: Vector3, post_b: Vector3, weight: number, b_t: number, pre_a_t: number, post_b_t: number): Vector3 @@ -333,18 +332,18 @@ export class Vector3 { // /** Returns a new vector moved toward [param to] by the fixed [param delta] amount. Will not go past the final value. */ // move_toward(to: Vector3, delta: number): Vector3 - /** Returns the dot product of this vector and [param with]. This can be used to compare the angle between two vectors. For example, this can be used to determine whether an enemy is facing the player. - * The dot product will be `0` for a right angle (90 degrees), greater than 0 for angles narrower than 90 degrees and lower than 0 for angles wider than 90 degrees. - * When using unit (normalized) vectors, the result will always be between `-1.0` (180 degree angle) when the vectors are facing opposite directions, and `1.0` (0 degree angle) when the vectors are aligned. - * - * **Note:** `a.dot(b)` is equivalent to `b.dot(a)`. + /** Returns the dot product of this vector and [param with]. This can be used to compare the angle between two vectors. For example, this can be used to determine whether an enemy is facing the player. + * The dot product will be `0` for a right angle (90 degrees), greater than 0 for angles narrower than 90 degrees and lower than 0 for angles wider than 90 degrees. + * When using unit (normalized) vectors, the result will always be between `-1.0` (180 degree angle) when the vectors are facing opposite directions, and `1.0` (0 degree angle) when the vectors are aligned. + * + * **Note:** `a.dot(b)` is equivalent to `b.dot(a)`. */ dot(with_: Vector3): number { return this.x * with_.x + this.y * with_.y + this.z * with_.z;; } - /** Returns the cross product of this vector and [param with]. - * This returns a vector perpendicular to both this and [param with], which would be the normal vector of the plane defined by the two vectors. As there are two such vectors, in opposite directions, this method returns the vector defined by a right-handed coordinate system. If the two vectors are parallel this returns an empty vector, making it useful for testing if two vectors are parallel. + /** Returns the cross product of this vector and [param with]. + * This returns a vector perpendicular to both this and [param with], which would be the normal vector of the plane defined by the two vectors. As there are two such vectors, in opposite directions, this method returns the vector defined by a right-handed coordinate system. If the two vectors are parallel this returns an empty vector, making it useful for testing if two vectors are parallel. */ cross(with_: Vector3): Vector3 { return new Vector3( @@ -354,7 +353,7 @@ export class Vector3 { } /** Returns the outer product with [param with]. */ - outer(with_: Vector3): Basis { + outer(with_: Vector3): never { throw new Error("NOT IMPLEMENTED"); // let basis = new Basis(); // basis.rows[0] = new Vector3(this.x * with_.x, this.x * with_.y, this.x * with_.z); @@ -385,33 +384,33 @@ export class Vector3 { return new Vector3(fposmod(this.x, p_mod.x), fposmod(this.y, p_mod.y), fposmod(this.z, p_mod.z)); } - /** Returns a new vector resulting from projecting this vector onto the given vector [param b]. The resulting new vector is parallel to [param b]. See also [method slide]. - * - * **Note:** If the vector [param b] is a zero vector, the components of the resulting new vector will be [constant @GDScript.NAN]. + /** Returns a new vector resulting from projecting this vector onto the given vector [param b]. The resulting new vector is parallel to [param b]. See also [method slide]. + * + * **Note:** If the vector [param b] is a zero vector, the components of the resulting new vector will be [constant @GDScript.NAN]. */ project(p_to: Vector3): Vector3 { return Vector3.MULTIPLY(p_to, (this.dot(p_to) / p_to.length_squared())); } - /** Returns a new vector resulting from sliding this vector along a plane with normal [param n]. The resulting new vector is perpendicular to [param n], and is equivalent to this vector minus its projection on [param n]. See also [method project]. - * - * **Note:** The vector [param n] must be normalized. See also [method normalized]. + /** Returns a new vector resulting from sliding this vector along a plane with normal [param n]. The resulting new vector is perpendicular to [param n], and is equivalent to this vector minus its projection on [param n]. See also [method project]. + * + * **Note:** The vector [param n] must be normalized. See also [method normalized]. */ slide(p_normal: Vector3): Vector3 { return Vector3.SUBTRACT(this, Vector3.MULTIPLY(p_normal, this.dot(p_normal))); } - /** Returns the vector "bounced off" from a plane defined by the given normal [param n]. - * - * **Note:** [method bounce] performs the operation that most engines and frameworks call [code skip-lint]reflect()`. + /** Returns the vector "bounced off" from a plane defined by the given normal [param n]. + * + * **Note:** [method bounce] performs the operation that most engines and frameworks call [code skip-lint]reflect()`. */ bounce(n: Vector3): Vector3 { return Vector3.NEGATE(this.reflect(n)); } - /** Returns the result of reflecting the vector through a plane defined by the given normal vector [param n]. - * - * **Note:** [method reflect] differs from what other engines and frameworks call [code skip-lint]reflect()`. In other engines, [code skip-lint]reflect()` returns the result of the vector reflected by the given plane. The reflection thus passes through the given normal. While in Godot the reflection passes through the plane and can be thought of as bouncing off the normal. See also [method bounce] which does what most engines call [code skip-lint]reflect()`. + /** Returns the result of reflecting the vector through a plane defined by the given normal vector [param n]. + * + * **Note:** [method reflect] differs from what other engines and frameworks call [code skip-lint]reflect()`. In other engines, [code skip-lint]reflect()` returns the result of the vector reflected by the given plane. The reflection thus passes through the given normal. While in Godot the reflection passes through the plane and can be thought of as bouncing off the normal. See also [method bounce] which does what most engines call [code skip-lint]reflect()`. */ reflect(p_normal: Vector3): Vector3 { return Vector3.SUBTRACT(Vector3.MULTIPLY(Vector3.MULTIPLY(2.0, p_normal), this.dot(p_normal)), new Vector3(this)); @@ -420,11 +419,11 @@ export class Vector3 { /** Returns a new vector with each component set to `1.0` if it's positive, `-1.0` if it's negative, and `0.0` if it's zero. The result is identical to calling [method @GlobalScope.sign] on each component. */ sign(): Vector3 { return new Vector3(Math.sign(this.x), Math.sign(this.y), Math.sign(this.z)); } - /** Returns the octahedral-encoded (oct32) form of this [Vector3] as a [Vector2]. Since a [Vector2] occupies 1/3 less memory compared to [Vector3], this form of compression can be used to pass greater amounts of [method normalized] [Vector3]s without increasing storage or memory requirements. See also [method octahedron_decode]. - * - * **Note:** [method octahedron_encode] can only be used for [method normalized] vectors. [method octahedron_encode] does *not* check whether this [Vector3] is normalized, and will return a value that does not decompress to the original value if the [Vector3] is not normalized. - * - * **Note:** Octahedral compression is *lossy* , although visual differences are rarely perceptible in real world scenarios. + /** Returns the octahedral-encoded (oct32) form of this [Vector3] as a [Vector2]. Since a [Vector2] occupies 1/3 less memory compared to [Vector3], this form of compression can be used to pass greater amounts of [method normalized] [Vector3]s without increasing storage or memory requirements. See also [method octahedron_decode]. + * + * **Note:** [method octahedron_encode] can only be used for [method normalized] vectors. [method octahedron_encode] does *not* check whether this [Vector3] is normalized, and will return a value that does not decompress to the original value if the [Vector3] is not normalized. + * + * **Note:** Octahedral compression is *lossy* , although visual differences are rarely perceptible in real world scenarios. */ octahedron_encode(): Vector2 { let n = Vector3.DIVIDE(this, Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z)); @@ -473,7 +472,7 @@ export class Vector3 { static MULTIPLY(left: Vector3, right: number): Vector3 static MULTIPLY(left: Vector3 | number, right: number | Vector3): Vector3 { if (typeof left === "number") { - return new Vector3(left * right.x, left * right.y, left * right.z); + return new Vector3(left * (right as Vector3).x, left * (right as Vector3).y, left * (right as Vector3).z); } else if (typeof right === "number") { return new Vector3(right * left.x, right * left.y, right * left.z); } diff --git a/scripts/out/jsb.editor.bundle.d.ts b/scripts/out/jsb.editor.bundle.d.ts index 0ac44b46..f656516b 100644 --- a/scripts/out/jsb.editor.bundle.d.ts +++ b/scripts/out/jsb.editor.bundle.d.ts @@ -36,7 +36,7 @@ declare module "jsb.editor.codegen" { make_return(method_info: jsb.editor.MethodBind, type_replacer?: (name: string) => string): string; make_signal_type(method_info: jsb.editor.MethodBind): string; } - export class TSDCodeGen { + export default class TSDCodeGen { private _split_index; private _outDir; private _splitter; @@ -55,16 +55,6 @@ declare module "jsb.editor.codegen" { private emit_godot_primitive; private emit_godot_class; } - export class SceneTSDCodeGen { - private _out_dir; - private _scene_paths; - private _types; - constructor(out_dir: string, scene_paths: string[]); - private make_path; - emit(): Promise; - private emit_children_node_types; - private emit_scene_node_types; - } } declare module "jsb.editor.main" { import { PackedStringArray } from "godot"; diff --git a/scripts/out/jsb.editor.bundle.js b/scripts/out/jsb.editor.bundle.js index 12f6b3f4..52503f60 100644 --- a/scripts/out/jsb.editor.bundle.js +++ b/scripts/out/jsb.editor.bundle.js @@ -33,232 +33,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], function (require, exports, godot_1, jsb) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - exports.SceneTSDCodeGen = exports.TSDCodeGen = exports.TypeDB = void 0; + exports.TypeDB = void 0; jsb = __importStar(jsb); if (!jsb.TOOLS_ENABLED) { throw new Error("codegen is only allowed in editor mode"); } const tab = " "; const GodotAnyType = "GAny"; - const CallableBind = { - description: "Create a callable object with a bound object `self`", - methods: [ - "static create(self: Object, fn: () => R): Callable0", - "static create(self: Object, fn: (v1: T1) => R): Callable1", - "static create(self: Object, fn: (v1: T1, v2: T2) => R): Callable2", - "static create(self: Object, fn: (v1: T1, v2: T2, v3: T3) => R): Callable3", - "static create(self: Object, fn: (v1: T1, v2: T2, v3: T3, v4: T4) => R): Callable4", - "static create(self: Object, fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => R): Callable5", - ] - }; - const CallableFuncBind = { - description: "Create godot Callable without a bound object", - methods: [ - "static create(fn: () => R): Callable0", - "static create(fn: (v1: T1) => R): Callable1", - "static create(fn: (v1: T1, v2: T2) => R): Callable2", - "static create(fn: (v1: T1, v2: T2, v3: T3) => R): Callable3", - "static create(fn: (v1: T1, v2: T2, v3: T3, v4: T4) => R): Callable4", - "static create(fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => R): Callable5", - ] - }; - function chain_mutators(...mutators) { - return function (line) { - return mutators.reduce((line, mutator) => mutator(line), line); - }; - } - function mutate_parameter_type(name, type) { - return function (line) { - return line.replace(new RegExp(`([,(] *)${name}: .+?([,)])`, 'g'), `$1${name}: ${type}$2`); - }; - } - function mutate_return_type(type) { - return function (line) { - return line.replace(/: [^:]+$/g, `: ${type}`); - }; - } - function mutate_template(template) { - return function (line) { - return line.replace(/([^(]+)(<[^>]+> *)?\(/, `$1$2<${template}>(`); - }; - } - const TypeMutations = { - Signal: { - super: "AnySignal", - }, - Callable: { - super: "AnyCallable", - intro: [ - ...CallableBind.methods.reduce((lines, method) => { - return [ - ...lines, - `/** ${CallableBind.description} */`, - method, - ]; - }, []), - ...CallableFuncBind.methods.reduce((lines, method) => { - return [ - ...lines, - `/** ${CallableBind.description} */`, - method, - ]; - }, []), - ], - }, - GArray: { - generic_parameters: { - T: { - default: "Any", - }, - }, - intro: [ - "[Symbol.iterator](): IteratorObject", - "/** Returns a Proxy that targets this GArray but behaves similar to a JavaScript array. */", - `proxy(): GArrayProxy`, - "", - "set_indexed(index: number, value: T): void", - "get_indexed(index: number): T", - ], - property_overrides: { - set: mutate_parameter_type("value", "T"), - push_back: mutate_parameter_type("value", "T"), - push_front: mutate_parameter_type("value", "T"), - append: mutate_parameter_type("value", "T"), - insert: mutate_parameter_type("value", "T"), - fill: mutate_parameter_type("value", "T"), - erase: mutate_parameter_type("value", "T"), - count: mutate_parameter_type("value", "T"), - has: mutate_parameter_type("value", "T"), - bsearch: mutate_parameter_type("value", "T"), - bsearch_custom: chain_mutators(mutate_parameter_type("value", "T"), mutate_parameter_type("func", "Callable2")), - find: mutate_parameter_type('what', 'T'), - rfind: mutate_parameter_type("what", "T"), - get: mutate_return_type("T"), - front: mutate_return_type("T"), - back: mutate_return_type("T"), - pick_random: mutate_return_type("T"), - pop_back: mutate_return_type("T"), - pop_front: mutate_return_type("T"), - pop_at: mutate_return_type("T"), - min: mutate_return_type("T"), - max: mutate_return_type("T"), - sort_custom: mutate_parameter_type("func", "Callable2"), - all: mutate_parameter_type("method", "Callable1"), - any: mutate_parameter_type("method", "Callable1"), - filter: chain_mutators(mutate_parameter_type("method", "Callable1"), mutate_return_type("GArray")), - map: chain_mutators(mutate_parameter_type("method", "Callable1"), mutate_return_type("GArray"), mutate_template("U")), - append_array: mutate_parameter_type("array", "GArray"), - duplicate: mutate_return_type("GArray"), - slice: mutate_return_type("GArray"), - }, - }, - GDictionary: { - generic_parameters: { - T: { - default: "Record", - }, - }, - intro: [ - "[Symbol.iterator](): IteratorObject<{ key: any, value: any }>", - "/** Returns a Proxy that targets this GDictionary but behaves similar to a regular JavaScript object. Values are exposed as enumerable properties, so Object.keys(), Object.entries() etc. will work. */", - "proxy(): GDictionaryProxy", - "", - "set_keyed(key: K, value: T[K]): void", - "get_keyed(key: K): T[K]", - ], - property_overrides: { - assign: mutate_parameter_type("dictionary", "T"), - merge: mutate_parameter_type("dictionary", "T"), - merged: chain_mutators(mutate_parameter_type("dictionary", "GDictionary"), mutate_return_type("GDictionary"), mutate_template("U")), - has: mutate_parameter_type("key", "keyof T"), - has_all: mutate_parameter_type("keys", "GArray"), - find_key: chain_mutators(mutate_parameter_type("value", "T[keyof T]"), mutate_return_type("keyof T")), // This can be typed more accurately with a mapped type, but it seems excessive. - erase: mutate_parameter_type("key", "keyof T"), - keys: mutate_return_type("Array"), - values: mutate_return_type("GArray"), - duplicate: mutate_return_type("GDictionary"), - get: chain_mutators(mutate_parameter_type("key", "K"), mutate_return_type("T[K]"), mutate_template("K extends keyof T")), - get_or_add: chain_mutators(mutate_parameter_type("key", "K"), mutate_parameter_type("default", "T[K]"), mutate_parameter_type("default", "T[K]"), mutate_template("K extends keyof T")), - set: chain_mutators(mutate_parameter_type("key", "K"), mutate_parameter_type("value", "T[K]"), mutate_template("K extends keyof T")), - } - }, - Node: { - generic_parameters: { - Map: { - extends: "Record", - default: "{}", - }, - }, - intro: [ - "// TypeScript's inference won't directly match against a generic parameter. The generic parameter has to", - "// appear somewhere in the type definition. Consequently, we insert a dummy direct usage of the parameter.", - // To observe this in practice, visit the following and comment out line 20: - // https://www.typescriptlang.org/play/?ts=5.8.2#code/C4TwDgpgBAcg9gEwgBQIbABYFlVigXigG8oBtAaSgEsA7KAZ2ACdaBzAXQH4AuWRCAMwARKAF8AsACgpoSFADKwdFQDG8JGkwAeHHggAPYBBoJ6fDemy4AfASgAKANYQQcAGZRdUAGQNmbAEooAB9iKSgySlooZ1cPL19GFhoO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exist_NodeMap: Map" - ], - property_overrides: { - get_node: [ - "get_node>(path: Path): ResolveNodePath", - "get_node(path: NodePath | string): Node", - ], - get_node_or_null: [ - "get_node_or_null>(path: Path): null | ResolveNodePath", - "get_node_or_null(path: NodePath | string): null | Node", - ], - }, - }, - PackedByteArray: { - intro: [ - "/** [jsb utility method] Converts a PackedByteArray to a JavaScript ArrayBuffer. */", - "to_array_buffer(): ArrayBuffer" - ], - }, - }; - const InheritedTypeMutations = { - Node: { - generic_parameters: { - Map: { - extends: "Record", - default: "Record", - }, - }, - super_generic_arguments: ["Map"], - }, - }; - function class_type_mutation(cls) { - const intro = []; - if (typeof cls.element_type !== "undefined") { - const element_type_name = get_primitive_type_name(cls.element_type); - intro.push(`set_indexed(index: number, value: ${element_type_name}): void`); - intro.push(`get_indexed(index: number): ${element_type_name}`); - } - if (cls.is_keyed) { - intro.push("set_keyed(index: any, value: any): void"); - intro.push("get_keyed(index: any): any"); - } - return { - intro, - }; - } - function merge_type_mutations(base, overrides) { - return Object.assign(Object.assign(Object.assign({}, base), overrides), { property_overrides: Object.assign(Object.assign({}, base.property_overrides), overrides.property_overrides) }); - } - function get_type_mutation(name, classes = {}) { - var _a; - const class_info = classes[name]; - let type_mutation = class_info ? class_type_mutation(class_info) : {}; - let super_name = class_info === null || class_info === void 0 ? void 0 : class_info.super; - while (super_name) { - if (InheritedTypeMutations[super_name]) { - type_mutation = merge_type_mutations(type_mutation, InheritedTypeMutations[super_name]); - } - super_name = (_a = classes[super_name]) === null || _a === void 0 ? void 0 : _a.super; - } - if (TypeMutations[name]) { - type_mutation = merge_type_mutations(type_mutation, TypeMutations[name]); - } - return type_mutation; - } function frame_step() { return new Promise((resolve, reject) => { setTimeout(() => { @@ -271,9 +52,8 @@ define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], funct helper.show_toast(msg, 0); // 0: info, 1: warning, 2: error } class CodegenTasks { - constructor(name) { + constructor() { this.tasks = []; - this._name = name; } add_task(name, func) { this.tasks.push({ name: name, execute: func }); @@ -283,32 +63,25 @@ define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], funct const EditorProgress = require("godot").GodotJSEditorProgress; const progress = new EditorProgress(); let force_wait = 24; - progress.init(`codegen-${this._name}`, `Generating ${this._name}`, this.tasks.length); - try { - for (let i = 0; i < this.tasks.length; ++i) { - const task = this.tasks[i]; - const result = task.execute(); - if (typeof result === "object" && result instanceof Promise) { + progress.init("codegen", "Generating godot.d.ts", this.tasks.length); + for (let i = 0; i < this.tasks.length; ++i) { + const task = this.tasks[i]; + const result = task.execute(); + if (typeof result === "object" && result instanceof Promise) { + progress.set_state_name(task.name); + progress.set_current(i); + yield result; + } + else { + if (!(i % force_wait)) { progress.set_state_name(task.name); progress.set_current(i); - yield result; - } - else { - if (!(i % force_wait)) { - progress.set_state_name(task.name); - progress.set_current(i); - yield frame_step(); - } + yield frame_step(); } } - progress.finish(); - toast(`${this._name} generated successfully`); - } - catch (e) { - console.error("CodegenTasks error:", e); - toast(`${this._name} failed!`); - progress.finish(); } + progress.finish(); + toast("godot.d.ts generated successfully"); }); } } @@ -378,6 +151,28 @@ define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], funct "GDScriptNativeClass", "GDScriptSyntaxHighlighter", ]); + const CallableBind = { + description: "Create a callable object with a bound object `self`", + methods: [ + "static create(self: Object, fn: () => R): Callable0", + "static create(self: Object, fn: (v1: T1) => R): Callable1", + "static create(self: Object, fn: (v1: T1, v2: T2) => R): Callable2", + "static create(self: Object, fn: (v1: T1, v2: T2, v3: T3) => R): Callable3", + "static create(self: Object, fn: (v1: T1, v2: T2, v3: T3, v4: T4) => R): Callable4", + "static create(self: Object, fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => R): Callable5", + ] + }; + const CallableFuncBind = { + description: "Create godot Callable without a bound object", + methods: [ + "static create(fn: () => R): Callable0", + "static create(fn: (v1: T1) => R): Callable1", + "static create(fn: (v1: T1, v2: T2) => R): Callable2", + "static create(fn: (v1: T1, v2: T2, v3: T3) => R): Callable3", + "static create(fn: (v1: T1, v2: T2, v3: T3, v4: T4) => R): Callable4", + "static create(fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => R): Callable5", + ] + }; const GlobalUtilityFuncs = [ { description: "shorthand for getting project settings", @@ -394,10 +189,7 @@ define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], funct const PrimitiveTypesSet = (function () { let set = new Set(); for (let name in godot_1.Variant.Type) { - // avoid babbling error messages in `type_string` call - if (godot_1.Variant.Type[name] === godot_1.Variant.Type.TYPE_MAX) - continue; - // use the original type name of Variant.Type, + // use the original type name of Variant.Type, // because this set is used with type name from the original godot class info (PropertyInfo) let str = (0, godot_1.type_string)(godot_1.Variant.Type[name]); if (str.length != 0) { @@ -458,20 +250,11 @@ define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], funct namespace_(name, class_doc) { return new NamespaceWriter(this, name, class_doc); } - interface_(name, generic_parameters, super_, super_generic_arguments, intro, property_overrides) { - return new InterfaceWriter(this, name, generic_parameters, super_, super_generic_arguments, intro, property_overrides); - } - class_(name, generic_parameters, super_, super_generic_arguments, property_overrides, intro, singleton_mode, class_doc) { - return new ClassWriter(this, name, generic_parameters, super_, super_generic_arguments, intro, property_overrides, singleton_mode, class_doc); - } - generic_(name) { - return new GenericWriter(this, name); + gd_class_(name, super_, singleton_mode, class_doc) { + return new ClassWriter(this, name, super_, singleton_mode, class_doc); } - property_(name) { - return new PropertyWriter(this, name); - } - object_(intro, property_overrides) { - return new ObjectWriter(this, intro, property_overrides); + valuetype_(name, super_, singleton_mode, class_doc) { + return new ClassWriter(this, name, super_, singleton_mode, class_doc); } // singleton_(info: jsb.editor.SingletonInfo): SingletonWriter { // return new SingletonWriter(this, info); @@ -618,7 +401,7 @@ define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], funct super.finish(); this._base.line('}'); } - // godot utility functions must be in global scope + // godot utility functions must be in global scope utility_(method_info) { const args = this.types.make_args(method_info); const rval = this.types.make_return(method_info); @@ -648,45 +431,35 @@ define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], funct } class ClassWriter extends IndentWriter { get class_doc() { return this._doc; } - constructor(base, name, generic_parameters, super_, super_generic_arguments, intro, property_overrides, singleton_mode, class_doc) { + constructor(base, name, super_, singleton_mode, class_doc) { super(base); this._separator_line = false; this._name = name; - this._generic_parameters = generic_parameters; this._super = super_; - this._super_generic_arguments = super_generic_arguments; - this._intro = intro; - this._property_overrides = property_overrides; this._singleton_mode = singleton_mode; this._doc = class_doc; } head() { - const params = this._generic_parameters - ? `<${Object.entries(this._generic_parameters).map(([name, p]) => `${name}${p.extends ? ` extends ${p.extends}` : ""}${p.default ? ` = ${p.default}` : ""}`).join(", ")}>` - : ""; if (typeof this._super !== "string" || this._super.length == 0) { - return `class ${this._name}${params}`; + if (this._name == "Signal") { + return "class Signal implements AnySignal"; + } + else if (this._name == "Callable") { + return "class Callable implements AnyCallable"; + } + else if (this._name == "GArray") { + return `class GArray`; + } + return `class ${this._name}`; } - const args = this._super_generic_arguments && this._super_generic_arguments.length > 0 - ? `<${this._super_generic_arguments.join(", ")}>` - : ""; - return `class ${this._name}${params} extends ${this._super}${args}`; + return `class ${this._name} extends ${this._super}`; } make_method_prefix(method_info) { return this._singleton_mode || method_info.is_static ? "static " : ""; } - intro() { - if (!this._intro) { - return; - } - for (const line of this._intro) { - this._base.line(tab + line); - } - } finish() { DocCommentHelper.write(this._base, Description.forClass(this.types, this._name), false); this._base.line(`${this.head()} {`); - this.intro(); super.finish(); this._base.line('}'); } @@ -708,34 +481,22 @@ define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], funct this._separator_line = true; this.line(`static readonly ${constant.name} = ${constant.value}`); } - property_(name_or_getset_info) { - var _a, _b, _c; - if (typeof name_or_getset_info === "string") { - return super.property_(name_or_getset_info); + property_(getset_info) { + var _a, _b; + // ignore properties which can't be directly represented with javascript (such as `AnimatedTexture.frame_0/texture`) + if (getset_info.name.indexOf("/") >= 0) { + return; } - const getset_info = name_or_getset_info; console.assert(getset_info.getter.length != 0); DocCommentHelper.write(this, (_b = (_a = this._doc) === null || _a === void 0 ? void 0 : _a.properties[getset_info.name]) === null || _b === void 0 ? void 0 : _b.description, this._separator_line); this._separator_line = true; - const property_override = (_c = this._property_overrides) === null || _c === void 0 ? void 0 : _c[getset_info.name]; - if (Array.isArray(property_override)) { - for (const line of property_override) { - this.line(line); - } - return; - } - const line = (line) => { var _a; return this.line((_a = property_override === null || property_override === void 0 ? void 0 : property_override(line)) !== null && _a !== void 0 ? _a : line); }; - // Handle properties with forward slashes e.g. `AnimatedTexture.frame_0/texture` - const name = getset_info.name.indexOf("/") >= 0 - ? `"${getset_info.name}"` - : getset_info.name; - // declare as get/set to avoid the pitfalls of modifying a value type return value + // declare as get/set to avoid the pitfalls of modifying a value type return value // `node.position.x = 0;` (Although, it works in GDScript) // // It's not an error in javascript which is more dangerous :( the actually modifed value is just a copy of `node.position`. - line(`get ${name}(): ${this.types.make_typename(getset_info.info, false)}`); + this.line(`get ${getset_info.name}(): ${this.types.make_typename(getset_info.info, false)}`); if (getset_info.setter.length != 0) { - line(`set ${name}(value: ${this.types.make_typename(getset_info.info, true)})`); + this.line(`set ${getset_info.name}(value: ${this.types.make_typename(getset_info.info, true)})`); } } primitive_property_(property_info) { @@ -790,17 +551,9 @@ define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], funct } } method_(method_info, category) { - var _a, _b, _c; + var _a, _b; DocCommentHelper.write(this, (_b = (_a = this._doc) === null || _a === void 0 ? void 0 : _a.methods[method_info.name]) === null || _b === void 0 ? void 0 : _b.description, this._separator_line); this._separator_line = true; - const property_override = (_c = this._property_overrides) === null || _c === void 0 ? void 0 : _c[method_info.name]; - if (Array.isArray(property_override)) { - for (const line of property_override) { - this.line(line); - } - return; - } - const line = (line) => { var _a; return this.line((_a = property_override === null || property_override === void 0 ? void 0 : property_override(line)) !== null && _a !== void 0 ? _a : line); }; let args = this.types.make_args(method_info, this.get_scoped_type_replacer()); let rval = this.types.make_return(method_info, this.get_scoped_type_replacer()); const prefix = this.make_method_prefix(method_info); @@ -810,7 +563,54 @@ define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], funct this.line(`${category}${prefix}["${method_info.name}"]: (${args}) => ${rval}`); return; } - line(`${category}${prefix}${method_info.name}${template}(${args}): ${rval}`); + //TODO a better way to specialize + if (this._name === "GArray") { + switch (method_info.name) { + case "push_back": + case "push_front": + case "append": + case "insert": + case "fill": + case "erase": + case "count": + case "has": + case "bsearch": + case "bsearch_custom": + args = args.replace("value: any", "value: T"); + break; + case "find": + case "rfind": + args = args.replace("what: any", "what: T"); + break; + case "front": + case "back": + case "pick_random": + case "pop_back": + case "pop_front": + case "pop_at": + case "min": + case "max": + rval = "T"; + break; + case "sort_custom": + case "bsearch_custom": + args = args.replace("func: AnyCallable", "func: Callable2"); + break; + case "all": + case "any": + case "filter": + args = args.replace("method: AnyCallable", "func: Callable1"); + break; + case "map": + template = ""; + rval = `GArray`; + args = args.replace("method: AnyCallable", "func: Callable1"); + break; + default: + break; + } + } + this.line(`${category}${prefix}${method_info.name}${template}(${args}): ${rval}`); } signal_(signal_info) { var _a, _b; @@ -857,162 +657,6 @@ define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], funct this.line(`${name} = ${value},`); } } - class InterfaceWriter extends IndentWriter { - constructor(base, name, generic_parameters, super_, super_generic_arguments, intro, property_overrides) { - super(base); - this._name = name; - this._generic_parameters = generic_parameters; - this._super = super_; - this._super_generic_arguments = super_generic_arguments; - this._intro = intro; - this._property_overrides = property_overrides; - } - head() { - const params = this._generic_parameters - ? `<${Object.entries(this._generic_parameters).map(([name, p]) => { - return `${name}${p.extends ? ` extends ${p.extends}` : ""}${p.default ? ` = ${p.default}` : ""}`; - }).join(", ")}>` - : ""; - if (typeof this._super !== "string" || this._super.length == 0) { - return `interface ${this._name}${params}`; - } - const args = this._super_generic_arguments && this._super_generic_arguments.length > 0 - ? `<${this._super_generic_arguments.join(", ")}>` - : ""; - return `interface ${this._name}${params} extends ${this._super}${args}`; - } - intro() { - if (!this._intro) { - return; - } - for (const line of this._intro) { - this._base.line(tab + line); - } - } - finish() { - this._base.line(`${this.head()} {`); - this.intro(); - super.finish(); - this._base.line('}'); - } - property_(key, type) { - var _a; - if (type === undefined) { - return super.property_(key); - } - const property_override = (_a = this._property_overrides) === null || _a === void 0 ? void 0 : _a[key]; - if (Array.isArray(property_override)) { - for (const line of property_override) { - this.line(line); - } - return; - } - const line = (line) => { var _a; return this.line((_a = property_override === null || property_override === void 0 ? void 0 : property_override(line)) !== null && _a !== void 0 ? _a : line); }; - line(`${key}: ${type};`); - } - } - class GenericWriter extends AbstractWriter { - constructor(base, name) { - super(); - this._base = base; - this._name = name; - this._lines = []; - this._size = name.length + 2; - } - get size() { return this._size; } - get lineno() { return this._lines.length; } - get types() { return this._base.types; } - finish() { - var _a; - if (this._lines.length < 2) { - this._base.line(`${this._name}<${(_a = this._lines[0]) !== null && _a !== void 0 ? _a : ""}>`); - return; - } - this._base.line(`${this._name}<`); - const indented = new IndentWriter(this._base); - for (const line of this._lines) { - indented.line(line); - } - indented.finish(); - this._base.line(">"); - } - line(text) { - this._lines.push(text); - this._size += text.length + 1; // + 1 due to the line break, tabs? - } - } - class ObjectWriter extends IndentWriter { - constructor(base, intro, property_overrides) { - super(base); - this._intro = intro; - this._property_overrides = property_overrides; - } - intro() { - if (!this._intro) { - return; - } - for (const line of this._intro) { - this._base.line(tab + line); - } - } - finish() { - if (this._lines.length === 0 && !this._intro) { - this._base.line('{}'); - return; - } - this._base.line(`{`); - this.intro(); - super.finish(); - this._base.line('}'); - } - property_(key, type) { - var _a; - if (type === undefined) { - return super.property_(key); - } - const property_override = (_a = this._property_overrides) === null || _a === void 0 ? void 0 : _a[key]; - if (Array.isArray(property_override)) { - for (const line of property_override) { - this.line(line); - } - return; - } - const line = (line) => { var _a; return this.line((_a = property_override === null || property_override === void 0 ? void 0 : property_override(line)) !== null && _a !== void 0 ? _a : line); }; - line(`${key}: ${type};`); - } - } - class PropertyWriter extends AbstractWriter { - constructor(base, name) { - super(); - this._size = 0; - this._base = base; - this._name = name; - this._lines = []; - } - get size() { return this._size; } - get lineno() { return this._lines.length; } - get types() { return this._base.types; } - finish() { - if (this._lines.length === 0) { - return; - } - this._lines[this._lines.length - 1] += ","; - for (const line of this._lines) { - this._base.line(line); - } - } - line(text) { - if (this._lines.length === 0) { - const key = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(this._name) - ? this._name - : `"${this._name.replace("\"", "\\\"")}"`; - text = `${key}: ${text}`; - this._size = 1; // trailing comma - } - this._lines.push(text); - this._size += text.length; - } - } class FileWriter extends AbstractWriter { constructor(types, file) { super(); @@ -1329,7 +973,7 @@ define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], funct emit() { return __awaiter(this, void 0, void 0, function* () { yield frame_step(); - const tasks = new CodegenTasks("godot.d.ts"); + const tasks = new CodegenTasks(); // predefined lines tasks.add_task("Predefined Lines", () => this.emit_mock()); // all singletons @@ -1426,7 +1070,7 @@ define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], funct } } emit_godot_primitive(cg, cls) { - var _a, _b; + var _a; const class_doc = this._types.find_doc(cls.name); const ignored_consts = new Set(); const class_ns_cg = cg.namespace_(cls.name, class_doc); @@ -1447,10 +1091,7 @@ define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], funct } } class_ns_cg.finish(); - const type_name = jsb.internal.get_type_name(cls.type); - const type_mutation = get_type_mutation(type_name); - const super_ = (_b = type_mutation.super) !== null && _b !== void 0 ? _b : undefined; - const class_cg = cg.class_(type_name, type_mutation.generic_parameters, super_, type_mutation.super_generic_arguments, type_mutation.property_overrides, type_mutation.intro, false, class_doc); + const class_cg = cg.valuetype_(jsb.internal.get_type_name(cls.type), "", false, class_doc); if (cls.constants) { for (let constant of cls.constants) { if (!ignored_consts.has(constant.name)) { @@ -1461,6 +1102,44 @@ define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], funct for (let constructor_info of cls.constructors) { class_cg.constructor_(constructor_info); } + //TODO [BEGIN] make all these messy hardcoded methods more flexible and readable + // + if (cls.type == godot_1.Variant.Type.TYPE_ARRAY) { + class_cg.line(`set_indexed(index: number, value: T)`); + class_cg.line(`get_indexed(index: number): T`); + } + else if (typeof cls.element_type !== "undefined") { + const element_type_name = get_primitive_type_name(cls.element_type); + class_cg.line(`set_indexed(index: number, value: ${element_type_name})`); + class_cg.line(`get_indexed(index: number): ${element_type_name}`); + } + // + if (cls.is_keyed) { + class_cg.line(`set_keyed(index: any, value: any)`); + class_cg.line(`get_keyed(index: any): any`); + } + // special iterator methods injected in jsb.core + if (cls.type == godot_1.Variant.Type.TYPE_DICTIONARY) { + class_cg.line("[Symbol.iterator](): IteratorObject<{ key: any, value: any}>"); + } + else if (cls.type == godot_1.Variant.Type.TYPE_ARRAY) { + class_cg.line("[Symbol.iterator](): IteratorObject"); + } + else if (cls.type == godot_1.Variant.Type.TYPE_PACKED_BYTE_ARRAY) { + class_cg.line("/** [jsb utility method] Converts a PackedByteArray to a JavaScript ArrayBuffer. */"); + class_cg.line("to_array_buffer(): ArrayBuffer"); + } + else if (cls.type == godot_1.Variant.Type.TYPE_CALLABLE) { + CallableBind.methods.forEach(method => { + class_cg.line(`/** ${CallableBind.description} */`); + class_cg.line(method); + }); + CallableFuncBind.methods.forEach(method => { + class_cg.line(`/** ${CallableFuncBind.description} */`); + class_cg.line(method); + }); + } + //TODO [END] make all these messy hardcoded methods more flexible and readable for (let method_info of cls.methods) { class_cg.ordinary_method_(method_info); } @@ -1473,7 +1152,6 @@ define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], funct class_cg.finish(); } emit_godot_class(cg, cls, singleton_mode) { - var _a; try { const class_doc = this._types.find_doc(cls.name); const ignored_consts = new Set(); @@ -1490,9 +1168,7 @@ define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], funct } } class_ns_cg.finish(); - const type_mutation = get_type_mutation(cls.name, this._types.classes); - const super_ = (_a = type_mutation.super) !== null && _a !== void 0 ? _a : (this.has_class(cls.super) ? cls.super : undefined); - const class_cg = cg.class_(cls.name, type_mutation.generic_parameters, super_, type_mutation.super_generic_arguments, type_mutation.property_overrides, type_mutation.intro, singleton_mode, class_doc); + const class_cg = cg.gd_class_(cls.name, this.has_class(cls.super) ? cls.super : "", singleton_mode, class_doc); if (cls.constants) { for (let constant of cls.constants) { if (!ignored_consts.has(constant.name)) { @@ -1525,85 +1201,7 @@ define("jsb.editor.codegen", ["require", "exports", "godot", "godot-jsb"], funct } } } - exports.TSDCodeGen = TSDCodeGen; - class SceneTSDCodeGen { - constructor(out_dir, scene_paths) { - console.log("SceneTSDCodeGen constructor"); - this._out_dir = out_dir; - this._scene_paths = scene_paths; - this._types = new TypeDB(); - } - make_path(scene_path, include_filename = true) { - const relative_path = (include_filename - ? scene_path.replace(/\.t?scn$/i, '.nodes.gen.d.ts') - : scene_path.replace(/\/[^\/]+$/, '')).replace(/^res:\/\//, ''); - if (typeof this._out_dir !== "string" || this._out_dir.length == 0) { - return relative_path; - } - return this._out_dir.endsWith("/") - ? this._out_dir + relative_path - : this._out_dir + "/" + relative_path; - } - emit() { - return __awaiter(this, void 0, void 0, function* () { - yield frame_step(); - const tasks = new CodegenTasks("Generating scene node types"); - for (const scene_path of this._scene_paths) { - tasks.add_task(`Generating scene node types: ${scene_path}`, () => this.emit_scene_node_types(scene_path)); - } - return tasks.submit(); - }); - } - emit_children_node_types(writer, children) { - const child_writer = writer.object_(); - for (const [key, value] of Object.entries(children)) { - const property = child_writer.property_(key); - const generic = property.generic_(value.class); - this.emit_children_node_types(generic, value.children); - generic.finish(); - property.finish(); - } - child_writer.finish(); - } - emit_scene_node_types(scene_path) { - var _a; - try { - const helper = require('godot').GodotJSEditorHelper; - const result = (_a = helper.get_scene_nodes(scene_path)) === null || _a === void 0 ? void 0 : _a.proxy(); - if (!result) { - throw new Error(`root node children unavailable: ${scene_path}`); - } - const dir_path = this.make_path(scene_path, false); - const dir_error = godot_1.DirAccess.make_dir_recursive_absolute(dir_path); - if (dir_error !== 0) { - console.error(`failed to create directory (error: ${dir_error}): ${dir_path}`); - } - const file = godot_1.FileAccess.open(this.make_path(scene_path), godot_1.FileAccess.ModeFlags.WRITE); - if (!file) { - throw new Error(`failed to open file for writing: ${dir_path}`); - } - try { - const file_writer = new FileWriter(this._types, file); - const module = new ModuleWriter(file_writer, 'godot'); - const scene_nodes_interface = new InterfaceWriter(module, 'SceneNodes'); - const scene_property = scene_nodes_interface.property_(scene_path.replace(/^res:\/\//, '')); - this.emit_children_node_types(scene_property, result.children); - scene_property.finish(); - scene_nodes_interface.finish(); - module.finish(); - file_writer.finish(); - } - finally { - file.close(); - } - } - catch (error) { - console.error(`failed to generate scene node types: ${scene_path}`); - throw error; - } - } - } - exports.SceneTSDCodeGen = SceneTSDCodeGen; + exports.default = TSDCodeGen; }); define("jsb.editor.main", ["require", "exports", "godot"], function (require, exports, godot_2) { "use strict"; diff --git a/scripts/out/jsb.editor.bundle.js.map b/scripts/out/jsb.editor.bundle.js.map index 4ee56a03..3748f391 100644 --- a/scripts/out/jsb.editor.bundle.js.map +++ b/scripts/out/jsb.editor.bundle.js.map @@ -1 +1 @@ -{"version":3,"file":"jsb.editor.bundle.js","sourceRoot":"../src/","sources":["jsb.editor.codegen.ts","jsb.editor.main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAcA,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;IAC7D,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,CAAC;IACnB,MAAM,YAAY,GAAW,MAAM,CAAC;IAiBpC,MAAM,YAAY,GAAG;QACjB,WAAW,EAAE,qDAAqD;QAClE,OAAO,EAAE;YACL,kEAAkE;YAClE,gFAAgF;Y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AAC;QACzD,IAAI,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC;YACZ,OAAO,CAAC,KAAK,CAAC,wIAAwI,CAAC,CAAC;QAC5J,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;QAChD,CAAC;IACL,CAAC"} \ No newline at end of file +{"version":3,"file":"jsb.editor.bundle.js","sourceRoot":"../src/","sources":["jsb.editor.codegen.ts","jsb.editor.main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIA,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;IAC7D,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,CAAC;IACnB,MAAM,YAAY,GAAW,MAAM,CAAC;IAuBpC,SAAS,UAAU;QACf,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACzC,UAAU,CAAC,GAAG,EAAE;gBACZ,OAAO,EAAE,CAAC;YACd,CAAC,EAAE,CAAC,CAAC,CAAC;QACV,CAAC,CAAC,CAAC;IACP,CAAC;IAED,SAAS,KAAK,CAAC,GAAW;QACtB,IAAI,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC;QAClD,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,gCAAgC;IAC/D,CAAC;IAOD,MAAM,YAAY;QAAlB;YACY,UAAK,GAA2B,EAAE,CAAC;QAgC/C,CAAC;QA9BG,QAAQ,CAAC,IAAY,EAAE,IAAkC;YACrD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,CAAC;QAEK,MAAM;;gBACR,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,qBAAq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C,KAAK,CAAC,wIAAwI,CAAC,CAAC;QAC5J,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;QAChD,CAAC;IACL,CAAC"} \ No newline at end of file diff --git a/scripts/out/jsb.runtime.bundle.d.ts b/scripts/out/jsb.runtime.bundle.d.ts index cf757aac..3776f6c7 100644 --- a/scripts/out/jsb.runtime.bundle.d.ts +++ b/scripts/out/jsb.runtime.bundle.d.ts @@ -1,91 +1,87 @@ -declare module "godot.annotations" { - import { PropertyHint, PropertyUsageFlags, Variant, MultiplayerAPI, MultiplayerPeer } from "godot"; - import * as jsb from "godot-jsb"; - export interface EnumPlaceholder { - } - export interface TypePairPlaceholder { - } - export function EnumType(type: any): EnumPlaceholder; - export function TypePair(key: ClassDescriptor, value: ClassDescriptor): TypePairPlaceholder; - export type ClassDescriptor = Function | Symbol | EnumPlaceholder | TypePairPlaceholder; - /** - * - */ - export function signal(): (target: any, key: string) => void; - export function export_multiline(): (target: any, key: string) => void; - export function export_range(min: number, max: number, step?: number, ...extra_hints: string[]): (target: any, key: string) => void; - export function export_range_i(min: number, max: number, step?: number, ...extra_hints: string[]): (target: any, key: string) => void; - /** String as a path to a file, custom filter provided as hint. */ - export function export_file(filter: string): (target: any, key: string) => void; - export function export_dir(filter: string): (target: any, key: string) => void; - export function export_global_file(filter: string): (target: any, key: string) => void; - export function export_global_dir(filter: string): (target: any, key: string) => void; - export function export_exp_easing(hint?: "" | "attenuation" | "positive_only" | "attenuation,positive_only"): (target: any, key: string) => void; - /** - * A Shortcut for `export_(Variant.Type.TYPE_ARRAY, { class_: clazz })` - */ - export function export_array(clazz: ClassDescriptor): (target: any, key: string) => void; - /** - * A Shortcut for `export_(Variant.Type.TYPE_DICTIONARY, { class_: [key_class, value_class] })` - */ - export function export_dictionary(key_class: ClassDescriptor, value_class: ClassDescriptor): (target: any, key: string) => void; - export function export_object(class_: ClassDescriptor): (target: any, key: string) => void; - /** - * [low level export] - */ - export function export_(type: Variant.Type, details?: { - class_?: ClassDescriptor; - hint?: PropertyHint; - hint_string?: string; - usage?: PropertyUsageFlags; - }): (target: any, key: string) => void; - /** - * In Godot, class members can be exported. - * This means their value gets saved along with the resource (such as the scene) they're attached to. - * They will also be available for editing in the property editor. - * Exporting is done by using the `@export_var` (or `@export_`) annotation. - */ - export function export_var(type: Variant.Type, details?: { - class_?: ClassDescriptor; - hint?: PropertyHint; - hint_string?: string; - usage?: PropertyUsageFlags; - }): (target: any, key: string) => void; - /** - * NOTE only int value enums are allowed - */ - export function export_enum(enum_type: any): (target: any, key: string) => void; - /** - * NOTE only int value enums are allowed - */ - export function export_flags(enum_type: any): (target: any, key: string) => void; - export interface RPCConfig { - mode?: MultiplayerAPI.RPCMode; - sync?: "call_remote" | "call_local"; - transfer_mode?: MultiplayerPeer.TransferMode; - transfer_channel?: number; - } - export function rpc(config?: RPCConfig): (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) => void; - /** - * auto initialized on ready (before _ready called) - * @param evaluator for now, only string is accepted - */ - export function onready(evaluator: string | jsb.internal.OnReadyEvaluatorFunc): (target: any, key: string) => void; - export function tool(): (target: any) => void; - export function icon(path: string): (target: any) => void; - export function deprecated(message?: string): (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) => void; - export function experimental(message?: string): (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) => void; - export function help(message?: string): (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) => void; -} -declare module "godot.typeloader" { - /** - * @param type the loaded type or function in godot module - */ - export type TypeLoadedCallback = (type: any) => void; - export function on_type_loaded(type_name: string | string[], callback: TypeLoadedCallback): void; -} -declare module "jsb.core" { } -declare const ProxyTarget: unique symbol; -declare const proxy_unwrap: (value: any) => any; -declare const proxyable_prototypes: any[]; -declare const proxy_wrap: (value: any) => any; +declare module "godot.annotations" { + import { PropertyHint, PropertyUsageFlags, Variant, MultiplayerAPI, MultiplayerPeer } from "godot"; + import * as jsb from "godot-jsb"; + export interface EnumPlaceholder { + } + export interface TypePairPlaceholder { + } + export function EnumType(type: any): EnumPlaceholder; + export function TypePair(key: ClassDescriptor, value: ClassDescriptor): TypePairPlaceholder; + export type ClassDescriptor = Function | Symbol | EnumPlaceholder | TypePairPlaceholder; + /** + * + */ + export function signal(): (target: any, key: string) => void; + export function export_multiline(): (target: any, key: string) => void; + export function export_range(min: number, max: number, step?: number, ...extra_hints: string[]): (target: any, key: string) => void; + export function export_range_i(min: number, max: number, step?: number, ...extra_hints: string[]): (target: any, key: string) => void; + /** String as a path to a file, custom filter provided as hint. */ + export function export_file(filter: string): (target: any, key: string) => void; + export function export_dir(filter: string): (target: any, key: string) => void; + export function export_global_file(filter: string): (target: any, key: string) => void; + export function export_global_dir(filter: string): (target: any, key: string) => void; + export function export_exp_easing(hint?: "" | "attenuation" | "positive_only" | "attenuation,positive_only"): (target: any, key: string) => void; + /** + * A Shortcut for `export_(Variant.Type.TYPE_ARRAY, { class_: clazz })` + */ + export function export_array(clazz: ClassDescriptor): (target: any, key: string) => void; + /** + * A Shortcut for `export_(Variant.Type.TYPE_DICTIONARY, { class_: [key_class, value_class] })` + */ + export function export_dictionary(key_class: ClassDescriptor, value_class: ClassDescriptor): (target: any, key: string) => void; + export function export_object(class_: ClassDescriptor): (target: any, key: string) => void; + /** + * [low level export] + */ + export function export_(type: Variant.Type, details?: { + class_?: ClassDescriptor; + hint?: PropertyHint; + hint_string?: string; + usage?: PropertyUsageFlags; + }): (target: any, key: string) => void; + /** + * In Godot, class members can be exported. + * This means their value gets saved along with the resource (such as the scene) they're attached to. + * They will also be available for editing in the property editor. + * Exporting is done by using the `@export_var` (or `@export_`) annotation. + */ + export function export_var(type: Variant.Type, details?: { + class_?: ClassDescriptor; + hint?: PropertyHint; + hint_string?: string; + usage?: PropertyUsageFlags; + }): (target: any, key: string) => void; + /** + * NOTE only int value enums are allowed + */ + export function export_enum(enum_type: any): (target: any, key: string) => void; + /** + * NOTE only int value enums are allowed + */ + export function export_flags(enum_type: any): (target: any, key: string) => void; + export interface RPCConfig { + mode?: MultiplayerAPI.RPCMode; + sync?: "call_remote" | "call_local"; + transfer_mode?: MultiplayerPeer.TransferMode; + transfer_channel?: number; + } + export function rpc(config?: RPCConfig): (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) => void; + /** + * auto initialized on ready (before _ready called) + * @param evaluator for now, only string is accepted + */ + export function onready(evaluator: string | jsb.internal.OnReadyEvaluatorFunc): (target: any, key: string) => void; + export function tool(): (target: any) => void; + export function icon(path: string): (target: any) => void; + export function deprecated(message?: string): (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) => void; + export function experimental(message?: string): (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) => void; + export function help(message?: string): (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) => void; +} +declare module "godot.typeloader" { + /** + * @param type the loaded type or function in godot module + */ + export type TypeLoadedCallback = (type: any) => void; + export function on_type_loaded(type_name: string | string[], callback: TypeLoadedCallback): void; +} +declare module "jsb.core" { } diff --git a/scripts/out/jsb.runtime.bundle.js b/scripts/out/jsb.runtime.bundle.js index 17c4da3e..0fa7d651 100644 --- a/scripts/out/jsb.runtime.bundle.js +++ b/scripts/out/jsb.runtime.bundle.js @@ -1,1030 +1,826 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -define("godot.annotations", ["require", "exports", "godot", "godot-jsb"], function (require, exports, godot_1, jsb) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.EnumType = EnumType; - exports.TypePair = TypePair; - exports.signal = signal; - exports.export_multiline = export_multiline; - exports.export_range = export_range; - exports.export_range_i = export_range_i; - exports.export_file = export_file; - exports.export_dir = export_dir; - exports.export_global_file = export_global_file; - exports.export_global_dir = export_global_dir; - exports.export_exp_easing = export_exp_easing; - exports.export_array = export_array; - exports.export_dictionary = export_dictionary; - exports.export_object = export_object; - exports.export_ = export_; - exports.export_var = export_var; - exports.export_enum = export_enum; - exports.export_flags = export_flags; - exports.rpc = rpc; - exports.onready = onready; - exports.tool = tool; - exports.icon = icon; - exports.deprecated = deprecated; - exports.experimental = experimental; - exports.help = help; - jsb = __importStar(jsb); - function guess_type_name(type) { - if (typeof type === "function") { - return type.name; - } - if (typeof type === "object") { - if (typeof type.constructor === "function") { - return type.constructor.name; - } - let proto = Object.getPrototypeOf(type); - if (typeof proto === "object") { - return guess_type_name(proto); - } - } - return type; - } - class EnumPlaceholderImpl { - constructor(target) { this.target = target; } - } - class TypePairPlaceholderImpl { - constructor(key, value) { this.key = key; this.value = value; } - } - function EnumType(type) { - return new EnumPlaceholderImpl(type); - } - function TypePair(key, value) { - return new EnumPlaceholderImpl([key, value]); - } - /** - * - */ - function signal() { - return function (target, key) { - jsb.internal.add_script_signal(target, key); - }; - } - function export_multiline() { - return export_(godot_1.Variant.Type.TYPE_STRING, { hint: godot_1.PropertyHint.PROPERTY_HINT_MULTILINE_TEXT }); - } - function __export_range(type, min, max, step = 1, ...extra_hints) { - let hint_string = `${min},${max},${step}`; - if (typeof extra_hints !== "undefined") { - hint_string += "," + extra_hints.join(","); - } - return export_(type, { hint: godot_1.PropertyHint.PROPERTY_HINT_RANGE, hint_string: hint_string }); - } - function export_range(min, max, step = 1, ...extra_hints) { - return __export_range(godot_1.Variant.Type.TYPE_FLOAT, min, max, step, ...extra_hints); - } - function export_range_i(min, max, step = 1, ...extra_hints) { - return __export_range(godot_1.Variant.Type.TYPE_INT, min, max, step, ...extra_hints); - } - /** String as a path to a file, custom filter provided as hint. */ - function export_file(filter) { - return export_(godot_1.Variant.Type.TYPE_STRING, { hint: godot_1.PropertyHint.PROPERTY_HINT_FILE, hint_string: filter }); - } - function export_dir(filter) { - return export_(godot_1.Variant.Type.TYPE_STRING, { hint: godot_1.PropertyHint.PROPERTY_HINT_DIR, hint_string: filter }); - } - function export_global_file(filter) { - return export_(godot_1.Variant.Type.TYPE_STRING, { hint: godot_1.PropertyHint.PROPERTY_HINT_GLOBAL_FILE, hint_string: filter }); - } - function export_global_dir(filter) { - return export_(godot_1.Variant.Type.TYPE_STRING, { hint: godot_1.PropertyHint.PROPERTY_HINT_GLOBAL_DIR, hint_string: filter }); - } - function export_exp_easing(hint) { - return export_(godot_1.Variant.Type.TYPE_FLOAT, { hint: godot_1.PropertyHint.PROPERTY_HINT_EXP_EASING, hint_string: hint }); - } - /** - * A Shortcut for `export_(Variant.Type.TYPE_ARRAY, { class_: clazz })` - */ - function export_array(clazz) { - return export_(godot_1.Variant.Type.TYPE_ARRAY, { class_: clazz }); - } - /** - * A Shortcut for `export_(Variant.Type.TYPE_DICTIONARY, { class_: [key_class, value_class] })` - */ - function export_dictionary(key_class, value_class) { - return export_(godot_1.Variant.Type.TYPE_DICTIONARY, { class_: TypePair(key_class, value_class) }); - } - function get_hint_string_for_enum(enum_type) { - let enum_vs = []; - for (let c in enum_type) { - const v = enum_type[c]; - if (typeof v === "string") { - enum_vs.push(v + ":" + c); - } - } - return enum_vs.join(","); - } - function get_hint_string(clazz) { - let gd = require("godot"); - if (typeof clazz === "symbol") { - if (clazz === gd.IntegerType) { - return godot_1.Variant.Type.TYPE_INT + ":"; - } - if (clazz === gd.FloatType) { - return godot_1.Variant.Type.TYPE_FLOAT + ":"; - } - } - if (typeof clazz === "function" && typeof clazz.prototype !== "undefined") { - if (clazz.prototype instanceof gd.Resource) { - return `${godot_1.Variant.Type.TYPE_OBJECT}/${godot_1.PropertyHint.PROPERTY_HINT_RESOURCE_TYPE}:${clazz.name}`; - } - else if (clazz.prototype instanceof gd.Node) { - return `${godot_1.Variant.Type.TYPE_OBJECT}/${godot_1.PropertyHint.PROPERTY_HINT_NODE_TYPE}:${clazz.name}`; - } - else { - // other than Resource and Node, only primitive types and enum types are supported in gdscript - //TODO but we barely know anything about the enum types and int/float/StringName/... in JS - if (clazz === Boolean) { - return godot_1.Variant.Type.TYPE_BOOL + ":"; - } - else if (clazz === Number) { - // we can only guess the type is float - return godot_1.Variant.Type.TYPE_FLOAT + ":"; - } - else if (clazz === String) { - return godot_1.Variant.Type.TYPE_STRING + ":"; - } - else { - if (typeof clazz.__builtin_type__ === "number") { - return clazz.__builtin_type__ + ":"; - } - else { - throw new Error("the given parameters are not supported or not implemented"); - } - } - } - } - if (typeof clazz === "object") { - if (clazz instanceof EnumPlaceholderImpl) { - return `${godot_1.Variant.Type.TYPE_INT}/${godot_1.Variant.Type.TYPE_INT}:${get_hint_string_for_enum(clazz.target)}`; - } - // probably an Array (as key-value type descriptor for a Dictionary) - if (clazz instanceof TypePairPlaceholderImpl) { - // special case for dictionary, int is preferred for key type of a dictionary - const key_type = clazz.key === Number ? godot_1.Variant.Type.TYPE_INT + ":" : get_hint_string(clazz.key); - const value_type = get_hint_string(clazz.value); - if (key_type.length === 0 || value_type.length === 0) { - throw new Error("the given parameters are not supported or not implemented"); - } - return key_type + ';' + value_type; - } - } - return ""; - } - function export_object(class_) { - return export_(godot_1.Variant.Type.TYPE_OBJECT, { class_: class_ }); - } - /** - * [low level export] - */ - function export_(type, details) { - return function (target, key) { - let ebd = { name: key, type: type, hint: godot_1.PropertyHint.PROPERTY_HINT_NONE, hint_string: "", usage: godot_1.PropertyUsageFlags.PROPERTY_USAGE_DEFAULT }; - if (typeof details === "object") { - if (typeof details.hint === "number") - ebd.hint = details.hint; - if (typeof details.usage === "number") - ebd.usage = details.usage; - if (typeof details.hint_string === "string") - ebd.hint_string = details.hint_string; - // overwrite hint if class_ is provided - try { - //TODO more general and unified way to handle all types - if (type === godot_1.Variant.Type.TYPE_OBJECT) { - const clazz = details.class_; - const gd = require("godot"); - if (typeof clazz === "function" && typeof clazz.prototype !== "undefined") { - if (clazz.prototype instanceof gd.Resource) { - ebd.hint = godot_1.PropertyHint.PROPERTY_HINT_RESOURCE_TYPE; - ebd.hint_string = clazz.name; - ebd.usage |= godot_1.PropertyUsageFlags.PROPERTY_USAGE_SCRIPT_VARIABLE; - } - else if (clazz.prototype instanceof gd.Node) { - ebd.hint = godot_1.PropertyHint.PROPERTY_HINT_NODE_TYPE; - ebd.hint_string = clazz.name; - ebd.usage |= godot_1.PropertyUsageFlags.PROPERTY_USAGE_SCRIPT_VARIABLE; - } - } - jsb.internal.add_script_property(target, ebd); - return; - } - let hint_string = get_hint_string(details.class_); - if (hint_string.length > 0) { - ebd.hint = godot_1.PropertyHint.PROPERTY_HINT_TYPE_STRING; - ebd.hint_string = hint_string; - ebd.usage |= godot_1.PropertyUsageFlags.PROPERTY_USAGE_SCRIPT_VARIABLE; - } - } - catch (e) { - if (ebd.hint === godot_1.PropertyHint.PROPERTY_HINT_NONE) { - console.warn("the given parameters are not supported or not implemented (you need to give hint/hint_string/usage manually)", `class:${guess_type_name(Object.getPrototypeOf(target))} prop:${key} type:${type} class_:${guess_type_name(details.class_)}`); - } - } - } - jsb.internal.add_script_property(target, ebd); - }; - } - /** - * In Godot, class members can be exported. - * This means their value gets saved along with the resource (such as the scene) they're attached to. - * They will also be available for editing in the property editor. - * Exporting is done by using the `@export_var` (or `@export_`) annotation. - */ - function export_var(type, details) { - return export_(type, details); - } - /** - * NOTE only int value enums are allowed - */ - function export_enum(enum_type) { - return function (target, key) { - let hint_string = get_hint_string_for_enum(enum_type); - let ebd = { name: key, type: godot_1.Variant.Type.TYPE_INT, hint: godot_1.PropertyHint.PROPERTY_HINT_ENUM, hint_string: hint_string, usage: godot_1.PropertyUsageFlags.PROPERTY_USAGE_DEFAULT }; - jsb.internal.add_script_property(target, ebd); - }; - } - /** - * NOTE only int value enums are allowed - */ - function export_flags(enum_type) { - return function (target, key) { - let enum_vs = []; - for (let c in enum_type) { - const v = enum_type[c]; - if (typeof v === "string" && enum_type[v] != 0) { - enum_vs.push(v + ":" + c); - } - } - let ebd = { name: key, type: godot_1.Variant.Type.TYPE_INT, hint: godot_1.PropertyHint.PROPERTY_HINT_FLAGS, hint_string: enum_vs.join(","), usage: godot_1.PropertyUsageFlags.PROPERTY_USAGE_DEFAULT }; - jsb.internal.add_script_property(target, ebd); - }; - } - function rpc(config) { - return function (target, propertyKey, descriptor) { - if (typeof propertyKey !== "string") { - throw new Error("only string is allowed as propertyKey for rpc config"); - return; - } - if (typeof config !== "undefined") { - jsb.internal.add_script_rpc(target, propertyKey, { - mode: config.mode, - sync: typeof config.sync !== "undefined" ? (config.sync == "call_local") : undefined, - transfer_mode: config.transfer_mode, - transfer_channel: config.transfer_channel, - }); - } - else { - jsb.internal.add_script_rpc(target, propertyKey, {}); - } - }; - } - /** - * auto initialized on ready (before _ready called) - * @param evaluator for now, only string is accepted - */ - function onready(evaluator) { - return function (target, key) { - let ebd = { name: key, evaluator: evaluator }; - jsb.internal.add_script_ready(target, ebd); - }; - } - function tool() { - return function (target) { - jsb.internal.add_script_tool(target); - }; - } - function icon(path) { - return function (target) { - jsb.internal.add_script_icon(target, path); - }; - } - function deprecated(message) { - return function (target, propertyKey, descriptor) { - if (typeof propertyKey === "undefined") { - jsb.internal.set_script_doc(target, undefined, 0, message !== null && message !== void 0 ? message : ""); - return; - } - if (typeof propertyKey !== "string" || propertyKey.length == 0) - throw new Error("only string key is allowed for doc"); - jsb.internal.set_script_doc(target, propertyKey, 0, message !== null && message !== void 0 ? message : ""); - }; - } - function experimental(message) { - return function (target, propertyKey, descriptor) { - if (typeof propertyKey === "undefined") { - jsb.internal.set_script_doc(target, undefined, 1, message !== null && message !== void 0 ? message : ""); - return; - } - if (typeof propertyKey !== "string" || propertyKey.length == 0) - throw new Error("only string key is allowed for doc"); - jsb.internal.set_script_doc(target, propertyKey, 1, message !== null && message !== void 0 ? message : ""); - }; - } - function help(message) { - return function (target, propertyKey, descriptor) { - if (typeof propertyKey === "undefined") { - jsb.internal.set_script_doc(target, undefined, 2, message !== null && message !== void 0 ? message : ""); - return; - } - if (typeof propertyKey !== "string" || propertyKey.length == 0) - throw new Error("only string key is allowed for doc"); - jsb.internal.set_script_doc(target, propertyKey, 2, message !== null && message !== void 0 ? message : ""); - }; - } -}); -define("godot.typeloader", ["require", "exports"], function (require, exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.on_type_loaded = on_type_loaded; - const type_db = {}; - class TypeProcessor { - constructor() { - // avoid cyclic call on the same type - this.locked = false; - this.callbacks = []; - } - push(callback) { - if (this.locked) { - throw new Error('TypeProcessor is locked'); - } - this.callbacks.push(callback); - return this; - } - exec(type) { - if (this.locked) { - throw new Error('TypeProcessor is locked'); - } - this.locked = true; - for (let cb of this.callbacks) { - try { - cb(type); - } - catch (e) { - console.error(e); - } - } - this.locked = false; - } - } - const type_processors = new Map(); - function _on_type_loaded(type_name, callback) { - if (typeof type_name !== 'string') { - throw new Error('type_name must be a string'); - } - if (typeof type_db[type_name] !== 'undefined') { - callback(type_db[type_name]); - return; - } - if (type_processors.has(type_name)) { - type_processors.get(type_name).push(callback); - } - else { - type_processors.set(type_name, new TypeProcessor().push(callback)); - } - } - // callback on a godot type loaded by jsb_godot_module_loader. - // each callback will be called only once. - function on_type_loaded(type_name, callback) { - if (typeof type_name === 'string') { - _on_type_loaded(type_name, callback); - } - else if (Array.isArray(type_name)) { - for (let name of type_name) { - _on_type_loaded(name, callback); - } - } - else { - throw new Error('type_name must be a string or an array of strings'); - } - } - const jsb_builtin_extras = { - "IntegerType": Symbol("IntegerType"), - "FloatType": Symbol("FloatType"), - }; - // callback on a godot type loaded by jsb_godot_module_loader - exports._mod_proxy_ = function (type_loader_func) { - return new Proxy(type_db, { - // @ts-ignore - set: function (target, prop_name, value) { - if (typeof prop_name !== 'string') { - throw new Error(`only string key is allowed`); - } - if (typeof target[prop_name] !== 'undefined') { - console.warn('overwriting existing value', prop_name); - } - target[prop_name] = value; - }, - get: function (target, prop_name) { - let o = target[prop_name]; - if (typeof o === 'undefined' && typeof prop_name === 'string') { - o = target[prop_name] = - typeof jsb_builtin_extras[prop_name] !== "undefined" - ? jsb_builtin_extras[prop_name] - : type_loader_func(prop_name); - } - return o; - } - }); - }; - exports._post_bind_ = function (type_name, type) { - const processors = type_processors.get(type_name); - if (processors !== undefined) { - processors.exec(type); - type_processors.delete(type_name); - } - }; -}); -define("jsb.core", ["require", "exports", "godot", "godot-jsb"], function (require, exports, godot_2, jsb) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - jsb = __importStar(jsb); - // [WARNING] ALL IMPLEMENTATIONS BELOW ARE FOR BACKWARD COMPATIBILITY ONLY. - // [WARNING] THEY EXIST TO TEMPORARILY SUPPORT OLD CODES THAT USE THESE FUNCTIONS. - // [WARNING] FOLLOW THE CHANGES IN `https://github.com/godotjs/GodotJS/tree/main/docs/breaking_changes.md` TO UPDATE YOUR CODES. - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use `SignalN<..., R>.as_promise()` instead. - */ - exports.$wait = function (signal) { - return new Promise(resolve => { - let fn = null; - fn = require("godot").Callable.create(function () { - signal.disconnect(fn); - if (arguments.length == 0) { - resolve(undefined); - return; - } - if (arguments.length == 1) { - resolve(arguments[0]); - return; - } - // return as javascript array if more than one - resolve(Array.from(arguments)); - jsb.internal.notify_microtasks_run(); - }); - signal.connect(fn, 0); - }); - }; - /** - * Wait for seconds as a promise. - * ```typescript - * function seconds(secs: number) { - * return new Promise(function (resolve) { - * setTimeout(function () { - * resolve(undefined); - * }, secs * 1000); - * }); - *} - * ``` - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Implement your own version of this function. - * @param secs time to wait in seconds - * @returns Promise to await - */ - exports.seconds = function (secs) { - return new Promise(function (resolve) { - setTimeout(function () { - resolve(undefined); - }, secs * 1000); - }); - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.signal = function () { - return function (target, key) { - jsb.internal.add_script_signal(target, key); - }; - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.export_multiline = function () { - return exports.export_(godot_2.Variant.Type.TYPE_STRING, { hint: godot_2.PropertyHint.PROPERTY_HINT_MULTILINE_TEXT }); - }; - function __export_range(type, min, max, step = 1, ...extra_hints) { - let hint_string = `${min},${max},${step}`; - if (typeof extra_hints !== "undefined") { - hint_string += "," + extra_hints.join(","); - } - return exports.export_(type, { hint: godot_2.PropertyHint.PROPERTY_HINT_RANGE, hint_string: hint_string }); - } - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.export_range = function (min, max, step = 1, ...extra_hints) { - return __export_range(godot_2.Variant.Type.TYPE_FLOAT, min, max, step, ...extra_hints); - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.export_range_i = function (min, max, step = 1, ...extra_hints) { - return __export_range(godot_2.Variant.Type.TYPE_INT, min, max, step, ...extra_hints); - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.export_file = function (filter) { - return exports.export_(godot_2.Variant.Type.TYPE_STRING, { hint: godot_2.PropertyHint.PROPERTY_HINT_FILE, hint_string: filter }); - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.export_dir = function (filter) { - return exports.export_(godot_2.Variant.Type.TYPE_STRING, { hint: godot_2.PropertyHint.PROPERTY_HINT_DIR, hint_string: filter }); - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.export_global_file = function (filter) { - return exports.export_(godot_2.Variant.Type.TYPE_STRING, { hint: godot_2.PropertyHint.PROPERTY_HINT_GLOBAL_FILE, hint_string: filter }); - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.export_global_dir = function (filter) { - return exports.export_(godot_2.Variant.Type.TYPE_STRING, { hint: godot_2.PropertyHint.PROPERTY_HINT_GLOBAL_DIR, hint_string: filter }); - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.export_exp_easing = function (hint) { - return exports.export_(godot_2.Variant.Type.TYPE_FLOAT, { hint: godot_2.PropertyHint.PROPERTY_HINT_EXP_EASING, hint_string: hint }); - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.export_ = function (type, details) { - return function (target, key) { - let ebd = { name: key, type: type, hint: godot_2.PropertyHint.PROPERTY_HINT_NONE, hint_string: "", usage: godot_2.PropertyUsageFlags.PROPERTY_USAGE_DEFAULT }; - if (typeof details === "object") { - if (typeof details.hint === "number") - ebd.hint = details.hint; - if (typeof details.hint_string === "string") - ebd.hint_string = details.hint_string; - if (typeof details.usage === "number") - ebd.usage = details.usage; - } - jsb.internal.add_script_property(target, ebd); - }; - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.export_enum = function (enum_type) { - return function (target, key) { - let enum_vs = []; - for (let c in enum_type) { - const v = enum_type[c]; - if (typeof v === "string") { - enum_vs.push(v + ":" + c); - } - } - let ebd = { name: key, type: godot_2.Variant.Type.TYPE_INT, hint: godot_2.PropertyHint.PROPERTY_HINT_ENUM, hint_string: enum_vs.join(","), usage: godot_2.PropertyUsageFlags.PROPERTY_USAGE_DEFAULT }; - jsb.internal.add_script_property(target, ebd); - }; - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.export_flags = function (enum_type) { - return function (target, key) { - let enum_vs = []; - for (let c in enum_type) { - const v = enum_type[c]; - if (typeof v === "string" && enum_type[v] != 0) { - enum_vs.push(v + ":" + c); - } - } - let ebd = { name: key, type: godot_2.Variant.Type.TYPE_INT, hint: godot_2.PropertyHint.PROPERTY_HINT_FLAGS, hint_string: enum_vs.join(","), usage: godot_2.PropertyUsageFlags.PROPERTY_USAGE_DEFAULT }; - jsb.internal.add_script_property(target, ebd); - }; - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.rpc = function (config) { - return function (target, propertyKey, descriptor) { - if (typeof propertyKey !== "string") { - throw new Error("only string is allowed as propertyKey for rpc config"); - return; - } - if (typeof config !== "undefined") { - jsb.internal.add_script_rpc(target, propertyKey, { - mode: config.mode, - sync: typeof config.sync !== "undefined" ? (config.sync == "call_local") : undefined, - transfer_mode: config.transfer_mode, - transfer_channel: config.transfer_channel, - }); - } - else { - jsb.internal.add_script_rpc(target, propertyKey, {}); - } - }; - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.onready = function (evaluator) { - return function (target, key) { - let ebd = { name: key, evaluator: evaluator }; - jsb.internal.add_script_ready(target, ebd); - }; - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.tool = function () { - return function (target) { - jsb.internal.add_script_tool(target); - }; - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.icon = function (path) { - return function (target) { - jsb.internal.add_script_icon(target, path); - }; - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.deprecated = function (message) { - return function (target, propertyKey, descriptor) { - if (typeof propertyKey === "undefined") { - jsb.internal.set_script_doc(target, undefined, 0, message !== null && message !== void 0 ? message : ""); - return; - } - if (typeof propertyKey !== "string" || propertyKey.length == 0) - throw new Error("only string key is allowed for doc"); - jsb.internal.set_script_doc(target, propertyKey, 0, message !== null && message !== void 0 ? message : ""); - }; - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.experimental = function (message) { - return function (target, propertyKey, descriptor) { - if (typeof propertyKey === "undefined") { - jsb.internal.set_script_doc(target, undefined, 1, message !== null && message !== void 0 ? message : ""); - return; - } - if (typeof propertyKey !== "string" || propertyKey.length == 0) - throw new Error("only string key is allowed for doc"); - jsb.internal.set_script_doc(target, propertyKey, 1, message !== null && message !== void 0 ? message : ""); - }; - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. - */ - exports.help = function (message) { - return function (target, propertyKey, descriptor) { - if (typeof propertyKey === "undefined") { - jsb.internal.set_script_doc(target, undefined, 2, message !== null && message !== void 0 ? message : ""); - return; - } - if (typeof propertyKey !== "string" || propertyKey.length == 0) - throw new Error("only string key is allowed for doc"); - jsb.internal.set_script_doc(target, propertyKey, 2, message !== null && message !== void 0 ? message : ""); - }; - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot` instead. - */ - exports.GLOBAL_GET = function (entry_path) { - return require("godot").ProjectSettings.get_setting_with_override(entry_path); - }; - /** - * FOR BACKWARD COMPATIBILITY ONLY - * @deprecated [WARNING] This function is deprecated. Use the same function from `godot` instead. - */ - exports.EDITOR_GET = function (entry_path) { - return require("godot").EditorInterface.get_editor_settings().get(entry_path); - }; -}); -const ProxyTarget = Symbol("proxy_target"); -const proxy_unwrap = function (value) { - var _a; - if (typeof value !== "object" || value === null) { - return value; - } - return (_a = value[ProxyTarget]) !== null && _a !== void 0 ? _a : value; -}; -const proxyable_prototypes = []; -const proxy_wrap = function (value) { - if (typeof value !== "object" || value === null) { - return value; - } - const proto = Object.getPrototypeOf(value); - return proto && proxyable_prototypes.includes(proto) - ? value.proxy() - : value; -}; -require("godot.typeloader").on_type_loaded("Array", function (type) { - proxyable_prototypes.push(type.prototype); - type.prototype[Symbol.iterator] = function* () { - for (let i = 0; i < this.size(); ++i) { - yield this.get_indexed(i); - } - }; - // We're not going to try expose the whole Array API, we'll just be super minimalistic. If the user is after - // something more complex, it'll likely be more performant to spread the GArray into a JS array anyway. - const method_mapping = { - pop: "pop_back", - indexOf: "find", - includes: "has", - }; - const iterator = function* () { - for (let i = 0; i < this.length; ++i) { - yield this[i]; - } - }; - const push = function (...values) { - const target = this[ProxyTarget]; - for (const value of values) { - target.push_back(proxy_unwrap(value)); - } - return target.size(); - }; - const toJSON = function (key = "") { - return [...this]; - }; - const toString = function (index) { - return [...this].map(v => { var _a, _b; return (_b = (_a = v === null || v === void 0 ? void 0 : v.toString) === null || _a === void 0 ? void 0 : _a.call(v)) !== null && _b !== void 0 ? _b : v; }).join(","); - }; - const handler = { - get(target, p, receiver) { - if (typeof p !== "string") { - return p === ProxyTarget - ? target - : p === Symbol.iterator - ? iterator - : undefined; - } - const num = Number.parseInt(p); - if (!Number.isFinite(num)) { - switch (p) { - case "length": - return target.size(); - case "push": - return push; - case "toJSON": - return toJSON; - case "toString": - return toString; - } - const mapped = method_mapping[p]; - return mapped && Reflect.get(target, mapped).bind(target); - } - if (num < 0 || num >= target.size()) { - return undefined; - } - return proxy_wrap(target.get(num)); - }, - getOwnPropertyDescriptor(target, p) { - if (typeof p !== "string") { - return undefined; - } - const num = Number.parseInt(p); - if (!(num >= 0) || num >= target.size()) { - return undefined; - } - return { - configurable: true, - enumerable: true, - value: proxy_wrap(target.get(num)), - writable: true, - }; - }, - has(target, p) { - if (typeof p !== "string") { - return p === Symbol.iterator; - } - const num = Number.parseInt(p); - if (!(num >= 0)) { - switch (p) { - case "length": - case "push": - case "toJSON": - case "toString": - return true; - } - return !!method_mapping[p]; - } - return num >= 0 && num < target.size(); - }, - isExtensible(target) { - return true; - }, - ownKeys(target) { - const keys = []; - for (let i = 0; i < target.size(); i++) { - keys.push(i.toString()); - } - return keys; - }, - preventExtensions(target) { - return true; - }, - set(target, p, newValue, receiver) { - if (typeof p !== "string") { - return false; - } - const num = Number.parseInt(p); - if (!(num >= 0) || num >= target.size()) { - return false; - } - target.set(num, proxy_unwrap(newValue)); - return true; - }, - setPrototypeOf(target, v) { - return false; - }, - }; - type.prototype.proxy = function () { - return new Proxy(this, handler); - }; -}); -require("godot.typeloader").on_type_loaded("Dictionary", function (type) { - proxyable_prototypes.push(type.prototype); - type.prototype[Symbol.iterator] = function* () { - let self = this; - let keys = self.keys(); - for (let i = 0; i < keys.size(); ++i) { - const key = keys.get_indexed(i); - yield { key: key, value: self.get_keyed(key) }; - } - }; - const handler = { - defineProperty(target, property, attributes) { - return false; - }, - deleteProperty(target, p) { - return target.erase(p); - }, - get(target, p, receiver) { - if (typeof p !== "string") { - return p === ProxyTarget - ? target - : undefined; - } - const value = target.get(p); - return value !== null - ? proxy_wrap(value) - : target.has(p) - ? value - : p === "toString" - ? Object.prototype.toString - : undefined; - }, - getOwnPropertyDescriptor(target, p) { - if (typeof p !== "string") { - return undefined; - } - return { - configurable: true, - enumerable: true, - value: proxy_wrap(target.get(p)), - writable: true, - }; - }, - has(target, p) { - if (typeof p !== "string") { - return false; - } - return target.has(p) || p === "toString"; - }, - isExtensible(target) { - return true; - }, - ownKeys(target) { - const keys = []; - for (const key of target.keys()) { - if (typeof key === "string") { - keys.push(key); - } - } - return keys; - }, - preventExtensions(target) { - return false; - }, - set(target, p, newValue, receiver) { - if (typeof p !== "string") { - return false; - } - target.set(p, proxy_unwrap(newValue)); - return true; - }, - setPrototypeOf(target, v) { - return false; - }, - }; - type.prototype.proxy = function () { - return new Proxy(this, handler); - }; -}); -require("godot.typeloader").on_type_loaded("Callable", function (type) { - const orignal_cc = type.create; - const custom_cc = require("godot-jsb").callable; - type.create = function () { - const argc = arguments.length; - if (argc == 1) { - if (typeof arguments[0] !== "function") { - throw new Error("not a function"); - } - return custom_cc(arguments[0]); - } - if (argc == 2) { - if (typeof arguments[1] !== "function") { - return orignal_cc(arguments[0], arguments[1]); - } - return custom_cc(arguments[0], arguments[1]); - } - throw new Error("invalid arguments"); - }; -}); -require("godot.typeloader").on_type_loaded("Signal", function (type) { - type.prototype.as_promise = function () { - let self = this; - return new Promise(function (resolve, reject) { - let fn = null; - let gd = require("godot"); - fn = gd.Callable.create(function () { - //self.disconnect(fn); - if (arguments.length == 0) { - resolve(undefined); - return; - } - if (arguments.length == 1) { - resolve(arguments[0]); - return; - } - // return as javascript array if more than one - resolve(Array.from(arguments)); - require("godot-jsb").internal.notify_microtasks_run(); - }); - self.connect(fn, gd.Object.ConnectFlags.CONNECT_ONE_SHOT); - self = undefined; - }); - }; -}); -Object.defineProperty(require("godot"), "GLOBAL_GET", { - value: function (entry_path) { - return require("godot").ProjectSettings.get_setting_with_override(entry_path); - } -}); -Object.defineProperty(require("godot"), "EDITOR_GET", { - value: function (entry_path) { - return require("godot").EditorInterface.get_editor_settings().get(entry_path); - } -}); -console.debug("jsb.inject loaded successfully"); +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +define("godot.annotations", ["require", "exports", "godot", "godot-jsb"], function (require, exports, godot_1, jsb) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.EnumType = EnumType; + exports.TypePair = TypePair; + exports.signal = signal; + exports.export_multiline = export_multiline; + exports.export_range = export_range; + exports.export_range_i = export_range_i; + exports.export_file = export_file; + exports.export_dir = export_dir; + exports.export_global_file = export_global_file; + exports.export_global_dir = export_global_dir; + exports.export_exp_easing = export_exp_easing; + exports.export_array = export_array; + exports.export_dictionary = export_dictionary; + exports.export_object = export_object; + exports.export_ = export_; + exports.export_var = export_var; + exports.export_enum = export_enum; + exports.export_flags = export_flags; + exports.rpc = rpc; + exports.onready = onready; + exports.tool = tool; + exports.icon = icon; + exports.deprecated = deprecated; + exports.experimental = experimental; + exports.help = help; + jsb = __importStar(jsb); + function guess_type_name(type) { + if (typeof type === "function") { + return type.name; + } + if (typeof type === "object") { + if (typeof type.constructor === "function") { + return type.constructor.name; + } + let proto = Object.getPrototypeOf(type); + if (typeof proto === "object") { + return guess_type_name(proto); + } + } + return type; + } + class EnumPlaceholderImpl { + constructor(target) { this.target = target; } + } + class TypePairPlaceholderImpl { + constructor(key, value) { this.key = key; this.value = value; } + } + function EnumType(type) { + return new EnumPlaceholderImpl(type); + } + function TypePair(key, value) { + return new EnumPlaceholderImpl([key, value]); + } + /** + * + */ + function signal() { + return function (target, key) { + jsb.internal.add_script_signal(target, key); + }; + } + function export_multiline() { + return export_(godot_1.Variant.Type.TYPE_STRING, { hint: godot_1.PropertyHint.PROPERTY_HINT_MULTILINE_TEXT }); + } + function __export_range(type, min, max, step = 1, ...extra_hints) { + let hint_string = `${min},${max},${step}`; + if (typeof extra_hints !== "undefined") { + hint_string += "," + extra_hints.join(","); + } + return export_(type, { hint: godot_1.PropertyHint.PROPERTY_HINT_RANGE, hint_string: hint_string }); + } + function export_range(min, max, step = 1, ...extra_hints) { + return __export_range(godot_1.Variant.Type.TYPE_FLOAT, min, max, step, ...extra_hints); + } + function export_range_i(min, max, step = 1, ...extra_hints) { + return __export_range(godot_1.Variant.Type.TYPE_INT, min, max, step, ...extra_hints); + } + /** String as a path to a file, custom filter provided as hint. */ + function export_file(filter) { + return export_(godot_1.Variant.Type.TYPE_STRING, { hint: godot_1.PropertyHint.PROPERTY_HINT_FILE, hint_string: filter }); + } + function export_dir(filter) { + return export_(godot_1.Variant.Type.TYPE_STRING, { hint: godot_1.PropertyHint.PROPERTY_HINT_DIR, hint_string: filter }); + } + function export_global_file(filter) { + return export_(godot_1.Variant.Type.TYPE_STRING, { hint: godot_1.PropertyHint.PROPERTY_HINT_GLOBAL_FILE, hint_string: filter }); + } + function export_global_dir(filter) { + return export_(godot_1.Variant.Type.TYPE_STRING, { hint: godot_1.PropertyHint.PROPERTY_HINT_GLOBAL_DIR, hint_string: filter }); + } + function export_exp_easing(hint) { + return export_(godot_1.Variant.Type.TYPE_FLOAT, { hint: godot_1.PropertyHint.PROPERTY_HINT_EXP_EASING, hint_string: hint }); + } + /** + * A Shortcut for `export_(Variant.Type.TYPE_ARRAY, { class_: clazz })` + */ + function export_array(clazz) { + return export_(godot_1.Variant.Type.TYPE_ARRAY, { class_: clazz }); + } + /** + * A Shortcut for `export_(Variant.Type.TYPE_DICTIONARY, { class_: [key_class, value_class] })` + */ + function export_dictionary(key_class, value_class) { + return export_(godot_1.Variant.Type.TYPE_DICTIONARY, { class_: TypePair(key_class, value_class) }); + } + function get_hint_string_for_enum(enum_type) { + let enum_vs = []; + for (let c in enum_type) { + const v = enum_type[c]; + if (typeof v === "string") { + enum_vs.push(v + ":" + c); + } + } + return enum_vs.join(","); + } + function get_hint_string(clazz) { + let gd = require("godot"); + if (typeof clazz === "symbol") { + if (clazz === gd.IntegerType) { + return godot_1.Variant.Type.TYPE_INT + ":"; + } + if (clazz === gd.FloatType) { + return godot_1.Variant.Type.TYPE_FLOAT + ":"; + } + } + if (typeof clazz === "function" && typeof clazz.prototype !== "undefined") { + if (clazz.prototype instanceof gd.Resource) { + return `${godot_1.Variant.Type.TYPE_OBJECT}/${godot_1.PropertyHint.PROPERTY_HINT_RESOURCE_TYPE}:${clazz.name}`; + } + else if (clazz.prototype instanceof gd.Node) { + return `${godot_1.Variant.Type.TYPE_OBJECT}/${godot_1.PropertyHint.PROPERTY_HINT_NODE_TYPE}:${clazz.name}`; + } + else { + // other than Resource and Node, only primitive types and enum types are supported in gdscript + //TODO but we barely know anything about the enum types and int/float/StringName/... in JS + if (clazz === Boolean) { + return godot_1.Variant.Type.TYPE_BOOL + ":"; + } + else if (clazz === Number) { + // we can only guess the type is float + return godot_1.Variant.Type.TYPE_FLOAT + ":"; + } + else if (clazz === String) { + return godot_1.Variant.Type.TYPE_STRING + ":"; + } + else { + if (typeof clazz.__builtin_type__ === "number") { + return clazz.__builtin_type__ + ":"; + } + else { + throw new Error("the given parameters are not supported or not implemented"); + } + } + } + } + if (typeof clazz === "object") { + if (clazz instanceof EnumPlaceholderImpl) { + return `${godot_1.Variant.Type.TYPE_INT}/${godot_1.Variant.Type.TYPE_INT}:${get_hint_string_for_enum(clazz.target)}`; + } + // probably an Array (as key-value type descriptor for a Dictionary) + if (clazz instanceof TypePairPlaceholderImpl) { + // special case for dictionary, int is preferred for key type of a dictionary + const key_type = clazz.key === Number ? godot_1.Variant.Type.TYPE_INT + ":" : get_hint_string(clazz.key); + const value_type = get_hint_string(clazz.value); + if (key_type.length === 0 || value_type.length === 0) { + throw new Error("the given parameters are not supported or not implemented"); + } + return key_type + ';' + value_type; + } + } + return ""; + } + function export_object(class_) { + return export_(godot_1.Variant.Type.TYPE_OBJECT, { class_: class_ }); + } + /** + * [low level export] + */ + function export_(type, details) { + return function (target, key) { + let ebd = { name: key, type: type, hint: godot_1.PropertyHint.PROPERTY_HINT_NONE, hint_string: "", usage: godot_1.PropertyUsageFlags.PROPERTY_USAGE_DEFAULT }; + if (typeof details === "object") { + if (typeof details.hint === "number") + ebd.hint = details.hint; + if (typeof details.usage === "number") + ebd.usage = details.usage; + if (typeof details.hint_string === "string") + ebd.hint_string = details.hint_string; + // overwrite hint if class_ is provided + try { + //TODO more general and unified way to handle all types + if (type === godot_1.Variant.Type.TYPE_OBJECT) { + const clazz = details.class_; + const gd = require("godot"); + if (typeof clazz === "function" && typeof clazz.prototype !== "undefined") { + if (clazz.prototype instanceof gd.Resource) { + ebd.hint = godot_1.PropertyHint.PROPERTY_HINT_RESOURCE_TYPE; + ebd.hint_string = clazz.name; + ebd.usage |= godot_1.PropertyUsageFlags.PROPERTY_USAGE_SCRIPT_VARIABLE; + } + else if (clazz.prototype instanceof gd.Node) { + ebd.hint = godot_1.PropertyHint.PROPERTY_HINT_NODE_TYPE; + ebd.hint_string = clazz.name; + ebd.usage |= godot_1.PropertyUsageFlags.PROPERTY_USAGE_SCRIPT_VARIABLE; + } + } + jsb.internal.add_script_property(target, ebd); + return; + } + let hint_string = get_hint_string(details.class_); + if (hint_string.length > 0) { + ebd.hint = godot_1.PropertyHint.PROPERTY_HINT_TYPE_STRING; + ebd.hint_string = hint_string; + ebd.usage |= godot_1.PropertyUsageFlags.PROPERTY_USAGE_SCRIPT_VARIABLE; + } + } + catch (e) { + if (ebd.hint === godot_1.PropertyHint.PROPERTY_HINT_NONE) { + console.warn("the given parameters are not supported or not implemented (you need to give hint/hint_string/usage manually)", `class:${guess_type_name(Object.getPrototypeOf(target))} prop:${key} type:${type} class_:${guess_type_name(details.class_)}`); + } + } + } + jsb.internal.add_script_property(target, ebd); + }; + } + /** + * In Godot, class members can be exported. + * This means their value gets saved along with the resource (such as the scene) they're attached to. + * They will also be available for editing in the property editor. + * Exporting is done by using the `@export_var` (or `@export_`) annotation. + */ + function export_var(type, details) { + return export_(type, details); + } + /** + * NOTE only int value enums are allowed + */ + function export_enum(enum_type) { + return function (target, key) { + let hint_string = get_hint_string_for_enum(enum_type); + let ebd = { name: key, type: godot_1.Variant.Type.TYPE_INT, hint: godot_1.PropertyHint.PROPERTY_HINT_ENUM, hint_string: hint_string, usage: godot_1.PropertyUsageFlags.PROPERTY_USAGE_DEFAULT }; + jsb.internal.add_script_property(target, ebd); + }; + } + /** + * NOTE only int value enums are allowed + */ + function export_flags(enum_type) { + return function (target, key) { + let enum_vs = []; + for (let c in enum_type) { + const v = enum_type[c]; + if (typeof v === "string" && enum_type[v] != 0) { + enum_vs.push(v + ":" + c); + } + } + let ebd = { name: key, type: godot_1.Variant.Type.TYPE_INT, hint: godot_1.PropertyHint.PROPERTY_HINT_FLAGS, hint_string: enum_vs.join(","), usage: godot_1.PropertyUsageFlags.PROPERTY_USAGE_DEFAULT }; + jsb.internal.add_script_property(target, ebd); + }; + } + function rpc(config) { + return function (target, propertyKey, descriptor) { + if (typeof propertyKey !== "string") { + throw new Error("only string is allowed as propertyKey for rpc config"); + return; + } + if (typeof config !== "undefined") { + jsb.internal.add_script_rpc(target, propertyKey, { + mode: config.mode, + sync: typeof config.sync !== "undefined" ? (config.sync == "call_local") : undefined, + transfer_mode: config.transfer_mode, + transfer_channel: config.transfer_channel, + }); + } + else { + jsb.internal.add_script_rpc(target, propertyKey, {}); + } + }; + } + /** + * auto initialized on ready (before _ready called) + * @param evaluator for now, only string is accepted + */ + function onready(evaluator) { + return function (target, key) { + let ebd = { name: key, evaluator: evaluator }; + jsb.internal.add_script_ready(target, ebd); + }; + } + function tool() { + return function (target) { + jsb.internal.add_script_tool(target); + }; + } + function icon(path) { + return function (target) { + jsb.internal.add_script_icon(target, path); + }; + } + function deprecated(message) { + return function (target, propertyKey, descriptor) { + if (typeof propertyKey === "undefined") { + jsb.internal.set_script_doc(target, undefined, 0, message !== null && message !== void 0 ? message : ""); + return; + } + if (typeof propertyKey !== "string" || propertyKey.length == 0) + throw new Error("only string key is allowed for doc"); + jsb.internal.set_script_doc(target, propertyKey, 0, message !== null && message !== void 0 ? message : ""); + }; + } + function experimental(message) { + return function (target, propertyKey, descriptor) { + if (typeof propertyKey === "undefined") { + jsb.internal.set_script_doc(target, undefined, 1, message !== null && message !== void 0 ? message : ""); + return; + } + if (typeof propertyKey !== "string" || propertyKey.length == 0) + throw new Error("only string key is allowed for doc"); + jsb.internal.set_script_doc(target, propertyKey, 1, message !== null && message !== void 0 ? message : ""); + }; + } + function help(message) { + return function (target, propertyKey, descriptor) { + if (typeof propertyKey === "undefined") { + jsb.internal.set_script_doc(target, undefined, 2, message !== null && message !== void 0 ? message : ""); + return; + } + if (typeof propertyKey !== "string" || propertyKey.length == 0) + throw new Error("only string key is allowed for doc"); + jsb.internal.set_script_doc(target, propertyKey, 2, message !== null && message !== void 0 ? message : ""); + }; + } +}); +define("godot.typeloader", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.on_type_loaded = on_type_loaded; + const type_db = {}; + class TypeProcessor { + constructor() { + // avoid cyclic call on the same type + this.locked = false; + this.callbacks = []; + } + push(callback) { + if (this.locked) { + throw new Error('TypeProcessor is locked'); + } + this.callbacks.push(callback); + return this; + } + exec(type) { + if (this.locked) { + throw new Error('TypeProcessor is locked'); + } + this.locked = true; + for (let cb of this.callbacks) { + try { + cb(type); + } + catch (e) { + console.error(e); + } + } + this.locked = false; + } + } + const type_processors = new Map(); + function _on_type_loaded(type_name, callback) { + if (typeof type_name !== 'string') { + throw new Error('type_name must be a string'); + } + if (typeof type_db[type_name] !== 'undefined') { + callback(type_db[type_name]); + return; + } + if (type_processors.has(type_name)) { + type_processors.get(type_name).push(callback); + } + else { + type_processors.set(type_name, new TypeProcessor().push(callback)); + } + } + // callback on a godot type loaded by jsb_godot_module_loader. + // each callback will be called only once. + function on_type_loaded(type_name, callback) { + if (typeof type_name === 'string') { + _on_type_loaded(type_name, callback); + } + else if (Array.isArray(type_name)) { + for (let name of type_name) { + _on_type_loaded(name, callback); + } + } + else { + throw new Error('type_name must be a string or an array of strings'); + } + } + const jsb_builtin_extras = { + "IntegerType": Symbol("IntegerType"), + "FloatType": Symbol("FloatType"), + }; + // callback on a godot type loaded by jsb_godot_module_loader + exports._mod_proxy_ = function (type_loader_func) { + return new Proxy(type_db, { + // @ts-ignore + set: function (target, prop_name, value) { + if (typeof prop_name !== 'string') { + throw new Error(`only string key is allowed`); + } + if (typeof target[prop_name] !== 'undefined') { + console.warn('overwriting existing value', prop_name); + } + target[prop_name] = value; + }, + get: function (target, prop_name) { + let o = target[prop_name]; + if (typeof o === 'undefined' && typeof prop_name === 'string') { + o = target[prop_name] = + typeof jsb_builtin_extras[prop_name] !== "undefined" + ? jsb_builtin_extras[prop_name] + : type_loader_func(prop_name); + } + return o; + } + }); + }; + exports._post_bind_ = function (type_name, type) { + const processors = type_processors.get(type_name); + if (processors !== undefined) { + processors.exec(type); + type_processors.delete(type_name); + } + }; +}); +define("jsb.core", ["require", "exports", "godot", "godot-jsb"], function (require, exports, godot_2, jsb) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + jsb = __importStar(jsb); + // [WARNING] ALL IMPLEMENTATIONS BELOW ARE FOR BACKWARD COMPATIBILITY ONLY. + // [WARNING] THEY EXIST TO TEMPORARILY SUPPORT OLD CODES THAT USE THESE FUNCTIONS. + // [WARNING] FOLLOW THE CHANGES IN `https://github.com/godotjs/GodotJS/tree/main/docs/breaking_changes.md` TO UPDATE YOUR CODES. + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use `SignalN<..., R>.as_promise()` instead. + */ + exports.$wait = function (signal) { + return new Promise(resolve => { + let fn = null; + fn = require("godot").Callable.create(function () { + signal.disconnect(fn); + if (arguments.length == 0) { + resolve(undefined); + return; + } + if (arguments.length == 1) { + resolve(arguments[0]); + return; + } + // return as javascript array if more than one + resolve(Array.from(arguments)); + jsb.internal.notify_microtasks_run(); + }); + signal.connect(fn, 0); + }); + }; + /** + * Wait for seconds as a promise. + * ```typescript + * function seconds(secs: number) { + * return new Promise(function (resolve) { + * setTimeout(function () { + * resolve(undefined); + * }, secs * 1000); + * }); + *} + * ``` + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Implement your own version of this function. + * @param secs time to wait in seconds + * @returns Promise to await + */ + exports.seconds = function (secs) { + return new Promise(function (resolve) { + setTimeout(function () { + resolve(undefined); + }, secs * 1000); + }); + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.signal = function () { + return function (target, key) { + jsb.internal.add_script_signal(target, key); + }; + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.export_multiline = function () { + return exports.export_(godot_2.Variant.Type.TYPE_STRING, { hint: godot_2.PropertyHint.PROPERTY_HINT_MULTILINE_TEXT }); + }; + function __export_range(type, min, max, step = 1, ...extra_hints) { + let hint_string = `${min},${max},${step}`; + if (typeof extra_hints !== "undefined") { + hint_string += "," + extra_hints.join(","); + } + return exports.export_(type, { hint: godot_2.PropertyHint.PROPERTY_HINT_RANGE, hint_string: hint_string }); + } + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.export_range = function (min, max, step = 1, ...extra_hints) { + return __export_range(godot_2.Variant.Type.TYPE_FLOAT, min, max, step, ...extra_hints); + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.export_range_i = function (min, max, step = 1, ...extra_hints) { + return __export_range(godot_2.Variant.Type.TYPE_INT, min, max, step, ...extra_hints); + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.export_file = function (filter) { + return exports.export_(godot_2.Variant.Type.TYPE_STRING, { hint: godot_2.PropertyHint.PROPERTY_HINT_FILE, hint_string: filter }); + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.export_dir = function (filter) { + return exports.export_(godot_2.Variant.Type.TYPE_STRING, { hint: godot_2.PropertyHint.PROPERTY_HINT_DIR, hint_string: filter }); + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.export_global_file = function (filter) { + return exports.export_(godot_2.Variant.Type.TYPE_STRING, { hint: godot_2.PropertyHint.PROPERTY_HINT_GLOBAL_FILE, hint_string: filter }); + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.export_global_dir = function (filter) { + return exports.export_(godot_2.Variant.Type.TYPE_STRING, { hint: godot_2.PropertyHint.PROPERTY_HINT_GLOBAL_DIR, hint_string: filter }); + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.export_exp_easing = function (hint) { + return exports.export_(godot_2.Variant.Type.TYPE_FLOAT, { hint: godot_2.PropertyHint.PROPERTY_HINT_EXP_EASING, hint_string: hint }); + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.export_ = function (type, details) { + return function (target, key) { + let ebd = { name: key, type: type, hint: godot_2.PropertyHint.PROPERTY_HINT_NONE, hint_string: "", usage: godot_2.PropertyUsageFlags.PROPERTY_USAGE_DEFAULT }; + if (typeof details === "object") { + if (typeof details.hint === "number") + ebd.hint = details.hint; + if (typeof details.hint_string === "string") + ebd.hint_string = details.hint_string; + if (typeof details.usage === "number") + ebd.usage = details.usage; + } + jsb.internal.add_script_property(target, ebd); + }; + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.export_enum = function (enum_type) { + return function (target, key) { + let enum_vs = []; + for (let c in enum_type) { + const v = enum_type[c]; + if (typeof v === "string") { + enum_vs.push(v + ":" + c); + } + } + let ebd = { name: key, type: godot_2.Variant.Type.TYPE_INT, hint: godot_2.PropertyHint.PROPERTY_HINT_ENUM, hint_string: enum_vs.join(","), usage: godot_2.PropertyUsageFlags.PROPERTY_USAGE_DEFAULT }; + jsb.internal.add_script_property(target, ebd); + }; + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.export_flags = function (enum_type) { + return function (target, key) { + let enum_vs = []; + for (let c in enum_type) { + const v = enum_type[c]; + if (typeof v === "string" && enum_type[v] != 0) { + enum_vs.push(v + ":" + c); + } + } + let ebd = { name: key, type: godot_2.Variant.Type.TYPE_INT, hint: godot_2.PropertyHint.PROPERTY_HINT_FLAGS, hint_string: enum_vs.join(","), usage: godot_2.PropertyUsageFlags.PROPERTY_USAGE_DEFAULT }; + jsb.internal.add_script_property(target, ebd); + }; + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.rpc = function (config) { + return function (target, propertyKey, descriptor) { + if (typeof propertyKey !== "string") { + throw new Error("only string is allowed as propertyKey for rpc config"); + return; + } + if (typeof config !== "undefined") { + jsb.internal.add_script_rpc(target, propertyKey, { + mode: config.mode, + sync: typeof config.sync !== "undefined" ? (config.sync == "call_local") : undefined, + transfer_mode: config.transfer_mode, + transfer_channel: config.transfer_channel, + }); + } + else { + jsb.internal.add_script_rpc(target, propertyKey, {}); + } + }; + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.onready = function (evaluator) { + return function (target, key) { + let ebd = { name: key, evaluator: evaluator }; + jsb.internal.add_script_ready(target, ebd); + }; + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.tool = function () { + return function (target) { + jsb.internal.add_script_tool(target); + }; + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.icon = function (path) { + return function (target) { + jsb.internal.add_script_icon(target, path); + }; + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.deprecated = function (message) { + return function (target, propertyKey, descriptor) { + if (typeof propertyKey === "undefined") { + jsb.internal.set_script_doc(target, undefined, 0, message !== null && message !== void 0 ? message : ""); + return; + } + if (typeof propertyKey !== "string" || propertyKey.length == 0) + throw new Error("only string key is allowed for doc"); + jsb.internal.set_script_doc(target, propertyKey, 0, message !== null && message !== void 0 ? message : ""); + }; + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.experimental = function (message) { + return function (target, propertyKey, descriptor) { + if (typeof propertyKey === "undefined") { + jsb.internal.set_script_doc(target, undefined, 1, message !== null && message !== void 0 ? message : ""); + return; + } + if (typeof propertyKey !== "string" || propertyKey.length == 0) + throw new Error("only string key is allowed for doc"); + jsb.internal.set_script_doc(target, propertyKey, 1, message !== null && message !== void 0 ? message : ""); + }; + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot.annotations` instead. + */ + exports.help = function (message) { + return function (target, propertyKey, descriptor) { + if (typeof propertyKey === "undefined") { + jsb.internal.set_script_doc(target, undefined, 2, message !== null && message !== void 0 ? message : ""); + return; + } + if (typeof propertyKey !== "string" || propertyKey.length == 0) + throw new Error("only string key is allowed for doc"); + jsb.internal.set_script_doc(target, propertyKey, 2, message !== null && message !== void 0 ? message : ""); + }; + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot` instead. + */ + exports.GLOBAL_GET = function (entry_path) { + return require("godot").ProjectSettings.get_setting_with_override(entry_path); + }; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] This function is deprecated. Use the same function from `godot` instead. + */ + exports.EDITOR_GET = function (entry_path) { + return require("godot").EditorInterface.get_editor_settings().get(entry_path); + }; +}); +require("godot.typeloader").on_type_loaded("Array", function (type) { + type.prototype[Symbol.iterator] = function* () { + let self = this; + for (let i = 0; i < self.size(); ++i) { + yield self.get_indexed(i); + } + }; +}); +require("godot.typeloader").on_type_loaded("Dictionary", function (type) { + type.prototype[Symbol.iterator] = function* () { + let self = this; + let keys = self.keys(); + for (let i = 0; i < keys.size(); ++i) { + const key = keys.get_indexed(i); + yield { key: key, value: self.get_keyed(key) }; + } + }; +}); +require("godot.typeloader").on_type_loaded("Callable", function (type) { + const orignal_cc = type.create; + const custom_cc = require("godot-jsb").callable; + type.create = function () { + const argc = arguments.length; + if (argc == 1) { + if (typeof arguments[0] !== "function") { + throw new Error("not a function"); + } + return custom_cc(arguments[0]); + } + if (argc == 2) { + if (typeof arguments[1] !== "function") { + return orignal_cc(arguments[0], arguments[1]); + } + return custom_cc(arguments[0], arguments[1]); + } + throw new Error("invalid arguments"); + }; +}); +require("godot.typeloader").on_type_loaded("Signal", function (type) { + type.prototype.as_promise = function () { + let self = this; + return new Promise(function (resolve, reject) { + let fn = null; + let gd = require("godot"); + fn = gd.Callable.create(function () { + //self.disconnect(fn); + if (arguments.length == 0) { + resolve(undefined); + return; + } + if (arguments.length == 1) { + resolve(arguments[0]); + return; + } + // return as javascript array if more than one + resolve(Array.from(arguments)); + require("godot-jsb").internal.notify_microtasks_run(); + }); + self.connect(fn, gd.Object.ConnectFlags.CONNECT_ONE_SHOT); + self = undefined; + }); + }; +}); +Object.defineProperty(require("godot"), "GLOBAL_GET", { + value: function (entry_path) { + return require("godot").ProjectSettings.get_setting_with_override(entry_path); + } +}); +Object.defineProperty(require("godot"), "EDITOR_GET", { + value: function (entry_path) { + return require("godot").EditorInterface.get_editor_settings().get(entry_path); + } +}); +console.debug("jsb.inject loaded successfully"); //# sourceMappingURL=jsb.runtime.bundle.js.map \ No newline at end of file diff --git a/scripts/out/jsb.runtime.bundle.js.map b/scripts/out/jsb.runtime.bundle.js.map index 46ac6099..d48b360e 100644 --- a/scripts/out/jsb.runtime.bundle.js.map +++ b/scripts/out/jsb.runtime.bundle.js.map @@ -1 +1 @@ -{"version":3,"file":"jsb.runtime.bundle.js","sourceRoot":"../src/","sources":["jsb.inject.ts","godot.annotations.ts","godot.typeloader.ts","jsb.core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;ICkCA,4BAEC;IAED,4BAEC;IAOD,wBAIC;IAED,4CAEC;IAUD,oCAEC;IAED,wCAEC;IAGD,kCAEC;IAED,gCAEC;IAED,gDAEC;IAED,8CAEC;IAED,8CAEC;IAKD,oCAEC;IAKD,8CAEC;IAsED,sCAEC;IAKD,0BA8CC;IAQD,gCAEC;IAKD,kCAMC;IAKD,oCAYC;IASD,kBAkBC;IAMD,0BAKC;IAED,oBAIC;IAED,oBAIC;IAED,gCASC;IAED,oCASC;IAED,oBASC;;IA1VD,SAAS,eAAe,CAAC,IAAS;QAC9B,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,IAAI,CAAC;QACrB,CAAC;QACD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AG,SAAS,CAAC;QACrB,CAAC,CAAC,CAAC;IACP,CAAC,CAAA;AACL,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE;IAClD,KAAK,EAAE,UAAU,UAAkB;QAC/B,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC;IAClF,CAAC;CACJ,CAAC,CAAA;AAEF,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE;IAClD,KAAK,EAAE,UAAU,UAAkB;QAC/B,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,mBAAmB,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAClF,CAAC;CACJ,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"jsb.runtime.bundle.js","sourceRoot":"../src/","sources":["jsb.inject.ts","godot.annotations.ts","godot.typeloader.ts","jsb.core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;ICkCA,4BAEC;IAED,4BAEC;IAOD,wBAIC;IAED,4CAEC;IAUD,oCAEC;IAED,wCAEC;IAGD,kCAEC;IAED,gCAEC;IAED,gDAEC;IAED,8CAEC;IAED,8CAEC;IAKD,oCAEC;IAKD,8CAEC;IAsED,sCAEC;IAKD,0BA8CC;IAQD,gCAEC;IAKD,kCAMC;IAKD,oCAYC;IASD,kBAkBC;IAMD,0BAKC;IAED,oBAIC;IAED,oBAIC;IAED,gCASC;IAED,oCASC;IAED,oBASC;;IA1VD,SAAS,eAAe,CAAC,IAAS;QAC9B,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,IAAI,CAAC;QACrB,CAAC;QACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAA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C,QAAQ,CAAC,qBAAqB,EAAE,CAAC;YAC1D,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;YAC1D,IAAI,GAAG,SAAS,CAAC;QACrB,CAAC,CAAC,CAAC;IACP,CAAC,CAAA;AACL,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE;IAClD,KAAK,EAAE,UAAU,UAAkB;QAC/B,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC;IAClF,CAAC;CACJ,CAAC,CAAA;AAEF,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE;IAClD,KAAK,EAAE,UAAU,UAAkB;QAC/B,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,mBAAmB,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAClF,CAAC;CACJ,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC"} \ No newline at end of file diff --git a/scripts/typings/godot.generated.d.ts b/scripts/typings/godot.generated.d.ts index 4e570ad8..caddc973 100644 --- a/scripts/typings/godot.generated.d.ts +++ b/scripts/typings/godot.generated.d.ts @@ -1,17 +1,26 @@ // THIS FILE IS ONLY A PLACEHOLDER FOR COMPILING THE PREMADE TYPESCRIPT SOURCES IN THE GODOTJS MODULE IN-PLACE WITHOUT ERRORS. // godot.xxx.d.ts files will be generated in a target project. +/// declare module "godot" { - class Node { } - class GArray { - get_indexed(index: number): any + class Node = {}> extends Object { } + class GArray { + proxy(): Write extends true ? GArrayProxy : GArrayReadProxy; + get_indexed(index: number): T size(): number } - class GDictionary { - get_keyed(index: any): any - keys(): GArray + class GDictionary { + proxy(): Write extends true ? GDictionaryProxy : GDictionaryReadProxy; + get(key: K, default_: any = {}): T[K] + get_keyed(index: K): T[K] + keys(): GArray } - type StringName = string; + type byte = number + type int32 = number + type int64 = number /* || bigint */ + type float32 = number + type float64 = number + type StringName = string class EditorSettings { get(path: StringName): any; } class EditorInterface { static get_editor_settings(): EditorSettings; } @@ -19,7 +28,7 @@ declare module "godot" { class OS { static get_name(): string - static create_process(path: string, arguments_: PackedStringArray | string[], open_console: boolean = false): int64 + static create_process(path: string, arguments_: PackedStringArray | string[], open_console?: boolean): int64 } // singleton @@ -29,38 +38,38 @@ declare module "godot" { enum RPCMode { /** Used with [method Node.rpc_config] to disable a method or property for all RPC calls, making it unavailable. Default for all methods. */ RPC_MODE_DISABLED = 0, - + /** Used with [method Node.rpc_config] to set a method to be callable remotely by any peer. Analogous to the `@rpc("any_peer")` annotation. Calls are accepted from all remote peers, no matter if they are node's authority or not. */ RPC_MODE_ANY_PEER = 1, - + /** Used with [method Node.rpc_config] to set a method to be callable remotely only by the current multiplayer authority (which is the server by default). Analogous to the `@rpc("authority")` annotation. See [method Node.set_multiplayer_authority]. */ RPC_MODE_AUTHORITY = 2, } } - + namespace MultiplayerPeer { enum ConnectionStatus { /** The MultiplayerPeer is disconnected. */ CONNECTION_DISCONNECTED = 0, - + /** The MultiplayerPeer is currently connecting to a server. */ CONNECTION_CONNECTING = 1, - + /** This MultiplayerPeer is connected. */ CONNECTION_CONNECTED = 2, } enum TransferMode { /** Packets are not acknowledged, no resend attempts are made for lost packets. Packets may arrive in any order. Potentially faster than [constant TRANSFER_MODE_UNRELIABLE_ORDERED]. Use for non-critical data, and always consider whether the order matters. */ TRANSFER_MODE_UNRELIABLE = 0, - + /** Packets are not acknowledged, no resend attempts are made for lost packets. Packets are received in the order they were sent in. Potentially faster than [constant TRANSFER_MODE_RELIABLE]. Use for non-critical data or data that would be outdated if received late due to resend attempt(s) anyway, for example movement and positional data. */ TRANSFER_MODE_UNRELIABLE_ORDERED = 1, - + /** Packets must be received and resend attempts should be made until the packets are acknowledged. Packets must be received in the order they were sent in. Most reliable transfer mode, but potentially the slowest due to the overhead. Use for critical data that must be transmitted and arrive in order, for example an ability being triggered or a chat message. Consider carefully if the information really is critical, and use sparingly. */ TRANSFER_MODE_RELIABLE = 2, } } - + class PackedByteArray { } class PackedStringArray { append(value: string): boolean } @@ -80,11 +89,12 @@ declare module "godot" { static file_exists(path: string): boolean; store_line(str: string); + store_string(string_: string): boolean get_position(): number; flush(): void; close() : void; } - + enum PropertyHint { PROPERTY_HINT_NONE = 0, PROPERTY_HINT_RANGE = 1, @@ -129,126 +139,126 @@ declare module "godot" { enum MethodFlags { /** Flag for a normal method. */ METHOD_FLAG_NORMAL = 1, - + /** Flag for an editor method. */ METHOD_FLAG_EDITOR = 2, - + /** Flag for a constant method. */ METHOD_FLAG_CONST = 4, - + /** Flag for a virtual method. */ METHOD_FLAG_VIRTUAL = 8, - + /** Flag for a method with a variable number of arguments. */ METHOD_FLAG_VARARG = 16, - + /** Flag for a static method. */ METHOD_FLAG_STATIC = 32, - + /** Used internally. Allows to not dump core virtual methods (such as [method Object._notification]) to the JSON API. */ METHOD_FLAG_OBJECT_CORE = 64, - + /** Default method flags (normal). */ METHOD_FLAGS_DEFAULT = 1, } enum PropertyUsageFlags { /** The property is not stored, and does not display in the editor. This is the default for non-exported properties. */ PROPERTY_USAGE_NONE = 0, - + /** The property is serialized and saved in the scene file (default). */ PROPERTY_USAGE_STORAGE = 2, - + /** The property is shown in the [EditorInspector] (default). */ PROPERTY_USAGE_EDITOR = 4, - + /** The property is excluded from the class reference. */ PROPERTY_USAGE_INTERNAL = 8, - + /** The property can be checked in the [EditorInspector]. */ PROPERTY_USAGE_CHECKABLE = 16, - + /** The property is checked in the [EditorInspector]. */ PROPERTY_USAGE_CHECKED = 32, - + /** Used to group properties together in the editor. See [EditorInspector]. */ PROPERTY_USAGE_GROUP = 64, - + /** Used to categorize properties together in the editor. */ PROPERTY_USAGE_CATEGORY = 128, - + /** Used to group properties together in the editor in a subgroup (under a group). See [EditorInspector]. */ PROPERTY_USAGE_SUBGROUP = 256, - + /** The property is a bitfield, i.e. it contains multiple flags represented as bits. */ PROPERTY_USAGE_CLASS_IS_BITFIELD = 512, - + /** The property does not save its state in [PackedScene]. */ PROPERTY_USAGE_NO_INSTANCE_STATE = 1024, - + /** Editing the property prompts the user for restarting the editor. */ PROPERTY_USAGE_RESTART_IF_CHANGED = 2048, - + /** The property is a script variable which should be serialized and saved in the scene file. */ PROPERTY_USAGE_SCRIPT_VARIABLE = 4096, - + /** The property value of type [Object] will be stored even if its value is `null`. */ PROPERTY_USAGE_STORE_IF_NULL = 8192, - + /** If this property is modified, all inspector fields will be refreshed. */ PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED = 16384, - - /** Signifies a default value from a placeholder script instance. - * *Deprecated.* This hint is not used anywhere and will be removed in the future. + + /** Signifies a default value from a placeholder script instance. + * *Deprecated.* This hint is not used anywhere and will be removed in the future. */ PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE = 32768, - + /** The property is an enum, i.e. it only takes named integer constants from its associated enumeration. */ PROPERTY_USAGE_CLASS_IS_ENUM = 65536, - + /** If property has `nil` as default value, its type will be [Variant]. */ PROPERTY_USAGE_NIL_IS_VARIANT = 131072, - + /** The property is an array. */ PROPERTY_USAGE_ARRAY = 262144, - + /** When duplicating a resource with [method Resource.duplicate], and this flag is set on a property of that resource, the property should always be duplicated, regardless of the `subresources` bool parameter. */ PROPERTY_USAGE_ALWAYS_DUPLICATE = 524288, - + /** When duplicating a resource with [method Resource.duplicate], and this flag is set on a property of that resource, the property should never be duplicated, regardless of the `subresources` bool parameter. */ PROPERTY_USAGE_NEVER_DUPLICATE = 1048576, - + /** The property is only shown in the editor if modern renderers are supported (the Compatibility rendering method is excluded). */ PROPERTY_USAGE_HIGH_END_GFX = 2097152, - + /** The [NodePath] property will always be relative to the scene's root. Mostly useful for local resources. */ PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT = 4194304, - + /** Use when a resource is created on the fly, i.e. the getter will always return a different instance. [ResourceSaver] needs this information to properly save such resources. */ PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT = 8388608, - + /** Inserting an animation key frame of this property will automatically increment the value, allowing to easily keyframe multiple values in a row. */ PROPERTY_USAGE_KEYING_INCREMENTS = 16777216, - - /** When loading, the resource for this property can be set at the end of loading. - * *Deprecated.* This hint is not used anywhere and will be removed in the future. + + /** When loading, the resource for this property can be set at the end of loading. + * *Deprecated.* This hint is not used anywhere and will be removed in the future. */ PROPERTY_USAGE_DEFERRED_SET_RESOURCE = 33554432, - + /** When this property is a [Resource] and base object is a [Node], a resource instance will be automatically created whenever the node is created in the editor. */ PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT = 67108864, - + /** The property is considered a basic setting and will appear even when advanced mode is disabled. Used for project settings. */ PROPERTY_USAGE_EDITOR_BASIC_SETTING = 134217728, - + /** The property is read-only in the [EditorInspector]. */ PROPERTY_USAGE_READ_ONLY = 268435456, - + /** An export preset property with this flag contains confidential information and is stored separately from the rest of the export preset configuration. */ PROPERTY_USAGE_SECRET = 536870912, - + /** Default usage (storage and editor). */ PROPERTY_USAGE_DEFAULT = 6, - + /** Default usage but without showing the property in the editor (storage). */ PROPERTY_USAGE_NO_EDITOR = 2, } @@ -326,10 +336,707 @@ declare module "godot" { } } - class Callable implements AnyCallable { + class Callable { + is_null(): boolean + is_custom(): boolean + is_standard(): boolean + is_valid(): boolean + get_object() + get_object_id(): int64 + get_method(): StringName + get_bound_arguments_count(): int64 + get_bound_arguments() + hash(): int64 + bind(...vargargs: any[]): AnyCallable + bindv(arguments_: GArray): AnyCallable + unbind(argcount: int64): AnyCallable + call: T; + callv(arguments_: GArray) + call_deferred(...vargargs: any[]): void static create(variant: any, method: StringName): AnyCallable + }`` + + /** + * GArray elements are exposed with a subset of JavaScript's standard Array API. Array indexes are exposed as + * enumerable properties, thus if you want to perform more complex operations you can convert to a regular + * JavaScript array with [...g_array.proxy()]. + */ + class GArrayProxy { + [Symbol.iterator](): IteratorObject>; + /** + * Gets the length of the array. This is a number one higher than the highest index in the array. + */ + get length(): number; + /** + * Performs the specified action for each element in an array. + * @param callback A function that accepts up to three arguments. forEach calls the callback function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used as the this value. + */ + forEach>(callback: (this: GArrayProxy, value: GProxyValueWrap, index: number) => void, thisArg?: S): void; + /** + * Removes the last element from an array and returns it. + * If the array is empty, undefined is returned and the array is not modified. + */ + pop(): T | undefined; + /** + * Appends new elements to the end of an array, and returns the new length of the array. + * @param items New elements to add to the array. + */ + push(...items: Array>): number; + /** + * Returns the index of the first occurrence of a value in an array, or -1 if it is not present. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + */ + includes(searchElement: T): boolean; + toJSON(key?: any): any; + toString(): string; + [n: number]: T | GProxyValueWrap; // More accurate get type blocked by https://github.com/microsoft/TypeScript/issues/43826 + } + + // Ideally this would be a class, but TS currently doesn't provide a way to type a class with mapped properties. + /** + * GObject entries are exposed as enumerable properties, so Object.keys(), Object.entries() etc. will work. + */ + type GDictionaryProxy = { + [K in keyof T]: T[K] | GProxyValueWrap; // More accurate get type blocked by https://github.com/microsoft/TypeScript/issues/43826 + }; + + type GProxyValueWrap = V extends GArray + ? GArrayProxy + : V extends GDictionary + ? GDictionaryProxy + : V; + + /** + * Semi-workaround for https://github.com/microsoft/TypeScript/issues/43826. + * @see GReadProxyValueWrap + */ + type GArrayReadProxy = Omit, 'forEach'> & { + [Symbol.iterator](): IteratorObject>; + forEach>(callback: (this: GArrayReadProxy, value: GReadProxyValueWrap, index: number) => void, thisArg?: S): void; + [n: number]: GReadProxyValueWrap; + } + + /** + * Semi-workaround for https://github.com/microsoft/TypeScript/issues/43826. + * @see GReadProxyValueWrap + */ + type GDictionaryReadProxy = { + [K in keyof T]: GReadProxyValueWrap; + }; + + // At runtime we only have the one kind of dictionary proxy and one kind of array proxy. The read interfaces have + // indexers typed correctly for access i.e. return proxied types. The non-read interfaces have indexers accurate for + // assignment and will accept both GArray/GDictionary and proxies. The read interfaces exist for convenience only, + // you can safely cast between the two interfaces types as desired. + type GReadProxyValueWrap = V extends GArray + ? GArrayReadProxy + : V extends GDictionary + ? GDictionaryReadProxy + : V; + + class Signal void = (...args: any[]) => void> { + constructor() + constructor(from: Signal) + constructor(object: GObject, signal: StringName) + isNull(): boolean + getObject(): GObject + getObjectId(): int64 + getName(): StringName + + /** Connects this signal to the specified [param callable]. Optional [param flags] can be also added to configure the connection's behavior (see [enum Object.ConnectFlags] constants). You can provide additional arguments to the connected [param callable] by using [method Callable.bind]. + * A signal can only be connected once to the same [Callable]. If the signal is already connected, returns [constant ERR_INVALID_PARAMETER] and pushes an error message, unless the signal is connected with [constant Object.CONNECT_REFERENCE_COUNTED]. To prevent this, use [method is_connected] first to check for existing connections. + * + */ + connect(callable: Callable, flags: int64 = 0): int64 + + /** Disconnects this signal from the specified [Callable]. If the connection does not exist, generates an error. Use [method is_connected] to make sure that the connection exists. */ + disconnect(callable: Callable): void + isConnected(callable: Callable): boolean + getConnections(): GArray + hasConnections(): boolean + + /** Emits this signal. All [Callable]s connected to this signal will be triggered. This method supports a variable number of arguments, so parameters can be passed as a comma separated list. */ + emit: T + static EQUAL(left: Signal, right: Signal): boolean + static NOT_EQUAL(left: Signal, right: Signal): boolean } - static function type_string(type: int64): string; - static function str(o: any): string; + function type_string(type: int64): string; + function str(o: any): string; + + class NodePath { + } + + class Object { + /** Notification received when the object is initialized, before its script is attached. Used internally. */ + static readonly NOTIFICATION_POSTINITIALIZE = 0 + + /** Notification received when the object is about to be deleted. Can be used like destructors in object-oriented programming languages. */ + static readonly NOTIFICATION_PREDELETE = 1 + + /** Notification received when the object finishes hot reloading. This notification is only sent for extensions classes and derived. */ + static readonly NOTIFICATION_EXTENSION_RELOADED = 2 + constructor(identifier?: any) + + /** Deletes the object from memory. Pre-existing references to the object become invalid, and any attempt to access them will result in a run-time error. Checking the references with [method @GlobalScope.is_instance_valid] will return `false`. */ + /* gdvirtual */ free(): void + + /** Called when the object's script is instantiated, oftentimes after the object is initialized in memory (through `Object.new()` in GDScript, or `new GodotObject` in C#). It can be also defined to take in parameters. This method is similar to a constructor in most programming languages. + * + * **Note:** If [method _init] is defined with *required* parameters, the Object with script may only be created directly. If any other means (such as [method PackedScene.instantiate] or [method Node.duplicate]) are used, the script's initialization will fail. + */ + /* gdvirtual */ _init(): void + + /** Override this method to customize the return value of [method to_string], and therefore the object's representation as a [String]. + * + */ + /* gdvirtual */ _to_string(): string + + /** Called when the object receives a notification, which can be identified in [param what] by comparing it with a constant. See also [method notification]. + * + * + * **Note:** The base [Object] defines a few notifications ([constant NOTIFICATION_POSTINITIALIZE] and [constant NOTIFICATION_PREDELETE]). Inheriting classes such as [Node] define a lot more notifications, which are also received by this method. + */ + /* gdvirtual */ _notification(what: int64): void + + /** Override this method to customize the behavior of [method set]. Should set the [param property] to [param value] and return `true`, or `false` if the [param property] should be handled normally. The *exact* way to set the [param property] is up to this method's implementation. + * Combined with [method _get] and [method _get_property_list], this method allows defining custom properties, which is particularly useful for editor plugins. Note that a property *must* be present in [method get_property_list], otherwise this method will not be called. + * + */ + /* gdvirtual */ _set(property: StringName, value: any): boolean + + /** Override this method to customize the behavior of [method get]. Should return the given [param property]'s value, or `null` if the [param property] should be handled normally. + * Combined with [method _set] and [method _get_property_list], this method allows defining custom properties, which is particularly useful for editor plugins. Note that a property must be present in [method get_property_list], otherwise this method will not be called. + * + */ + /* gdvirtual */ _get(property: StringName): any + + /** Override this method to provide a custom list of additional properties to handle by the engine. + * Should return a property list, as an [Array] of dictionaries. The result is added to the array of [method get_property_list], and should be formatted in the same way. Each [Dictionary] must at least contain the `name` and `type` entries. + * You can use [method _property_can_revert] and [method _property_get_revert] to customize the default values of the properties added by this method. + * The example below displays a list of numbers shown as words going from `ZERO` to `FIVE`, with `number_count` controlling the size of the list: + * + * + * **Note:** This method is intended for advanced purposes. For most common use cases, the scripting languages offer easier ways to handle properties. See [annotation @GDScript.@export], [annotation @GDScript.@export_enum], [annotation @GDScript.@export_group], etc. If you want to customize exported properties, use [method _validate_property]. + * + * **Note:** If the object's script is not [annotation @GDScript.@tool], this method will not be called in the editor. + */ + /* gdvirtual */ _get_property_list(): GArray + + /** Override this method to customize existing properties. Every property info goes through this method, except properties added with [method _get_property_list]. The dictionary contents is the same as in [method _get_property_list]. + * + */ + /* gdvirtual */ _validate_property(property: GDictionary): void + + /** Override this method to customize the given [param property]'s revert behavior. Should return `true` if the [param property] has a custom default value and is revertible in the Inspector dock. Use [method _property_get_revert] to specify the [param property]'s default value. + * + * **Note:** This method must return consistently, regardless of the current value of the [param property]. + */ + /* gdvirtual */ _property_can_revert(property: StringName): boolean + + /** Override this method to customize the given [param property]'s revert behavior. Should return the default value for the [param property]. If the default value differs from the [param property]'s current value, a revert icon is displayed in the Inspector dock. + * + * **Note:** [method _property_can_revert] must also be overridden for this method to be called. + */ + /* gdvirtual */ _property_get_revert(property: StringName): any + + /** Initializes the iterator. [param iter] stores the iteration state. Since GDScript does not support passing arguments by reference, a single-element array is used as a wrapper. Returns `true` so long as the iterator has not reached the end. + * Example: + * + * + * **Note:** Alternatively, you can ignore [param iter] and use the object's state instead, see [url=https://docs.godotengine.org/en/latest/tutorials/scripting/gdscript/gdscript_advanced.html#custom-iterators]online docs[/url] for an example. Note that in this case you will not be able to reuse the same iterator instance in nested loops. Also, make sure you reset the iterator state in this method if you want to reuse the same instance multiple times. + */ + /* gdvirtual */ _iter_init(iter: GArray): boolean + + /** Moves the iterator to the next iteration. [param iter] stores the iteration state. Since GDScript does not support passing arguments by reference, a single-element array is used as a wrapper. Returns `true` so long as the iterator has not reached the end. */ + /* gdvirtual */ _iter_next(iter: GArray): boolean + + /** Returns the current iterable value. [param iter] stores the iteration state, but unlike [method _iter_init] and [method _iter_next] the state is supposed to be read-only, so there is no [Array] wrapper. */ + /* gdvirtual */ _iter_get(iter: any): any + + /** Returns the object's built-in class name, as a [String]. See also [method is_class]. + * + * **Note:** This method ignores `class_name` declarations. If this object's script has defined a `class_name`, the base, built-in class name is returned instead. + */ + get_class(): string + + /** Returns `true` if the object inherits from the given [param class]. See also [method get_class]. + * + * + * **Note:** This method ignores `class_name` declarations in the object's script. + */ + is_class(class_: string): boolean + + /** Assigns [param value] to the given [param property]. If the property does not exist or the given [param value]'s type doesn't match, nothing happens. + * + * + * **Note:** In C#, [param property] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the `PropertyName` class to avoid allocating a new [StringName] on each call. + */ + set(property: StringName, value: any): void + + /** Returns the [Variant] value of the given [param property]. If the [param property] does not exist, this method returns `null`. + * + * + * **Note:** In C#, [param property] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the `PropertyName` class to avoid allocating a new [StringName] on each call. + */ + get(property: StringName): any + + /** Assigns a new [param value] to the property identified by the [param property_path]. The path should be a [NodePath] relative to this object, and can use the colon character (`:`) to access nested properties. + * + * + * **Note:** In C#, [param property_path] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the `PropertyName` class to avoid allocating a new [StringName] on each call. + */ + set_indexed(property_path: NodePath | string, value: any): void + + /** Gets the object's property indexed by the given [param property_path]. The path should be a [NodePath] relative to the current object and can use the colon character (`:`) to access nested properties. + * **Examples:** `"position:x"` or `"material:next_pass:blend_mode"`. + * + * + * **Note:** In C#, [param property_path] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the `PropertyName` class to avoid allocating a new [StringName] on each call. + * + * **Note:** This method does not support actual paths to nodes in the [SceneTree], only sub-property paths. In the context of nodes, use [method Node.get_node_and_resource] instead. + */ + get_indexed(property_path: NodePath | string): any + + /** Returns the object's property list as an [Array] of dictionaries. Each [Dictionary] contains the following entries: + * - `name` is the property's name, as a [String]; + * - `class_name` is an empty [StringName], unless the property is [constant TYPE_OBJECT] and it inherits from a class; + * - `type` is the property's type, as an [int] (see [enum Variant.Type]); + * - `hint` is *how* the property is meant to be edited (see [enum PropertyHint]); + * - `hint_string` depends on the hint (see [enum PropertyHint]); + * - `usage` is a combination of [enum PropertyUsageFlags]. + * + * **Note:** In GDScript, all class members are treated as properties. In C# and GDExtension, it may be necessary to explicitly mark class members as Godot properties using decorators or attributes. + */ + get_property_list(): GArray + + /** Returns this object's methods and their signatures as an [Array] of dictionaries. Each [Dictionary] contains the following entries: + * - `name` is the name of the method, as a [String]; + * - `args` is an [Array] of dictionaries representing the arguments; + * - `default_args` is the default arguments as an [Array] of variants; + * - `flags` is a combination of [enum MethodFlags]; + * - `id` is the method's internal identifier [int]; + * - `return` is the returned value, as a [Dictionary]; + * + * **Note:** The dictionaries of `args` and `return` are formatted identically to the results of [method get_property_list], although not all entries are used. + */ + get_method_list(): GArray + + /** Returns `true` if the given [param property] has a custom default value. Use [method property_get_revert] to get the [param property]'s default value. + * + * **Note:** This method is used by the Inspector dock to display a revert icon. The object must implement [method _property_can_revert] to customize the default value. If [method _property_can_revert] is not implemented, this method returns `false`. + */ + property_can_revert(property: StringName): boolean + + /** Returns the custom default value of the given [param property]. Use [method property_can_revert] to check if the [param property] has a custom default value. + * + * **Note:** This method is used by the Inspector dock to display a revert icon. The object must implement [method _property_get_revert] to customize the default value. If [method _property_get_revert] is not implemented, this method returns `null`. + */ + property_get_revert(property: StringName): any + + /** Sends the given [param what] notification to all classes inherited by the object, triggering calls to [method _notification], starting from the highest ancestor (the [Object] class) and going down to the object's script. + * If [param reversed] is `true`, the call order is reversed. + * + */ + notification(what: int64, reversed?: boolean): void + + /** Returns a [String] representing the object. Defaults to `""`. Override [method _to_string] to customize the string representation of the object. */ + to_string(): string + + /** Returns the object's unique instance ID. This ID can be saved in [EncodedObjectAsID], and can be used to retrieve this object instance with [method @GlobalScope.instance_from_id]. + * + * **Note:** This ID is only useful during the current session. It won't correspond to a similar object if the ID is sent over a network, or loaded from a file at a later time. + */ + get_instance_id(): int64 + + /** Attaches [param script] to the object, and instantiates it. As a result, the script's [method _init] is called. A [Script] is used to extend the object's functionality. + * If a script already exists, its instance is detached, and its property values and state are lost. Built-in property values are still kept. + */ + set_script(script: any): void + + /** Returns the object's [Script] instance, or `null` if no script is attached. */ + get_script(): any + + /** Adds or changes the entry [param name] inside the object's metadata. The metadata [param value] can be any [Variant], although some types cannot be serialized correctly. + * If [param value] is `null`, the entry is removed. This is the equivalent of using [method remove_meta]. See also [method has_meta] and [method get_meta]. + * + * **Note:** A metadata's name must be a valid identifier as per [method StringName.is_valid_identifier] method. + * + * **Note:** Metadata that has a name starting with an underscore (`_`) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method. + */ + set_meta(name: StringName, value: any): void + + /** Removes the given entry [param name] from the object's metadata. See also [method has_meta], [method get_meta] and [method set_meta]. + * + * **Note:** A metadata's name must be a valid identifier as per [method StringName.is_valid_identifier] method. + * + * **Note:** Metadata that has a name starting with an underscore (`_`) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method. + */ + remove_meta(name: StringName): void + + /** Returns the object's metadata value for the given entry [param name]. If the entry does not exist, returns [param default]. If [param default] is `null`, an error is also generated. + * + * **Note:** A metadata's name must be a valid identifier as per [method StringName.is_valid_identifier] method. + * + * **Note:** Metadata that has a name starting with an underscore (`_`) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method. + */ + get_meta(name: StringName, default_?: any): any + + /** Returns `true` if a metadata entry is found with the given [param name]. See also [method get_meta], [method set_meta] and [method remove_meta]. + * + * **Note:** A metadata's name must be a valid identifier as per [method StringName.is_valid_identifier] method. + * + * **Note:** Metadata that has a name starting with an underscore (`_`) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method. + */ + has_meta(name: StringName): boolean + + /** Returns the object's metadata entry names as an [Array] of [StringName]s. */ + get_meta_list(): GArray + + /** Adds a user-defined signal named [param signal]. Optional arguments for the signal can be added as an [Array] of dictionaries, each defining a `name` [String] and a `type` [int] (see [enum Variant.Type]). See also [method has_user_signal] and [method remove_user_signal]. + * + */ + add_user_signal(signal: string, arguments_?: GArray): void + + /** Returns `true` if the given user-defined [param signal] name exists. Only signals added with [method add_user_signal] are included. See also [method remove_user_signal]. */ + has_user_signal(signal: StringName): boolean + + /** Removes the given user signal [param signal] from the object. See also [method add_user_signal] and [method has_user_signal]. */ + remove_user_signal(signal: StringName): void + + /** Emits the given [param signal] by name. The signal must exist, so it should be a built-in signal of this class or one of its inherited classes, or a user-defined signal (see [method add_user_signal]). This method supports a variable number of arguments, so parameters can be passed as a comma separated list. + * Returns [constant ERR_UNAVAILABLE] if [param signal] does not exist or the parameters are invalid. + * + * + * **Note:** In C#, [param signal] must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the `SignalName` class to avoid allocating a new [StringName] on each call. + */ + emit_signal(signal: StringName, ...vargargs: any[]): Error + + /** Calls the [param method] on the object and returns the result. This method supports a variable number of arguments, so parameters can be passed as a comma separated list. + * + * + * **Note:** In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the `MethodName` class to avoid allocating a new [StringName] on each call. + */ + call(method: StringName, ...vargargs: any[]): any + + /** Calls the [param method] on the object during idle time. Always returns `null`, **not** the method's result. + * Idle time happens mainly at the end of process and physics frames. In it, deferred calls will be run until there are none left, which means you can defer calls from other deferred calls and they'll still be run in the current idle time cycle. This means you should not call a method deferred from itself (or from a method called by it), as this causes infinite recursion the same way as if you had called the method directly. + * This method supports a variable number of arguments, so parameters can be passed as a comma separated list. + * + * See also [method Callable.call_deferred]. + * + * **Note:** In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the `MethodName` class to avoid allocating a new [StringName] on each call. + * + * **Note:** If you're looking to delay the function call by a frame, refer to the [signal SceneTree.process_frame] and [signal SceneTree.physics_frame] signals. + * + */ + call_deferred(method: StringName, ...vargargs: any[]): any + + /** Assigns [param value] to the given [param property], at the end of the current frame. This is equivalent to calling [method set] through [method call_deferred]. + * + * + * **Note:** In C#, [param property] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the `PropertyName` class to avoid allocating a new [StringName] on each call. + */ + set_deferred(property: StringName, value: any): void + + /** Calls the [param method] on the object and returns the result. Unlike [method call], this method expects all parameters to be contained inside [param arg_array]. + * + * + * **Note:** In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the `MethodName` class to avoid allocating a new [StringName] on each call. + */ + callv(method: StringName, arg_array: GArray): any + + /** Returns `true` if the given [param method] name exists in the object. + * + * **Note:** In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the `MethodName` class to avoid allocating a new [StringName] on each call. + */ + has_method(method: StringName): boolean + + /** Returns the number of arguments of the given [param method] by name. + * + * **Note:** In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the `MethodName` class to avoid allocating a new [StringName] on each call. + */ + get_method_argument_count(method: StringName): int64 + + /** Returns `true` if the given [param signal] name exists in the object. + * + * **Note:** In C#, [param signal] must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the `SignalName` class to avoid allocating a new [StringName] on each call. + */ + has_signal(signal: StringName): boolean + + /** Returns the list of existing signals as an [Array] of dictionaries. + * + * **Note:** Due of the implementation, each [Dictionary] is formatted very similarly to the returned values of [method get_method_list]. + */ + get_signal_list(): GArray + + /** Returns an [Array] of connections for the given [param signal] name. Each connection is represented as a [Dictionary] that contains three entries: + * - [code skip-lint]signal` is a reference to the [Signal]; + * - `callable` is a reference to the connected [Callable]; + * - `flags` is a combination of [enum ConnectFlags]. + */ + get_signal_connection_list(signal: StringName): GArray + + /** Returns an [Array] of signal connections received by this object. Each connection is represented as a [Dictionary] that contains three entries: + * - `signal` is a reference to the [Signal]; + * - `callable` is a reference to the [Callable]; + * - `flags` is a combination of [enum ConnectFlags]. + */ + get_incoming_connections(): GArray + + /** Connects a [param signal] by name to a [param callable]. Optional [param flags] can be also added to configure the connection's behavior (see [enum ConnectFlags] constants). + * A signal can only be connected once to the same [Callable]. If the signal is already connected, this method returns [constant ERR_INVALID_PARAMETER] and pushes an error message, unless the signal is connected with [constant CONNECT_REFERENCE_COUNTED]. To prevent this, use [method is_connected] first to check for existing connections. + * If the [param callable]'s object is freed, the connection will be lost. + * **Examples with recommended syntax:** + * Connecting signals is one of the most common operations in Godot and the API gives many options to do so, which are described further down. The code block below shows the recommended approach. + * + * **[code skip-lint]Object.connect()` or [code skip-lint]Signal.connect()`?** + * As seen above, the recommended method to connect signals is not [method Object.connect]. The code block below shows the four options for connecting signals, using either this legacy method or the recommended [method Signal.connect], and using either an implicit [Callable] or a manually defined one. + * + * While all options have the same outcome (`button`'s [signal BaseButton.button_down] signal will be connected to `_on_button_down`), **option 3** offers the best validation: it will print a compile-time error if either the `button_down` [Signal] or the `_on_button_down` [Callable] are not defined. On the other hand, **option 2** only relies on string names and will only be able to validate either names at runtime: it will print a runtime error if `"button_down"` doesn't correspond to a signal, or if `"_on_button_down"` is not a registered method in the object `self`. The main reason for using options 1, 2, or 4 would be if you actually need to use strings (e.g. to connect signals programmatically based on strings read from a configuration file). Otherwise, option 3 is the recommended (and fastest) method. + * **Binding and passing parameters:** + * The syntax to bind parameters is through [method Callable.bind], which returns a copy of the [Callable] with its parameters bound. + * When calling [method emit_signal] or [method Signal.emit], the signal parameters can be also passed. The examples below show the relationship between these signal parameters and bound parameters. + * + */ + connect(signal: StringName, callable: Callable, flags?: int64): Error + + /** Disconnects a [param signal] by name from a given [param callable]. If the connection does not exist, generates an error. Use [method is_connected] to make sure that the connection exists. */ + disconnect(signal: StringName, callable: Callable): void + + /** Returns `true` if a connection exists between the given [param signal] name and [param callable]. + * + * **Note:** In C#, [param signal] must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the `SignalName` class to avoid allocating a new [StringName] on each call. + */ + is_connected(signal: StringName, callable: Callable): boolean + + /** Returns `true` if any connection exists on the given [param signal] name. + * + * **Note:** In C#, [param signal] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the `SignalName` class to avoid allocating a new [StringName] on each call. + */ + has_connections(signal: StringName): boolean + + /** If set to `true`, the object becomes unable to emit signals. As such, [method emit_signal] and signal connections will not work, until it is set to `false`. */ + set_block_signals(enable: boolean): void + + /** Returns `true` if the object is blocking its signals from being emitted. See [method set_block_signals]. */ + is_blocking_signals(): boolean + + /** Emits the [signal property_list_changed] signal. This is mainly used to refresh the editor, so that the Inspector and editor plugins are properly updated. */ + notify_property_list_changed(): void + + /** If set to `true`, allows the object to translate messages with [method tr] and [method tr_n]. Enabled by default. See also [method can_translate_messages]. */ + set_message_translation(enable: boolean): void + + /** Returns `true` if the object is allowed to translate messages with [method tr] and [method tr_n]. See also [method set_message_translation]. */ + can_translate_messages(): boolean + + /** Translates a [param message], using the translation catalogs configured in the Project Settings. Further [param context] can be specified to help with the translation. Note that most [Control] nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text. + * If [method can_translate_messages] is `false`, or no translation is available, this method returns the [param message] without changes. See [method set_message_translation]. + * For detailed examples, see [url=https://docs.godotengine.org/en/latest/tutorials/i18n/internationalizing_games.html]Internationalizing games[/url]. + * + * **Note:** This method can't be used without an [Object] instance, as it requires the [method can_translate_messages] method. To translate strings in a static context, use [method TranslationServer.translate]. + */ + tr(message: StringName, context?: StringName): string + + /** Translates a [param message] or [param plural_message], using the translation catalogs configured in the Project Settings. Further [param context] can be specified to help with the translation. + * If [method can_translate_messages] is `false`, or no translation is available, this method returns [param message] or [param plural_message], without changes. See [method set_message_translation]. + * The [param n] is the number, or amount, of the message's subject. It is used by the translation system to fetch the correct plural form for the current language. + * For detailed examples, see [url=https://docs.godotengine.org/en/latest/tutorials/i18n/localization_using_gettext.html]Localization using gettext[/url]. + * + * **Note:** Negative and [float] numbers may not properly apply to some countable subjects. It's recommended to handle these cases with [method tr]. + * + * **Note:** This method can't be used without an [Object] instance, as it requires the [method can_translate_messages] method. To translate strings in a static context, use [method TranslationServer.translate_plural]. + */ + tr_n(message: StringName, plural_message: StringName, n: int64, context?: StringName): string + + /** Returns the name of the translation domain used by [method tr] and [method tr_n]. See also [TranslationServer]. */ + get_translation_domain(): StringName + + /** Sets the name of the translation domain used by [method tr] and [method tr_n]. See also [TranslationServer]. */ + set_translation_domain(domain: StringName): void + + /** Returns `true` if the [method Node.queue_free] method was called for the object. */ + is_queued_for_deletion(): boolean + + /** If this method is called during [constant NOTIFICATION_PREDELETE], this object will reject being freed and will remain allocated. This is mostly an internal function used for error handling to avoid the user from freeing objects when they are not intended to. */ + cancel_free(): void + + /** Emitted when the object's script is changed. + * + * **Note:** When this signal is emitted, the new script is not initialized yet. If you need to access the new script, defer connections to this signal with [constant CONNECT_DEFERRED]. + */ + readonly script_changed: Signal<() => void> + + /** Emitted when [method notify_property_list_changed] is called. */ + readonly property_list_changed: Signal<() => void> + } + + enum Error { + /** Methods that return [enum Error] return [constant OK] when no error occurred. + * Since [constant OK] has value `0`, and all other error constants are positive integers, it can also be used in boolean checks. + * + * + * **Note:** Many functions do not return an error code, but will print error messages to standard output. + */ + OK = 0, + + /** Generic error. */ + FAILED = 1, + + /** Unavailable error. */ + ERR_UNAVAILABLE = 2, + + /** Unconfigured error. */ + ERR_UNCONFIGURED = 3, + + /** Unauthorized error. */ + ERR_UNAUTHORIZED = 4, + + /** Parameter range error. */ + ERR_PARAMETER_RANGE_ERROR = 5, + + /** Out of memory (OOM) error. */ + ERR_OUT_OF_MEMORY = 6, + + /** File: Not found error. */ + ERR_FILE_NOT_FOUND = 7, + + /** File: Bad drive error. */ + ERR_FILE_BAD_DRIVE = 8, + + /** File: Bad path error. */ + ERR_FILE_BAD_PATH = 9, + + /** File: No permission error. */ + ERR_FILE_NO_PERMISSION = 10, + + /** File: Already in use error. */ + ERR_FILE_ALREADY_IN_USE = 11, + + /** File: Can't open error. */ + ERR_FILE_CANT_OPEN = 12, + + /** File: Can't write error. */ + ERR_FILE_CANT_WRITE = 13, + + /** File: Can't read error. */ + ERR_FILE_CANT_READ = 14, + + /** File: Unrecognized error. */ + ERR_FILE_UNRECOGNIZED = 15, + + /** File: Corrupt error. */ + ERR_FILE_CORRUPT = 16, + + /** File: Missing dependencies error. */ + ERR_FILE_MISSING_DEPENDENCIES = 17, + + /** File: End of file (EOF) error. */ + ERR_FILE_EOF = 18, + + /** Can't open error. */ + ERR_CANT_OPEN = 19, + + /** Can't create error. */ + ERR_CANT_CREATE = 20, + + /** Query failed error. */ + ERR_QUERY_FAILED = 21, + + /** Already in use error. */ + ERR_ALREADY_IN_USE = 22, + + /** Locked error. */ + ERR_LOCKED = 23, + + /** Timeout error. */ + ERR_TIMEOUT = 24, + + /** Can't connect error. */ + ERR_CANT_CONNECT = 25, + + /** Can't resolve error. */ + ERR_CANT_RESOLVE = 26, + + /** Connection error. */ + ERR_CONNECTION_ERROR = 27, + + /** Can't acquire resource error. */ + ERR_CANT_ACQUIRE_RESOURCE = 28, + + /** Can't fork process error. */ + ERR_CANT_FORK = 29, + + /** Invalid data error. */ + ERR_INVALID_DATA = 30, + + /** Invalid parameter error. */ + ERR_INVALID_PARAMETER = 31, + + /** Already exists error. */ + ERR_ALREADY_EXISTS = 32, + + /** Does not exist error. */ + ERR_DOES_NOT_EXIST = 33, + + /** Database: Read error. */ + ERR_DATABASE_CANT_READ = 34, + + /** Database: Write error. */ + ERR_DATABASE_CANT_WRITE = 35, + + /** Compilation failed error. */ + ERR_COMPILATION_FAILED = 36, + + /** Method not found error. */ + ERR_METHOD_NOT_FOUND = 37, + + /** Linking failed error. */ + ERR_LINK_FAILED = 38, + + /** Script failed error. */ + ERR_SCRIPT_FAILED = 39, + + /** Cycling link (import cycle) error. */ + ERR_CYCLIC_LINK = 40, + + /** Invalid declaration error. */ + ERR_INVALID_DECLARATION = 41, + + /** Duplicate symbol error. */ + ERR_DUPLICATE_SYMBOL = 42, + + /** Parse error. */ + ERR_PARSE_ERROR = 43, + + /** Busy error. */ + ERR_BUSY = 44, + + /** Skip error. */ + ERR_SKIP = 45, + + /** Help error. Used internally when passing `--version` or `--help` as executable options. */ + ERR_HELP = 46, + + /** Bug error, caused by an implementation issue in the method. + * + * **Note:** If a built-in method returns this code, please open an issue on [url=https://github.com/godotengine/godot/issues]the GitHub Issue Tracker[/url]. + */ + ERR_BUG = 47, + + /** Printer on fire error (This is an easter egg, no built-in methods return this error code). */ + ERR_PRINTER_ON_FIRE = 48, + } + + class DirAccess { + static make_dir_recursive_absolute(path: string): Error; + } } diff --git a/scripts/typings/godot.minimal.d.ts b/scripts/typings/godot.minimal.d.ts index 1ff5f719..47d648f9 100644 --- a/scripts/typings/godot.minimal.d.ts +++ b/scripts/typings/godot.minimal.d.ts @@ -1,6 +1,18 @@ - +/// declare module "godot-jsb" { - import { Object as GDObject, PackedByteArray, PropertyUsageFlags, PropertyHint, MethodFlags, Variant, Callable0, Callable1, Callable2, Callable3, Callable4, Callable5, StringName, MultiplayerAPI, MultiplayerPeer } from "godot"; + import { + Callable, + MethodFlags, + MultiplayerAPI, + MultiplayerPeer, + Object as GDObject, + PackedByteArray, + PropertyInfo, + StringName, + Variant, + } from "godot"; + + const CAMEL_CASE_BINDINGS_ENABLED: boolean; const DEV_ENABLED: boolean; const TOOLS_ENABLED: boolean; @@ -11,71 +23,21 @@ declare module "godot-jsb" { /** impl currently used */ const impl: string; - /** - * Create godot Callable with a bound object `self`. - * @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead. - */ - function callable(self: GDObject, fn: () => R): Callable0; - /** - * Create godot Callable with a bound object `self`. - * @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead. - */ - function callable(self: GDObject, fn: (v1: T1) => R): Callable1; - /** - * Create godot Callable with a bound object `self`. - * @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead. - */ - function callable(self: GDObject, fn: (v1: T1, v2: T2) => R): Callable2; - /** - * Create godot Callable with a bound object `self`. - * @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead. - */ - function callable(self: GDObject, fn: (v1: T1, v2: T2, v3: T3) => R): Callable3; - /** - * Create godot Callable with a bound object `self`. - * @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead. - */ - function callable(self: GDObject, fn: (v1: T1, v2: T2, v3: T3, v4: T4) => R): Callable4; - /** - * Create godot Callable with a bound object `self`. - * @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead. - */ - function callable(self: GDObject, fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => R): Callable5; - - /** - * Create godot Callable without a bound object. - * @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead. - */ - function callable(fn: () => R): Callable0; - /** - * Create godot Callable without a bound object. - * @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead. - */ - function callable(fn: (v1: T1) => R): Callable1; - /** - * Create godot Callable without a bound object. - * @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead. - */ - function callable(fn: (v1: T1, v2: T2) => R): Callable2; - /** - * Create godot Callable without a bound object. - * @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead. - */ - function callable(fn: (v1: T1, v2: T2, v3: T3) => R): Callable3; /** * Create godot Callable without a bound object. * @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead. */ - function callable(fn: (v1: T1, v2: T2, v3: T3, v4: T4) => R): Callable4; + function callable(fn: F): Callable; + /** - * Create godot Callable without a bound object. + * Create godot Callable with a bound object `self`. * @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead. */ - function callable(fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => R): Callable5; + function callable any>(self: S, fn: F): Callable; /** - * Explicitly convert a `PackedByteArray`(aka `Vector`) into a javascript `ArrayBuffer` - * @deprecated [WARNING] This free function '_to_array_buffer' is deprecated and will be removed in a future version, use 'PackedByteArray.to_array_buffer()' instead. + * Explicitly convert a `PackedByteArray`(aka `Vector`) into a javascript `ArrayBuffer` + * @deprecated [WARNING] This free function '_to_array_buffer' is deprecated and will be removed in a future version, use 'PackedByteArray.to_array_buffer()' instead. */ function to_array_buffer(packed: PackedByteArray): ArrayBuffer; @@ -92,10 +54,10 @@ declare module "godot-jsb" { type OnReadyEvaluatorFunc = (self: any) => any; interface RPCConfig { - mode?: MultiplayerAPI.RPCMode, - sync?: boolean, - transfer_mode?: MultiplayerPeer.TransferMode, - transfer_channel?: number, + mode?: MultiplayerAPI.RPCMode, + sync?: boolean, + transfer_mode?: MultiplayerPeer.TransferMode, + transfer_channel?: number, } function add_script_signal(target: any, name: string): void; @@ -106,7 +68,7 @@ declare module "godot-jsb" { function add_script_rpc(target: any, propertyKey: string, config: RPCConfig): void; // 0: deprecated, 1: experimental, 2: help - function set_script_doc(target: any, propertyKey?: string, field: 0 | 1 | 2, message: string): void; + function set_script_doc(target: any, propertyKey: undefined | string, field: 0 | 1 | 2, message: string): void; function add_module(id: string, obj: any): void; function find_module(id: string): any; @@ -132,8 +94,7 @@ declare module "godot-jsb" { interface EnumInfo { name: string; - - literals: Array; + literals: Record; is_bitfield: boolean; } @@ -159,15 +120,6 @@ declare module "godot-jsb" { return_: PropertyInfo | undefined; } - interface PropertyInfo { - name: string; - type: Variant.Type; - class_name: string; - hint: PropertyHint; - hint_string: string; - usage: PropertyUsageFlags; - } - interface PropertySetGetInfo { name: string; @@ -213,6 +165,7 @@ declare module "godot-jsb" { // godot class interface ClassInfo extends BasicClassInfo { + internal_name: string; super: string; properties: Array; diff --git a/scripts/typings/godot.mix.d.ts b/scripts/typings/godot.mix.d.ts index 9d8e1bab..d68d7895 100644 --- a/scripts/typings/godot.mix.d.ts +++ b/scripts/typings/godot.mix.d.ts @@ -1,190 +1,91 @@ -/// +/// declare module "godot" { export const IntegerType: unique symbol; export const FloatType: unique symbol; - /** A built-in type representing a method or a standalone function. - * - * @link https://docs.godotengine.org/en/4.2/classes/class_callable.html + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] Use Callable/Callable. */ - interface AnyCallable { - /** Returns `true` if this [Callable] has no target to call the method on. */ - is_null(): boolean - - /** Returns `true` if this [Callable] is a custom callable. Custom callables are created from [method bind] or [method unbind]. In GDScript, lambda functions are also custom callables. */ - is_custom(): boolean - - /** Returns `true` if this [Callable] is a standard callable. This method is the opposite of [method is_custom]. Returns `false` if this callable is a lambda function. */ - is_standard(): boolean - - /** Returns `true` if the callable's object exists and has a valid method name assigned, or is a custom callable. */ - is_valid(): boolean - - /** Returns the object on which this [Callable] is called. */ - get_object(): Object - - /** Returns the ID of this [Callable]'s object (see [method Object.get_instance_id]). */ - get_object_id(): int64 - - /** Returns the name of the method represented by this [Callable]. If the callable is a GDScript lambda function, returns the function's name or `""`. */ - get_method(): StringName - - /** Returns the total amount of arguments bound (or unbound) via successive [method bind] or [method unbind] calls. If the amount of arguments unbound is greater than the ones bound, this function returns a value less than zero. */ - get_bound_arguments_count(): int64 - - /** Return the bound arguments (as long as [method get_bound_arguments_count] is greater than zero), or empty (if [method get_bound_arguments_count] is less than or equal to zero). */ - get_bound_arguments(): Array - - /** Returns the 32-bit hash value of this [Callable]'s object. - * - * **Note:** [Callable]s with equal content will always produce identical hash values. However, the reverse is not true. Returning identical hash values does *not* imply the callables are equal, because different callables can have identical hash values due to hash collisions. The engine uses a 32-bit hash algorithm for [method hash]. - */ - hash(): int64 + type AnyCallable = Callable; - /** Returns a copy of this [Callable] with one or more arguments bound. When called, the bound arguments are passed *after* the arguments supplied by [method call]. See also [method unbind]. - * - * **Note:** When this method is chained with other similar methods, the order in which the argument list is modified is read from right to left. - */ - bind(...vargargs: any[]): AnyCallable - - /** Returns a copy of this [Callable] with one or more arguments bound, reading them from an array. When called, the bound arguments are passed *after* the arguments supplied by [method call]. See also [method unbind]. - * - * **Note:** When this method is chained with other similar methods, the order in which the argument list is modified is read from right to left. - */ - bindv(arguments_: GArray): AnyCallable - - /** Returns a copy of this [Callable] with a number of arguments unbound. In other words, when the new callable is called the last few arguments supplied by the user are ignored, according to [param argcount]. The remaining arguments are passed to the callable. This allows to use the original callable in a context that attempts to pass more arguments than this callable can handle, e.g. a signal with a fixed number of arguments. See also [method bind]. - * - * **Note:** When this method is chained with other similar methods, the order in which the argument list is modified is read from right to left. - * - */ - unbind(argcount: int64): AnyCallable - - /** Calls the method represented by this [Callable]. Arguments can be passed and should match the method's signature. */ - call(...vargargs: any[]): any - - /** Calls the method represented by this [Callable]. Unlike [method call], this method expects all arguments to be contained inside the [param arguments] [Array]. */ - callv(arguments_: GArray): any - - /** Calls the method represented by this [Callable] in deferred mode, i.e. at the end of the current frame. Arguments can be passed and should match the method's signature. - * - * - * **Note:** Deferred calls are processed at idle time. Idle time happens mainly at the end of process and physics frames. In it, deferred calls will be run until there are none left, which means you can defer calls from other deferred calls and they'll still be run in the current idle time cycle. This means you should not call a method deferred from itself (or from a method called by it), as this causes infinite recursion the same way as if you had called the method directly. - * See also [method Object.call_deferred]. - */ - call_deferred(...vargargs: any[]): void - } - - /** A built-in type representing a signal of an [Object]. - * - * @link https://docs.godotengine.org/en/4.2/classes/class_signal.html + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] Use Signal/Signal. */ - interface AnySignal { - /** Returns `true` if the signal's name does not exist in its object, or the object is not valid. */ - is_null(): boolean - - /** Returns the object emitting this signal. */ - get_object(): Object - - /** Returns the ID of the object emitting this signal (see [method Object.get_instance_id]). */ - get_object_id(): int64 + type AnySignal = Signal; - /** Returns the name of this signal. */ - get_name(): StringName - - /** Returns `true` if the specified [Callable] is connected to this signal. */ - is_connected(callable: AnyCallable): boolean - - /** Returns an [Array] of connections for this signal. Each connection is represented as a [Dictionary] that contains three entries: - * - `signal` is a reference to this signal; - * - `callable` is a reference to the connected [Callable]; - * - `flags` is a combination of [enum Object.ConnectFlags]. - */ - get_connections(): Array - } - - interface Callable0 extends AnyCallable { - call(): R; - } - - interface Callable1 extends AnyCallable { - call(v1: T1): R; - } - - interface Callable2 extends AnyCallable { - call(v1: T1, v2, T2): R; - } - - interface Callable3 extends AnyCallable { - call(v1: T1, v2: T2, v3: T3): R; - } - - interface Callable4 extends AnyCallable { - call(v1: T1, v2: T2, v3: T3, v4: T4): R; - } - - interface Callable5 extends AnyCallable { - call(v1: T1, v2: T2, v3: T3, v4: T4, v5: T5): R; - } - - interface Signal0 extends AnySignal { - connect(callable: Callable0, flags: int64 = 0): void; - disconnect(callable: Callable0): void; - is_connected(callable: Callable0): boolean; - emit(): void; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] Use Callable. + */ + type Callable0 = Callable<() => R>; - as_promise(): Promise; - } + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] Use Callable. + */ + type Callable1 = Callable<(v1: T1) => R>; - interface Signal1 extends AnySignal { - connect(callable: Callable1, flags: int64 = 0): void; - disconnect(callable: Callable1): void; - is_connected(callable: Callable1): boolean; - emit(v1: T1): void; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] Use Callable. + */ + type Callable2 = Callable<(v1: T1, v2, T2) => R>; - // the first argument is used as the resolved value - as_promise(): Promise; - } + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] Use Callable. + */ + type Callable3 = Callable<(v1: T1, v2: T2, v3: T3) => R>; - interface Signal2 extends AnySignal { - connect(callable: Callable2, flags: int64 = 0): void; - disconnect(callable: Callable2): void; - is_connected(callable: Callable2): boolean; - emit(v1: T1, v2: T2): void; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] Use Callable. + */ + type Callable4 = Callable<(v1: T1, v2: T2, v3: T3, v4: T4) => R>; - // the first argument is used as the resolved value - as_promise(): Promise; - } + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] Use Callable. + */ + type Callable5 = Callable<(v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => R>; - interface Signal3 extends AnySignal { - connect(callable: Callable3, flags: int64 = 0): void; - disconnect(callable: Callable3): void; - is_connected(callable: Callable3): boolean; - emit(v1: T1, v2: T2, v3: T3): void; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] Use Signal. + */ + type Signal0 = Signal<() => void>; - // the first argument is used as the resolved value - as_promise(): Promise; - } + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] Use Signal. + */ + type Signal1 = Signal<(v1: T1) => void>; - interface Signal4 extends AnySignal { - connect(callable: Callable4, flags: int64 = 0): void; - disconnect(callable: Callable4): void; - is_connected(callable: Callable4): boolean; - emit(v1: T1, v2: T2, v3: T3, v4: T4): void; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] Use Signal. + */ + type Signal2 = Signal<(v1: T1, v2, T2) => void>; - // the first argument is used as the resolved value - as_promise(): Promise; - } + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] Use Signal. + */ + type Signal3 = Signal<(v1: T1, v2: T2, v3: T3) => void>; - interface Signal5 extends AnySignal { - connect(callable: Callable5, flags: int64 = 0): void; - disconnect(callable: Callable5): void; - is_connected(callable: Callable5): boolean; - emit(v1: T1, v2: T2, v3: T3, v4: T4, v5: T5): void; + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] Use Signal. + */ + type Signal4 = Signal<(v1: T1, v2: T2, v3: T3, v4: T4) => void>; - // the first argument is used as the resolved value - as_promise(): Promise; - } + /** + * FOR BACKWARD COMPATIBILITY ONLY + * @deprecated [WARNING] Use Signal. + */ + type Signal5 = Signal<(v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => void>; type NodePathMap = { [K in string]?: Node }; @@ -213,27 +114,34 @@ declare module "godot" { * Gets the length of the array. This is a number one higher than the highest index in the array. */ get length(): number; + /** + * Performs the specified action for each element in an array. + * @param callback A function that accepts up to three arguments. forEach calls the callback function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used as the this value. + */ + forEach>(callback: (this: GArrayProxy, value: GProxyValueWrap, index: number) => void, thisArg?: S): void; /** * Removes the last element from an array and returns it. * If the array is empty, undefined is returned and the array is not modified. */ - pop(): T | undefined; + pop(): GProxyValueWrap | undefined; /** * Appends new elements to the end of an array, and returns the new length of the array. - * @param items New elements to add to the array. + * @param item New element to add to the array. + * @param additionalItems Additional new elements to add to the array. */ - push(...items: Array>): number; + push(item: T | GProxyValueWrap, ...additionalItems: Array>): number; /** * Returns the index of the first occurrence of a value in an array, or -1 if it is not present. * @param searchElement The value to locate in the array. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. */ - indexOf(searchElement: T, fromIndex?: number): number; + indexOf(searchElement: T | GProxyValueWrap, fromIndex?: number): number; /** * Determines whether an array includes a certain element, returning true or false as appropriate. * @param searchElement The element to search for. */ - includes(searchElement: T): boolean; + includes(searchElement: T | GProxyValueWrap): boolean; toJSON(key?: any): any; toString(): string; [n: number]: T | GProxyValueWrap; // More accurate get type blocked by https://github.com/microsoft/TypeScript/issues/43826 @@ -244,14 +152,60 @@ declare module "godot" { * GObject entries are exposed as enumerable properties, so Object.keys(), Object.entries() etc. will work. */ type GDictionaryProxy = { - [K in keyof T & string]: T[K] | GProxyValueWrap; // More accurate get type blocked by https://github.com/microsoft/TypeScript/issues/43826 - } & ('toString' extends keyof T ? {} : { - toString(): string; - }); + [K in keyof T]: T[K] | GProxyValueWrap; // More accurate get type blocked by https://github.com/microsoft/TypeScript/issues/43826 + }; type GProxyValueWrap = V extends GArray ? GArrayProxy : V extends GDictionary ? GDictionaryProxy : V; + + type GProxyValueUnwrap = V extends GArray + ? E + : V extends GDictionary + ? T + : V; + + /** + * Semi-workaround for https://github.com/microsoft/TypeScript/issues/43826. + * @see GReadProxyValueWrap + */ + type GArrayReadProxy = Omit, 'forEach'> & { + [Symbol.iterator](): IteratorObject>; + forEach>(callback: (this: GArrayReadProxy, value: GReadProxyValueWrap, index: number) => void, thisArg?: S): void; + [n: number]: GReadProxyValueWrap; + } + + /** + * Semi-workaround for https://github.com/microsoft/TypeScript/issues/43826. + * @see GReadProxyValueWrap + */ + type GDictionaryReadProxy = { + [K in keyof T]: GReadProxyValueWrap; + }; + + // At runtime we only have the one kind of dictionary proxy and one kind of array proxy. The read interfaces have + // indexers typed correctly for access i.e. return proxied types. The non-read interfaces have indexers accurate for + // assignment and will accept both GArray/GDictionary and proxies. The read interfaces exist for convenience only, + // you can safely cast between the two interfaces types as desired. + type GReadProxyValueWrap = V extends GArray + ? GArrayReadProxy + : V extends GDictionary + ? GDictionaryReadProxy + : V; + + interface PropertyInfo { + name: string; + type: Variant.Type; + class_name: string; + hint: PropertyHint; + hint_string: string; + usage: PropertyUsageFlags; + } + + type BindRight any, B extends any[]> = + F extends (this: infer T, ...args: [...(infer A), ...B]) => infer R + ? (this: T, ...args: A) => R + : never; } diff --git a/weaver-editor/jsb_editor_helper.cpp b/weaver-editor/jsb_editor_helper.cpp index b1bcf2a4..f1fa3406 100644 --- a/weaver-editor/jsb_editor_helper.cpp +++ b/weaver-editor/jsb_editor_helper.cpp @@ -1,21 +1,112 @@ #include "jsb_editor_helper.h" -Dictionary GodotJSEditorHelper::_build_node_path_map(Node *node) +#include "../../bridge/jsb_callable.h" +#include "../../bridge/jsb_type_convert.h" +#include "../../weaver/jsb_script.h" + +#include "editor/gui/editor_toaster.h" +#include "scene/resources/packed_scene.h" + +// The following enums must be kept in sync with jsb.editor.codegen.ts +enum class CodeGenType { + ScriptNodeTypeDescriptor, +}; +enum class DescriptorType { + Godot, + User, + FunctionLiteral, + ObjectLiteral, + StringLiteral, + NumericLiteral, + BooleanLiteral, + Union, + Intersection, + Conditional, + Tuple, + Infer, + Mapped +}; + +Dictionary GodotJSEditorHelper::_build_node_type_descriptor(jsb::JSEnvironment& p_env, Node *node) { - Dictionary map; Dictionary children; - map["class"] = node->get_class_name(); - map["children"] = children; + int child_count = node->get_child_count(true); - int cc = node->get_child_count(true); + for (int i = 0; i < child_count; i++) + { + Node* child = node->get_child(i, true); + children[child->get_name()] = _build_node_type_descriptor(p_env, child); + } - for (int i = 0; i < cc; i++) + ScriptInstance* script_instance = node->get_script_instance(); + GodotJSScript* script = script_instance ? Object::cast_to(*script_instance->get_script()) : nullptr; + + if (script) { - Node *child = node->get_child(i, true); - children[child->get_name()] = _build_node_path_map(child); + v8::Isolate* isolate = p_env->get_isolate(); + v8::Local context = p_env->get_context(); + + script->load_module_if_missing(); + String module_id = script->get_module_id(); + jsb::JavaScriptModule* module = p_env->get_module_cache().find(module_id); + + if (module == nullptr) + { + JSB_LOG(Warning, "Codegen failed to load module '%s'.", module_id); + } + + v8::Local module_exports; + + if (module != nullptr && !module->exports.IsEmpty()) + { + module_exports = module->exports.Get(isolate); + } + + if (!module_exports.IsEmpty() && module_exports->IsObject()) + { + const v8::Local codegen_func_val = module_exports.As()->Get(context, jsb_name(p_env, codegen)).ToLocalChecked(); + + if (!codegen_func_val.IsEmpty() && codegen_func_val->IsFunction()) + { + const v8::Local codegen_func = codegen_func_val.As(); + + Dictionary codegen_request; + codegen_request[jsb_string_name(type)] = (int32_t) CodeGenType::ScriptNodeTypeDescriptor; + codegen_request[jsb_string_name(node)] = node; + codegen_request[jsb_string_name(children)] = children; + + v8::Local codegen_request_val; + + if (jsb::TypeConvert::gd_var_to_js(isolate, context, codegen_request, codegen_request_val)) + { + v8::Local argv[] = { codegen_request_val }; + + const v8::MaybeLocal maybe_result = codegen_func->Call(context, v8::Undefined(isolate), std::size(argv), argv); + v8::Local result_val; + Variant result; + + if (maybe_result.ToLocal(&result_val) && jsb::TypeConvert::js_to_gd_var(isolate, context, result_val, Variant::Type::DICTIONARY, result)) + { + return result; + } + } + } + } } - return map; + Dictionary object_literal; + object_literal[jsb_string_name(type)] = (int32_t) DescriptorType::ObjectLiteral; + object_literal[jsb_string_name(properties)] = children; + + Array generic_arguments; + generic_arguments.push_back(object_literal); + + Dictionary default_descriptor; + default_descriptor[jsb_string_name(name)] = node->get_class_name(); + default_descriptor[jsb_string_name(type)] = (int32_t) DescriptorType::Godot; + default_descriptor[jsb_string_name(arguments)] = generic_arguments; + + return default_descriptor; } // Similar logic to EditorNode::_dialog_display_load_error. @@ -84,9 +175,22 @@ Dictionary GodotJSEditorHelper::get_scene_nodes(const String& p_path) return Dictionary(); } - const Dictionary rval = _build_node_path_map(instantiated_scene); + jsb::JSEnvironment env(instantiated_scene->get_scene_file_path(), true); + v8::Isolate* isolate = env->get_isolate(); + v8::HandleScope handle_scope(isolate); + + Dictionary nodes; + int child_count = instantiated_scene->get_child_count(true); + + for (int i = 0; i < child_count; i++) + { + Node *child = instantiated_scene->get_child(i, true); + nodes[child->get_name()] = _build_node_type_descriptor(env, child); + } + instantiated_scene->queue_free(); - return rval; + + return nodes; } void GodotJSEditorHelper::show_toast(const String& p_text, int p_severity) diff --git a/weaver-editor/jsb_editor_helper.h b/weaver-editor/jsb_editor_helper.h index 50462f98..d02df2b2 100644 --- a/weaver-editor/jsb_editor_helper.h +++ b/weaver-editor/jsb_editor_helper.h @@ -8,7 +8,7 @@ class GodotJSEditorHelper : public Object private: - static Dictionary _build_node_path_map(Node *node); + static Dictionary _build_node_type_descriptor(jsb::JSEnvironment& p_env, Node *node); static void _log_scene_load_error(const String& p_file, Error p_error); protected: diff --git a/weaver/jsb_script.h b/weaver/jsb_script.h index 62824250..5b87dede 100644 --- a/weaver/jsb_script.h +++ b/weaver/jsb_script.h @@ -54,6 +54,8 @@ class GodotJSScript : public Script GodotJSScript(); virtual ~GodotJSScript() override; + StringName get_module_id() const { return script_class_info_.module_id; }; + // Error attach_source(const String& p_path, bool p_take_over); Error load_source_code(const String &p_path); void load_module_if_missing();