From 6c49fe9c62b3401323a6497447679fdfded6f116 Mon Sep 17 00:00:00 2001 From: Karroffel Date: Tue, 4 Apr 2017 19:38:46 +0200 Subject: [DLScript] added variant constructor and a function to get userdata of a script The godot_dlinstance_get_userdata() function can be used to get the DLScript userdata pointer of any object that has a DLScript attached to it. This is particularly useful and even required for language bindings to work properly. This also fixes non-tool builds. --- modules/dlscript/api_generator.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'modules/dlscript/api_generator.cpp') diff --git a/modules/dlscript/api_generator.cpp b/modules/dlscript/api_generator.cpp index 2c2497b5b1..c5c5cb46e6 100644 --- a/modules/dlscript/api_generator.cpp +++ b/modules/dlscript/api_generator.cpp @@ -1,5 +1,7 @@ #include "api_generator.h" +#ifdef TOOLS_ENABLED + #include "class_db.h" #include "core/global_config.h" #include "os/file_access.h" @@ -368,15 +370,22 @@ static List generate_c_api_json(const List &p_api) { // +#endif + /* * Saves the whole Godot API to a JSON file located at * p_path */ Error generate_c_api(const String &p_path) { +#ifndef TOOLS_ENABLED + return ERR_BUG; +#else + List api = generate_c_api_classes(); List json_source = generate_c_api_json(api); return save_file(p_path, json_source); +#endif } -- cgit v1.2.3