summaryrefslogtreecommitdiff
path: root/modules/gdnative
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdnative')
-rw-r--r--modules/gdnative/gdnative.cpp6
-rw-r--r--modules/gdnative/gdnative_library_editor_plugin.cpp4
-rw-r--r--modules/gdnative/include/gdnative/variant.h2
-rw-r--r--modules/gdnative/include/pluginscript/godot_pluginscript.h2
-rw-r--r--modules/gdnative/nativescript/api_generator.cpp2
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp8
-rw-r--r--modules/gdnative/nativescript/nativescript.h4
-rw-r--r--modules/gdnative/nativescript/register_types.cpp4
-rw-r--r--modules/gdnative/pluginscript/pluginscript_language.cpp19
-rw-r--r--modules/gdnative/pluginscript/pluginscript_language.h2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_script.cpp18
-rw-r--r--modules/gdnative/pluginscript/pluginscript_script.h2
-rw-r--r--modules/gdnative/register_types.cpp8
-rw-r--r--modules/gdnative/videodecoder/register_types.cpp2
-rw-r--r--modules/gdnative/videodecoder/video_stream_gdnative.cpp2
-rw-r--r--modules/gdnative/xr/xr_interface_gdnative.cpp8
16 files changed, 51 insertions, 42 deletions
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index fa11132dd9..1ff591a87f 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -52,7 +52,7 @@ extern const godot_gdnative_core_api_struct api_struct;
Map<String, Vector<Ref<GDNative>>> GDNativeLibrary::loaded_libraries;
GDNativeLibrary::GDNativeLibrary() {
- config_file.instance();
+ config_file.instantiate();
symbol_prefix = default_symbol_prefix;
load_once = default_load_once;
@@ -112,7 +112,7 @@ bool GDNativeLibrary::_get(const StringName &p_name, Variant &r_property) const
}
void GDNativeLibrary::reset_state() {
- config_file.instance();
+ config_file.instantiate();
current_library_path = "";
current_dependencies.clear();
symbol_prefix = default_symbol_prefix;
@@ -532,7 +532,7 @@ Error GDNative::get_symbol(StringName p_procedure_name, void *&r_handle, bool p_
RES GDNativeLibraryResourceLoader::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) {
Ref<GDNativeLibrary> lib;
- lib.instance();
+ lib.instantiate();
Ref<ConfigFile> config = lib->get_config_file();
diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp
index b4ac0d886e..bdbf151393 100644
--- a/modules/gdnative/gdnative_library_editor_plugin.cpp
+++ b/modules/gdnative/gdnative_library_editor_plugin.cpp
@@ -356,12 +356,12 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() {
tree->set_column_titles_visible(true);
tree->set_columns(4);
tree->set_column_expand(0, false);
- tree->set_column_min_width(0, int(200 * EDSCALE));
+ tree->set_column_custom_minimum_width(0, int(200 * EDSCALE));
tree->set_column_title(0, TTR("Platform"));
tree->set_column_title(1, TTR("Dynamic Library"));
tree->set_column_title(2, TTR("Dependencies"));
tree->set_column_expand(3, false);
- tree->set_column_min_width(3, int(110 * EDSCALE));
+ tree->set_column_custom_minimum_width(3, int(110 * EDSCALE));
tree->connect("button_pressed", callable_mp(this, &GDNativeLibraryEditor::_on_item_button));
tree->connect("item_collapsed", callable_mp(this, &GDNativeLibraryEditor::_on_item_collapsed));
tree->connect("item_activated", callable_mp(this, &GDNativeLibraryEditor::_on_item_activated));
diff --git a/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h
index dd4f76cf57..a88bd2878a 100644
--- a/modules/gdnative/include/gdnative/variant.h
+++ b/modules/gdnative/include/gdnative/variant.h
@@ -164,7 +164,7 @@ typedef void (*godot_validated_keyed_getter)(const godot_variant *p_base, const
typedef bool (*godot_validated_keyed_checker)(const godot_variant *p_base, const godot_variant *p_key, bool *r_valid);
typedef void (*godot_ptr_keyed_setter)(void *p_base, const void *p_key, const void *p_value);
typedef void (*godot_ptr_keyed_getter)(const void *p_base, const void *p_key, void *r_value);
-typedef bool (*godot_ptr_keyed_checker)(const godot_variant *p_base, const godot_variant *p_key);
+typedef uint32_t (*godot_ptr_keyed_checker)(const godot_variant *p_base, const godot_variant *p_key);
typedef void (*godot_validated_utility_function)(godot_variant *r_return, const godot_variant **p_arguments, int p_argument_count);
typedef void (*godot_ptr_utility_function)(void *r_return, const void **p_arguments, int p_argument_count);
diff --git a/modules/gdnative/include/pluginscript/godot_pluginscript.h b/modules/gdnative/include/pluginscript/godot_pluginscript.h
index 34ed4f097d..02ee4066d0 100644
--- a/modules/gdnative/include/pluginscript/godot_pluginscript.h
+++ b/modules/gdnative/include/pluginscript/godot_pluginscript.h
@@ -132,7 +132,7 @@ typedef struct {
godot_bool can_inherit_from_file;
godot_string (*get_template_source_code)(godot_pluginscript_language_data *p_data, const godot_string *p_class_name, const godot_string *p_base_class_name);
- godot_bool (*validate)(godot_pluginscript_language_data *p_data, const godot_string *p_script, int *r_line_error, int *r_col_error, godot_string *r_test_error, const godot_string *p_path, godot_packed_string_array *r_functions);
+ godot_bool (*validate)(godot_pluginscript_language_data *p_data, const godot_string *p_script, const godot_string *p_path, godot_packed_string_array *r_functions, godot_array *r_errors); // errors = Array of Dictionary with "line", "column", "message" keys
int (*find_function)(godot_pluginscript_language_data *p_data, const godot_string *p_function, const godot_string *p_code); // Can be nullptr
godot_string (*make_function)(godot_pluginscript_language_data *p_data, const godot_string *p_class, const godot_string *p_name, const godot_packed_string_array *p_args);
godot_error (*complete_code)(godot_pluginscript_language_data *p_data, const godot_string *p_code, const godot_string *p_path, godot_object *p_owner, godot_array *r_options, godot_bool *r_force, godot_string *r_call_hint);
diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp
index 57717010f7..4f696f2a39 100644
--- a/modules/gdnative/nativescript/api_generator.cpp
+++ b/modules/gdnative/nativescript/api_generator.cpp
@@ -251,7 +251,7 @@ List<ClassAPI> generate_c_api_classes() {
class_api.singleton_name = name;
}
}
- class_api.is_instantiable = !class_api.is_singleton && ClassDB::can_instance(class_name);
+ class_api.is_instantiable = !class_api.is_singleton && ClassDB::can_instantiate(class_name);
{
List<StringName> inheriters;
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index 6c2d038654..3695f6b9a3 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -170,7 +170,7 @@ String NativeScript::get_script_class_icon_path() const {
return script_class_icon_path;
}
-bool NativeScript::can_instance() const {
+bool NativeScript::can_instantiate() const {
NativeScriptDesc *script_data = get_script_desc();
#ifdef TOOLS_ENABLED
@@ -503,7 +503,7 @@ Variant NativeScript::_new(const Variant **p_args, int p_argcount, Callable::Cal
Object *owner = nullptr;
if (!(script_data->base_native_type == "")) {
- owner = ClassDB::instance(script_data->base_native_type);
+ owner = ClassDB::instantiate(script_data->base_native_type);
} else {
owner = memnew(RefCounted);
}
@@ -1035,7 +1035,7 @@ Ref<Script> NativeScriptLanguage::get_template(const String &p_class_name, const
return Ref<NativeScript>(s);
}
-bool NativeScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions, List<ScriptLanguage::Warning> *r_warnings, Set<int> *r_safe_lines) const {
+bool NativeScriptLanguage::validate(const String &p_script, const String &p_path, List<String> *r_functions, List<ScriptLanguage::ScriptError> *r_errors, List<ScriptLanguage::Warning> *r_warnings, Set<int> *r_safe_lines) const {
return true;
}
@@ -1422,7 +1422,7 @@ void NativeScriptLanguage::init_library(const Ref<GDNativeLibrary> &lib) {
if (!E) {
Ref<GDNative> gdn;
- gdn.instance();
+ gdn.instantiate();
gdn->set_library(lib);
// TODO check the return value?
diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h
index 1756321281..777a878660 100644
--- a/modules/gdnative/nativescript/nativescript.h
+++ b/modules/gdnative/nativescript/nativescript.h
@@ -137,7 +137,7 @@ public:
void set_script_class_icon_path(String p_icon_path);
String get_script_class_icon_path() const;
- virtual bool can_instance() const override;
+ virtual bool can_instantiate() const override;
virtual Ref<Script> get_base_script() const override; //for script inheritance
@@ -317,7 +317,7 @@ public:
virtual void get_comment_delimiters(List<String> *p_delimiters) const;
virtual void get_string_delimiters(List<String> *p_delimiters) const;
virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
- virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions, List<ScriptLanguage::Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const;
+ virtual bool validate(const String &p_script, const String &p_path, List<String> *r_functions, List<ScriptLanguage::ScriptError> *r_errors = nullptr, List<ScriptLanguage::Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const;
virtual Script *create_script() const;
virtual bool has_named_classes() const;
virtual bool supports_builtin_mode() const;
diff --git a/modules/gdnative/nativescript/register_types.cpp b/modules/gdnative/nativescript/register_types.cpp
index 0353ab2092..0191cfd809 100644
--- a/modules/gdnative/nativescript/register_types.cpp
+++ b/modules/gdnative/nativescript/register_types.cpp
@@ -50,10 +50,10 @@ void register_nativescript_types() {
native_script_language->set_language_index(ScriptServer::get_language_count());
ScriptServer::register_language(native_script_language);
- resource_saver_gdns.instance();
+ resource_saver_gdns.instantiate();
ResourceSaver::add_resource_format_saver(resource_saver_gdns);
- resource_loader_gdns.instance();
+ resource_loader_gdns.instantiate();
ResourceLoader::add_resource_format_loader(resource_loader_gdns);
}
diff --git a/modules/gdnative/pluginscript/pluginscript_language.cpp b/modules/gdnative/pluginscript/pluginscript_language.cpp
index 0291ae560b..79aba342c9 100644
--- a/modules/gdnative/pluginscript/pluginscript_language.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_language.cpp
@@ -112,20 +112,29 @@ Ref<Script> PluginScriptLanguage::get_template(const String &p_class_name, const
return script;
}
-bool PluginScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions, List<ScriptLanguage::Warning> *r_warnings, Set<int> *r_safe_lines) const {
+bool PluginScriptLanguage::validate(const String &p_script, const String &p_path, List<String> *r_functions, List<ScriptLanguage::ScriptError> *r_errors, List<ScriptLanguage::Warning> *r_warnings, Set<int> *r_safe_lines) const {
PackedStringArray functions;
+ Array errors;
if (_desc.validate) {
bool ret = _desc.validate(
_data,
(godot_string *)&p_script,
- &r_line_error,
- &r_col_error,
- (godot_string *)&r_test_error,
(godot_string *)&p_path,
- (godot_packed_string_array *)&functions);
+ (godot_packed_string_array *)&functions,
+ (godot_array *)&errors);
for (int i = 0; i < functions.size(); i++) {
r_functions->push_back(functions[i]);
}
+ if (r_errors) {
+ for (int i = 0; i < errors.size(); i++) {
+ Dictionary error = errors[i];
+ ScriptLanguage::ScriptError e;
+ e.line = error["line"];
+ e.column = error["column"];
+ e.message = error["message"];
+ r_errors->push_back(e);
+ }
+ }
return ret;
}
return true;
diff --git a/modules/gdnative/pluginscript/pluginscript_language.h b/modules/gdnative/pluginscript/pluginscript_language.h
index 957bf355ca..26ab4a95e3 100644
--- a/modules/gdnative/pluginscript/pluginscript_language.h
+++ b/modules/gdnative/pluginscript/pluginscript_language.h
@@ -75,7 +75,7 @@ public:
virtual void get_comment_delimiters(List<String> *p_delimiters) const;
virtual void get_string_delimiters(List<String> *p_delimiters) const;
virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
- virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptLanguage::Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const;
+ virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptLanguage::ScriptError> *r_errors = nullptr, List<ScriptLanguage::Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const;
virtual Script *create_script() const;
virtual bool has_named_classes() const;
virtual bool supports_builtin_mode() const;
diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp
index 1dabb1db63..7fc8178e34 100644
--- a/modules/gdnative/pluginscript/pluginscript_script.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_script.cpp
@@ -38,13 +38,13 @@
#ifdef DEBUG_ENABLED
#define __ASSERT_SCRIPT_REASON "Cannot retrieve PluginScript class for this script, is your code correct?"
-#define ASSERT_SCRIPT_VALID() \
- { \
- ERR_FAIL_COND_MSG(!can_instance(), __ASSERT_SCRIPT_REASON); \
+#define ASSERT_SCRIPT_VALID() \
+ { \
+ ERR_FAIL_COND_MSG(!can_instantiate(), __ASSERT_SCRIPT_REASON); \
}
-#define ASSERT_SCRIPT_VALID_V(ret) \
- { \
- ERR_FAIL_COND_V_MSG(!can_instance(), ret, __ASSERT_SCRIPT_REASON); \
+#define ASSERT_SCRIPT_VALID_V(ret) \
+ { \
+ ERR_FAIL_COND_V_MSG(!can_instantiate(), ret, __ASSERT_SCRIPT_REASON); \
}
#else
#define ASSERT_SCRIPT_VALID()
@@ -96,7 +96,7 @@ Variant PluginScript::_new(const Variant **p_args, int p_argcount, Callable::Cal
if (get_instance_base_type() == "") {
owner = memnew(RefCounted);
} else {
- owner = ClassDB::instance(get_instance_base_type());
+ owner = ClassDB::instantiate(get_instance_base_type());
}
if (!owner) {
@@ -133,7 +133,7 @@ void PluginScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder)
#endif
-bool PluginScript::can_instance() const {
+bool PluginScript::can_instantiate() const {
bool can = _valid || (!_tool && !ScriptServer::is_scripting_enabled());
return can;
}
@@ -198,7 +198,7 @@ ScriptInstance *PluginScript::instance_create(Object *p_this) {
StringName base_type = get_instance_base_type();
if (base_type) {
if (!ClassDB::is_parent_class(p_this->get_class_name(), base_type)) {
- String msg = "Script inherits from native type '" + String(base_type) + "', so it can't be instanced in object of type: '" + p_this->get_class() + "'";
+ String msg = "Script inherits from native type '" + String(base_type) + "', so it can't be instantiated in object of type: '" + p_this->get_class() + "'";
// TODO: implement PluginscriptLanguage::debug_break_parse
// if (EngineDebugger::is_active()) {
// _language->debug_break_parse(get_path(), 0, msg);
diff --git a/modules/gdnative/pluginscript/pluginscript_script.h b/modules/gdnative/pluginscript/pluginscript_script.h
index 97989a19d8..838195147f 100644
--- a/modules/gdnative/pluginscript/pluginscript_script.h
+++ b/modules/gdnative/pluginscript/pluginscript_script.h
@@ -92,7 +92,7 @@ public:
return _icon_path;
}
- virtual bool can_instance() const override;
+ virtual bool can_instantiate() const override;
virtual Ref<Script> get_base_script() const override; //for script inheritance
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index cf19c0c44c..8e20a2b90d 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -230,7 +230,7 @@ static void editor_init_callback() {
ProjectSettingsEditor::get_singleton()->get_tabs()->add_child(library_editor);
Ref<GDNativeExportPlugin> export_plugin;
- export_plugin.instance();
+ export_plugin.instantiate();
EditorExport::get_singleton()->add_export_plugin(export_plugin);
@@ -262,10 +262,10 @@ void register_gdnative_types() {
ClassDB::register_class<GDNativeLibrary>();
ClassDB::register_class<GDNative>();
- resource_loader_gdnlib.instance();
+ resource_loader_gdnlib.instantiate();
ResourceLoader::add_resource_format_loader(resource_loader_gdnlib);
- resource_saver_gdnlib.instance();
+ resource_saver_gdnlib.instantiate();
ResourceSaver::add_resource_format_saver(resource_saver_gdnlib);
GDNativeCallRegistry::singleton = memnew(GDNativeCallRegistry);
@@ -298,7 +298,7 @@ void register_gdnative_types() {
Ref<GDNativeLibrary> lib = ResourceLoader::load(path);
Ref<GDNative> singleton;
- singleton.instance();
+ singleton.instantiate();
singleton->set_library(lib);
if (!singleton->initialize()) {
diff --git a/modules/gdnative/videodecoder/register_types.cpp b/modules/gdnative/videodecoder/register_types.cpp
index 394831daeb..e822d42312 100644
--- a/modules/gdnative/videodecoder/register_types.cpp
+++ b/modules/gdnative/videodecoder/register_types.cpp
@@ -36,7 +36,7 @@
static Ref<ResourceFormatLoaderVideoStreamGDNative> resource_loader_vsgdnative;
void register_videodecoder_types() {
- resource_loader_vsgdnative.instance();
+ resource_loader_vsgdnative.instantiate();
ResourceLoader::add_resource_format_loader(resource_loader_vsgdnative, true);
ClassDB::register_class<VideoStreamGDNative>();
diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.cpp b/modules/gdnative/videodecoder/video_stream_gdnative.cpp
index 8b0434c7dd..26b044c0ef 100644
--- a/modules/gdnative/videodecoder/video_stream_gdnative.cpp
+++ b/modules/gdnative/videodecoder/video_stream_gdnative.cpp
@@ -122,7 +122,7 @@ bool VideoStreamPlaybackGDNative::open_file(const String &p_file) {
samples_decoded = 0;
Ref<Image> img;
- img.instance();
+ img.instantiate();
img->create((int)texture_size.width, false, (int)texture_size.height, Image::FORMAT_RGBA8);
texture->create_from_image(img);
diff --git a/modules/gdnative/xr/xr_interface_gdnative.cpp b/modules/gdnative/xr/xr_interface_gdnative.cpp
index ff959affa3..e51542e23d 100644
--- a/modules/gdnative/xr/xr_interface_gdnative.cpp
+++ b/modules/gdnative/xr/xr_interface_gdnative.cpp
@@ -258,7 +258,7 @@ void GDAPI godot_xr_register_interface(const godot_xr_interface_gdnative *p_inte
ERR_FAIL_COND_MSG(p_interface->version.major < 4, "GDNative XR interfaces build for Godot 3.x are not supported.");
Ref<XRInterfaceGDNative> new_interface;
- new_interface.instance();
+ new_interface.instantiate();
new_interface->set_interface((const godot_xr_interface_gdnative *)p_interface);
XRServer::get_singleton()->add_interface(new_interface);
}
@@ -331,7 +331,7 @@ godot_int GDAPI godot_xr_add_controller(char *p_device_name, godot_int p_hand, g
ERR_FAIL_NULL_V(input, 0);
Ref<XRPositionalTracker> new_tracker;
- new_tracker.instance();
+ new_tracker.instantiate();
new_tracker->set_tracker_name(p_device_name);
new_tracker->set_tracker_type(XRServer::TRACKER_CONTROLLER);
if (p_hand == 1) {
@@ -412,7 +412,7 @@ void GDAPI godot_xr_set_controller_button(godot_int p_controller_id, godot_int p
if (tracker.is_valid()) {
int joyid = tracker->get_joy_id();
if (joyid != -1) {
- input->joy_button(joyid, p_button, p_is_pressed);
+ input->joy_button(joyid, (JoyButton)p_button, p_is_pressed);
}
}
}
@@ -431,7 +431,7 @@ void GDAPI godot_xr_set_controller_axis(godot_int p_controller_id, godot_int p_a
Input::JoyAxisValue jx;
jx.min = p_can_be_negative ? -1 : 0;
jx.value = p_value;
- input->joy_axis(joyid, p_axis, jx);
+ input->joy_axis(joyid, (JoyAxis)p_axis, jx);
}
}
}