diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/enet/networked_multiplayer_enet.cpp | 4 | ||||
-rw-r--r-- | modules/enet/networked_multiplayer_enet.h | 8 | ||||
-rw-r--r-- | modules/gdnative/gdnative/gdnative.cpp | 4 | ||||
-rw-r--r-- | modules/gdnative/gdnative_api.json | 6 | ||||
-rw-r--r-- | modules/gdnative/include/gdnative/gdnative.h | 4 | ||||
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 42 | ||||
-rw-r--r-- | modules/gdscript/register_types.cpp | 44 | ||||
-rw-r--r-- | modules/gridmap/grid_map.cpp | 4 | ||||
-rw-r--r-- | modules/gridmap/grid_map.h | 5 | ||||
-rw-r--r-- | modules/thekla_unwrap/SCsub | 2 |
10 files changed, 97 insertions, 26 deletions
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp index ce485956b4..396bebf0ea 100644 --- a/modules/enet/networked_multiplayer_enet.cpp +++ b/modules/enet/networked_multiplayer_enet.cpp @@ -386,7 +386,7 @@ int NetworkedMultiplayerENet::get_available_packet_count() const { return incoming_packets.size(); } -Error NetworkedMultiplayerENet::get_packet(const uint8_t **r_buffer, int &r_buffer_size) const { +Error NetworkedMultiplayerENet::get_packet(const uint8_t **r_buffer, int &r_buffer_size) { ERR_FAIL_COND_V(incoming_packets.size() == 0, ERR_UNAVAILABLE); @@ -480,7 +480,7 @@ int NetworkedMultiplayerENet::get_max_packet_size() const { return 1 << 24; //anything is good } -void NetworkedMultiplayerENet::_pop_current_packet() const { +void NetworkedMultiplayerENet::_pop_current_packet() { if (current_packet.packet) { enet_packet_destroy(current_packet.packet); diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h index 81d517147d..d7bc5c7849 100644 --- a/modules/enet/networked_multiplayer_enet.h +++ b/modules/enet/networked_multiplayer_enet.h @@ -86,12 +86,12 @@ private: CompressionMode compression_mode; - mutable List<Packet> incoming_packets; + List<Packet> incoming_packets; - mutable Packet current_packet; + Packet current_packet; uint32_t _gen_unique_id() const; - void _pop_current_packet() const; + void _pop_current_packet(); Vector<uint8_t> src_compressor_mem; Vector<uint8_t> dst_compressor_mem; @@ -123,7 +123,7 @@ public: virtual bool is_server() const; virtual int get_available_packet_count() const; - virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) const; ///< buffer is GONE after next get_packet + virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size); ///< buffer is GONE after next get_packet virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size); virtual int get_max_packet_size() const; diff --git a/modules/gdnative/gdnative/gdnative.cpp b/modules/gdnative/gdnative/gdnative.cpp index 92a88e354b..8ff67b10b1 100644 --- a/modules/gdnative/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative/gdnative.cpp @@ -52,10 +52,6 @@ godot_object GDAPI *godot_global_get_singleton(char *p_name) { return (godot_object *)Engine::get_singleton()->get_singleton_object(String(p_name)); } // result shouldn't be freed -void GDAPI *godot_get_stack_bottom() { - return OS::get_singleton()->get_stack_bottom(); -} - // MethodBind API godot_method_bind GDAPI *godot_method_bind_get_method(const char *p_classname, const char *p_methodname) { diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 31f3b0b77b..06c6e9f410 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -5569,6 +5569,12 @@ ] }, { + "name": "godot_get_global_constants", + "return_type": "godot_dictionary", + "arguments": [ + ] + }, + { "name": "godot_register_native_call_type", "return_type": "void", "arguments": [ diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h index f7f5606428..9d7829a51f 100644 --- a/modules/gdnative/include/gdnative/gdnative.h +++ b/modules/gdnative/include/gdnative/gdnative.h @@ -212,10 +212,6 @@ void GDAPI godot_object_destroy(godot_object *p_o); godot_object GDAPI *godot_global_get_singleton(char *p_name); // result shouldn't be freed -////// OS API - -void GDAPI *godot_get_stack_bottom(); // returns stack bottom of the main thread - ////// MethodBind API typedef struct { diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 36ae61e388..8c110143b8 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -597,12 +597,36 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s OperatorNode *op = alloc_node<OperatorNode>(); op->op = OperatorNode::OP_CALL; + //Do a quick Array and Dictionary Check. Replace if either require no arguments. + bool replaced = false; + if (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_TYPE) { + Variant::Type ct = tokenizer->get_token_type(); + if (p_parsing_constant == false) { + if (ct == Variant::ARRAY) { + if (tokenizer->get_token(2) == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { + ArrayNode *arr = alloc_node<ArrayNode>(); + expr = arr; + replaced = true; + tokenizer->advance(3); + } + } + if (ct == Variant::DICTIONARY) { + if (tokenizer->get_token(2) == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { + DictionaryNode *dict = alloc_node<DictionaryNode>(); + expr = dict; + replaced = true; + tokenizer->advance(3); + } + } + } - TypeNode *tn = alloc_node<TypeNode>(); - tn->vtype = tokenizer->get_token_type(); - op->arguments.push_back(tn); - tokenizer->advance(2); + if (!replaced) { + TypeNode *tn = alloc_node<TypeNode>(); + tn->vtype = tokenizer->get_token_type(); + op->arguments.push_back(tn); + tokenizer->advance(2); + } } else if (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_FUNC) { BuiltInFunctionNode *bn = alloc_node<BuiltInFunctionNode>(); @@ -628,11 +652,11 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s _make_completable_call(0); completion_node = op; } - if (!_parse_arguments(op, op->arguments, p_static, true)) - return NULL; - - expr = op; - + if (!replaced) { + if (!_parse_arguments(op, op->arguments, p_static, true)) + return NULL; + expr = op; + } } else if (tokenizer->is_token_literal(0, true)) { // We check with is_token_literal, as this allows us to use match/sync/etc. as a name //identifier (reference) diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp index 1e007ddb0f..e707032ed8 100644 --- a/modules/gdscript/register_types.cpp +++ b/modules/gdscript/register_types.cpp @@ -30,6 +30,7 @@ #include "register_types.h" #include "gdscript.h" +#include "gdscript_tokenizer.h" #include "io/file_access_encrypted.h" #include "io/resource_loader.h" #include "os/file_access.h" @@ -38,6 +39,45 @@ GDScriptLanguage *script_language_gd = NULL; ResourceFormatLoaderGDScript *resource_loader_gd = NULL; ResourceFormatSaverGDScript *resource_saver_gd = NULL; +#ifdef TOOLS_ENABLED + +#include "editor/editor_export.h" +#include "editor/editor_node.h" +#include "editor/editor_settings.h" + +class EditorExportGDScript : public EditorExportPlugin { + + GDCLASS(EditorExportGDScript, EditorExportPlugin); + +public: + virtual void _export_file(const String &p_path, const String &p_type, const Set<String> &p_features) { + + if (!p_path.ends_with(".gd")) + return; + + Vector<uint8_t> file = FileAccess::get_file_as_array(p_path); + if (file.empty()) + return; + String txt; + txt.parse_utf8((const char *)file.ptr(), file.size()); + file = GDScriptTokenizerBuffer::parse_code_string(txt); + + if (file.empty()) + return; + + add_file(p_path.get_basename() + ".gdc", file, true); + } +}; + +static void _editor_init() { + + Ref<EditorExportGDScript> gd_export; + gd_export.instance(); + EditorExport::get_singleton()->add_export_plugin(gd_export); +} + +#endif + void register_gdscript_types() { ClassDB::register_class<GDScript>(); @@ -49,6 +89,10 @@ void register_gdscript_types() { ResourceLoader::add_resource_format_loader(resource_loader_gd); resource_saver_gd = memnew(ResourceFormatSaverGDScript); ResourceSaver::add_resource_format_saver(resource_saver_gd); + +#ifdef TOOLS_ENABLED + EditorNode::add_init_callback(_editor_init); +#endif } void unregister_gdscript_types() { diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index b3a1947647..bebf8bcf8f 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -469,7 +469,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) { nm.xform = xform; if (navigation) { - nm.id = navigation->navmesh_create(navmesh, xform, this); + nm.id = navigation->navmesh_add(navmesh, xform, this); } else { nm.id = -1; } @@ -556,7 +556,7 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) { if (cell_map.has(F->key()) && F->get().id < 0) { Ref<NavigationMesh> nm = theme->get_item_navmesh(cell_map[F->key()].item); if (nm.is_valid()) { - F->get().id = navigation->navmesh_create(nm, F->get().xform, this); + F->get().id = navigation->navmesh_add(nm, F->get().xform, this); } } } diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h index 5bfdf1dac3..ab66bf123e 100644 --- a/modules/gridmap/grid_map.h +++ b/modules/gridmap/grid_map.h @@ -186,6 +186,11 @@ class GridMap : public Spatial { Vector3 _get_offset() const; + struct BakedMesh { + Ref<Mesh> mesh; + Transform transform; + }; + protected: bool _set(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_ret) const; diff --git a/modules/thekla_unwrap/SCsub b/modules/thekla_unwrap/SCsub index b489fcc9e7..c57bf326ea 100644 --- a/modules/thekla_unwrap/SCsub +++ b/modules/thekla_unwrap/SCsub @@ -67,7 +67,7 @@ if env['builtin_thekla_atlas']: if env.msvc: env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_WIN32", "-DNV_CC_MSVC", "-DPOSH_COMPILER_MSVC" ]) else: - env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_MINGW", "-DNV_CC_GNUC", "-DPOSH_COMPILER_GCC"]) + env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_MINGW", "-DNV_CC_GNUC", "-DPOSH_COMPILER_GCC", "-U__STRICT_ANSI__"]) env.Append(LIBS=["dbghelp"]) # Godot source files |