diff options
Diffstat (limited to 'modules')
182 files changed, 3764 insertions, 2263 deletions
diff --git a/modules/dds/register_types.cpp b/modules/dds/register_types.cpp index d0eaf3f995..4a758fe033 100644 --- a/modules/dds/register_types.cpp +++ b/modules/dds/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/dds/register_types.h b/modules/dds/register_types.h index 69f47006e2..4807c7dd5b 100644 --- a/modules/dds/register_types.h +++ b/modules/dds/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp index ac981d2b1a..f80e6e501e 100644 --- a/modules/dds/texture_loader_dds.cpp +++ b/modules/dds/texture_loader_dds.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/dds/texture_loader_dds.h b/modules/dds/texture_loader_dds.h index c347937cd5..3b36e7f1eb 100644 --- a/modules/dds/texture_loader_dds.h +++ b/modules/dds/texture_loader_dds.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/dlscript/api_generator.h b/modules/dlscript/api_generator.h deleted file mode 100644 index 4a8354e9d6..0000000000 --- a/modules/dlscript/api_generator.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef API_GENERATOR_H -#define API_GENERATOR_H - -#include "core/ustring.h" -#include "typedefs.h" - -Error generate_c_api(const String &p_path); - -#endif // API_GENERATOR_H diff --git a/modules/dlscript/dl_script.cpp b/modules/dlscript/dl_script.cpp deleted file mode 100644 index 9917018891..0000000000 --- a/modules/dlscript/dl_script.cpp +++ /dev/null @@ -1,1048 +0,0 @@ -/*************************************************************************/ -/* dl_script.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "dl_script.h" - -#include "global_config.h" -#include "global_constants.h" -#include "io/file_access_encrypted.h" -#include "os/file_access.h" -#include "os/os.h" - -#include "scene/resources/scene_format_text.h" - -#ifdef TOOLS_ENABLED -// #include "editor/editor_import_export.h" -#endif - -#if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED) -#include "api_generator.h" -#endif - -// Script - -bool DLScript::can_instance() const { -#ifdef DLSCRIPT_EDITOR_FEATURES - return script_data || (!is_tool() && !ScriptServer::is_scripting_enabled()); -#else - // allow defaultlibrary without editor features - if (!library.is_valid()) { - String path = GLOBAL_GET("dlscript/default_dllibrary"); - - RES lib = ResourceLoader::load(path); - - if (lib.is_valid() && lib->cast_to<DLLibrary>()) { - return true; - } - } - - return script_data; -#endif - //return script_data || (!tool && !ScriptServer::is_scripting_enabled()); - // change to true enable in editor stuff. -} - -Ref<Script> DLScript::get_base_script() const { - Ref<DLScript> base_script; - base_script->library = library; - base_script->script_data = script_data; - base_script->script_name = script_data->base; - return base_script; -} - -StringName DLScript::get_instance_base_type() const { - return script_data->base_native_type; -} - -ScriptInstance *DLScript::instance_create(Object *p_this) { - -#ifdef TOOLS_ENABLED - -// find a good way to initialize stuff in the editor -#ifdef DLSCRIPT_EDITOR_FEATURES - if (!ScriptServer::is_scripting_enabled() && !is_tool()) { - // placeholder, for nodes. But for tools we want the real thing - - PlaceHolderScriptInstance *sins = memnew(PlaceHolderScriptInstance(DLScriptLanguage::singleton, Ref<Script>((Script *)this), p_this)); - placeholders.insert(sins); - - List<PropertyInfo> pinfo; - Map<StringName, Variant> values; - - if (!library.is_valid()) - return sins; - - if (!library->library_handle) { - Error err = library->_initialize_handle(true); - if (err != OK) { - return sins; - } - } - - if (!script_data) { - script_data = library->get_script_data(script_name); - } - if (script_data) - script_data->create_func.create_func((godot_object *)p_this, script_data->create_func.method_data); - - if (script_data) { - for (Map<StringName, DLScriptData::Property>::Element *E = script_data->properties.front(); E; E = E->next()) { - - PropertyInfo p = E->get().info; - p.name = String(E->key()); - pinfo.push_back(p); - values[p.name] = E->get().default_value; - } - } - - sins->update(pinfo, values); - - return sins; - } -#endif - -#endif - - if (!library.is_valid()) { - String path = GLOBAL_GET("dlscript/default_dllibrary"); - - RES lib = ResourceLoader::load(path); - - if (lib.is_valid() && lib->cast_to<DLLibrary>()) { - set_library(lib); - } - } - - DLInstance *new_instance = memnew(DLInstance); - - new_instance->owner = p_this; - new_instance->script = Ref<DLScript>(this); - -#ifndef DLSCRIPT_EDITOR_FEATURES - if (!ScriptServer::is_scripting_enabled()) { - new_instance->userdata = 0; - } else { - new_instance->userdata = script_data->create_func.create_func((godot_object *)p_this, script_data->create_func.method_data); - } -#else - new_instance->userdata = script_data->create_func.create_func((godot_object *)p_this, script_data->create_func.method_data); -#endif - - instances.insert(p_this); - return new_instance; -} - -bool DLScript::instance_has(const Object *p_this) const { - return instances.has((Object *)p_this); // TODO -} - -bool DLScript::has_source_code() const { - return false; -} - -String DLScript::get_source_code() const { - return ""; -} - -Error DLScript::reload(bool p_keep_state) { - return FAILED; -} - -bool DLScript::has_method(const StringName &p_method) const { - if (!script_data) - return false; - return script_data->methods.has(p_method); -} - -MethodInfo DLScript::get_method_info(const StringName &p_method) const { - if (!script_data) - return MethodInfo(); - ERR_FAIL_COND_V(!script_data->methods.has(p_method), MethodInfo()); - return script_data->methods[p_method].info; -} - -void DLScript::get_script_method_list(List<MethodInfo> *p_list) const { - if (!script_data) return; - for (Map<StringName, DLScriptData::Method>::Element *E = script_data->methods.front(); E; E = E->next()) { - p_list->push_back(E->get().info); - } -} - -void DLScript::get_script_property_list(List<PropertyInfo> *p_list) const { - if (!script_data) return; - for (Map<StringName, DLScriptData::Property>::Element *E = script_data->properties.front(); E; E = E->next()) { - p_list->push_back(E->get().info); - } -} - -bool DLScript::get_property_default_value(const StringName &p_property, Variant &r_value) const { - if (!script_data) return false; - if (script_data->properties.has(p_property)) { - r_value = script_data->properties[p_property].default_value; - return true; - } - return false; -} - -bool DLScript::is_tool() const { - ERR_FAIL_COND_V(!script_data, false); - return script_data->is_tool; -} - -String DLScript::get_node_type() const { - return ""; // ? -} - -ScriptLanguage *DLScript::get_language() const { - return DLScriptLanguage::singleton; -} - -bool DLScript::has_script_signal(const StringName &p_signal) const { - if (!script_data) - return false; - return script_data->signals_.has(p_signal); -} - -void DLScript::get_script_signal_list(List<MethodInfo> *r_signals) const { - if (!script_data) - return; - for (Map<StringName, DLScriptData::Signal>::Element *S = script_data->signals_.front(); S; S = S->next()) { - r_signals->push_back(S->get().signal); - } -} - -Ref<DLLibrary> DLScript::get_library() const { - return library; -} - -void DLScript::set_library(Ref<DLLibrary> p_library) { - library = p_library; - -#ifdef TOOLS_ENABLED - if (!ScriptServer::is_scripting_enabled()) - return; -#endif - if (library.is_valid()) { - Error initalize_status = library->_initialize_handle(!ScriptServer::is_scripting_enabled()); - ERR_FAIL_COND(initalize_status != OK); - if (script_name) { - script_data = library->get_script_data(script_name); - ERR_FAIL_COND(!script_data); - } - } -} - -StringName DLScript::get_script_name() const { - return script_name; -} - -void DLScript::set_script_name(StringName p_script_name) { - script_name = p_script_name; - - if (library.is_valid()) { - script_data = library->get_script_data(script_name); - ERR_FAIL_COND(!script_data); - } -} - -void DLScript::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_library"), &DLScript::get_library); - ClassDB::bind_method(D_METHOD("set_library", "library"), &DLScript::set_library); - ClassDB::bind_method(D_METHOD("get_script_name"), &DLScript::get_script_name); - ClassDB::bind_method(D_METHOD("set_script_name", "script_name"), &DLScript::set_script_name); - - ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "DLLibrary"), "set_library", "get_library"); - ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "script_name"), "set_script_name", "get_script_name"); -} - -DLScript::DLScript() { - script_data = NULL; -} - -DLScript::~DLScript() { - //hmm -} - -// Library - -DLLibrary *DLLibrary::currently_initialized_library = NULL; - -DLLibrary *DLLibrary::get_currently_initialized_library() { - return currently_initialized_library; -} - -static const char *_dl_platforms_info[] = { - "|unix|so|Unix", - "unix|x11|so|X11", - "unix|server|so|Server", - "unix|android|so|Android", - "unix|blackberry|so|Blackberry 10", - "unix|haiku|so|Haiku", // Right? - "|mac|dynlib|Mac", - "mac|ios|dynlib|iOS", - "mac|osx|dynlib|OSX", - "|html5|js|HTML5", - "|windows|dll|Windows", - "windows|uwp|dll|UWP", - NULL // Finishing condition -}; - -void DLLibrary::set_platform_file(StringName p_platform, String p_file) { - if (p_file.empty()) { - platform_files.erase(p_platform); - } else { - platform_files[p_platform] = p_file; - } -} - -String DLLibrary::get_platform_file(StringName p_platform) const { - if (platform_files.has(p_platform)) { - return platform_files[p_platform]; - } else { - return ""; - } -} - -Error DLLibrary::_initialize_handle(bool p_in_editor) { - _THREAD_SAFE_METHOD_ - - void *_library_handle; - - // Get the file - - const String platform_name = OS::get_singleton()->get_name(); - String platform_file(""); - char **platform_info = (char **)_dl_platforms_info; - - if (platform_files.has(platform_name.to_lower())) { - platform_file = platform_files[platform_name.to_lower()]; - } - - while (*platform_info) { - String platform_info_string(*platform_info); - - if (platform_name == platform_info_string.get_slicec('|', 3)) { - String platform_key = platform_info_string.get_slicec('|', 1); - String fallback_platform_key = platform_info_string.get_slicec('|', 0); - - if (platform_files.has(platform_key)) { - platform_file = platform_files[platform_key]; - } else if (!fallback_platform_key.empty() && platform_files.has(fallback_platform_key)) { - platform_file = platform_files[fallback_platform_key]; - } else { - return ERR_UNAVAILABLE; - } - } - platform_info++; - } - ERR_FAIL_COND_V(platform_file == "", ERR_DOES_NOT_EXIST); - - library_path = GlobalConfig::get_singleton()->globalize_path(platform_file); - - if (DLScriptLanguage::get_singleton()->is_library_initialized(library_path)) { - *this = *DLScriptLanguage::get_singleton()->get_library_dllibrary(library_path); - return OK; - } - - // Open the file - - Error error; - error = OS::get_singleton()->open_dynamic_library(library_path, _library_handle); - if (error) return error; - ERR_FAIL_COND_V(!_library_handle, ERR_BUG); - - // Get the method - - void *library_init; - error = OS::get_singleton()->get_dynamic_library_symbol_handle(_library_handle, DLScriptLanguage::get_init_symbol_name(), library_init); - if (error) return error; - ERR_FAIL_COND_V(!library_init, ERR_BUG); - - DLLibrary::currently_initialized_library = this; - - void (*library_init_fpointer)(godot_dlscript_init_options *) = (void (*)(godot_dlscript_init_options *))library_init; - - godot_dlscript_init_options options; - - options.in_editor = p_in_editor; - options.core_api_hash = ClassDB::get_api_hash(ClassDB::API_CORE); - options.editor_api_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR); - options.no_api_hash = ClassDB::get_api_hash(ClassDB::API_NONE); - - library_init_fpointer(&options); // Catch errors? - /*{ - ERR_EXPLAIN("Couldn't initialize library"); - ERR_FAIL_V(ERR_SCRIPT_FAILED); - }*/ - - DLLibrary::currently_initialized_library = NULL; - library_handle = _library_handle; - - DLScriptLanguage::get_singleton()->set_library_initialized(library_path, this); - - return OK; -} - -Error DLLibrary::_free_handle(bool p_in_editor) { - ERR_FAIL_COND_V(!library_handle, ERR_BUG); - - if (!DLScriptLanguage::get_singleton()->is_library_initialized(library_path)) { - OS::get_singleton()->close_dynamic_library(library_handle); - library_handle = 0; - return OK; - } - - Error error = OK; - void *library_terminate; - error = OS::get_singleton()->get_dynamic_library_symbol_handle(library_handle, DLScriptLanguage::get_terminate_symbol_name(), library_terminate); - if (error) - return OK; // no terminate? okay, not that important lol - - void (*library_terminate_pointer)(godot_dlscript_terminate_options *) = (void (*)(godot_dlscript_terminate_options *))library_terminate; - - godot_dlscript_terminate_options options; - options.in_editor = p_in_editor; - - library_terminate_pointer(&options); - - DLScriptLanguage::get_singleton()->set_library_uninitialized(library_path); - - OS::get_singleton()->close_dynamic_library(library_handle); - library_handle = 0; - - return OK; -} - -void DLLibrary::_register_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func) { - ERR_FAIL_COND(scripts.has(p_name)); - - DLScriptData *s = memnew(DLScriptData); - s->base = p_base; - s->create_func = p_instance_func; - s->destroy_func = p_destroy_func; - Map<StringName, DLScriptData *>::Element *E = scripts.find(p_base); - if (E) { - s->base_data = E->get(); - s->base_native_type = s->base_data->base_native_type; - } else { - if (!ClassDB::class_exists(p_base)) { - memdelete(s); - ERR_EXPLAIN("Invalid base for registered type '" + p_name + "'"); - ERR_FAIL(); - } - s->base_native_type = p_base; - } - - scripts.insert(p_name, s); -} - -void DLLibrary::_register_tool_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func) { - ERR_FAIL_COND(scripts.has(p_name)); - - DLScriptData *s = memnew(DLScriptData); - s->base = p_base; - s->create_func = p_instance_func; - s->destroy_func = p_destroy_func; - s->is_tool = true; - Map<StringName, DLScriptData *>::Element *E = scripts.find(p_base); - if (E) { - s->base_data = E->get(); - s->base_native_type = s->base_data->base_native_type; - } else { - if (!ClassDB::class_exists(p_base)) { - memdelete(s); - ERR_EXPLAIN("Invalid base for registered type '" + p_name + "'"); - ERR_FAIL(); - } - s->base_native_type = p_base; - } - - scripts.insert(p_name, s); -} - -void DLLibrary::_register_script_method(const StringName p_name, const StringName p_method, godot_method_attributes p_attr, godot_instance_method p_func, MethodInfo p_info) { - ERR_FAIL_COND(!scripts.has(p_name)); - - p_info.name = p_method; - DLScriptData::Method method; - - method = DLScriptData::Method(p_func, p_info, p_attr.rpc_type); - - scripts[p_name]->methods.insert(p_method, method); -} - -void DLLibrary::_register_script_property(const StringName p_name, const String p_path, godot_property_attributes *p_attr, godot_property_set_func p_setter, godot_property_get_func p_getter) { - ERR_FAIL_COND(!scripts.has(p_name)); - - DLScriptData::Property p; - - PropertyInfo pi; - pi.name = p_path; - - if (p_attr != NULL) { - pi = PropertyInfo((Variant::Type)p_attr->type, p_path, (PropertyHint)p_attr->hint, *(String *)&p_attr->hint_string, p_attr->usage); - - p = DLScriptData::Property(p_setter, p_getter, pi, *(Variant *)&p_attr->default_value, p_attr->rset_type); - } - - scripts[p_name]->properties.insert(p_path, p); -} - -void DLLibrary::_register_script_signal(const StringName p_name, const godot_signal *p_signal) { - ERR_FAIL_COND(!scripts.has(p_name)); - ERR_FAIL_COND(!p_signal); - - DLScriptData::Signal signal; - - signal.signal.name = *(String *)&p_signal->name; - - { - List<PropertyInfo> arguments; - for (int i = 0; i < p_signal->num_args; i++) { - PropertyInfo info; - godot_signal_argument attrib = p_signal->args[i]; - - String *name = (String *)&attrib.name; - info.name = *name; - info.type = (Variant::Type)attrib.type; - info.hint = (PropertyHint)attrib.hint; - info.hint_string = *(String *)&attrib.hint_string; - info.usage = attrib.usage; - - arguments.push_back(info); - } - - signal.signal.arguments = arguments; - } - - { - Vector<Variant> default_arguments; - for (int i = 0; i < p_signal->num_default_args; i++) { - Variant *v; - godot_signal_argument attrib = p_signal->args[i]; - - v = (Variant *)&attrib.default_value; - - default_arguments.push_back(*v); - } - - signal.signal.default_arguments = default_arguments; - } - - scripts[p_name]->signals_.insert(*(String *)&p_signal->name, signal); -} - -DLScriptData *DLLibrary::get_script_data(const StringName p_name) { - - if (!scripts.has(p_name)) { - if (DLScriptLanguage::get_singleton()->is_library_initialized(library_path)) { - _update_library(*DLScriptLanguage::get_singleton()->get_library_dllibrary(library_path)); - } - ERR_FAIL_COND_V(!scripts.has(p_name), NULL); - } - - return scripts[p_name]; -} - -bool DLLibrary::_set(const StringName &p_name, const Variant &p_value) { - String name = p_name; - if (name.begins_with("platform/")) { - set_platform_file(name.get_slice("/", 1), p_value); - return true; - } - return false; -} - -bool DLLibrary::_get(const StringName &p_name, Variant &r_ret) const { - String name = p_name; - if (name.begins_with("platform/")) { - r_ret = get_platform_file(name.get_slice("/", 1)); - return true; - } - return false; -} - -void DLLibrary::_get_property_list(List<PropertyInfo> *p_list) const { - char **platform_info = (char **)_dl_platforms_info; - - Set<String> registered_platform_names; - { - List<StringName> ep; - // ep.push_back("X11"); - // EditorImportExport::get_singleton()->get_export_platforms(&ep); - for (List<StringName>::Element *E = ep.front(); E; E = E->next()) { - registered_platform_names.insert(String(E->get()).to_lower()); - } - } - - while (*platform_info) { - String platform_info_string(*platform_info); - String fallback_platform_key = platform_info_string.get_slicec('|', 0); - String platform_key = platform_info_string.get_slicec('|', 1); - String platform_extension = platform_info_string.get_slicec('|', 2); - String platform_name = platform_info_string.get_slicec('|', 3); - - registered_platform_names.erase(platform_name); - - if (fallback_platform_key.empty()) { - p_list->push_back(PropertyInfo(Variant::STRING, "platform/" + platform_key, PROPERTY_HINT_FILE, "*." + platform_extension)); - - } else { - if (platform_files.has(platform_key)) { - p_list->push_back(PropertyInfo(Variant::STRING, "platform/" + platform_key, PROPERTY_HINT_FILE, "*." + platform_extension, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_CHECKABLE | PROPERTY_USAGE_CHECKED)); - } else { - p_list->push_back(PropertyInfo(Variant::STRING, "platform/" + platform_key, PROPERTY_HINT_FILE, "*." + platform_extension, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_CHECKABLE)); - } - } - platform_info++; - } - - while (registered_platform_names.size()) { - const String platform_name = registered_platform_names.front()->get(); - registered_platform_names.erase(platform_name); - p_list->push_back(PropertyInfo(Variant::STRING, "platform/" + platform_name.to_lower(), PROPERTY_HINT_FILE, "*")); - } -} - -void DLLibrary::_notification(int what) { - // TODO -} - -void DLLibrary::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_platform_file", "platform", "file"), &DLLibrary::set_platform_file); - ClassDB::bind_method(D_METHOD("get_platform_file", "platform"), &DLLibrary::get_platform_file); -} - -DLLibrary::DLLibrary() { - library_handle = NULL; -} - -DLLibrary::~DLLibrary() { - - for (Map<StringName, DLScriptData *>::Element *E = scripts.front(); E; E = E->next()) { - for (Map<StringName, DLScriptData::Method>::Element *M = E->get()->methods.front(); M; M = M->next()) { - if (M->get().method.free_func) { - M->get().method.free_func(M->get().method.method_data); - } - } - memdelete(E->get()); - } - - if (library_handle) { - bool in_editor = false; -#ifdef TOOLS_ENABLED - in_editor = !ScriptServer::is_scripting_enabled(); -#endif - _free_handle(in_editor); - } -} - -// Instance - -bool DLInstance::set(const StringName &p_name, const Variant &p_value) { - if (!script->script_data) - return false; - if (script->script_data->properties.has(p_name)) { - script->script_data->properties[p_name].setter.set_func((godot_object *)owner, script->script_data->properties[p_name].setter.method_data, userdata, *(godot_variant *)&p_value); - return true; - } - return false; -} - -bool DLInstance::get(const StringName &p_name, Variant &r_ret) const { - if (!script->script_data) - return false; - if (script->script_data->properties.has(p_name)) { - godot_variant value = script->script_data->properties[p_name].getter.get_func((godot_object *)owner, script->script_data->properties[p_name].getter.method_data, userdata); - r_ret = *(Variant *)&value; - return true; - } - return false; -} - -void DLInstance::get_property_list(List<PropertyInfo> *p_properties) const { - script->get_script_property_list(p_properties); - // TODO: dynamic properties -} - -Variant::Type DLInstance::get_property_type(const StringName &p_name, bool *r_is_valid) const { - if (script->script_data->properties.has(p_name)) { - *r_is_valid = true; - return script->script_data->properties[p_name].info.type; - } - *r_is_valid = false; - return Variant::NIL; -} - -void DLInstance::get_method_list(List<MethodInfo> *p_list) const { - script->get_script_method_list(p_list); -} - -bool DLInstance::has_method(const StringName &p_method) const { - return script->has_method(p_method); -} - -Variant DLInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { - // TODO: validated methods & errors - - DLScriptData *data_ptr = script->script_data; - while (data_ptr) { - Map<StringName, DLScriptData::Method>::Element *E = data_ptr->methods.find(p_method); - if (E) { - godot_variant result = E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, p_argcount, (godot_variant **)p_args); - return *(Variant *)&result; - } - data_ptr = data_ptr->base_data; - } - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; - return Variant(); -} - -void DLInstance::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) { - // TODO: validated methods & errors - - DLScriptData *data_ptr = script->script_data; - while (data_ptr) { - Map<StringName, DLScriptData::Method>::Element *E = data_ptr->methods.find(p_method); - if (E) { - E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, p_argcount, (godot_variant **)p_args); - } - data_ptr = data_ptr->base_data; - } -} - -void DLInstance::_ml_call_reversed(DLScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount) { - // TODO: validated methods & errors - - if (data_ptr->base_data) - _ml_call_reversed(data_ptr->base_data, p_method, p_args, p_argcount); - - // Variant::CallError ce; - - Map<StringName, DLScriptData::Method>::Element *E = data_ptr->methods.find(p_method); - if (E) { - E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, p_argcount, (godot_variant **)p_args); - } -} - -void DLInstance::call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount) { - if (script.ptr() && script->script_data) { - _ml_call_reversed(script->script_data, p_method, p_args, p_argcount); - } -} - -void DLInstance::notification(int p_notification) { - Variant value = p_notification; - const Variant *args[1] = { &value }; - call_multilevel(DLScriptLanguage::singleton->strings._notification, args, 1); -} - -Ref<Script> DLInstance::get_script() const { - return script; -} - -ScriptLanguage *DLInstance::get_language() { - return DLScriptLanguage::singleton; -} - -ScriptInstance::RPCMode DLInstance::get_rpc_mode(const StringName &p_method) const { - DLScriptData::Method m = script->script_data->methods[p_method]; - switch (m.rpc_mode) { - case GODOT_METHOD_RPC_MODE_DISABLED: - return RPC_MODE_DISABLED; - case GODOT_METHOD_RPC_MODE_REMOTE: - return RPC_MODE_REMOTE; - case GODOT_METHOD_RPC_MODE_SYNC: - return RPC_MODE_SYNC; - case GODOT_METHOD_RPC_MODE_MASTER: - return RPC_MODE_MASTER; - case GODOT_METHOD_RPC_MODE_SLAVE: - return RPC_MODE_SLAVE; - default: - return RPC_MODE_DISABLED; - } -} - -ScriptInstance::RPCMode DLInstance::get_rset_mode(const StringName &p_variable) const { - DLScriptData::Property p = script->script_data->properties[p_variable]; - switch (p.rset_mode) { - case GODOT_METHOD_RPC_MODE_DISABLED: - return RPC_MODE_DISABLED; - case GODOT_METHOD_RPC_MODE_REMOTE: - return RPC_MODE_REMOTE; - case GODOT_METHOD_RPC_MODE_SYNC: - return RPC_MODE_SYNC; - case GODOT_METHOD_RPC_MODE_MASTER: - return RPC_MODE_MASTER; - case GODOT_METHOD_RPC_MODE_SLAVE: - return RPC_MODE_SLAVE; - default: - return RPC_MODE_DISABLED; - } -} - -DLInstance::DLInstance() { - owner = NULL; - userdata = NULL; -} - -DLInstance::~DLInstance() { - if (script.is_valid()) { - if (owner) { - script->instances.erase(owner); - } - if (!script->script_data) - return; - script->script_data->destroy_func.destroy_func((godot_object *)owner, script->script_data->destroy_func.method_data, userdata); - if (script->script_data->destroy_func.free_func) - script->script_data->destroy_func.free_func(script->script_data->destroy_func.method_data); - if (script->script_data->create_func.free_func) - script->script_data->create_func.free_func(script->script_data->create_func.method_data); - } -} - -// Language - -DLScriptLanguage *DLScriptLanguage::singleton = NULL; - -String DLScriptLanguage::get_name() const { - return "DLScript"; -} - -bool DLScriptLanguage::is_library_initialized(const String &p_path) { - - return initialized_libraries.has(p_path); -} - -void DLScriptLanguage::set_library_initialized(const String &p_path, DLLibrary *p_dllibrary) { - - initialized_libraries[p_path] = p_dllibrary; -} - -DLLibrary *DLScriptLanguage::get_library_dllibrary(const String &p_path) { - - return initialized_libraries[p_path]; -} - -void DLScriptLanguage::set_library_uninitialized(const String &p_path) { - - initialized_libraries.erase(p_path); -} - -void DLScriptLanguage::init() { - // TODO: Expose globals - GLOBAL_DEF("dlscript/default_dllibrary", ""); - PropertyInfo prop_info(Variant::STRING, "dlscript/default_dllibrary", PROPERTY_HINT_FILE, "tres,res,dllib"); - GlobalConfig::get_singleton()->set_custom_property_info("dlscript/default_dllibrary", prop_info); - -// generate bindings -#if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED) - - List<String> args = OS::get_singleton()->get_cmdline_args(); - - List<String>::Element *E = args.find("--dlscript-generate-json-api"); - - if (E && E->next()) { - if (generate_c_api(E->next()->get()) != OK) { - ERR_PRINT("Failed to generate C API\n"); - } - } -#endif -} - -String DLScriptLanguage::get_type() const { - return "DLScript"; -} - -String DLScriptLanguage::get_extension() const { - return "dl"; -} - -Error DLScriptLanguage::execute_file(const String &p_path) { - return OK; // ?? -} - -void DLScriptLanguage::finish() { - // cleanup is for noobs -} - -// scons doesn't want to link in the api source so we need to call a dummy function to cause it to link -extern "C" void _api_anchor(); - -void DLScriptLanguage::_compile_dummy_for_the_api() { - _api_anchor(); -} - -Ref<Script> DLScriptLanguage::get_template(const String &p_class_name, const String &p_base_class_name) const { - DLScript *src = memnew(DLScript); - src->set_script_name(p_class_name); - return Ref<DLScript>(src); -} - -bool DLScriptLanguage::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) const { - return false; // TODO -} - -Script *DLScriptLanguage::create_script() const { - DLScript *scr = memnew(DLScript); - return scr; -} - -bool DLScriptLanguage::has_named_classes() const { - return true; -} - -int DLScriptLanguage::find_function(const String &p_function, const String &p_code) const { - return -1; // No source code! -} - -String DLScriptLanguage::make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const { - return ""; // No source code! -} - -void DLScriptLanguage::add_global_constant(const StringName &p_variable, const Variant &p_value) { - // TODO TODO TODO -} - -// TODO: Any debugging? (research) -String DLScriptLanguage::debug_get_error() const { - return ""; -} - -int DLScriptLanguage::debug_get_stack_level_count() const { - return 1; // ? -} - -int DLScriptLanguage::debug_get_stack_level_line(int p_level) const { - return -1; -} - -String DLScriptLanguage::debug_get_stack_level_function(int p_level) const { - return "[native code]"; // ? -} - -String DLScriptLanguage::debug_get_stack_level_source(int p_level) const { - return ""; -} - -void DLScriptLanguage::debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {} - -void DLScriptLanguage::debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {} - -String DLScriptLanguage::debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems, int p_max_depth) { - return ""; // ?? -} - -void DLScriptLanguage::reload_all_scripts() { - // @Todo -} - -void DLScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_soft_reload) { - // @Todo - OS::get_singleton()->print("reload tool scripts\n"); -} - -void DLScriptLanguage::get_recognized_extensions(List<String> *p_extensions) const { - p_extensions->push_back("dl"); // Container file format -} - -void DLScriptLanguage::get_public_functions(List<MethodInfo> *p_functions) const { -} - -void DLScriptLanguage::get_public_constants(List<Pair<String, Variant> > *p_constants) const { -} - -// TODO: all profilling -void DLScriptLanguage::profiling_start() { -} - -void DLScriptLanguage::profiling_stop() { -} - -int DLScriptLanguage::profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max) { - return 0; -} - -int DLScriptLanguage::profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max) { - return 0; -} - -void DLScriptLanguage::frame() { -} - -String DLScriptLanguage::get_init_symbol_name() { - return "godot_dlscript_init"; // TODO: Maybe make some internal function which would do the actual stuff -} - -String DLScriptLanguage::get_terminate_symbol_name() { - return "godot_dlscript_terminate"; -} - -DLScriptLanguage::DLScriptLanguage() { - ERR_FAIL_COND(singleton); - strings._notification = StringName("_notification"); - singleton = this; - initialized_libraries = Map<String, DLLibrary *>(); -} - -DLScriptLanguage::~DLScriptLanguage() { - singleton = NULL; -} - -RES ResourceFormatLoaderDLScript::load(const String &p_path, const String &p_original_path, Error *r_error) { - ResourceFormatLoaderText rsflt; - return rsflt.load(p_path, p_original_path, r_error); -} - -void ResourceFormatLoaderDLScript::get_recognized_extensions(List<String> *p_extensions) const { - p_extensions->push_back("dl"); -} -bool ResourceFormatLoaderDLScript::handles_type(const String &p_type) const { - return (p_type == "Script" || p_type == "DLScript"); -} -String ResourceFormatLoaderDLScript::get_resource_type(const String &p_path) const { - String el = p_path.get_extension().to_lower(); - if (el == "dl") - return "DLScript"; - return ""; -} - -Error ResourceFormatSaverDLScript::save(const String &p_path, const RES &p_resource, uint32_t p_flags) { - ResourceFormatSaverText rfst; - return rfst.save(p_path, p_resource, p_flags); -} - -bool ResourceFormatSaverDLScript::recognize(const RES &p_resource) const { - return p_resource->cast_to<DLScript>() != NULL; -} - -void ResourceFormatSaverDLScript::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const { - if (p_resource->cast_to<DLScript>()) { - p_extensions->push_back("dl"); - } -} diff --git a/modules/dlscript/godot/godot_basis.cpp b/modules/dlscript/godot/godot_basis.cpp deleted file mode 100644 index 813a531de5..0000000000 --- a/modules/dlscript/godot/godot_basis.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "godot_basis.h" - -#include "math/matrix3.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _basis_api_anchor() { -} - -void GDAPI godot_basis_new(godot_basis *p_basis) { - Basis *basis = (Basis *)p_basis; - *basis = Basis(); -} - -void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_basis, const godot_quat *p_euler) { - Basis *basis = (Basis *)p_basis; - Quat *euler = (Quat *)p_euler; - *basis = Basis(*euler); -} - -void GDAPI godot_basis_new_with_euler(godot_basis *p_basis, const godot_vector3 *p_euler) { - Basis *basis = (Basis *)p_basis; - Vector3 *euler = (Vector3 *)p_euler; - *basis = Basis(*euler); -} - -godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_basis) { - const Basis *basis = (const Basis *)p_basis; - godot_quat quat; - Quat *p_quat = (Quat *)&quat; - *p_quat = basis->operator Quat(); - return quat; -} - -godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_basis) { - const Basis *basis = (const Basis *)p_basis; - godot_vector3 euler; - Vector3 *p_euler = (Vector3 *)&euler; - *p_euler = basis->get_euler(); - return euler; -} - -/* - * p_elements is a pointer to an array of 3 (!!) vector3 - */ -void GDAPI godot_basis_get_elements(godot_basis *p_basis, godot_vector3 *p_elements) { - Basis *basis = (Basis *)p_basis; - Vector3 *elements = (Vector3 *)p_elements; - elements[0] = basis->elements[0]; - elements[1] = basis->elements[1]; - elements[2] = basis->elements[2]; -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_basis.h b/modules/dlscript/godot/godot_basis.h deleted file mode 100644 index 43efd65ea2..0000000000 --- a/modules/dlscript/godot/godot_basis.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef GODOT_DLSCRIPT_BASIS_H -#define GODOT_DLSCRIPT_BASIS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED -typedef struct godot_basis { - uint8_t _dont_touch_that[36]; -} godot_basis; -#endif - -#include "../godot.h" - -void GDAPI godot_basis_new(godot_basis *p_basis); -void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_basis, const godot_quat *p_euler); -void GDAPI godot_basis_new_with_euler(godot_basis *p_basis, const godot_vector3 *p_euler); - -godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_basis); -godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_basis); - -/* - * p_elements is a pointer to an array of 3 (!!) vector3 - */ -void GDAPI godot_basis_get_elements(godot_basis *p_basis, godot_vector3 *p_elements); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_BASIS_H diff --git a/modules/dlscript/godot/godot_color.cpp b/modules/dlscript/godot/godot_color.cpp deleted file mode 100644 index 7e49565d40..0000000000 --- a/modules/dlscript/godot/godot_color.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "godot_color.h" - -#include "color.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _color_api_anchor() { -} - -void GDAPI godot_color_new(godot_color *p_color) { - Color *color = (Color *)p_color; - *color = Color(); -} - -void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a) { - Color *color = (Color *)p_color; - *color = Color(r, g, b, a); -} - -uint32_t GDAPI godot_color_get_32(const godot_color *p_color) { - const Color *color = (const Color *)p_color; - return color->to_32(); -} - -float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx) { - Color *color = (Color *)p_color; - return &color->operator[](idx); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_color.h b/modules/dlscript/godot/godot_color.h deleted file mode 100644 index 72e16a2c5a..0000000000 --- a/modules/dlscript/godot/godot_color.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef GODOT_DLSCRIPT_COLOR_H -#define GODOT_DLSCRIPT_COLOR_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED -typedef struct godot_color { - uint8_t _dont_touch_that[16]; -} godot_color; -#endif - -#include "../godot.h" - -void GDAPI godot_color_new(godot_color *p_color); -void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a); - -uint32_t GDAPI godot_color_get_32(const godot_color *p_color); - -float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_COLOR_H diff --git a/modules/dlscript/godot/godot_dictionary.h b/modules/dlscript/godot/godot_dictionary.h deleted file mode 100644 index 5f86cbca5a..0000000000 --- a/modules/dlscript/godot/godot_dictionary.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef GODOT_DLSCRIPT_DICTIONARY_H -#define GODOT_DLSCRIPT_DICTIONARY_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_DICITIONARY_TYPE_DEFINED -typedef struct godot_dictionary { - uint8_t _dont_touch_that[8]; -} godot_dictionary; -#endif - -#include "godot_array.h" -#include "godot_variant.h" - -void GDAPI godot_dictionary_new(godot_dictionary *p_dict); - -void GDAPI godot_dictionary_clear(godot_dictionary *p_dict); - -godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_dict); - -void GDAPI godot_dictionary_erase(godot_dictionary *p_dict, const godot_variant *p_key); - -godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_dict, const godot_variant *p_key); - -godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_dict, const godot_array *p_keys); - -uint32_t GDAPI godot_dictionary_hash(const godot_dictionary *p_dict); - -godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_dict); - -godot_int GDAPI godot_dictionary_parse_json(godot_dictionary *p_dict, const godot_string *p_json); - -godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key); - -godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_dict); - -godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_dict); - -godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_dict); - -void GDAPI godot_dictionary_destroy(godot_dictionary *p_dict); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_DICTIONARY_H diff --git a/modules/dlscript/godot/godot_node_path.cpp b/modules/dlscript/godot/godot_node_path.cpp deleted file mode 100644 index cc0652c75b..0000000000 --- a/modules/dlscript/godot/godot_node_path.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include "godot_node_path.h" - -#include "path_db.h" - -#include <memory.h> // why is there no <cmemory> btw? - -#ifdef __cplusplus -extern "C" { -#endif - -void _node_path_api_anchor() { -} - -#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr) - -// @Bug ? -// Do I need to memnew_placement when returning strings? - -void GDAPI godot_node_path_new(godot_node_path *p_np, const godot_string *p_from) { - NodePath *np = (NodePath *)p_np; - String *from = (String *)p_from; - memnew_placement_custom(np, NodePath, NodePath(*from)); -} - -godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_np, const godot_int p_idx) { - const NodePath *np = (const NodePath *)p_np; - godot_string str; - String *s = (String *)&str; - memnew_placement(s, String); - *s = np->get_name(p_idx); - return str; -} - -godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_np) { - const NodePath *np = (const NodePath *)p_np; - return np->get_name_count(); -} - -godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_np) { - const NodePath *np = (const NodePath *)p_np; - godot_string str; - String *s = (String *)&str; - memnew_placement(s, String); - *s = np->get_property(); - return str; -} - -godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_np, const godot_int p_idx) { - const NodePath *np = (const NodePath *)p_np; - godot_string str; - String *s = (String *)&str; - memnew_placement(s, String); - *s = np->get_subname(p_idx); - return str; -} - -godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_np) { - const NodePath *np = (const NodePath *)p_np; - return np->get_subname_count(); -} - -godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_np) { - const NodePath *np = (const NodePath *)p_np; - return np->is_absolute(); -} - -godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_np) { - const NodePath *np = (const NodePath *)p_np; - return np->is_empty(); -} - -godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_np) { - const NodePath *np = (const NodePath *)p_np; - godot_string str; - String *s = (String *)&str; - memnew_placement(s, String); - *s = *np; - return str; -} - -void GDAPI godot_node_path_destroy(godot_node_path *p_np) { - ((NodePath *)p_np)->~NodePath(); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_node_path.h b/modules/dlscript/godot/godot_node_path.h deleted file mode 100644 index b322e55d83..0000000000 --- a/modules/dlscript/godot/godot_node_path.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef GODOT_DLSCRIPT_NODE_PATH_H -#define GODOT_DLSCRIPT_NODE_PATH_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED -typedef struct godot_node_path { - uint8_t _dont_touch_that[8]; -} godot_node_path; -#endif - -#include "../godot.h" - -void GDAPI godot_node_path_new(godot_node_path *p_np, const godot_string *p_from); - -godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_np, const godot_int p_idx); -godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_np); - -godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_np); -godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_np, const godot_int p_idx); -godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_np); - -godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_np); -godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_np); - -godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_np); - -void GDAPI godot_node_path_destroy(godot_node_path *p_np); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_NODE_PATH_H diff --git a/modules/dlscript/godot/godot_plane.cpp b/modules/dlscript/godot/godot_plane.cpp deleted file mode 100644 index 883aeb6282..0000000000 --- a/modules/dlscript/godot/godot_plane.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "godot_plane.h" - -#include "math/plane.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _plane_api_anchor() { -} - -void GDAPI godot_plane_new(godot_plane *p_pl) { - Plane *pl = (Plane *)p_pl; - *pl = Plane(); -} - -void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d) { - Plane *pl = (Plane *)p_pl; - const Vector3 *normal = (const Vector3 *)p_normal; - *pl = Plane(*normal, p_d); -} - -void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal) { - Plane *pl = (Plane *)p_pl; - const Vector3 *normal = (const Vector3 *)p_normal; - pl->set_normal(*normal); -} - -godot_vector3 godot_plane_get_normal(const godot_plane *p_pl) { - const Plane *pl = (const Plane *)p_pl; - const Vector3 normal = pl->get_normal(); - godot_vector3 *v3 = (godot_vector3 *)&normal; - return *v3; -} - -void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d) { - Plane *pl = (Plane *)p_pl; - pl->d = p_d; -} - -godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl) { - const Plane *pl = (const Plane *)p_pl; - return pl->d; -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_plane.h b/modules/dlscript/godot/godot_plane.h deleted file mode 100644 index 1323ef4075..0000000000 --- a/modules/dlscript/godot/godot_plane.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef GODOT_DLSCRIPT_PLANE_H -#define GODOT_DLSCRIPT_PLANE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED -typedef struct godot_plane { - uint8_t _dont_touch_that[16]; -} godot_plane; -#endif - -#include "godot_vector3.h" - -void GDAPI godot_plane_new(godot_plane *p_pl); -void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d); - -// @Incomplete -// These are additional valid constructors -// _FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_d); -// _FORCE_INLINE_ Plane(const Vector3 &p_point, const Vector3& p_normal); -// _FORCE_INLINE_ Plane(const Vector3 &p_point1, const Vector3 &p_point2,const Vector3 &p_point3,ClockDirection p_dir = CLOCKWISE); - -void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal); -godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_pl); - -godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl); -void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_PLANE_H diff --git a/modules/dlscript/godot/godot_quat.cpp b/modules/dlscript/godot/godot_quat.cpp deleted file mode 100644 index 5571614e07..0000000000 --- a/modules/dlscript/godot/godot_quat.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include "godot_quat.h" - -#include "math/quat.h" - -#include <memory.h> // why is there no <cmemory> btw? - -#ifdef __cplusplus -extern "C" { -#endif - -void _quat_api_anchor() { -} - -void GDAPI godot_quat_new(godot_quat *p_quat) { - Quat *quat = (Quat *)p_quat; - *quat = Quat(); -} - -void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w) { - Quat *quat = (Quat *)p_quat; - *quat = Quat(x, y, z, w); -} - -void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle) { - Quat *quat = (Quat *)p_quat; - const Vector3 *axis = (const Vector3 *)p_axis; - *quat = Quat(*axis, p_angle); -} - -void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1) { - Quat *quat = (Quat *)p_quat; - const Vector3 *v0 = (const Vector3 *)p_v0; - const Vector3 *v1 = (const Vector3 *)p_v1; - *quat = Quat(*v0, *v1); -} - -godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat) { - Quat *quat = (Quat *)p_quat; - Vector3 euler = quat->get_euler(); - return *(godot_vector3 *)&euler; -} - -void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler) { - Quat *quat = (Quat *)p_quat; - const Vector3 *euler = (const Vector3 *)p_euler; - quat->set_euler(*euler); -} - -godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx) { - Quat *quat = (Quat *)p_quat; - switch (p_idx) { - case 0: - return &quat->x; - case 1: - return &quat->y; - case 2: - return &quat->z; - default: - return &quat->y; - } -} - -godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx) { - const Quat *quat = (const Quat *)p_quat; - switch (p_idx) { - case 0: - return quat->x; - case 1: - return quat->y; - case 2: - return quat->z; - default: - return quat->y; - } -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_quat.h b/modules/dlscript/godot/godot_quat.h deleted file mode 100644 index 4e3253c4e5..0000000000 --- a/modules/dlscript/godot/godot_quat.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef GODOT_DLSCRIPT_QUAT_H -#define GODOT_DLSCRIPT_QUAT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED -typedef struct godot_quat { - uint8_t _dont_touch_that[16]; -} godot_quat; -#endif - -#include "../godot.h" - -void GDAPI godot_quat_new(godot_quat *p_quat); -void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w); -void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle); -void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1); - -godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat); -void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler); - -godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx); -godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_QUAT_H diff --git a/modules/dlscript/godot/godot_rect2.cpp b/modules/dlscript/godot/godot_rect2.cpp deleted file mode 100644 index 8e60811114..0000000000 --- a/modules/dlscript/godot/godot_rect2.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "godot_rect2.h" - -#include "math/math_2d.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _rect2_api_anchor() { -} - -void GDAPI godot_rect2_new(godot_rect2 *p_rect) { - Rect2 *rect = (Rect2 *)p_rect; - *rect = Rect2(); -} - -void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size) { - Rect2 *rect = (Rect2 *)p_rect; - const Vector2 *pos = (const Vector2 *)p_pos; - const Vector2 *size = (const Vector2 *)p_size; - *rect = Rect2(*pos, *size); -} - -godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect) { - Rect2 *rect = (Rect2 *)p_rect; - return (godot_vector2 *)&rect->pos; -} - -void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos) { - Rect2 *rect = (Rect2 *)p_rect; - const Vector2 *pos = (const Vector2 *)p_pos; - rect->pos = *pos; -} - -godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect) { - Rect2 *rect = (Rect2 *)p_rect; - return (godot_vector2 *)&rect->size; -} - -void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size) { - Rect2 *rect = (Rect2 *)p_rect; - const Vector2 *size = (const Vector2 *)p_size; - rect->size = *size; -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_rect2.h b/modules/dlscript/godot/godot_rect2.h deleted file mode 100644 index a3b19bdb7e..0000000000 --- a/modules/dlscript/godot/godot_rect2.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef GODOT_DLSCRIPT_RECT2_H -#define GODOT_DLSCRIPT_RECT2_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED -typedef struct godot_rect2 { - uint8_t _dont_touch_that[16]; -} godot_rect2; -#endif - -#include "../godot.h" - -void GDAPI godot_rect2_new(godot_rect2 *p_rect); -void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size); - -godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect); -void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos); - -godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect); -void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_RECT3_H diff --git a/modules/dlscript/godot/godot_rect3.cpp b/modules/dlscript/godot/godot_rect3.cpp deleted file mode 100644 index 3c442a278b..0000000000 --- a/modules/dlscript/godot/godot_rect3.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "godot_rect3.h" - -#include "math/rect3.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _rect3_api_anchor() { -} - -void GDAPI godot_rect3_new(godot_rect3 *p_rect) { - Rect3 *rect = (Rect3 *)p_rect; - *rect = Rect3(); -} - -void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size) { - Rect3 *rect = (Rect3 *)p_rect; - const Vector3 *pos = (const Vector3 *)p_pos; - const Vector3 *size = (const Vector3 *)p_size; - *rect = Rect3(*pos, *size); -} - -godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect) { - Rect3 *rect = (Rect3 *)p_rect; - return (godot_vector3 *)&rect->pos; -} - -void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos) { - Rect3 *rect = (Rect3 *)p_rect; - const Vector3 *pos = (const Vector3 *)p_pos; - rect->pos = *pos; -} - -godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect) { - Rect3 *rect = (Rect3 *)p_rect; - return (godot_vector3 *)&rect->size; -} - -void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size) { - Rect3 *rect = (Rect3 *)p_rect; - const Vector3 *size = (const Vector3 *)p_size; - rect->size = *size; -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_rect3.h b/modules/dlscript/godot/godot_rect3.h deleted file mode 100644 index b9279616d1..0000000000 --- a/modules/dlscript/godot/godot_rect3.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef GODOT_DLSCRIPT_RECT3_H -#define GODOT_DLSCRIPT_RECT3_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED -typedef struct godot_rect3 { - uint8_t _dont_touch_that[24]; -} godot_rect3; -#endif - -#include "../godot.h" - -void GDAPI godot_rect3_new(godot_rect3 *p_rect); -void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size); - -godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect); -void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos); - -godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect); -void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_RECT3_H diff --git a/modules/dlscript/godot/godot_rid.cpp b/modules/dlscript/godot/godot_rid.cpp deleted file mode 100644 index a36a2e64a3..0000000000 --- a/modules/dlscript/godot/godot_rid.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "godot_rid.h" - -#include "object.h" -#include "resource.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _rid_api_anchor() { -} - -void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from) { - - Resource *res_from = ((Object *)p_from)->cast_to<Resource>(); - - RID *rid = (RID *)p_rid; - memnew_placement(rid, RID); - - if (res_from) { - *rid = RID(res_from->get_rid()); - } -} - -uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid) { - RID *rid = (RID *)p_rid; - return rid->get_id(); -} - -void GDAPI godot_rid_destroy(godot_rid *p_rid) { - ((RID *)p_rid)->~RID(); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_rid.h b/modules/dlscript/godot/godot_rid.h deleted file mode 100644 index f20c0d4dae..0000000000 --- a/modules/dlscript/godot/godot_rid.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef GODOT_DLSCRIPT_RID_H -#define GODOT_DLSCRIPT_RID_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_RID_TYPE_DEFINED -typedef struct godot_rid { - uint8_t _dont_touch_that[8]; -} godot_rid; -#endif - -#include "../godot.h" - -void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from); - -uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid); - -void GDAPI godot_rid_destroy(godot_rid *p_rid); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_RID_H diff --git a/modules/dlscript/godot/godot_string.cpp b/modules/dlscript/godot/godot_string.cpp deleted file mode 100644 index 1501743e02..0000000000 --- a/modules/dlscript/godot/godot_string.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include "godot_string.h" - -#include "string_db.h" -#include "ustring.h" - -#include <memory.h> // why is there no <cmemory> btw? - -#ifdef __cplusplus -extern "C" { -#endif - -void _string_api_anchor() { -} - -void GDAPI godot_string_new(godot_string *p_str) { - String *p = (String *)p_str; - memnew_placement(p, String); - // *p = String(); // useless here -} - -void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size) { - String *p = (String *)p_str; - memnew_placement(p, String); - *p = String::utf8(p_contents, p_size); -} - -void GDAPI godot_string_get_data(const godot_string *p_str, wchar_t *p_dest, int *p_size) { - String *p = (String *)p_str; - if (p_size != NULL) { - *p_size = p->length(); - } - if (p_dest != NULL) { - memcpy(p_dest, p->ptr(), *p_size * sizeof(CharType)); - } -} - -void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src) { - String *dest = (String *)p_dest; - String *src = (String *)p_src; - - *dest = *src; -} - -wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx) { - String *s = (String *)p_str; - return &(s->operator[](p_idx)); -} - -const wchar_t GDAPI *godot_string_c_str(const godot_string *p_str) { - const String *s = (const String *)p_str; - return s->c_str(); -} - -godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b) { - String *a = (String *)p_a; - String *b = (String *)p_b; - return *a == *b; -} - -godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b) { - String *a = (String *)p_a; - String *b = (String *)p_b; - return *a < *b; -} - -void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b) { - String *dest = (String *)p_dest; - const String *a = (String *)p_a; - const String *b = (String *)p_b; - - String tmp = *a + *b; - godot_string_new(p_dest); - *dest = tmp; -} - -void GDAPI godot_string_destroy(godot_string *p_str) { - String *p = (String *)p_str; - p->~String(); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_string.h b/modules/dlscript/godot/godot_string.h deleted file mode 100644 index 73b366d9cd..0000000000 --- a/modules/dlscript/godot/godot_string.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef GODOT_DLSCRIPT_STRING_H -#define GODOT_DLSCRIPT_STRING_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED -typedef struct godot_string { - uint8_t _dont_touch_that[8]; -} godot_string; -#endif - -#include "../godot.h" - -void GDAPI godot_string_new(godot_string *p_str); -void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size); - -void GDAPI godot_string_get_data(const godot_string *p_str, wchar_t *p_dest, int *p_size); - -void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src); - -wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx); -const wchar_t GDAPI *godot_string_c_str(const godot_string *p_str); - -godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b); -godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b); -void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b); - -// @Incomplete -// hmm, I guess exposing the whole API doesn't make much sense -// since the language used in the library has its own string funcs - -void GDAPI godot_string_destroy(godot_string *p_str); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_STRING_H diff --git a/modules/dlscript/godot/godot_transform.cpp b/modules/dlscript/godot/godot_transform.cpp deleted file mode 100644 index 18d218e6c4..0000000000 --- a/modules/dlscript/godot/godot_transform.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "godot_transform.h" - -#include "math/transform.h" - -#include <memory.h> // why is there no <cmemory> btw? - -#ifdef __cplusplus -extern "C" { -#endif - -void _transform_api_anchor() { -} - -void GDAPI godot_transform_new(godot_transform *p_trans) { - Transform *trans = (Transform *)p_trans; - *trans = Transform(); -} - -void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis) { - Transform *trans = (Transform *)p_trans; - const Basis *basis = (const Basis *)p_basis; - *trans = Transform(*basis); -} - -void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin) { - Transform *trans = (Transform *)p_trans; - const Basis *basis = (const Basis *)p_basis; - const Vector3 *origin = (const Vector3 *)p_origin; - *trans = Transform(*basis, *origin); -} - -godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans) { - Transform *trans = (Transform *)p_trans; - return (godot_basis *)&trans->basis; -} - -godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans) { - Transform *trans = (Transform *)p_trans; - return (godot_vector3 *)&trans->origin; -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_transform.h b/modules/dlscript/godot/godot_transform.h deleted file mode 100644 index 54af78d5b9..0000000000 --- a/modules/dlscript/godot/godot_transform.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef GODOT_DLSCRIPT_TRANSFORM_H -#define GODOT_DLSCRIPT_TRANSFORM_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED -typedef struct godot_transform { - uint8_t _dont_touch_that[48]; -} godot_transform; -#endif - -#include "../godot.h" - -void GDAPI godot_transform_new(godot_transform *p_trans); -void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis); -void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin); - -godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans); -godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_TRANSFORM_H diff --git a/modules/dlscript/godot/godot_transform2d.cpp b/modules/dlscript/godot/godot_transform2d.cpp deleted file mode 100644 index 39fa0e7363..0000000000 --- a/modules/dlscript/godot/godot_transform2d.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "godot_transform2d.h" - -#include "../godot.h" - -#include "math/math_2d.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _transform2d_api_anchor() { -} - -void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t) { - Transform2D *t = (Transform2D *)p_t; - *t = Transform2D(); -} - -void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c) { - Transform2D *t = (Transform2D *)p_t; - Vector2 *a = (Vector2 *)p_a; - Vector2 *b = (Vector2 *)p_b; - Vector2 *c = (Vector2 *)p_c; - *t = Transform2D(a->x, a->y, b->x, b->y, c->x, c->y); -} - -void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos) { - Transform2D *t = (Transform2D *)p_t; - Vector2 *pos = (Vector2 *)p_pos; - *t = Transform2D(p_rot, *pos); -} - -godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx) { - const Transform2D *t = (const Transform2D *)p_t; - const Vector2 *e = &t->operator[](p_idx); - return (godot_vector2 const *)e; -} - -godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx) { - Transform2D *t = (Transform2D *)p_t; - Vector2 *e = &t->operator[](p_idx); - return (godot_vector2 *)e; -} - -godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis) { - return *godot_transform2d_const_index(p_t, p_axis); -} - -void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec) { - godot_vector2 *origin_v = godot_transform2d_index(p_t, p_axis); - *origin_v = *p_vec; -} - -// @Incomplete -// See header file - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_transform2d.h b/modules/dlscript/godot/godot_transform2d.h deleted file mode 100644 index 7403954527..0000000000 --- a/modules/dlscript/godot/godot_transform2d.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef GODOT_TRANSFORM2D_H -#define GODOT_TRANSFORM2D_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED -typedef struct godot_transform2d { - uint8_t _dont_touch_that[24]; -} godot_transform2d; -#endif - -#include "../godot.h" - -#include "godot_vector2.h" - -void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t); -void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c); -void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos); - -/* -godot_real GDAPI godot_transform2d_tdotx(const godot_transform2d *p_t, const godot_vector2 *p_v); -godot_real GDAPI godot_transform2d_tdoty(const godot_transform2d *p_t, const godot_vector2 *p_v); -*/ - -godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx); -godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx); - -godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis); -void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec); - -/* -void GDAPI godot_transform2d_invert(godot_transform2d *p_t); -godot_transform2d GDAPI godot_transform2d_inverse(const godot_transform2d *p_t); -*/ - -// @Incomplete -// I feel like it should be enough to expose get and set, the whole logic can be done in the bindings. - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_TRANSFORM2D_H diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp index 13760b33aa..c05c86d9ae 100644 --- a/modules/enet/networked_multiplayer_enet.cpp +++ b/modules/enet/networked_multiplayer_enet.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h index deddf4ecc7..c20c1af68e 100644 --- a/modules/enet/networked_multiplayer_enet.h +++ b/modules/enet/networked_multiplayer_enet.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/enet/register_types.cpp b/modules/enet/register_types.cpp index 0dea038520..a6e6c87c14 100644 --- a/modules/enet/register_types.cpp +++ b/modules/enet/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/enet/register_types.h b/modules/enet/register_types.h index 14cb1ba868..9bcb35a92b 100644 --- a/modules/enet/register_types.h +++ b/modules/enet/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/etc1/image_etc.cpp b/modules/etc1/image_etc.cpp index 642ec027f3..60544594f6 100644 --- a/modules/etc1/image_etc.cpp +++ b/modules/etc1/image_etc.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/etc1/image_etc.h b/modules/etc1/image_etc.h index 18461819d6..69e082bb87 100644 --- a/modules/etc1/image_etc.h +++ b/modules/etc1/image_etc.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/etc1/register_types.cpp b/modules/etc1/register_types.cpp index b3b6419d26..859486222f 100644 --- a/modules/etc1/register_types.cpp +++ b/modules/etc1/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/etc1/register_types.h b/modules/etc1/register_types.h index fe92496cea..0552b87d65 100644 --- a/modules/etc1/register_types.h +++ b/modules/etc1/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/etc1/texture_loader_pkm.cpp b/modules/etc1/texture_loader_pkm.cpp index bce10e691e..9817de3a0f 100644 --- a/modules/etc1/texture_loader_pkm.cpp +++ b/modules/etc1/texture_loader_pkm.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/etc1/texture_loader_pkm.h b/modules/etc1/texture_loader_pkm.h index 19d15d21fc..8a0f06a51a 100644 --- a/modules/etc1/texture_loader_pkm.h +++ b/modules/etc1/texture_loader_pkm.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/freetype/register_types.cpp b/modules/freetype/register_types.cpp index 2579a925d4..3f290c2138 100644 --- a/modules/freetype/register_types.cpp +++ b/modules/freetype/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/freetype/register_types.h b/modules/freetype/register_types.h index 2837898123..c3ba324ed1 100644 --- a/modules/freetype/register_types.h +++ b/modules/freetype/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/freetype/uwpdef.h b/modules/freetype/uwpdef.h index b4aabb1929..c29b14dd12 100644 --- a/modules/freetype/uwpdef.h +++ b/modules/freetype/uwpdef.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/dlscript/SCsub b/modules/gdnative/SCsub index ac13319a1d..ac13319a1d 100644 --- a/modules/dlscript/SCsub +++ b/modules/gdnative/SCsub diff --git a/modules/dlscript/api_generator.cpp b/modules/gdnative/api_generator.cpp index c5c5cb46e6..f5d010f0a2 100644 --- a/modules/dlscript/api_generator.cpp +++ b/modules/gdnative/api_generator.cpp @@ -1,9 +1,39 @@ +/*************************************************************************/ +/* api_generator.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "api_generator.h" #ifdef TOOLS_ENABLED #include "class_db.h" #include "core/global_config.h" +#include "core/global_constants.h" #include "os/file_access.h" // helper stuff @@ -92,6 +122,23 @@ List<ClassAPI> generate_c_api_classes() { List<StringName> classes; ClassDB::get_class_list(&classes); + // Register global constants as a fake GlobalConstants singleton class + { + ClassAPI global_constants_api; + global_constants_api.class_name = L"GlobalConstants"; + global_constants_api.api_type = ClassDB::API_CORE; + global_constants_api.is_singleton = true; + global_constants_api.is_instanciable = false; + const int constants_count = GlobalConstants::get_global_constant_count(); + for (int i = 0; i < constants_count; ++i) { + ConstantAPI constant_api; + constant_api.constant_name = GlobalConstants::get_global_constant_name(i); + constant_api.constant_value = GlobalConstants::get_global_constant_value(i); + global_constants_api.constants.push_back(constant_api); + } + api.push_back(global_constants_api); + } + for (List<StringName>::Element *e = classes.front(); e != NULL; e = e->next()) { StringName class_name = e->get(); @@ -112,7 +159,7 @@ List<ClassAPI> generate_c_api_classes() { bool is_reference = false; List<StringName> inheriters; ClassDB::get_inheriters_from_class("Reference", &inheriters); - is_reference = inheriters.find(class_name) < 0; + is_reference = !!inheriters.find(class_name); // @Unclear class_api.memory_own = !class_api.is_singleton && is_reference; } @@ -230,8 +277,8 @@ List<ClassAPI> generate_c_api_classes() { method_api.has_varargs = method_bind && method_bind->is_vararg(); // Method flags - if (method_bind && method_bind->get_hint_flags()) { - const uint32_t flags = method_bind->get_hint_flags(); + if (method_info.flags) { + const uint32_t flags = method_info.flags; method_api.is_editor = flags & METHOD_FLAG_EDITOR; method_api.is_noscript = flags & METHOD_FLAG_NOSCRIPT; method_api.is_const = flags & METHOD_FLAG_CONST; @@ -240,6 +287,8 @@ List<ClassAPI> generate_c_api_classes() { method_api.is_from_script = flags & METHOD_FLAG_FROM_SCRIPT; } + method_api.is_virtual = method_api.is_virtual || method_api.method_name[0] == '_'; + // method argument name and type for (int i = 0; i < method_api.argument_count; i++) { @@ -346,6 +395,7 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) { source.push_back(String("\t\t\t\t\"is_const\": ") + (e->get().is_const ? "true" : "false") + ",\n"); source.push_back(String("\t\t\t\t\"is_reverse\": ") + (e->get().is_reverse ? "true" : "false") + ",\n"); source.push_back(String("\t\t\t\t\"is_virtual\": ") + (e->get().is_virtual ? "true" : "false") + ",\n"); + source.push_back(String("\t\t\t\t\"has_varargs\": ") + (e->get().has_varargs ? "true" : "false") + ",\n"); source.push_back(String("\t\t\t\t\"is_from_script\": ") + (e->get().is_from_script ? "true" : "false") + ",\n"); source.push_back("\t\t\t\t\"arguments\": [\n"); for (int i = 0; i < e->get().argument_names.size(); i++) { diff --git a/modules/gdnative/api_generator.h b/modules/gdnative/api_generator.h new file mode 100644 index 0000000000..a108d7a7b6 --- /dev/null +++ b/modules/gdnative/api_generator.h @@ -0,0 +1,38 @@ +/*************************************************************************/ +/* api_generator.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef API_GENERATOR_H +#define API_GENERATOR_H + +#include "core/ustring.h" +#include "typedefs.h" + +Error generate_c_api(const String &p_path); + +#endif // API_GENERATOR_H diff --git a/modules/dlscript/config.py b/modules/gdnative/config.py index 9f57b9bb74..9f57b9bb74 100644 --- a/modules/dlscript/config.py +++ b/modules/gdnative/config.py diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp new file mode 100644 index 0000000000..43b309ae36 --- /dev/null +++ b/modules/gdnative/gdnative.cpp @@ -0,0 +1,1234 @@ +/*************************************************************************/ +/* gdnative.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "gdnative.h" + +#include "global_config.h" +#include "global_constants.h" +#include "io/file_access_encrypted.h" +#include "os/file_access.h" +#include "os/os.h" + +#include "scene/main/scene_main_loop.h" +#include "scene/resources/scene_format_text.h" + +#if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED) +#include "api_generator.h" +#endif + +#ifdef TOOLS_ENABLED +#include "editor/editor_node.h" +#endif + +Error NativeLibrary::initialize(NativeLibrary *&p_native_lib, const StringName p_path) { + + if (GDNativeScriptLanguage::get_singleton()->initialized_libraries.has(p_path)) { + p_native_lib = GDNativeScriptLanguage::get_singleton()->initialized_libraries[p_path]; + return OK; + } + + NativeLibrary *lib = memnew(NativeLibrary); + lib->path = p_path; + + p_native_lib = lib; + + // Open the file + + Error error; + error = OS::get_singleton()->open_dynamic_library(p_path, lib->handle); + if (error) return error; + ERR_FAIL_COND_V(!lib->handle, ERR_BUG); + + // Get the method + + void *library_init; + error = OS::get_singleton()->get_dynamic_library_symbol_handle(lib->handle, GDNativeScriptLanguage::get_init_symbol_name(), library_init); + if (error) return error; + ERR_FAIL_COND_V(!library_init, ERR_BUG); + + void (*library_init_fpointer)(godot_native_init_options *) = (void (*)(godot_native_init_options *))library_init; + + godot_native_init_options options; + + options.in_editor = SceneTree::get_singleton()->is_editor_hint(); + /* + options.core_api_hash = ClassDB::get_api_hash(ClassDB::API_CORE); + options.editor_api_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR); + options.no_api_hash = ClassDB::get_api_hash(ClassDB::API_NONE); + */ + + library_init_fpointer(&options); // Catch errors? + + GDNativeScriptLanguage::get_singleton()->initialized_libraries[p_path] = lib; + + return OK; +} + +Error NativeLibrary::terminate(NativeLibrary *&p_native_lib) { + + if (!GDNativeScriptLanguage::get_singleton()->initialized_libraries.has(p_native_lib->path)) { + OS::get_singleton()->close_dynamic_library(p_native_lib->handle); + p_native_lib->handle = 0; + return OK; + } + + Error error = OK; + void *library_terminate; + error = OS::get_singleton()->get_dynamic_library_symbol_handle(p_native_lib->handle, GDNativeScriptLanguage::get_terminate_symbol_name(), library_terminate); + if (error) + return OK; // no terminate? okay, not that important lol + + void (*library_terminate_pointer)(godot_native_terminate_options *) = (void (*)(godot_native_terminate_options *))library_terminate; + + godot_native_terminate_options options; + options.in_editor = SceneTree::get_singleton()->is_editor_hint(); + + library_terminate_pointer(&options); + + GDNativeScriptLanguage::get_singleton()->initialized_libraries.erase(p_native_lib->path); + + OS::get_singleton()->close_dynamic_library(p_native_lib->handle); + p_native_lib->handle = 0; + + return OK; +} + +// Script +#ifdef TOOLS_ENABLED + +void GDNativeScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder) { + ERR_FAIL_COND(!script_data); + + List<PropertyInfo> pinfo; + Map<StringName, Variant> values; + + for (Map<StringName, GDNativeScriptData::Property>::Element *E = script_data->properties.front(); E; E = E->next()) { + PropertyInfo p = E->get().info; + p.name = String(E->key()); + pinfo.push_back(p); + values[p.name] = E->get().default_value; + } + + p_placeholder->update(pinfo, values); +} + +void GDNativeScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) { + + placeholders.erase(p_placeholder); +} + +#endif + +bool GDNativeScript::can_instance() const { +#ifdef TOOLS_ENABLED + return script_data || (!is_tool() && !ScriptServer::is_scripting_enabled()); +#else + // allow defaultlibrary without editor features + if (!library.is_valid()) { + String path = GLOBAL_GET("gdnative/default_gdnativelibrary"); + + RES lib = ResourceLoader::load(path); + + if (lib.is_valid() && lib->cast_to<GDNativeLibrary>()) { + return true; + } + } + + return script_data; +#endif + //return script_data || (!tool && !ScriptServer::is_scripting_enabled()); + // change to true enable in editor stuff. +} + +Ref<Script> GDNativeScript::get_base_script() const { + Ref<GDNativeScript> base_script; + base_script->library = library; + base_script->script_data = script_data; + base_script->script_name = script_data->base; + return base_script; +} + +StringName GDNativeScript::get_instance_base_type() const { + return script_data->base_native_type; +} + +ScriptInstance *GDNativeScript::instance_create(Object *p_this) { + +#ifdef TOOLS_ENABLED + + // find a good way to initialize stuff in the editor + if (!ScriptServer::is_scripting_enabled() && !is_tool()) { + // placeholder, for nodes. But for tools we want the real thing + + PlaceHolderScriptInstance *sins = memnew(PlaceHolderScriptInstance(GDNativeScriptLanguage::singleton, Ref<Script>((Script *)this), p_this)); + placeholders.insert(sins); + + if (!library.is_valid()) + return sins; + + if (!library->native_library) { + Error err = library->_initialize(); + if (err != OK) { + return sins; + } + } + + if (!script_data) { + script_data = library->get_script_data(script_name); + } + if (script_data && script_data->create_func.create_func) { + script_data->create_func.create_func((godot_object *)p_this, script_data->create_func.method_data); + } + + _update_placeholder(sins); + + return sins; + } + +#endif + + if (!library.is_valid()) { + String path = GLOBAL_GET("gdnative/default_gdnativelibrary"); + + RES lib = ResourceLoader::load(path); + + if (lib.is_valid() && lib->cast_to<GDNativeLibrary>()) { + set_library(lib); + } + } + + GDNativeInstance *new_instance = memnew(GDNativeInstance); + + new_instance->owner = p_this; + new_instance->script = Ref<GDNativeScript>(this); + +#ifndef TOOLS_ENABLED + if (!ScriptServer::is_scripting_enabled()) { + new_instance->userdata = 0; + } else { + new_instance->userdata = script_data->create_func.create_func((godot_object *)p_this, script_data->create_func.method_data); + } +#else + new_instance->userdata = script_data->create_func.create_func((godot_object *)p_this, script_data->create_func.method_data); +#endif + + instances.insert(p_this); + return new_instance; +} + +bool GDNativeScript::instance_has(const Object *p_this) const { + return instances.has((Object *)p_this); // TODO +} + +bool GDNativeScript::has_source_code() const { + return false; +} + +String GDNativeScript::get_source_code() const { + return ""; +} + +Error GDNativeScript::reload(bool p_keep_state) { + return FAILED; +} + +bool GDNativeScript::has_method(const StringName &p_method) const { + if (!script_data) + return false; + GDNativeScriptData *data = script_data; + + while (data) { + if (data->methods.has(p_method)) + return true; + + data = data->base_data; + } + + return false; +} + +MethodInfo GDNativeScript::get_method_info(const StringName &p_method) const { + if (!script_data) + return MethodInfo(); + GDNativeScriptData *data = script_data; + + while (data) { + if (data->methods.has(p_method)) + return data->methods[p_method].info; + + data = data->base_data; + } + + ERR_FAIL_COND_V(!script_data->methods.has(p_method), MethodInfo()); + return MethodInfo(); +} + +void GDNativeScript::get_script_method_list(List<MethodInfo> *p_list) const { + if (!script_data) return; + + Set<MethodInfo> methods; + GDNativeScriptData *data = script_data; + + while (data) { + for (Map<StringName, GDNativeScriptData::Method>::Element *E = data->methods.front(); E; E = E->next()) { + methods.insert(E->get().info); + } + data = data->base_data; + } + + for (Set<MethodInfo>::Element *E = methods.front(); E; E = E->next()) { + p_list->push_back(E->get()); + } +} + +void GDNativeScript::get_script_property_list(List<PropertyInfo> *p_list) const { + if (!script_data) return; + + Set<PropertyInfo> properties; + GDNativeScriptData *data = script_data; + + while (data) { + for (Map<StringName, GDNativeScriptData::Property>::Element *E = data->properties.front(); E; E = E->next()) { + properties.insert(E->get().info); + } + data = data->base_data; + } + + for (Set<PropertyInfo>::Element *E = properties.front(); E; E = E->next()) { + p_list->push_back(E->get()); + } +} + +bool GDNativeScript::get_property_default_value(const StringName &p_property, Variant &r_value) const { + if (!script_data) return false; + + GDNativeScriptData *data = script_data; + + while (data) { + if (data->properties.has(p_property)) { + r_value = data->properties[p_property].default_value; + return true; + } + + data = data->base_data; + } + + return false; +} + +bool GDNativeScript::is_tool() const { + ERR_FAIL_COND_V(!script_data, false); + return script_data->is_tool; +} + +String GDNativeScript::get_node_type() const { + return ""; // ? +} + +ScriptLanguage *GDNativeScript::get_language() const { + return GDNativeScriptLanguage::singleton; +} + +bool GDNativeScript::has_script_signal(const StringName &p_signal) const { + if (!script_data) + return false; + + GDNativeScriptData *data = script_data; + + while (data) { + if (data->signals_.has(p_signal)) { + return true; + } + + data = data->base_data; + } + + return false; +} + +void GDNativeScript::get_script_signal_list(List<MethodInfo> *r_signals) const { + if (!script_data) + return; + + Set<MethodInfo> signals_; + GDNativeScriptData *data = script_data; + + while (data) { + + for (Map<StringName, GDNativeScriptData::Signal>::Element *S = data->signals_.front(); S; S = S->next()) { + signals_.insert(S->get().signal); + } + + data = data->base_data; + } + + for (Set<MethodInfo>::Element *E = signals_.front(); E; E = E->next()) { + r_signals->push_back(E->get()); + } +} + +Ref<GDNativeLibrary> GDNativeScript::get_library() const { + return library; +} + +void GDNativeScript::set_library(Ref<GDNativeLibrary> p_library) { + library = p_library; + +#ifdef TOOLS_ENABLED + if (!ScriptServer::is_scripting_enabled()) + return; +#endif + if (library.is_valid()) { + Error initalize_status = library->_initialize(); + ERR_FAIL_COND(initalize_status != OK); + if (script_name) { + script_data = library->native_library->scripts[script_name]; + ERR_FAIL_COND(!script_data); + } + } +} + +StringName GDNativeScript::get_script_name() const { + return script_name; +} + +void GDNativeScript::set_script_name(StringName p_script_name) { + script_name = p_script_name; + + if (library.is_valid()) { +#ifdef TOOLS_ENABLED + if (!library->native_library) { + library->_initialize(); + } +#endif + if (library->native_library) { + script_data = library->get_script_data(script_name); + ERR_FAIL_COND(!script_data); + } + } +} + +void GDNativeScript::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_library"), &GDNativeScript::get_library); + ClassDB::bind_method(D_METHOD("set_library", "library"), &GDNativeScript::set_library); + ClassDB::bind_method(D_METHOD("get_script_name"), &GDNativeScript::get_script_name); + ClassDB::bind_method(D_METHOD("set_script_name", "script_name"), &GDNativeScript::set_script_name); + + ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "GDNativeLibrary"), "set_library", "get_library"); + ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "script_name"), "set_script_name", "get_script_name"); +} + +GDNativeScript::GDNativeScript() { + script_data = NULL; + GDNativeScriptLanguage::get_singleton()->script_list.insert(this); +} + +GDNativeScript::~GDNativeScript() { + //hmm + GDNativeScriptLanguage::get_singleton()->script_list.erase(this); +} + +// Library + +GDNativeLibrary *GDNativeLibrary::currently_initialized_library = NULL; + +GDNativeLibrary *GDNativeLibrary::get_currently_initialized_library() { + return currently_initialized_library; +} + +static const char *_dl_platforms_info[] = { + "|unix|so|Unix", + "unix|x11|so|X11", + "unix|server|so|Server", + "unix|android|so|Android", + "unix|blackberry|so|Blackberry 10", + "unix|haiku|so|Haiku", // Right? + "|mac|dynlib|Mac", + "mac|ios|dynlib|iOS", + "mac|osx|dynlib|OSX", + "|html5|js|HTML5", + "|windows|dll|Windows", + "windows|uwp|dll|UWP", + NULL // Finishing condition +}; + +void GDNativeLibrary::set_platform_file(StringName p_platform, String p_file) { + if (p_file.empty()) { + platform_files.erase(p_platform); + } else { + platform_files[p_platform] = p_file; + } +} + +String GDNativeLibrary::get_platform_file(StringName p_platform) const { + if (platform_files.has(p_platform)) { + return platform_files[p_platform]; + } else { + return ""; + } +} + +Error GDNativeLibrary::_initialize() { + _THREAD_SAFE_METHOD_ + + // Get the file + + const String platform_name = OS::get_singleton()->get_name(); + String platform_file(""); + char **platform_info = (char **)_dl_platforms_info; + + if (platform_files.has(platform_name.to_lower())) { + platform_file = platform_files[platform_name.to_lower()]; + } + + while (*platform_info) { + String platform_info_string(*platform_info); + + if (platform_name == platform_info_string.get_slicec('|', 3)) { + String platform_key = platform_info_string.get_slicec('|', 1); + String fallback_platform_key = platform_info_string.get_slicec('|', 0); + + if (platform_files.has(platform_key)) { + platform_file = platform_files[platform_key]; + } else if (!fallback_platform_key.empty() && platform_files.has(fallback_platform_key)) { + platform_file = platform_files[fallback_platform_key]; + } else { + return ERR_UNAVAILABLE; + } + } + platform_info++; + } + ERR_FAIL_COND_V(platform_file == "", ERR_DOES_NOT_EXIST); + + StringName path = GlobalConfig::get_singleton()->globalize_path(platform_file); + + GDNativeLibrary::currently_initialized_library = this; + + Error ret = NativeLibrary::initialize(native_library, path); + native_library->dllib = this; + + GDNativeLibrary::currently_initialized_library = NULL; + + return ret; +} + +Error GDNativeLibrary::_terminate() { + ERR_FAIL_COND_V(!native_library, ERR_BUG); + ERR_FAIL_COND_V(!native_library->handle, ERR_BUG); + + // de-init stuff + + for (Map<StringName, GDNativeScriptData *>::Element *E = native_library->scripts.front(); E; E = E->next()) { + for (Map<StringName, GDNativeScriptData::Method>::Element *M = E->get()->methods.front(); M; M = M->next()) { + if (M->get().method.free_func) { + M->get().method.free_func(M->get().method.method_data); + } + } + if (E->get()->create_func.free_func) { + E->get()->create_func.free_func(E->get()->create_func.method_data); + } + if (E->get()->destroy_func.free_func) { + E->get()->destroy_func.free_func(E->get()->destroy_func.method_data); + } + + for (Set<GDNativeScript *>::Element *S = GDNativeScriptLanguage::get_singleton()->script_list.front(); S; S = S->next()) { + if (S->get()->script_data == E->get()) { + S->get()->script_data = NULL; + } + } + + memdelete(E->get()); + } + + Error ret = NativeLibrary::terminate(native_library); + + native_library->scripts.clear(); + + return ret; +} + +void GDNativeLibrary::_register_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func) { + ERR_FAIL_COND(!native_library); + ERR_FAIL_COND(native_library->scripts.has(p_name)); + + GDNativeScriptData *s = memnew(GDNativeScriptData); + s->base = p_base; + s->create_func = p_instance_func; + s->destroy_func = p_destroy_func; + Map<StringName, GDNativeScriptData *>::Element *E = native_library->scripts.find(p_base); + if (E) { + s->base_data = E->get(); + s->base_native_type = s->base_data->base_native_type; + } else { + if (!ClassDB::class_exists(p_base)) { + memdelete(s); + ERR_EXPLAIN("Invalid base for registered type '" + p_name + "'"); + ERR_FAIL(); + } + s->base_native_type = p_base; + } + + native_library->scripts.insert(p_name, s); +} + +void GDNativeLibrary::_register_tool_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func) { + ERR_FAIL_COND(!native_library); + ERR_FAIL_COND(native_library->scripts.has(p_name)); + + GDNativeScriptData *s = memnew(GDNativeScriptData); + s->base = p_base; + s->create_func = p_instance_func; + s->destroy_func = p_destroy_func; + s->is_tool = true; + Map<StringName, GDNativeScriptData *>::Element *E = native_library->scripts.find(p_base); + if (E) { + s->base_data = E->get(); + s->base_native_type = s->base_data->base_native_type; + } else { + if (!ClassDB::class_exists(p_base)) { + memdelete(s); + ERR_EXPLAIN("Invalid base for registered type '" + p_name + "'"); + ERR_FAIL(); + } + s->base_native_type = p_base; + } + + native_library->scripts.insert(p_name, s); +} + +void GDNativeLibrary::_register_script_method(const StringName p_name, const StringName p_method, godot_method_attributes p_attr, godot_instance_method p_func, MethodInfo p_info) { + ERR_FAIL_COND(!native_library); + ERR_FAIL_COND(!native_library->scripts.has(p_name)); + + p_info.name = p_method; + GDNativeScriptData::Method method; + + method = GDNativeScriptData::Method(p_func, p_info, p_attr.rpc_type); + + native_library->scripts[p_name]->methods.insert(p_method, method); +} + +void GDNativeLibrary::_register_script_property(const StringName p_name, const String p_path, godot_property_attributes *p_attr, godot_property_set_func p_setter, godot_property_get_func p_getter) { + ERR_FAIL_COND(!native_library); + ERR_FAIL_COND(!native_library->scripts.has(p_name)); + + GDNativeScriptData::Property p; + + PropertyInfo pi; + pi.name = p_path; + + if (p_attr != NULL) { + pi = PropertyInfo((Variant::Type)p_attr->type, p_path, (PropertyHint)p_attr->hint, *(String *)&p_attr->hint_string, p_attr->usage); + + p = GDNativeScriptData::Property(p_setter, p_getter, pi, *(Variant *)&p_attr->default_value, p_attr->rset_type); + } + + native_library->scripts[p_name]->properties.insert(p_path, p); +} + +void GDNativeLibrary::_register_script_signal(const StringName p_name, const godot_signal *p_signal) { + ERR_FAIL_COND(!native_library); + ERR_FAIL_COND(!native_library->scripts.has(p_name)); + ERR_FAIL_COND(!p_signal); + + GDNativeScriptData::Signal signal; + + signal.signal.name = *(String *)&p_signal->name; + + { + List<PropertyInfo> arguments; + for (int i = 0; i < p_signal->num_args; i++) { + PropertyInfo info; + godot_signal_argument attrib = p_signal->args[i]; + + String *name = (String *)&attrib.name; + info.name = *name; + info.type = (Variant::Type)attrib.type; + info.hint = (PropertyHint)attrib.hint; + info.hint_string = *(String *)&attrib.hint_string; + info.usage = attrib.usage; + + arguments.push_back(info); + } + + signal.signal.arguments = arguments; + } + + { + Vector<Variant> default_arguments; + for (int i = 0; i < p_signal->num_default_args; i++) { + Variant *v; + godot_signal_argument attrib = p_signal->args[i]; + + v = (Variant *)&attrib.default_value; + + default_arguments.push_back(*v); + } + + signal.signal.default_arguments = default_arguments; + } + + native_library->scripts[p_name]->signals_.insert(*(String *)&p_signal->name, signal); +} + +GDNativeScriptData *GDNativeLibrary::get_script_data(const StringName p_name) { + ERR_FAIL_COND_V(!native_library, NULL); + + ERR_FAIL_COND_V(!native_library->scripts.has(p_name), NULL); + + return native_library->scripts[p_name]; +} + +bool GDNativeLibrary::_set(const StringName &p_name, const Variant &p_value) { + String name = p_name; + if (name.begins_with("platform/")) { + set_platform_file(name.get_slice("/", 1), p_value); + return true; + } + return false; +} + +bool GDNativeLibrary::_get(const StringName &p_name, Variant &r_ret) const { + String name = p_name; + if (name.begins_with("platform/")) { + r_ret = get_platform_file(name.get_slice("/", 1)); + return true; + } + return false; +} + +void GDNativeLibrary::_get_property_list(List<PropertyInfo> *p_list) const { + char **platform_info = (char **)_dl_platforms_info; + + Set<String> registered_platform_names; + { + List<StringName> ep; + // ep.push_back("X11"); + // EditorImportExport::get_singleton()->get_export_platforms(&ep); + + // @Todo + // get export platforms with the new export system somehow. + for (List<StringName>::Element *E = ep.front(); E; E = E->next()) { + registered_platform_names.insert(String(E->get()).to_lower()); + } + } + + while (*platform_info) { + String platform_info_string(*platform_info); + String fallback_platform_key = platform_info_string.get_slicec('|', 0); + String platform_key = platform_info_string.get_slicec('|', 1); + String platform_extension = platform_info_string.get_slicec('|', 2); + String platform_name = platform_info_string.get_slicec('|', 3); + + registered_platform_names.erase(platform_name); + + if (fallback_platform_key.empty()) { + p_list->push_back(PropertyInfo(Variant::STRING, "platform/" + platform_key, PROPERTY_HINT_FILE, "*." + platform_extension)); + + } else { + if (platform_files.has(platform_key)) { + p_list->push_back(PropertyInfo(Variant::STRING, "platform/" + platform_key, PROPERTY_HINT_FILE, "*." + platform_extension, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_CHECKABLE | PROPERTY_USAGE_CHECKED)); + } else { + p_list->push_back(PropertyInfo(Variant::STRING, "platform/" + platform_key, PROPERTY_HINT_FILE, "*." + platform_extension, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_CHECKABLE)); + } + } + platform_info++; + } + + while (registered_platform_names.size()) { + const String platform_name = registered_platform_names.front()->get(); + registered_platform_names.erase(platform_name); + p_list->push_back(PropertyInfo(Variant::STRING, "platform/" + platform_name.to_lower(), PROPERTY_HINT_FILE, "*")); + } +} + +void GDNativeLibrary::_notification(int what) { + // TODO +} + +void GDNativeLibrary::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_platform_file", "platform", "file"), &GDNativeLibrary::set_platform_file); + ClassDB::bind_method(D_METHOD("get_platform_file", "platform"), &GDNativeLibrary::get_platform_file); +} + +GDNativeLibrary::GDNativeLibrary() { + native_library = NULL; +} + +GDNativeLibrary::~GDNativeLibrary() { + + if (!native_library) { + return; + } + + if (native_library->handle) { + _terminate(); + } +} + +// Instance + +bool GDNativeInstance::set(const StringName &p_name, const Variant &p_value) { + if (!script->script_data) + return false; + if (script->script_data->properties.has(p_name)) { + script->script_data->properties[p_name].setter.set_func((godot_object *)owner, script->script_data->properties[p_name].setter.method_data, userdata, *(godot_variant *)&p_value); + return true; + } + return false; +} + +bool GDNativeInstance::get(const StringName &p_name, Variant &r_ret) const { + if (!script->script_data) + return false; + if (script->script_data->properties.has(p_name)) { + godot_variant value = script->script_data->properties[p_name].getter.get_func((godot_object *)owner, script->script_data->properties[p_name].getter.method_data, userdata); + r_ret = *(Variant *)&value; + return true; + } + return false; +} + +void GDNativeInstance::get_property_list(List<PropertyInfo> *p_properties) const { + script->get_script_property_list(p_properties); + // TODO: dynamic properties +} + +Variant::Type GDNativeInstance::get_property_type(const StringName &p_name, bool *r_is_valid) const { + if (script->script_data->properties.has(p_name)) { + *r_is_valid = true; + return script->script_data->properties[p_name].info.type; + } + *r_is_valid = false; + return Variant::NIL; +} + +void GDNativeInstance::get_method_list(List<MethodInfo> *p_list) const { + script->get_script_method_list(p_list); +} + +bool GDNativeInstance::has_method(const StringName &p_method) const { + return script->has_method(p_method); +} + +Variant GDNativeInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { + // TODO: validated methods & errors + + GDNativeScriptData *data_ptr = script->script_data; + while (data_ptr) { + Map<StringName, GDNativeScriptData::Method>::Element *E = data_ptr->methods.find(p_method); + if (E) { + godot_variant result = E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, p_argcount, (godot_variant **)p_args); + return *(Variant *)&result; + } + data_ptr = data_ptr->base_data; + } + r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + return Variant(); +} + +void GDNativeInstance::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) { + // TODO: validated methods & errors + + GDNativeScriptData *data_ptr = script->script_data; + while (data_ptr) { + Map<StringName, GDNativeScriptData::Method>::Element *E = data_ptr->methods.find(p_method); + if (E) { + E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, p_argcount, (godot_variant **)p_args); + } + data_ptr = data_ptr->base_data; + } +} + +void GDNativeInstance::_ml_call_reversed(GDNativeScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount) { + // TODO: validated methods & errors + + if (data_ptr->base_data) + _ml_call_reversed(data_ptr->base_data, p_method, p_args, p_argcount); + + // Variant::CallError ce; + + Map<StringName, GDNativeScriptData::Method>::Element *E = data_ptr->methods.find(p_method); + if (E) { + E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, p_argcount, (godot_variant **)p_args); + } +} + +void GDNativeInstance::call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount) { + if (script.ptr() && script->script_data) { + _ml_call_reversed(script->script_data, p_method, p_args, p_argcount); + } +} + +void GDNativeInstance::notification(int p_notification) { + Variant value = p_notification; + const Variant *args[1] = { &value }; + call_multilevel(GDNativeScriptLanguage::singleton->strings._notification, args, 1); +} + +Ref<Script> GDNativeInstance::get_script() const { + return script; +} + +ScriptLanguage *GDNativeInstance::get_language() { + return GDNativeScriptLanguage::singleton; +} + +ScriptInstance::RPCMode GDNativeInstance::get_rpc_mode(const StringName &p_method) const { + GDNativeScriptData::Method m = script->script_data->methods[p_method]; + switch (m.rpc_mode) { + case GODOT_METHOD_RPC_MODE_DISABLED: + return RPC_MODE_DISABLED; + case GODOT_METHOD_RPC_MODE_REMOTE: + return RPC_MODE_REMOTE; + case GODOT_METHOD_RPC_MODE_SYNC: + return RPC_MODE_SYNC; + case GODOT_METHOD_RPC_MODE_MASTER: + return RPC_MODE_MASTER; + case GODOT_METHOD_RPC_MODE_SLAVE: + return RPC_MODE_SLAVE; + default: + return RPC_MODE_DISABLED; + } +} + +ScriptInstance::RPCMode GDNativeInstance::get_rset_mode(const StringName &p_variable) const { + GDNativeScriptData::Property p = script->script_data->properties[p_variable]; + switch (p.rset_mode) { + case GODOT_METHOD_RPC_MODE_DISABLED: + return RPC_MODE_DISABLED; + case GODOT_METHOD_RPC_MODE_REMOTE: + return RPC_MODE_REMOTE; + case GODOT_METHOD_RPC_MODE_SYNC: + return RPC_MODE_SYNC; + case GODOT_METHOD_RPC_MODE_MASTER: + return RPC_MODE_MASTER; + case GODOT_METHOD_RPC_MODE_SLAVE: + return RPC_MODE_SLAVE; + default: + return RPC_MODE_DISABLED; + } +} + +GDNativeInstance::GDNativeInstance() { + owner = NULL; + userdata = NULL; +} + +GDNativeInstance::~GDNativeInstance() { + if (script.is_valid()) { + if (owner) { + script->instances.erase(owner); + } + if (!script->script_data) + return; + script->script_data->destroy_func.destroy_func((godot_object *)owner, script->script_data->destroy_func.method_data, userdata); + if (script->script_data->destroy_func.free_func) + script->script_data->destroy_func.free_func(script->script_data->destroy_func.method_data); + if (script->script_data->create_func.free_func) + script->script_data->create_func.free_func(script->script_data->create_func.method_data); + } +} + +// Language + +GDNativeScriptLanguage *GDNativeScriptLanguage::singleton = NULL; + +String GDNativeScriptLanguage::get_name() const { + return "Native"; +} + +void _add_reload_node() { +#ifdef TOOLS_ENABLED + GDNativeReloadNode *rn = memnew(GDNativeReloadNode); + EditorNode::get_singleton()->add_child(rn); +#endif +} + +void GDNativeScriptLanguage::init() { + // TODO: Expose globals + GLOBAL_DEF("gdnative/default_gdnativelibrary", ""); + PropertyInfo prop_info(Variant::STRING, "gdnative/default_gdnativelibrary", PROPERTY_HINT_FILE, "tres,res,dllib"); + GlobalConfig::get_singleton()->set_custom_property_info("gdnative/default_gdnativelibrary", prop_info); + +// generate bindings +#if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED) + + List<String> args = OS::get_singleton()->get_cmdline_args(); + + List<String>::Element *E = args.find("--gdnative-generate-json-api"); + + if (E && E->next()) { + if (generate_c_api(E->next()->get()) != OK) { + ERR_PRINT("Failed to generate C API\n"); + } + } +#endif + +#ifdef TOOLS_ENABLED + // if (SceneTree::get_singleton()->is_editor_hint()) { + EditorNode::add_init_callback(&_add_reload_node); +// } +#endif +} + +String GDNativeScriptLanguage::get_type() const { + return "Native"; +} + +String GDNativeScriptLanguage::get_extension() const { + return "gdn"; +} + +Error GDNativeScriptLanguage::execute_file(const String &p_path) { + return OK; // ?? +} + +void GDNativeScriptLanguage::finish() { + // cleanup is for noobs +} + +// scons doesn't want to link in the api source so we need to call a dummy function to cause it to link +extern "C" void _api_anchor(); + +void GDNativeScriptLanguage::_compile_dummy_for_the_api() { + _api_anchor(); +} + +Ref<Script> GDNativeScriptLanguage::get_template(const String &p_class_name, const String &p_base_class_name) const { + GDNativeScript *src = memnew(GDNativeScript); + src->set_script_name(p_class_name); + return Ref<GDNativeScript>(src); +} + +bool GDNativeScriptLanguage::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) const { + return false; // TODO +} + +Script *GDNativeScriptLanguage::create_script() const { + GDNativeScript *scr = memnew(GDNativeScript); + return scr; +} + +bool GDNativeScriptLanguage::has_named_classes() const { + return true; +} + +int GDNativeScriptLanguage::find_function(const String &p_function, const String &p_code) const { + return -1; // No source code! +} + +String GDNativeScriptLanguage::make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const { + return ""; // No source code! +} + +void GDNativeScriptLanguage::add_global_constant(const StringName &p_variable, const Variant &p_value) { + // TODO TODO TODO +} + +// TODO: Any debugging? (research) +String GDNativeScriptLanguage::debug_get_error() const { + return ""; +} + +int GDNativeScriptLanguage::debug_get_stack_level_count() const { + return 1; // ? +} + +int GDNativeScriptLanguage::debug_get_stack_level_line(int p_level) const { + return -1; +} + +String GDNativeScriptLanguage::debug_get_stack_level_function(int p_level) const { + return "[native code]"; // ? +} + +String GDNativeScriptLanguage::debug_get_stack_level_source(int p_level) const { + return ""; +} + +void GDNativeScriptLanguage::debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {} + +void GDNativeScriptLanguage::debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {} + +String GDNativeScriptLanguage::debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems, int p_max_depth) { + return ""; // ?? +} + +void GDNativeScriptLanguage::reload_all_scripts() { + // @Todo +} + +void GDNativeScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_soft_reload) { + // @Todo + OS::get_singleton()->print("reload tool scripts\n"); +} + +void GDNativeScriptLanguage::get_recognized_extensions(List<String> *p_extensions) const { + p_extensions->push_back("gdn"); // Container file format +} + +void GDNativeScriptLanguage::get_public_functions(List<MethodInfo> *p_functions) const { +} + +void GDNativeScriptLanguage::get_public_constants(List<Pair<String, Variant> > *p_constants) const { +} + +// TODO: all profilling +void GDNativeScriptLanguage::profiling_start() { +} + +void GDNativeScriptLanguage::profiling_stop() { +} + +int GDNativeScriptLanguage::profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max) { + return 0; +} + +int GDNativeScriptLanguage::profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max) { + return 0; +} + +void GDNativeScriptLanguage::frame() { +} + +String GDNativeScriptLanguage::get_init_symbol_name() { + return "godot_native_init"; // TODO: Maybe make some internal function which would do the actual stuff +} + +String GDNativeScriptLanguage::get_terminate_symbol_name() { + return "godot_native_terminate"; +} + +GDNativeScriptLanguage::GDNativeScriptLanguage() { + ERR_FAIL_COND(singleton); + strings._notification = StringName("_notification"); + singleton = this; + initialized_libraries = Map<StringName, NativeLibrary *>(); +} + +GDNativeScriptLanguage::~GDNativeScriptLanguage() { + singleton = NULL; +} + +// DLReloadNode + +void GDNativeReloadNode::_bind_methods() { + ClassDB::bind_method("_notification", &GDNativeReloadNode::_notification); +} + +void GDNativeReloadNode::_notification(int p_what) { +#ifdef TOOLS_ENABLED + + switch (p_what) { + case MainLoop::NOTIFICATION_WM_FOCUS_IN: { + + Set<NativeLibrary *> libs_to_reload; + + for (Map<StringName, NativeLibrary *>::Element *L = GDNativeScriptLanguage::get_singleton()->initialized_libraries.front(); L; L = L->next()) { + // check if file got modified at all + // @Todo + + libs_to_reload.insert(L->get()); + } + + for (Set<NativeLibrary *>::Element *L = libs_to_reload.front(); L; L = L->next()) { + + GDNativeLibrary *lib = L->get()->dllib; + + lib->_terminate(); + lib->_initialize(); + + // update placeholders (if any) + + GDNativeScript *script = NULL; + + for (Set<GDNativeScript *>::Element *S = GDNativeScriptLanguage::get_singleton()->script_list.front(); S; S = S->next()) { + if (lib->native_library->scripts.has(S->get()->get_script_name())) { + script = S->get(); + script->script_data = lib->get_script_data(script->get_script_name()); + break; + } + } + + if (script == NULL) { + // new class, cool. Nothing to do here + continue; + } + + if (script->placeholders.size() == 0) + continue; + + for (Set<PlaceHolderScriptInstance *>::Element *P = script->placeholders.front(); P; P = P->next()) { + PlaceHolderScriptInstance *p = P->get(); + script->_update_placeholder(p); + } + } + + } break; + default: { + }; + } +#endif +} + +// Resource loader/saver + +RES ResourceFormatLoaderGDNativeScript::load(const String &p_path, const String &p_original_path, Error *r_error) { + ResourceFormatLoaderText rsflt; + return rsflt.load(p_path, p_original_path, r_error); +} + +void ResourceFormatLoaderGDNativeScript::get_recognized_extensions(List<String> *p_extensions) const { + p_extensions->push_back("gdn"); +} +bool ResourceFormatLoaderGDNativeScript::handles_type(const String &p_type) const { + return (p_type == "Script" || p_type == "Native"); +} +String ResourceFormatLoaderGDNativeScript::get_resource_type(const String &p_path) const { + String el = p_path.get_extension().to_lower(); + if (el == "gdn") + return "Native"; + return ""; +} + +Error ResourceFormatSaverGDNativeScript::save(const String &p_path, const RES &p_resource, uint32_t p_flags) { + ResourceFormatSaverText rfst; + return rfst.save(p_path, p_resource, p_flags); +} + +bool ResourceFormatSaverGDNativeScript::recognize(const RES &p_resource) const { + return p_resource->cast_to<GDNativeScript>() != NULL; +} + +void ResourceFormatSaverGDNativeScript::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const { + if (p_resource->cast_to<GDNativeScript>()) { + p_extensions->push_back("gdn"); + } +} diff --git a/modules/dlscript/dl_script.h b/modules/gdnative/gdnative.h index 497208c832..89270b4e26 100644 --- a/modules/dlscript/dl_script.h +++ b/modules/gdnative/gdnative.h @@ -1,11 +1,12 @@ /*************************************************************************/ -/* dl_script.h */ +/* gdnative.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -26,23 +27,35 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef DL_SCRIPT_H -#define DL_SCRIPT_H +#ifndef GDNATIVE_H +#define GDNATIVE_H #include "io/resource_loader.h" #include "io/resource_saver.h" #include "os/thread_safe.h" #include "resource.h" +#include "scene/main/node.h" #include "script_language.h" #include "self_list.h" #include "godot.h" -#ifdef TOOLS_ENABLED -// #define DLSCRIPT_EDITOR_FEATURES -#endif +class GDNativeScriptData; +class GDNativeLibrary; + +struct NativeLibrary { + StringName path; + void *handle; -struct DLScriptData { + GDNativeLibrary *dllib; + + Map<StringName, GDNativeScriptData *> scripts; + + static Error initialize(NativeLibrary *&p_native_lib, const StringName p_path); + static Error terminate(NativeLibrary *&p_native_lib); +}; + +struct GDNativeScriptData { /* typedef void* (InstanceFunc)(godot_object* instance); typedef void (DestroyFunc)(godot_object* instance,void* userdata); typedef godot_variant (MethodFunc)(godot_object *instance, void *userdata, void *method_data, int arg_count,godot_variant **args); @@ -94,18 +107,18 @@ struct DLScriptData { Map<StringName, Signal> signals_; // QtCreator doesn't like the name signals StringName base; StringName base_native_type; - DLScriptData *base_data; + GDNativeScriptData *base_data; godot_instance_create_func create_func; godot_instance_destroy_func destroy_func; bool is_tool; - DLScriptData() { + GDNativeScriptData() { base = StringName(); base_data = NULL; is_tool = false; } - DLScriptData(StringName p_base, godot_instance_create_func p_instance, godot_instance_destroy_func p_free) { + GDNativeScriptData(StringName p_base, godot_instance_create_func p_instance, godot_instance_destroy_func p_free) { base = p_base; base_data = NULL; create_func = p_instance; @@ -114,26 +127,27 @@ struct DLScriptData { } }; -class DLLibrary; - -class DLScript : public Script { +class GDNativeLibrary; - GDCLASS(DLScript, Script); +class GDNativeScript : public Script { + GDCLASS(GDNativeScript, Script); - Ref<DLLibrary> library; + Ref<GDNativeLibrary> library; StringName script_name; StringName base_native_type; Set<Object *> instances; - DLScriptData *script_data; + GDNativeScriptData *script_data; #ifdef TOOLS_ENABLED Set<PlaceHolderScriptInstance *> placeholders; -// void _update_placeholder(PlaceHolderScriptInstance *p_placeholder); -// virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder); + void _update_placeholder(PlaceHolderScriptInstance *p_placeholder); + virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder); #endif - friend class DLInstance; - friend class DLScriptLanguage; + friend class GDNativeInstance; + friend class GDNativeScriptLanguage; + friend class GDNativeReloadNode; + friend class GDNativeLibrary; protected: static void _bind_methods(); @@ -170,42 +184,32 @@ public: virtual void get_script_method_list(List<MethodInfo> *p_list) const; virtual void get_script_property_list(List<PropertyInfo> *p_list) const; - Ref<DLLibrary> get_library() const; - void set_library(Ref<DLLibrary> p_library); + Ref<GDNativeLibrary> get_library() const; + void set_library(Ref<GDNativeLibrary> p_library); StringName get_script_name() const; void set_script_name(StringName p_script_name); - DLScript(); - ~DLScript(); + GDNativeScript(); + ~GDNativeScript(); }; -class DLLibrary : public Resource { +class GDNativeLibrary : public Resource { _THREAD_SAFE_CLASS_ - GDCLASS(DLLibrary, Resource); - OBJ_SAVE_TYPE(DLLibrary); + GDCLASS(GDNativeLibrary, Resource); + OBJ_SAVE_TYPE(GDNativeLibrary); Map<StringName, String> platform_files; - void *library_handle; - String library_path; - static DLLibrary *currently_initialized_library; - Map<StringName, DLScriptData *> scripts; + NativeLibrary *native_library; + static GDNativeLibrary *currently_initialized_library; protected: - friend class DLScript; - _FORCE_INLINE_ void _update_library(const DLLibrary &p_other) { - platform_files = p_other.platform_files; - library_handle = p_other.library_handle; - library_path = p_other.library_path; - scripts = p_other.scripts; - } - - Error _initialize_handle(bool p_in_editor = false); - - Error _free_handle(bool p_in_editor = false); + friend class GDNativeScript; + friend class NativeLibrary; + friend class GDNativeReloadNode; - DLScriptData *get_script_data(const StringName p_name); + GDNativeScriptData *get_script_data(const StringName p_name); bool _set(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_ret) const; @@ -214,7 +218,10 @@ protected: static void _bind_methods(); public: - static DLLibrary *get_currently_initialized_library(); + Error _initialize(); + Error _terminate(); + + static GDNativeLibrary *get_currently_initialized_library(); void _register_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func); void _register_tool_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func); @@ -225,18 +232,18 @@ public: void set_platform_file(StringName p_platform, String p_file); String get_platform_file(StringName p_platform) const; - DLLibrary(); - ~DLLibrary(); + GDNativeLibrary(); + ~GDNativeLibrary(); }; -class DLInstance : public ScriptInstance { - friend class DLScript; +class GDNativeInstance : public ScriptInstance { + friend class GDNativeScript; Object *owner; - Ref<DLScript> script; + Ref<GDNativeScript> script; void *userdata; - void _ml_call_reversed(DLScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount); + void _ml_call_reversed(GDNativeScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount); public: _FORCE_INLINE_ Object *get_owner() { return owner; } @@ -269,15 +276,19 @@ public: virtual RPCMode get_rpc_mode(const StringName &p_method) const; virtual RPCMode get_rset_mode(const StringName &p_variable) const; - DLInstance(); - ~DLInstance(); + GDNativeInstance(); + ~GDNativeInstance(); }; -class DLScriptLanguage : public ScriptLanguage { - friend class DLScript; - friend class DLInstance; +class GDNativeReloadNode; + +class GDNativeScriptLanguage : public ScriptLanguage { + friend class GDNativeScript; + friend class GDNativeInstance; + friend class GDNativeReloadNode; + friend class GDNativeLibrary; - static DLScriptLanguage *singleton; + static GDNativeScriptLanguage *singleton; Variant *_global_array; // @Unused necessary? Vector<Variant> global_array; // @Unused necessary? @@ -288,9 +299,7 @@ class DLScriptLanguage : public ScriptLanguage { Mutex *lock; - SelfList<DLScript>::List script_list; - - Map<String, DLLibrary *> initialized_libraries; + Set<GDNativeScript *> script_list; bool profiling; uint64_t script_frame_time; @@ -302,14 +311,11 @@ class DLScriptLanguage : public ScriptLanguage { } strings; public: - _FORCE_INLINE_ static DLScriptLanguage *get_singleton() { return singleton; } + Map<StringName, NativeLibrary *> initialized_libraries; - virtual String get_name() const; + _FORCE_INLINE_ static GDNativeScriptLanguage *get_singleton() { return singleton; } - bool is_library_initialized(const String &p_path); - void set_library_initialized(const String &p_path, DLLibrary *p_dllibrary); - DLLibrary *get_library_dllibrary(const String &p_path); - void set_library_uninitialized(const String &p_path); + virtual String get_name() const; /* LANGUAGE FUNCTIONS */ virtual void init(); @@ -381,11 +387,18 @@ public: /* HACKER FUNCTIONS */ void _compile_dummy_for_the_api(); - DLScriptLanguage(); - ~DLScriptLanguage(); + GDNativeScriptLanguage(); + ~GDNativeScriptLanguage(); }; -class ResourceFormatLoaderDLScript : public ResourceFormatLoader { +class GDNativeReloadNode : public Node { + GDCLASS(GDNativeReloadNode, Node) +public: + static void _bind_methods(); + void _notification(int p_what); +}; + +class ResourceFormatLoaderGDNativeScript : public ResourceFormatLoader { public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; @@ -393,12 +406,10 @@ public: virtual String get_resource_type(const String &p_path) const; }; -class ResourceFormatSaverDLScript : public ResourceFormatSaver { +class ResourceFormatSaverGDNativeScript : public ResourceFormatSaver { virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0); virtual bool recognize(const RES &p_resource) const; virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const; }; -// ugly, but hey - -#endif // DL_SCRIPT_H +#endif // GDNATIVE_H diff --git a/modules/dlscript/godot.cpp b/modules/gdnative/godot.cpp index 0e09a82de6..5ad716d0cd 100644 --- a/modules/dlscript/godot.cpp +++ b/modules/gdnative/godot.cpp @@ -1,11 +1,12 @@ /*************************************************************************/ -/* godot_c.cpp */ +/* godot.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -28,15 +29,12 @@ /*************************************************************************/ #include "godot.h" -#include <cstdlib> - #include "class_db.h" -#include "dl_script.h" +#include "gdnative.h" #include "global_config.h" +#include "global_constants.h" #include "variant.h" -#include <memory.h> - #ifdef __cplusplus extern "C" { #endif @@ -128,7 +126,7 @@ void GDAPI godot_method_bind_varcall(godot_method_bind *p_method_bind) // Script API void GDAPI godot_script_register_class(const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func) { - DLLibrary *library = DLLibrary::get_currently_initialized_library(); + GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library(); if (!library) { ERR_EXPLAIN("Attempt to register script after initializing library!"); ERR_FAIL(); @@ -137,7 +135,7 @@ void GDAPI godot_script_register_class(const char *p_name, const char *p_base, g } void GDAPI godot_script_register_tool_class(const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func) { - DLLibrary *library = DLLibrary::get_currently_initialized_library(); + GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library(); if (!library) { ERR_EXPLAIN("Attempt to register script after initializing library!"); ERR_FAIL(); @@ -146,7 +144,7 @@ void GDAPI godot_script_register_tool_class(const char *p_name, const char *p_ba } void GDAPI godot_script_register_method(const char *p_name, const char *p_function_name, godot_method_attributes p_attr, godot_instance_method p_method) { - DLLibrary *library = DLLibrary::get_currently_initialized_library(); + GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library(); if (!library) { ERR_EXPLAIN("Attempt to register script after initializing library!"); ERR_FAIL(); @@ -155,7 +153,7 @@ void GDAPI godot_script_register_method(const char *p_name, const char *p_functi } void GDAPI godot_script_register_property(const char *p_name, const char *p_path, godot_property_attributes *p_attr, godot_property_set_func p_set_func, godot_property_get_func p_get_func) { - DLLibrary *library = DLLibrary::get_currently_initialized_library(); + GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library(); if (!library) { ERR_EXPLAIN("Attempt to register script after initializing library!"); ERR_FAIL(); @@ -165,7 +163,7 @@ void GDAPI godot_script_register_property(const char *p_name, const char *p_path } void GDAPI godot_script_register_signal(const char *p_name, const godot_signal *p_signal) { - DLLibrary *library = DLLibrary::get_currently_initialized_library(); + GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library(); if (!library) { ERR_EXPLAIN("Attempt to register script after initializing library!"); ERR_FAIL(); @@ -174,16 +172,29 @@ void GDAPI godot_script_register_signal(const char *p_name, const godot_signal * library->_register_script_signal(p_name, p_signal); } -void GDAPI *godot_dlinstance_get_userdata(godot_object *p_instance) { +void GDAPI *godot_native_get_userdata(godot_object *p_instance) { Object *instance = (Object *)p_instance; if (!instance) return NULL; - if (instance->get_script_instance() && instance->get_script_instance()->get_language() == DLScriptLanguage::get_singleton()) { - return ((DLInstance *)instance->get_script_instance())->get_userdata(); + if (instance->get_script_instance() && instance->get_script_instance()->get_language() == GDNativeScriptLanguage::get_singleton()) { + return ((GDNativeInstance *)instance->get_script_instance())->get_userdata(); } return NULL; } +godot_dictionary GDAPI godot_get_global_constants() { + godot_dictionary constants; + godot_dictionary_new(&constants); + Dictionary *p_constants = (Dictionary *)&constants; + const int constants_count = GlobalConstants::get_global_constant_count(); + for (int i = 0; i < constants_count; ++i) { + const char *name = GlobalConstants::get_global_constant_name(i); + int value = GlobalConstants::get_global_constant_value(i); + (*p_constants)[name] = value; + } + return constants; +} + // System functions void GDAPI *godot_alloc(int p_bytes) { return memalloc(p_bytes); diff --git a/modules/dlscript/godot.h b/modules/gdnative/godot.h index 75f1f47ed1..45ac64feee 100644 --- a/modules/dlscript/godot.h +++ b/modules/gdnative/godot.h @@ -1,11 +1,12 @@ /*************************************************************************/ -/* godot_c.h */ +/* godot.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -216,16 +217,16 @@ void GDAPI godot_method_bind_ptrcall(godot_method_bind *p_method_bind, godot_obj ////// Script API -typedef struct godot_dlscript_init_options { +typedef struct godot_native_init_options { godot_bool in_editor; uint64_t core_api_hash; uint64_t editor_api_hash; uint64_t no_api_hash; -} godot_dlscript_init_options; +} godot_native_init_options; -typedef struct godot_dlscript_terminate_options { +typedef struct godot_native_terminate_options { godot_bool in_editor; -} godot_dlscript_terminate_options; +} godot_native_terminate_options; typedef enum godot_method_rpc_mode { GODOT_METHOD_RPC_MODE_DISABLED, @@ -373,7 +374,9 @@ typedef struct godot_signal { void GDAPI godot_script_register_signal(const char *p_name, const godot_signal *p_signal); -void GDAPI *godot_dlinstance_get_userdata(godot_object *p_instance); +void GDAPI *godot_native_get_userdata(godot_object *p_instance); + +godot_dictionary GDAPI godot_get_global_constants(); ////// System Functions diff --git a/modules/dlscript/godot/godot_array.cpp b/modules/gdnative/godot/godot_array.cpp index 21ad97ca78..6c55c5d048 100644 --- a/modules/dlscript/godot/godot_array.cpp +++ b/modules/gdnative/godot/godot_array.cpp @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_array.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "godot_array.h" #include "core/array.h" diff --git a/modules/dlscript/godot/godot_array.h b/modules/gdnative/godot/godot_array.h index 544e95a2ed..b92ebb834f 100644 --- a/modules/dlscript/godot/godot_array.h +++ b/modules/gdnative/godot/godot_array.h @@ -1,5 +1,35 @@ -#ifndef GODOT_DLSCRIPT_ARRAY_H -#define GODOT_DLSCRIPT_ARRAY_H +/*************************************************************************/ +/* godot_array.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef GODOT_ARRAY_H +#define GODOT_ARRAY_H #ifdef __cplusplus extern "C" { @@ -85,4 +115,4 @@ void GDAPI godot_array_destroy(godot_array *p_arr); } #endif -#endif // GODOT_DLSCRIPT_ARRAY_H +#endif // GODOT_ARRAY_H diff --git a/modules/gdnative/godot/godot_basis.cpp b/modules/gdnative/godot/godot_basis.cpp new file mode 100644 index 0000000000..4322acc401 --- /dev/null +++ b/modules/gdnative/godot/godot_basis.cpp @@ -0,0 +1,87 @@ +/*************************************************************************/ +/* godot_basis.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_basis.h" + +#include "math/matrix3.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _basis_api_anchor() { +} + +void GDAPI godot_basis_new(godot_basis *p_basis) { + Basis *basis = (Basis *)p_basis; + *basis = Basis(); +} + +void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_basis, const godot_quat *p_euler) { + Basis *basis = (Basis *)p_basis; + Quat *euler = (Quat *)p_euler; + *basis = Basis(*euler); +} + +void GDAPI godot_basis_new_with_euler(godot_basis *p_basis, const godot_vector3 *p_euler) { + Basis *basis = (Basis *)p_basis; + Vector3 *euler = (Vector3 *)p_euler; + *basis = Basis(*euler); +} + +godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_basis) { + const Basis *basis = (const Basis *)p_basis; + godot_quat quat; + Quat *p_quat = (Quat *)&quat; + *p_quat = basis->operator Quat(); + return quat; +} + +godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_basis) { + const Basis *basis = (const Basis *)p_basis; + godot_vector3 euler; + Vector3 *p_euler = (Vector3 *)&euler; + *p_euler = basis->get_euler(); + return euler; +} + +/* + * p_elements is a pointer to an array of 3 (!!) vector3 + */ +void GDAPI godot_basis_get_elements(godot_basis *p_basis, godot_vector3 *p_elements) { + Basis *basis = (Basis *)p_basis; + Vector3 *elements = (Vector3 *)p_elements; + elements[0] = basis->elements[0]; + elements[1] = basis->elements[1]; + elements[2] = basis->elements[2]; +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_basis.h b/modules/gdnative/godot/godot_basis.h new file mode 100644 index 0000000000..a8f19bfde5 --- /dev/null +++ b/modules/gdnative/godot/godot_basis.h @@ -0,0 +1,63 @@ +/*************************************************************************/ +/* godot_basis.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_BASIS_H +#define GODOT_BASIS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED +typedef struct godot_basis { + uint8_t _dont_touch_that[36]; +} godot_basis; +#endif + +#include "../godot.h" + +void GDAPI godot_basis_new(godot_basis *p_basis); +void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_basis, const godot_quat *p_euler); +void GDAPI godot_basis_new_with_euler(godot_basis *p_basis, const godot_vector3 *p_euler); + +godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_basis); +godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_basis); + +/* + * p_elements is a pointer to an array of 3 (!!) vector3 + */ +void GDAPI godot_basis_get_elements(godot_basis *p_basis, godot_vector3 *p_elements); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_BASIS_H diff --git a/modules/gdnative/godot/godot_color.cpp b/modules/gdnative/godot/godot_color.cpp new file mode 100644 index 0000000000..203ce672fa --- /dev/null +++ b/modules/gdnative/godot/godot_color.cpp @@ -0,0 +1,63 @@ +/*************************************************************************/ +/* godot_color.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_color.h" + +#include "color.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _color_api_anchor() { +} + +void GDAPI godot_color_new(godot_color *p_color) { + Color *color = (Color *)p_color; + *color = Color(); +} + +void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a) { + Color *color = (Color *)p_color; + *color = Color(r, g, b, a); +} + +uint32_t GDAPI godot_color_get_32(const godot_color *p_color) { + const Color *color = (const Color *)p_color; + return color->to_32(); +} + +float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx) { + Color *color = (Color *)p_color; + return &color->operator[](idx); +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_color.h b/modules/gdnative/godot/godot_color.h new file mode 100644 index 0000000000..b99a062a66 --- /dev/null +++ b/modules/gdnative/godot/godot_color.h @@ -0,0 +1,58 @@ +/*************************************************************************/ +/* godot_color.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_COLOR_H +#define GODOT_COLOR_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED +typedef struct godot_color { + uint8_t _dont_touch_that[16]; +} godot_color; +#endif + +#include "../godot.h" + +void GDAPI godot_color_new(godot_color *p_color); +void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a); + +uint32_t GDAPI godot_color_get_32(const godot_color *p_color); + +float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_COLOR_H diff --git a/modules/dlscript/godot/godot_dictionary.cpp b/modules/gdnative/godot/godot_dictionary.cpp index 9147b17307..16d08e58e2 100644 --- a/modules/dlscript/godot/godot_dictionary.cpp +++ b/modules/gdnative/godot/godot_dictionary.cpp @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_dictionary.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "godot_dictionary.h" #include "core/dictionary.h" diff --git a/modules/gdnative/godot/godot_dictionary.h b/modules/gdnative/godot/godot_dictionary.h new file mode 100644 index 0000000000..3f7c504880 --- /dev/null +++ b/modules/gdnative/godot/godot_dictionary.h @@ -0,0 +1,80 @@ +/*************************************************************************/ +/* godot_dictionary.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_DICTIONARY_H +#define GODOT_DICTIONARY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_DICITIONARY_TYPE_DEFINED +typedef struct godot_dictionary { + uint8_t _dont_touch_that[8]; +} godot_dictionary; +#endif + +#include "godot_array.h" +#include "godot_variant.h" + +void GDAPI godot_dictionary_new(godot_dictionary *p_dict); + +void GDAPI godot_dictionary_clear(godot_dictionary *p_dict); + +godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_dict); + +void GDAPI godot_dictionary_erase(godot_dictionary *p_dict, const godot_variant *p_key); + +godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_dict, const godot_variant *p_key); + +godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_dict, const godot_array *p_keys); + +uint32_t GDAPI godot_dictionary_hash(const godot_dictionary *p_dict); + +godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_dict); + +godot_int GDAPI godot_dictionary_parse_json(godot_dictionary *p_dict, const godot_string *p_json); + +godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key); + +godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_dict); + +godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_dict); + +godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_dict); + +void GDAPI godot_dictionary_destroy(godot_dictionary *p_dict); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_DICTIONARY_H diff --git a/modules/dlscript/godot/godot_image.cpp b/modules/gdnative/godot/godot_image.cpp index 362d1aa3e6..ae8290afc2 100644 --- a/modules/dlscript/godot/godot_image.cpp +++ b/modules/gdnative/godot/godot_image.cpp @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_image.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "godot_image.h" #include "image.h" diff --git a/modules/dlscript/godot/godot_image.h b/modules/gdnative/godot/godot_image.h index 78593f21a7..c43dd45148 100644 --- a/modules/dlscript/godot/godot_image.h +++ b/modules/gdnative/godot/godot_image.h @@ -1,5 +1,34 @@ -#ifndef GODOT_DLSCRIPT_IMAGE_H -#define GODOT_DLSCRIPT_IMAGE_H +/*************************************************************************/ +/* godot_image.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_IMAGE_H +#define GODOT_IMAGE_H #ifdef __cplusplus extern "C" { @@ -92,4 +121,4 @@ void GDAPI godot_image_destroy(godot_image *p_img); } #endif -#endif // GODOT_DLSCRIPT_IMAGE_H +#endif // GODOT_IMAGE_H diff --git a/modules/dlscript/godot/godot_input_event.cpp b/modules/gdnative/godot/godot_input_event.cpp index b50ed8a22d..0401c96a88 100644 --- a/modules/dlscript/godot/godot_input_event.cpp +++ b/modules/gdnative/godot/godot_input_event.cpp @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_input_event.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "godot_input_event.h" #include "os/input_event.h" diff --git a/modules/dlscript/godot/godot_input_event.h b/modules/gdnative/godot/godot_input_event.h index bfda18bf7c..b0a133e3d9 100644 --- a/modules/dlscript/godot/godot_input_event.h +++ b/modules/gdnative/godot/godot_input_event.h @@ -1,5 +1,34 @@ -#ifndef GODOT_DLSCRIPT_INPUT_EVENT_H -#define GODOT_DLSCRIPT_INPUT_EVENT_H +/*************************************************************************/ +/* godot_input_event.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_INPUT_EVENT_H +#define GODOT_INPUT_EVENT_H #ifdef __cplusplus extern "C" { @@ -203,4 +232,4 @@ float GDAPI *godot_input_event_screen_drag_get_speed_y(godot_input_event *p_even } #endif -#endif // GODOT_DLSCRIPT_INPUT_EVENT_H +#endif // GODOT_INPUT_EVENT_H diff --git a/modules/gdnative/godot/godot_node_path.cpp b/modules/gdnative/godot/godot_node_path.cpp new file mode 100644 index 0000000000..a2c9e11699 --- /dev/null +++ b/modules/gdnative/godot/godot_node_path.cpp @@ -0,0 +1,120 @@ +/*************************************************************************/ +/* godot_node_path.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_node_path.h" + +#include "path_db.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _node_path_api_anchor() { +} + +#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr) + +// @Bug ? +// Do I need to memnew_placement when returning strings? + +void GDAPI godot_node_path_new(godot_node_path *p_np, const godot_string *p_from) { + NodePath *np = (NodePath *)p_np; + String *from = (String *)p_from; + memnew_placement_custom(np, NodePath, NodePath(*from)); +} + +void GDAPI godot_node_path_copy(godot_node_path *p_np, const godot_node_path *p_from) { + NodePath *np = (NodePath *)p_np; + NodePath *from = (NodePath *)p_from; + *np = *from; +} + +godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_np, const godot_int p_idx) { + const NodePath *np = (const NodePath *)p_np; + godot_string str; + String *s = (String *)&str; + memnew_placement(s, String); + *s = np->get_name(p_idx); + return str; +} + +godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_np) { + const NodePath *np = (const NodePath *)p_np; + return np->get_name_count(); +} + +godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_np) { + const NodePath *np = (const NodePath *)p_np; + godot_string str; + String *s = (String *)&str; + memnew_placement(s, String); + *s = np->get_property(); + return str; +} + +godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_np, const godot_int p_idx) { + const NodePath *np = (const NodePath *)p_np; + godot_string str; + String *s = (String *)&str; + memnew_placement(s, String); + *s = np->get_subname(p_idx); + return str; +} + +godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_np) { + const NodePath *np = (const NodePath *)p_np; + return np->get_subname_count(); +} + +godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_np) { + const NodePath *np = (const NodePath *)p_np; + return np->is_absolute(); +} + +godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_np) { + const NodePath *np = (const NodePath *)p_np; + return np->is_empty(); +} + +godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_np) { + const NodePath *np = (const NodePath *)p_np; + godot_string str; + String *s = (String *)&str; + memnew_placement(s, String); + *s = *np; + return str; +} + +void GDAPI godot_node_path_destroy(godot_node_path *p_np) { + ((NodePath *)p_np)->~NodePath(); +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_node_path.h b/modules/gdnative/godot/godot_node_path.h new file mode 100644 index 0000000000..c5f313d190 --- /dev/null +++ b/modules/gdnative/godot/godot_node_path.h @@ -0,0 +1,68 @@ +/*************************************************************************/ +/* godot_node_path.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_NODE_PATH_H +#define GODOT_NODE_PATH_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED +typedef struct godot_node_path { + uint8_t _dont_touch_that[8]; +} godot_node_path; +#endif + +#include "../godot.h" + +void GDAPI godot_node_path_new(godot_node_path *p_np, const godot_string *p_from); +void GDAPI godot_node_path_copy(godot_node_path *p_np, const godot_node_path *p_from); + +godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_np, const godot_int p_idx); +godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_np); + +godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_np); +godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_np, const godot_int p_idx); +godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_np); + +godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_np); +godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_np); + +godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_np); + +void GDAPI godot_node_path_destroy(godot_node_path *p_np); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_NODE_PATH_H diff --git a/modules/gdnative/godot/godot_plane.cpp b/modules/gdnative/godot/godot_plane.cpp new file mode 100644 index 0000000000..38329ef709 --- /dev/null +++ b/modules/gdnative/godot/godot_plane.cpp @@ -0,0 +1,77 @@ +/*************************************************************************/ +/* godot_plane.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_plane.h" + +#include "math/plane.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _plane_api_anchor() { +} + +void GDAPI godot_plane_new(godot_plane *p_pl) { + Plane *pl = (Plane *)p_pl; + *pl = Plane(); +} + +void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d) { + Plane *pl = (Plane *)p_pl; + const Vector3 *normal = (const Vector3 *)p_normal; + *pl = Plane(*normal, p_d); +} + +void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal) { + Plane *pl = (Plane *)p_pl; + const Vector3 *normal = (const Vector3 *)p_normal; + pl->set_normal(*normal); +} + +godot_vector3 godot_plane_get_normal(const godot_plane *p_pl) { + const Plane *pl = (const Plane *)p_pl; + const Vector3 normal = pl->get_normal(); + godot_vector3 *v3 = (godot_vector3 *)&normal; + return *v3; +} + +void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d) { + Plane *pl = (Plane *)p_pl; + pl->d = p_d; +} + +godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl) { + const Plane *pl = (const Plane *)p_pl; + return pl->d; +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_plane.h b/modules/gdnative/godot/godot_plane.h new file mode 100644 index 0000000000..c98e45c9cb --- /dev/null +++ b/modules/gdnative/godot/godot_plane.h @@ -0,0 +1,66 @@ +/*************************************************************************/ +/* godot_plane.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_PLANE_H +#define GODOT_PLANE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED +typedef struct godot_plane { + uint8_t _dont_touch_that[16]; +} godot_plane; +#endif + +#include "godot_vector3.h" + +void GDAPI godot_plane_new(godot_plane *p_pl); +void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d); + +// @Incomplete +// These are additional valid constructors +// _FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_d); +// _FORCE_INLINE_ Plane(const Vector3 &p_point, const Vector3& p_normal); +// _FORCE_INLINE_ Plane(const Vector3 &p_point1, const Vector3 &p_point2,const Vector3 &p_point3,ClockDirection p_dir = CLOCKWISE); + +void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal); +godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_pl); + +godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl); +void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_PLANE_H diff --git a/modules/dlscript/godot/godot_pool_arrays.cpp b/modules/gdnative/godot/godot_pool_arrays.cpp index 3fb030f835..93e9a9e9dc 100644 --- a/modules/dlscript/godot/godot_pool_arrays.cpp +++ b/modules/gdnative/godot/godot_pool_arrays.cpp @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_pool_arrays.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "godot_pool_arrays.h" #include "array.h" diff --git a/modules/dlscript/godot/godot_pool_arrays.h b/modules/gdnative/godot/godot_pool_arrays.h index 77b6c3dde0..ec9185f6f3 100644 --- a/modules/dlscript/godot/godot_pool_arrays.h +++ b/modules/gdnative/godot/godot_pool_arrays.h @@ -1,5 +1,34 @@ -#ifndef GODOT_DLSCRIPT_POOL_ARRAYS_H -#define GODOT_DLSCRIPT_POOL_ARRAYS_H +/*************************************************************************/ +/* godot_pool_arrays.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_POOL_ARRAYS_H +#define GODOT_POOL_ARRAYS_H #ifdef __cplusplus extern "C" { @@ -253,4 +282,4 @@ void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_pca); } #endif -#endif // GODOT_DLSCRIPT_POOL_ARRAYS_H +#endif // GODOT_POOL_ARRAYS_H diff --git a/modules/gdnative/godot/godot_quat.cpp b/modules/gdnative/godot/godot_quat.cpp new file mode 100644 index 0000000000..7c3a71dfc0 --- /dev/null +++ b/modules/gdnative/godot/godot_quat.cpp @@ -0,0 +1,106 @@ +/*************************************************************************/ +/* godot_quat.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_quat.h" + +#include "math/quat.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _quat_api_anchor() { +} + +void GDAPI godot_quat_new(godot_quat *p_quat) { + Quat *quat = (Quat *)p_quat; + *quat = Quat(); +} + +void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w) { + Quat *quat = (Quat *)p_quat; + *quat = Quat(x, y, z, w); +} + +void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle) { + Quat *quat = (Quat *)p_quat; + const Vector3 *axis = (const Vector3 *)p_axis; + *quat = Quat(*axis, p_angle); +} + +void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1) { + Quat *quat = (Quat *)p_quat; + const Vector3 *v0 = (const Vector3 *)p_v0; + const Vector3 *v1 = (const Vector3 *)p_v1; + *quat = Quat(*v0, *v1); +} + +godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat) { + Quat *quat = (Quat *)p_quat; + Vector3 euler = quat->get_euler(); + return *(godot_vector3 *)&euler; +} + +void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler) { + Quat *quat = (Quat *)p_quat; + const Vector3 *euler = (const Vector3 *)p_euler; + quat->set_euler(*euler); +} + +godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx) { + Quat *quat = (Quat *)p_quat; + switch (p_idx) { + case 0: + return &quat->x; + case 1: + return &quat->y; + case 2: + return &quat->z; + default: + return &quat->y; + } +} + +godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx) { + const Quat *quat = (const Quat *)p_quat; + switch (p_idx) { + case 0: + return quat->x; + case 1: + return quat->y; + case 2: + return quat->z; + default: + return quat->y; + } +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_quat.h b/modules/gdnative/godot/godot_quat.h new file mode 100644 index 0000000000..35b1acd3ed --- /dev/null +++ b/modules/gdnative/godot/godot_quat.h @@ -0,0 +1,62 @@ +/*************************************************************************/ +/* godot_quat.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_QUAT_H +#define GODOT_QUAT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED +typedef struct godot_quat { + uint8_t _dont_touch_that[16]; +} godot_quat; +#endif + +#include "../godot.h" + +void GDAPI godot_quat_new(godot_quat *p_quat); +void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w); +void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle); +void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1); + +godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat); +void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler); + +godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx); +godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_QUAT_H diff --git a/modules/gdnative/godot/godot_rect2.cpp b/modules/gdnative/godot/godot_rect2.cpp new file mode 100644 index 0000000000..b19096b79e --- /dev/null +++ b/modules/gdnative/godot/godot_rect2.cpp @@ -0,0 +1,77 @@ +/*************************************************************************/ +/* godot_rect2.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_rect2.h" + +#include "math/math_2d.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _rect2_api_anchor() { +} + +void GDAPI godot_rect2_new(godot_rect2 *p_rect) { + Rect2 *rect = (Rect2 *)p_rect; + *rect = Rect2(); +} + +void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size) { + Rect2 *rect = (Rect2 *)p_rect; + const Vector2 *pos = (const Vector2 *)p_pos; + const Vector2 *size = (const Vector2 *)p_size; + *rect = Rect2(*pos, *size); +} + +godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect) { + Rect2 *rect = (Rect2 *)p_rect; + return (godot_vector2 *)&rect->pos; +} + +void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos) { + Rect2 *rect = (Rect2 *)p_rect; + const Vector2 *pos = (const Vector2 *)p_pos; + rect->pos = *pos; +} + +godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect) { + Rect2 *rect = (Rect2 *)p_rect; + return (godot_vector2 *)&rect->size; +} + +void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size) { + Rect2 *rect = (Rect2 *)p_rect; + const Vector2 *size = (const Vector2 *)p_size; + rect->size = *size; +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_rect2.h b/modules/gdnative/godot/godot_rect2.h new file mode 100644 index 0000000000..e9e4a26897 --- /dev/null +++ b/modules/gdnative/godot/godot_rect2.h @@ -0,0 +1,60 @@ +/*************************************************************************/ +/* godot_rect2.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_RECT2_H +#define GODOT_RECT2_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED +typedef struct godot_rect2 { + uint8_t _dont_touch_that[16]; +} godot_rect2; +#endif + +#include "../godot.h" + +void GDAPI godot_rect2_new(godot_rect2 *p_rect); +void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size); + +godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect); +void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos); + +godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect); +void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_RECT3_H diff --git a/modules/gdnative/godot/godot_rect3.cpp b/modules/gdnative/godot/godot_rect3.cpp new file mode 100644 index 0000000000..96c5d17b1a --- /dev/null +++ b/modules/gdnative/godot/godot_rect3.cpp @@ -0,0 +1,77 @@ +/*************************************************************************/ +/* godot_rect3.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_rect3.h" + +#include "math/rect3.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _rect3_api_anchor() { +} + +void GDAPI godot_rect3_new(godot_rect3 *p_rect) { + Rect3 *rect = (Rect3 *)p_rect; + *rect = Rect3(); +} + +void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size) { + Rect3 *rect = (Rect3 *)p_rect; + const Vector3 *pos = (const Vector3 *)p_pos; + const Vector3 *size = (const Vector3 *)p_size; + *rect = Rect3(*pos, *size); +} + +godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect) { + Rect3 *rect = (Rect3 *)p_rect; + return (godot_vector3 *)&rect->pos; +} + +void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos) { + Rect3 *rect = (Rect3 *)p_rect; + const Vector3 *pos = (const Vector3 *)p_pos; + rect->pos = *pos; +} + +godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect) { + Rect3 *rect = (Rect3 *)p_rect; + return (godot_vector3 *)&rect->size; +} + +void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size) { + Rect3 *rect = (Rect3 *)p_rect; + const Vector3 *size = (const Vector3 *)p_size; + rect->size = *size; +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_rect3.h b/modules/gdnative/godot/godot_rect3.h new file mode 100644 index 0000000000..562ac8379e --- /dev/null +++ b/modules/gdnative/godot/godot_rect3.h @@ -0,0 +1,60 @@ +/*************************************************************************/ +/* godot_rect3.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_RECT3_H +#define GODOT_RECT3_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED +typedef struct godot_rect3 { + uint8_t _dont_touch_that[24]; +} godot_rect3; +#endif + +#include "../godot.h" + +void GDAPI godot_rect3_new(godot_rect3 *p_rect); +void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size); + +godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect); +void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos); + +godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect); +void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_RECT3_H diff --git a/modules/gdnative/godot/godot_rid.cpp b/modules/gdnative/godot/godot_rid.cpp new file mode 100644 index 0000000000..fff31e3992 --- /dev/null +++ b/modules/gdnative/godot/godot_rid.cpp @@ -0,0 +1,65 @@ +/*************************************************************************/ +/* godot_rid.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_rid.h" + +#include "object.h" +#include "resource.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _rid_api_anchor() { +} + +void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from) { + + Resource *res_from = ((Object *)p_from)->cast_to<Resource>(); + + RID *rid = (RID *)p_rid; + memnew_placement(rid, RID); + + if (res_from) { + *rid = RID(res_from->get_rid()); + } +} + +uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid) { + RID *rid = (RID *)p_rid; + return rid->get_id(); +} + +void GDAPI godot_rid_destroy(godot_rid *p_rid) { + ((RID *)p_rid)->~RID(); +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_rid.h b/modules/gdnative/godot/godot_rid.h new file mode 100644 index 0000000000..e00c8f89ad --- /dev/null +++ b/modules/gdnative/godot/godot_rid.h @@ -0,0 +1,57 @@ +/*************************************************************************/ +/* godot_rid.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_RID_H +#define GODOT_RID_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_RID_TYPE_DEFINED +typedef struct godot_rid { + uint8_t _dont_touch_that[8]; +} godot_rid; +#endif + +#include "../godot.h" + +void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from); + +uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid); + +void GDAPI godot_rid_destroy(godot_rid *p_rid); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_RID_H diff --git a/modules/gdnative/godot/godot_string.cpp b/modules/gdnative/godot/godot_string.cpp new file mode 100644 index 0000000000..2a78b2c96f --- /dev/null +++ b/modules/gdnative/godot/godot_string.cpp @@ -0,0 +1,112 @@ +/*************************************************************************/ +/* godot_string.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_string.h" + +#include "string_db.h" +#include "ustring.h" + +#include <string.h> + +#ifdef __cplusplus +extern "C" { +#endif + +void _string_api_anchor() { +} + +void GDAPI godot_string_new(godot_string *p_str) { + String *p = (String *)p_str; + memnew_placement(p, String); + // *p = String(); // useless here +} + +void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size) { + String *p = (String *)p_str; + memnew_placement(p, String); + *p = String::utf8(p_contents, p_size); +} + +void GDAPI godot_string_get_data(const godot_string *p_str, wchar_t *p_dest, int *p_size) { + String *p = (String *)p_str; + if (p_size != NULL) { + *p_size = p->length(); + } + if (p_dest != NULL) { + memcpy(p_dest, p->ptr(), *p_size * sizeof(CharType)); + } +} + +void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src) { + String *dest = (String *)p_dest; + String *src = (String *)p_src; + + *dest = *src; +} + +wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx) { + String *s = (String *)p_str; + return &(s->operator[](p_idx)); +} + +const wchar_t GDAPI *godot_string_c_str(const godot_string *p_str) { + const String *s = (const String *)p_str; + return s->c_str(); +} + +godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b) { + String *a = (String *)p_a; + String *b = (String *)p_b; + return *a == *b; +} + +godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b) { + String *a = (String *)p_a; + String *b = (String *)p_b; + return *a < *b; +} + +void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b) { + String *dest = (String *)p_dest; + const String *a = (String *)p_a; + const String *b = (String *)p_b; + + String tmp = *a + *b; + godot_string_new(p_dest); + *dest = tmp; +} + +void GDAPI godot_string_destroy(godot_string *p_str) { + String *p = (String *)p_str; + p->~String(); +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_string.h b/modules/gdnative/godot/godot_string.h new file mode 100644 index 0000000000..7cde482cce --- /dev/null +++ b/modules/gdnative/godot/godot_string.h @@ -0,0 +1,71 @@ +/*************************************************************************/ +/* godot_string.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_STRING_H +#define GODOT_STRING_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED +typedef struct godot_string { + uint8_t _dont_touch_that[8]; +} godot_string; +#endif + +#include "../godot.h" + +void GDAPI godot_string_new(godot_string *p_str); +void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size); + +void GDAPI godot_string_get_data(const godot_string *p_str, wchar_t *p_dest, int *p_size); + +void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src); + +wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx); +const wchar_t GDAPI *godot_string_c_str(const godot_string *p_str); + +godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b); +godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b); +void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b); + +// @Incomplete +// hmm, I guess exposing the whole API doesn't make much sense +// since the language used in the library has its own string funcs + +void GDAPI godot_string_destroy(godot_string *p_str); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_STRING_H diff --git a/modules/gdnative/godot/godot_transform.cpp b/modules/gdnative/godot/godot_transform.cpp new file mode 100644 index 0000000000..681c2b049a --- /dev/null +++ b/modules/gdnative/godot/godot_transform.cpp @@ -0,0 +1,71 @@ +/*************************************************************************/ +/* godot_transform.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_transform.h" + +#include "math/transform.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _transform_api_anchor() { +} + +void GDAPI godot_transform_new(godot_transform *p_trans) { + Transform *trans = (Transform *)p_trans; + *trans = Transform(); +} + +void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis) { + Transform *trans = (Transform *)p_trans; + const Basis *basis = (const Basis *)p_basis; + *trans = Transform(*basis); +} + +void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin) { + Transform *trans = (Transform *)p_trans; + const Basis *basis = (const Basis *)p_basis; + const Vector3 *origin = (const Vector3 *)p_origin; + *trans = Transform(*basis, *origin); +} + +godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans) { + Transform *trans = (Transform *)p_trans; + return (godot_basis *)&trans->basis; +} + +godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans) { + Transform *trans = (Transform *)p_trans; + return (godot_vector3 *)&trans->origin; +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_transform.h b/modules/gdnative/godot/godot_transform.h new file mode 100644 index 0000000000..93817ffbf2 --- /dev/null +++ b/modules/gdnative/godot/godot_transform.h @@ -0,0 +1,58 @@ +/*************************************************************************/ +/* godot_transform.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_TRANSFORM_H +#define GODOT_TRANSFORM_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED +typedef struct godot_transform { + uint8_t _dont_touch_that[48]; +} godot_transform; +#endif + +#include "../godot.h" + +void GDAPI godot_transform_new(godot_transform *p_trans); +void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis); +void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin); + +godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans); +godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_TRANSFORM_H diff --git a/modules/gdnative/godot/godot_transform2d.cpp b/modules/gdnative/godot/godot_transform2d.cpp new file mode 100644 index 0000000000..ffc7167559 --- /dev/null +++ b/modules/gdnative/godot/godot_transform2d.cpp @@ -0,0 +1,88 @@ +/*************************************************************************/ +/* godot_transform2d.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_transform2d.h" + +#include "../godot.h" + +#include "math/math_2d.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _transform2d_api_anchor() { +} + +void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t) { + Transform2D *t = (Transform2D *)p_t; + *t = Transform2D(); +} + +void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c) { + Transform2D *t = (Transform2D *)p_t; + Vector2 *a = (Vector2 *)p_a; + Vector2 *b = (Vector2 *)p_b; + Vector2 *c = (Vector2 *)p_c; + *t = Transform2D(a->x, a->y, b->x, b->y, c->x, c->y); +} + +void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos) { + Transform2D *t = (Transform2D *)p_t; + Vector2 *pos = (Vector2 *)p_pos; + *t = Transform2D(p_rot, *pos); +} + +godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx) { + const Transform2D *t = (const Transform2D *)p_t; + const Vector2 *e = &t->operator[](p_idx); + return (godot_vector2 const *)e; +} + +godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx) { + Transform2D *t = (Transform2D *)p_t; + Vector2 *e = &t->operator[](p_idx); + return (godot_vector2 *)e; +} + +godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis) { + return *godot_transform2d_const_index(p_t, p_axis); +} + +void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec) { + godot_vector2 *origin_v = godot_transform2d_index(p_t, p_axis); + *origin_v = *p_vec; +} + +// @Incomplete +// See header file + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_transform2d.h b/modules/gdnative/godot/godot_transform2d.h new file mode 100644 index 0000000000..ae0569dbe8 --- /dev/null +++ b/modules/gdnative/godot/godot_transform2d.h @@ -0,0 +1,77 @@ +/*************************************************************************/ +/* godot_transform2d.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_TRANSFORM2D_H +#define GODOT_TRANSFORM2D_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED +typedef struct godot_transform2d { + uint8_t _dont_touch_that[24]; +} godot_transform2d; +#endif + +#include "../godot.h" + +#include "godot_vector2.h" + +void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t); +void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c); +void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos); + +/* +godot_real GDAPI godot_transform2d_tdotx(const godot_transform2d *p_t, const godot_vector2 *p_v); +godot_real GDAPI godot_transform2d_tdoty(const godot_transform2d *p_t, const godot_vector2 *p_v); +*/ + +godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx); +godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx); + +godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis); +void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec); + +/* +void GDAPI godot_transform2d_invert(godot_transform2d *p_t); +godot_transform2d GDAPI godot_transform2d_inverse(const godot_transform2d *p_t); +*/ + +// @Incomplete +// I feel like it should be enough to expose get and set, the whole logic can be done in the bindings. + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_TRANSFORM2D_H diff --git a/modules/dlscript/godot/godot_variant.cpp b/modules/gdnative/godot/godot_variant.cpp index 3681f89753..2214f85056 100644 --- a/modules/dlscript/godot/godot_variant.cpp +++ b/modules/gdnative/godot/godot_variant.cpp @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_variant.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "godot_variant.h" #include "../godot.h" diff --git a/modules/dlscript/godot/godot_variant.h b/modules/gdnative/godot/godot_variant.h index 1ff5ba4a57..6f98b32363 100644 --- a/modules/dlscript/godot/godot_variant.h +++ b/modules/gdnative/godot/godot_variant.h @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_variant.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #ifndef GODOT_VARIANT_H #define GODOT_VARIANT_H diff --git a/modules/dlscript/godot/godot_vector2.cpp b/modules/gdnative/godot/godot_vector2.cpp index 0664da186e..dce4c03b5d 100644 --- a/modules/dlscript/godot/godot_vector2.cpp +++ b/modules/gdnative/godot/godot_vector2.cpp @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_vector2.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "godot_vector2.h" #include "math/math_2d.h" diff --git a/modules/dlscript/godot/godot_vector2.h b/modules/gdnative/godot/godot_vector2.h index 63da367e4f..afda8aa10b 100644 --- a/modules/dlscript/godot/godot_vector2.h +++ b/modules/gdnative/godot/godot_vector2.h @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_vector2.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #ifndef GODOT_VECTOR2_H #define GODOT_VECTOR2_H diff --git a/modules/dlscript/godot/godot_vector3.cpp b/modules/gdnative/godot/godot_vector3.cpp index 34005cbcb8..f08bfbcf06 100644 --- a/modules/dlscript/godot/godot_vector3.cpp +++ b/modules/gdnative/godot/godot_vector3.cpp @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_vector3.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "godot_vector3.h" #include "math/vector3.h" diff --git a/modules/dlscript/godot/godot_vector3.h b/modules/gdnative/godot/godot_vector3.h index 7fe93e3fd5..b7dc40965d 100644 --- a/modules/dlscript/godot/godot_vector3.h +++ b/modules/gdnative/godot/godot_vector3.h @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_vector3.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #ifndef GODOT_VECTOR3_H #define GODOT_VECTOR3_H diff --git a/modules/dlscript/register_types.cpp b/modules/gdnative/register_types.cpp index 1da00701a0..8789c9a267 100644 --- a/modules/dlscript/register_types.cpp +++ b/modules/gdnative/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -27,43 +28,39 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "register_types.h" -#include "dl_script.h" +#include "gdnative.h" #include "io/resource_loader.h" #include "io/resource_saver.h" -DLScriptLanguage *script_language_dl = NULL; -ResourceFormatLoaderDLScript *resource_loader_dl = NULL; -ResourceFormatSaverDLScript *resource_saver_dl = NULL; +GDNativeScriptLanguage *script_language_gdn = NULL; +ResourceFormatLoaderGDNativeScript *resource_loader_gdn = NULL; +ResourceFormatSaverGDNativeScript *resource_saver_gdn = NULL; //ResourceFormatLoaderDLLibrary *resource_loader_dllib=NULL; -void register_dlscript_types() { +void register_gdnative_types() { - ClassDB::register_class<DLLibrary>(); - ClassDB::register_class<DLScript>(); + ClassDB::register_class<GDNativeLibrary>(); + ClassDB::register_class<GDNativeScript>(); - script_language_dl = memnew(DLScriptLanguage); - //script_language_gd->init(); - ScriptServer::register_language(script_language_dl); - resource_loader_dl = memnew(ResourceFormatLoaderDLScript); - ResourceLoader::add_resource_format_loader(resource_loader_dl); - resource_saver_dl = memnew(ResourceFormatSaverDLScript); - ResourceSaver::add_resource_format_saver(resource_saver_dl); - - // resource_loader_dllib=memnew( ResourceFormatLoaderDLLibrary ); - // ResourceLoader::add_resource_format_loader(resource_loader_gd); + script_language_gdn = memnew(GDNativeScriptLanguage); + ScriptServer::register_language(script_language_gdn); + resource_loader_gdn = memnew(ResourceFormatLoaderGDNativeScript); + ResourceLoader::add_resource_format_loader(resource_loader_gdn); + resource_saver_gdn = memnew(ResourceFormatSaverGDNativeScript); + ResourceSaver::add_resource_format_saver(resource_saver_gdn); } -void unregister_dlscript_types() { +void unregister_gdnative_types() { - ScriptServer::unregister_language(script_language_dl); + ScriptServer::unregister_language(script_language_gdn); - if (script_language_dl) - memdelete(script_language_dl); + if (script_language_gdn) + memdelete(script_language_gdn); - if (resource_loader_dl) - memdelete(resource_loader_dl); + if (resource_loader_gdn) + memdelete(resource_loader_gdn); - if (resource_saver_dl) - memdelete(resource_saver_dl); + if (resource_saver_gdn) + memdelete(resource_saver_gdn); } diff --git a/modules/dlscript/register_types.h b/modules/gdnative/register_types.h index 90aa1d87fc..48e778cb2c 100644 --- a/modules/dlscript/register_types.h +++ b/modules/gdnative/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -26,5 +27,5 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -void register_dlscript_types(); -void unregister_dlscript_types(); +void register_gdnative_types(); +void unregister_gdnative_types(); diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp index 245f44887c..12b43d6060 100644 --- a/modules/gdscript/gd_compiler.cpp +++ b/modules/gdscript/gd_compiler.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdscript/gd_compiler.h b/modules/gdscript/gd_compiler.h index c84bd97246..b7ff092eba 100644 --- a/modules/gdscript/gd_compiler.h +++ b/modules/gdscript/gd_compiler.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index 1499f167c4..ae5bb5694c 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp index 0e7ba981f4..608256c88a 100644 --- a/modules/gdscript/gd_function.cpp +++ b/modules/gdscript/gd_function.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdscript/gd_function.h b/modules/gdscript/gd_function.h index 321b3b6cfa..f0bf33147b 100644 --- a/modules/gdscript/gd_function.h +++ b/modules/gdscript/gd_function.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp index fa92f0a194..a361971ef4 100644 --- a/modules/gdscript/gd_functions.cpp +++ b/modules/gdscript/gd_functions.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdscript/gd_functions.h b/modules/gdscript/gd_functions.h index cde1a9210d..4d52abaeab 100644 --- a/modules/gdscript/gd_functions.h +++ b/modules/gdscript/gd_functions.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index 1540bb51f8..cd16fef6b3 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -2264,6 +2265,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { if (!is_first_line && tab_level.back()->prev() && tab_level.back()->prev()->get() == indent_level) { // pythonic single-line expression, don't parse future lines tab_level.pop_back(); + p_block->end_line = tokenizer->get_token_line(); return; } is_first_line = false; @@ -2420,7 +2422,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { p_block->sub_blocks.push_back(cf_if->body); if (!_enter_indent_block(cf_if->body)) { - _set_error("Expected intended block after 'if'"); + _set_error("Expected indented block after 'if'"); p_block->end_line = tokenizer->get_token_line(); return; } @@ -2435,9 +2437,8 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { while (true) { - while (tokenizer->get_token() == GDTokenizer::TK_NEWLINE) { - tokenizer->advance(); - } + while (tokenizer->get_token() == GDTokenizer::TK_NEWLINE && _parse_newline()) + ; if (tab_level.back()->get() < indent_level) { //not at current indent level p_block->end_line = tokenizer->get_token_line(); diff --git a/modules/gdscript/gd_parser.h b/modules/gdscript/gd_parser.h index 8d2c136818..445ad7361c 100644 --- a/modules/gdscript/gd_parser.h +++ b/modules/gdscript/gd_parser.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 9aafe41a0c..2367f60740 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h index d64cc9798d..93f8ee8721 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index dca34f923e..13674f1f9a 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdscript/gd_tokenizer.h b/modules/gdscript/gd_tokenizer.h index c1ed8ad92e..ea7629b661 100644 --- a/modules/gdscript/gd_tokenizer.h +++ b/modules/gdscript/gd_tokenizer.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp index 5acd412f7e..41ea0c2a26 100644 --- a/modules/gdscript/register_types.cpp +++ b/modules/gdscript/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdscript/register_types.h b/modules/gdscript/register_types.h index 5778dfcadc..4e969f5bd4 100644 --- a/modules/gdscript/register_types.h +++ b/modules/gdscript/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 128592fa29..d1f54e021f 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h index 2a0c2b9646..c386e4f66b 100644 --- a/modules/gridmap/grid_map.h +++ b/modules/gridmap/grid_map.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index a6a3a03503..39fe0a1675 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -834,9 +835,9 @@ void GridMapEditor::edit(GridMap *p_gridmap) { //update grids indicator_mat.instance(); - indicator_mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); - indicator_mat->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); - indicator_mat->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + indicator_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true); + indicator_mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); + indicator_mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); indicator_mat->set_albedo(Color(0.8, 0.5, 0.1)); Vector<Vector3> grid_points[3]; @@ -1309,9 +1310,9 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { inner_mat.instance(); inner_mat->set_albedo(Color(0.7, 0.7, 1.0, 0.3)); - inner_mat->set_flag(FixedSpatialMaterial::FLAG_ONTOP, true); - inner_mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); - inner_mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + inner_mat->set_flag(SpatialMaterial::FLAG_ONTOP, true); + inner_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true); + inner_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true); d[VS::ARRAY_VERTEX] = triangles; VisualServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh, VS::PRIMITIVE_TRIANGLES, d); @@ -1319,10 +1320,10 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { outer_mat.instance(); outer_mat->set_albedo(Color(0.7, 0.7, 1.0, 0.3)); - outer_mat->set_flag(FixedSpatialMaterial::FLAG_ONTOP, true); - outer_mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + outer_mat->set_flag(SpatialMaterial::FLAG_ONTOP, true); + outer_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true); outer_mat->set_line_width(3.0); - outer_mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + outer_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true); d[VS::ARRAY_VERTEX] = lines; VisualServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh, VS::PRIMITIVE_LINES, d); diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h index 27a063ee41..d928e6afac 100644 --- a/modules/gridmap/grid_map_editor_plugin.h +++ b/modules/gridmap/grid_map_editor_plugin.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -112,9 +113,9 @@ class GridMapEditor : public VBoxContainer { RID duplicate_mesh; RID duplicate_instance; - Ref<FixedSpatialMaterial> indicator_mat; - Ref<FixedSpatialMaterial> inner_mat; - Ref<FixedSpatialMaterial> outer_mat; + Ref<SpatialMaterial> indicator_mat; + Ref<SpatialMaterial> inner_mat; + Ref<SpatialMaterial> outer_mat; bool updating; diff --git a/modules/gridmap/register_types.cpp b/modules/gridmap/register_types.cpp index 4035caea78..e4def9378f 100644 --- a/modules/gridmap/register_types.cpp +++ b/modules/gridmap/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gridmap/register_types.h b/modules/gridmap/register_types.h index cc7c13961a..1978353fc3 100644 --- a/modules/gridmap/register_types.h +++ b/modules/gridmap/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/jpg/image_loader_jpegd.cpp b/modules/jpg/image_loader_jpegd.cpp index ca928c4fe6..83685d6446 100644 --- a/modules/jpg/image_loader_jpegd.cpp +++ b/modules/jpg/image_loader_jpegd.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/jpg/image_loader_jpegd.h b/modules/jpg/image_loader_jpegd.h index 0803cfba1e..d23e8a7d48 100644 --- a/modules/jpg/image_loader_jpegd.h +++ b/modules/jpg/image_loader_jpegd.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/jpg/register_types.cpp b/modules/jpg/register_types.cpp index ce0330643a..2379bee0df 100644 --- a/modules/jpg/register_types.cpp +++ b/modules/jpg/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/jpg/register_types.h b/modules/jpg/register_types.h index 62132bf461..c14f860742 100644 --- a/modules/jpg/register_types.h +++ b/modules/jpg/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/ogg/register_types.cpp b/modules/ogg/register_types.cpp index ed796ec092..9837ae12d9 100644 --- a/modules/ogg/register_types.cpp +++ b/modules/ogg/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/ogg/register_types.h b/modules/ogg/register_types.h index cc67b4d2f0..dc84227b80 100644 --- a/modules/ogg/register_types.h +++ b/modules/ogg/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/openssl/register_types.cpp b/modules/openssl/register_types.cpp index 6cc9fa3669..e1ae581caf 100644 --- a/modules/openssl/register_types.cpp +++ b/modules/openssl/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/openssl/register_types.h b/modules/openssl/register_types.h index 3bcee59bfd..ff39ec8798 100644 --- a/modules/openssl/register_types.h +++ b/modules/openssl/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/openssl/stream_peer_openssl.cpp b/modules/openssl/stream_peer_openssl.cpp index 3b25b8a50e..8159296b3c 100644 --- a/modules/openssl/stream_peer_openssl.cpp +++ b/modules/openssl/stream_peer_openssl.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/openssl/stream_peer_openssl.h b/modules/openssl/stream_peer_openssl.h index 56b45802df..12262da94a 100644 --- a/modules/openssl/stream_peer_openssl.h +++ b/modules/openssl/stream_peer_openssl.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/opus/audio_stream_opus.cpp b/modules/opus/audio_stream_opus.cpp index 52b055ca82..e361ebf019 100644 --- a/modules/opus/audio_stream_opus.cpp +++ b/modules/opus/audio_stream_opus.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Author: George Marques <george@gmarqu.es> */ /* */ diff --git a/modules/opus/audio_stream_opus.h b/modules/opus/audio_stream_opus.h index f1bee121b2..daf3958c2a 100644 --- a/modules/opus/audio_stream_opus.h +++ b/modules/opus/audio_stream_opus.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Author: George Marques <george@gmarqu.es> */ /* */ diff --git a/modules/opus/register_types.cpp b/modules/opus/register_types.cpp index 8a48c5084e..e8bff58cbb 100644 --- a/modules/opus/register_types.cpp +++ b/modules/opus/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/opus/register_types.h b/modules/opus/register_types.h index 09181b4f03..4517dc5df7 100644 --- a/modules/opus/register_types.h +++ b/modules/opus/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/pbm/bitmap_loader_pbm.cpp b/modules/pbm/bitmap_loader_pbm.cpp index 04051fc38f..c8f25ad68c 100644 --- a/modules/pbm/bitmap_loader_pbm.cpp +++ b/modules/pbm/bitmap_loader_pbm.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/pbm/bitmap_loader_pbm.h b/modules/pbm/bitmap_loader_pbm.h index 5e5062f435..7a72edaeee 100644 --- a/modules/pbm/bitmap_loader_pbm.h +++ b/modules/pbm/bitmap_loader_pbm.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/pbm/register_types.cpp b/modules/pbm/register_types.cpp index abfc08c909..c9531ba14f 100644 --- a/modules/pbm/register_types.cpp +++ b/modules/pbm/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/pbm/register_types.h b/modules/pbm/register_types.h index c9a125083d..3888fd6f77 100644 --- a/modules/pbm/register_types.h +++ b/modules/pbm/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/pvr/register_types.cpp b/modules/pvr/register_types.cpp index 76fe7970d3..04e20558ce 100644 --- a/modules/pvr/register_types.cpp +++ b/modules/pvr/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/pvr/register_types.h b/modules/pvr/register_types.h index ac2ab748df..7ff5237c03 100644 --- a/modules/pvr/register_types.h +++ b/modules/pvr/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp index 0409998408..62cbd9cd8d 100644 --- a/modules/pvr/texture_loader_pvr.cpp +++ b/modules/pvr/texture_loader_pvr.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/pvr/texture_loader_pvr.h b/modules/pvr/texture_loader_pvr.h index 768070ee61..7d60831175 100644 --- a/modules/pvr/texture_loader_pvr.h +++ b/modules/pvr/texture_loader_pvr.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp index e8fed382b5..eb9f1d2ab1 100644 --- a/modules/regex/regex.cpp +++ b/modules/regex/regex.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/regex/regex.h b/modules/regex/regex.h index 7aecf9b3ec..106d2649a5 100644 --- a/modules/regex/regex.h +++ b/modules/regex/regex.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/regex/register_types.cpp b/modules/regex/register_types.cpp index 2e24edcd84..eaa8f41e33 100644 --- a/modules/regex/register_types.cpp +++ b/modules/regex/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/regex/register_types.h b/modules/regex/register_types.h index 5d676b6daa..3b977edd32 100644 --- a/modules/regex/register_types.h +++ b/modules/regex/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/register_module_types.h b/modules/register_module_types.h index 7d9a130ea1..e30dab2819 100644 --- a/modules/register_module_types.h +++ b/modules/register_module_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp index dd46dac234..c6835d4b62 100644 --- a/modules/squish/image_compress_squish.cpp +++ b/modules/squish/image_compress_squish.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/squish/image_compress_squish.h b/modules/squish/image_compress_squish.h index 198889402a..81f57c6822 100644 --- a/modules/squish/image_compress_squish.h +++ b/modules/squish/image_compress_squish.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/squish/register_types.cpp b/modules/squish/register_types.cpp index 995711c758..41341db93b 100644 --- a/modules/squish/register_types.cpp +++ b/modules/squish/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/squish/register_types.h b/modules/squish/register_types.h index 0db4301997..3bf1b19dec 100644 --- a/modules/squish/register_types.h +++ b/modules/squish/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp index 1c6e7e461d..227e5e61b6 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.h b/modules/stb_vorbis/audio_stream_ogg_vorbis.h index c32b3e578d..bb895c4dfa 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.h +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/stb_vorbis/register_types.cpp b/modules/stb_vorbis/register_types.cpp index 36b7ebc11a..726260b45c 100644 --- a/modules/stb_vorbis/register_types.cpp +++ b/modules/stb_vorbis/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/stb_vorbis/register_types.h b/modules/stb_vorbis/register_types.h index 2824aa9f0c..c17e1eafe9 100644 --- a/modules/stb_vorbis/register_types.h +++ b/modules/stb_vorbis/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp index 11d8551db5..9a3d5c2651 100644 --- a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp +++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.h b/modules/stb_vorbis/resource_importer_ogg_vorbis.h index 2f0fcbe9a1..c588b58fb2 100644 --- a/modules/stb_vorbis/resource_importer_ogg_vorbis.h +++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/theora/register_types.cpp b/modules/theora/register_types.cpp index deb54b5d80..1bea5439a3 100644 --- a/modules/theora/register_types.cpp +++ b/modules/theora/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/theora/register_types.h b/modules/theora/register_types.h index 582aa785c7..cb9f9d1848 100644 --- a/modules/theora/register_types.h +++ b/modules/theora/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index c390701adb..28463e2cba 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h index ea568906da..84b665382b 100644 --- a/modules/theora/video_stream_theora.h +++ b/modules/theora/video_stream_theora.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp index b05ea716ed..4006ad3428 100644 --- a/modules/visual_script/register_types.cpp +++ b/modules/visual_script/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/visual_script/register_types.h b/modules/visual_script/register_types.h index f6904420bd..2c0ee56268 100644 --- a/modules/visual_script/register_types.h +++ b/modules/visual_script/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 610309afca..53521c55a7 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index e3af3f4a1b..ee8ed2c965 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index 378ca06f90..203e0bb483 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/visual_script/visual_script_builtin_funcs.h b/modules/visual_script/visual_script_builtin_funcs.h index 7246239513..8e9c0eca76 100644 --- a/modules/visual_script/visual_script_builtin_funcs.h +++ b/modules/visual_script/visual_script_builtin_funcs.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index ae2d4d5df3..ee5bd66aa2 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index 5ece1c9e2c..7322da5cfb 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp index 96864b4bf6..791b5d99ff 100644 --- a/modules/visual_script/visual_script_expression.cpp +++ b/modules/visual_script/visual_script_expression.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/visual_script/visual_script_expression.h b/modules/visual_script/visual_script_expression.h index 59a7d9fba0..4a9f59ebc3 100644 --- a/modules/visual_script/visual_script_expression.h +++ b/modules/visual_script/visual_script_expression.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp index 78847fb588..2deb6064d3 100644 --- a/modules/visual_script/visual_script_flow_control.cpp +++ b/modules/visual_script/visual_script_flow_control.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/visual_script/visual_script_flow_control.h b/modules/visual_script/visual_script_flow_control.h index 1739f67b5b..e3936da9e5 100644 --- a/modules/visual_script/visual_script_flow_control.h +++ b/modules/visual_script/visual_script_flow_control.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index 3cd20050ce..84224dfcbe 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/visual_script/visual_script_func_nodes.h b/modules/visual_script/visual_script_func_nodes.h index 3f82edc5f0..b56a3c2bcc 100644 --- a/modules/visual_script/visual_script_func_nodes.h +++ b/modules/visual_script/visual_script_func_nodes.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 68bd1e6d4c..08f4191d3d 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h index b2fc115660..c0933d1a78 100644 --- a/modules/visual_script/visual_script_nodes.h +++ b/modules/visual_script/visual_script_nodes.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp index 919ced74b9..8f96eb6800 100644 --- a/modules/visual_script/visual_script_yield_nodes.cpp +++ b/modules/visual_script/visual_script_yield_nodes.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/visual_script/visual_script_yield_nodes.h b/modules/visual_script/visual_script_yield_nodes.h index 35f72cdfad..638b7b5b41 100644 --- a/modules/visual_script/visual_script_yield_nodes.h +++ b/modules/visual_script/visual_script_yield_nodes.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp index 88c8ecc0df..1b10637fdc 100644 --- a/modules/vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/vorbis/audio_stream_ogg_vorbis.h b/modules/vorbis/audio_stream_ogg_vorbis.h index a13e934f2a..519ceaaea1 100644 --- a/modules/vorbis/audio_stream_ogg_vorbis.h +++ b/modules/vorbis/audio_stream_ogg_vorbis.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/vorbis/register_types.cpp b/modules/vorbis/register_types.cpp index b405acd16b..d9865072b9 100644 --- a/modules/vorbis/register_types.cpp +++ b/modules/vorbis/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/vorbis/register_types.h b/modules/vorbis/register_types.h index b2adb55acd..e7cde7a66c 100644 --- a/modules/vorbis/register_types.h +++ b/modules/vorbis/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/webm/register_types.cpp b/modules/webm/register_types.cpp index e50eb337ae..c234f81097 100644 --- a/modules/webm/register_types.cpp +++ b/modules/webm/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/webm/register_types.h b/modules/webm/register_types.h index 3df0d7bbaa..cf412e601e 100644 --- a/modules/webm/register_types.h +++ b/modules/webm/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp index 8d6fbdfe75..9d8062d283 100644 --- a/modules/webm/video_stream_webm.cpp +++ b/modules/webm/video_stream_webm.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h index 2b62cf48b6..b2e88347aa 100644 --- a/modules/webm/video_stream_webm.h +++ b/modules/webm/video_stream_webm.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp index 829e77873a..39c8f812ac 100644 --- a/modules/webp/image_loader_webp.cpp +++ b/modules/webp/image_loader_webp.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/webp/image_loader_webp.h b/modules/webp/image_loader_webp.h index ccf22bae13..2d0ac796d3 100644 --- a/modules/webp/image_loader_webp.h +++ b/modules/webp/image_loader_webp.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/webp/register_types.cpp b/modules/webp/register_types.cpp index 8a708aae6a..6e29986740 100644 --- a/modules/webp/register_types.cpp +++ b/modules/webp/register_types.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/webp/register_types.h b/modules/webp/register_types.h index ce1f29937b..d0aa148079 100644 --- a/modules/webp/register_types.h +++ b/modules/webp/register_types.h @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ |