From c0f21990ce02b94a3f2b03d29b4d671d3890bf45 Mon Sep 17 00:00:00 2001 From: TDRChan Date: Wed, 10 Aug 2022 18:03:11 +0200 Subject: [PATCH 1/7] [] Resolving Compile Error regarding the signal interface being changed. # - The optional argument p'_binds' parameter from 'Object::Connect' has been deprecated and should be replaced by 'Callable.bind()' instead according to Godot-Commit(d4433ae6d3a525683ef37ea521d30b6b97a44024). Thus replacing the older signal syntax with the newer one where needed. --- modules/godot/editor_plugins/editor_world_ecs.cpp | 2 +- modules/godot/editor_plugins/entity_editor_plugin.cpp | 2 +- modules/godot/nodes/ecs_world.cpp | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/modules/godot/editor_plugins/editor_world_ecs.cpp b/modules/godot/editor_plugins/editor_world_ecs.cpp index 9f24bc67..33aa2b0b 100644 --- a/modules/godot/editor_plugins/editor_world_ecs.cpp +++ b/modules/godot/editor_plugins/editor_world_ecs.cpp @@ -42,7 +42,7 @@ PipelineElementInfoBox::PipelineElementInfoBox(EditorNode *p_editor, EditorWorld remove_btn->set_h_size_flags(0); remove_btn->set_v_size_flags(0); remove_btn->set_flat(true); - remove_btn->connect(SNAME("pressed"), callable_mp(this, &PipelineElementInfoBox::system_remove), Vector(), CONNECT_DEFERRED); + remove_btn->connect(SNAME("pressed"), callable_mp(this, &PipelineElementInfoBox::system_remove), CONNECT_DEFERRED); box->add_child(remove_btn); system_name_lbl = memnew(Label); diff --git a/modules/godot/editor_plugins/entity_editor_plugin.cpp b/modules/godot/editor_plugins/entity_editor_plugin.cpp index f01f5c2a..b70fd2af 100644 --- a/modules/godot/editor_plugins/entity_editor_plugin.cpp +++ b/modules/godot/editor_plugins/entity_editor_plugin.cpp @@ -83,7 +83,7 @@ void EntityEditor::update_editors() { del_btn->set_icon(editor->get_theme_base()->get_theme_icon(SNAME("Remove"), SNAME("EditorIcons"))); del_btn->set_flat(false); del_btn->set_text_alignment(HORIZONTAL_ALIGNMENT_LEFT); - del_btn->connect(SNAME("pressed"), callable_mp(this, &EntityEditor::_remove_component_pressed), varray(*it.key)); + del_btn->connect(SNAME("pressed"), callable_mp(this, &EntityEditor::_remove_component_pressed).bind(*it.key)); component_section->get_vbox()->add_child(del_btn); create_component_inspector(*it.key, *it.value, component_section->get_vbox()); diff --git a/modules/godot/nodes/ecs_world.cpp b/modules/godot/nodes/ecs_world.cpp index 5d5abde4..8a2ad428 100644 --- a/modules/godot/nodes/ecs_world.cpp +++ b/modules/godot/nodes/ecs_world.cpp @@ -331,7 +331,7 @@ void WorldECS::_notification(int p_what) { if (Engine::get_singleton()->is_editor_hint()) { init_default(); - ScriptEcs::get_singleton()->connect("ecs_script_reloaded", callable_mp(this, &WorldECS::on_ecs_script_reloaded), Vector(), CONNECT_DEFERRED); + ScriptEcs::get_singleton()->connect("ecs_script_reloaded", callable_mp(this, &WorldECS::on_ecs_script_reloaded), CONNECT_DEFERRED); } #endif @@ -467,12 +467,9 @@ void WorldECS::add_pipeline(Ref p_pipeline) { if (Engine::get_singleton()->is_editor_hint()) { update_configuration_warnings(); - Vector vars; - vars.push_back(p_pipeline); p_pipeline->connect( CoreStringNames::get_singleton()->property_list_changed, - callable_mp(this, &WorldECS::on_pipeline_changed), - vars); + callable_mp(this, &WorldECS::on_pipeline_changed).bind(p_pipeline)); } #endif } From af825c0d8d1d1e313ff3f400a6f882592aee4091 Mon Sep 17 00:00:00 2001 From: TDRChan Date: Wed, 10 Aug 2022 18:08:44 +0200 Subject: [PATCH 2/7] [] Fixing Compile Error: HSeparator and VSeparator where no longer defined in 'editor_world_ecs.cpp' - most likely due to godot include changes. # - Adding proper include as a fix. --- modules/godot/editor_plugins/editor_world_ecs.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/godot/editor_plugins/editor_world_ecs.cpp b/modules/godot/editor_plugins/editor_world_ecs.cpp index 33aa2b0b..9af61dde 100644 --- a/modules/godot/editor_plugins/editor_world_ecs.cpp +++ b/modules/godot/editor_plugins/editor_world_ecs.cpp @@ -10,6 +10,7 @@ #include "editor/editor_scale.h" #include "scene/gui/color_rect.h" #include "scene/gui/reference_rect.h" +#include "scene/gui/separator.h" PipelineElementInfoBox::PipelineElementInfoBox(EditorNode *p_editor, EditorWorldECS *p_editor_world_ecs) : editor(p_editor), From 4fcb234139b1b30204c58068b64dd7d80d99f93a Mon Sep 17 00:00:00 2001 From: TDRChan Date: Wed, 10 Aug 2022 18:28:10 +0200 Subject: [PATCH 3/7] [] Resolving Linker Error : The file is including a translation unit instead of a header file resulting in mutliple defined symbols in the linking process. # --- systems/dynamic_system.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systems/dynamic_system.cpp b/systems/dynamic_system.cpp index bab7f22b..3b6da60f 100644 --- a/systems/dynamic_system.cpp +++ b/systems/dynamic_system.cpp @@ -2,7 +2,7 @@ #include "../pipeline/pipeline.h" #include "../utils/fetchers.h" -#include "modules/gdscript/gdscript.cpp" +#include "modules/gdscript/gdscript.h" godex::DynamicSystemExecutionData::DynamicSystemExecutionData() {} From 49f73c641824cb7ed536aff4b7e309ce3289fa4f Mon Sep 17 00:00:00 2001 From: TDRChan Date: Thu, 11 Aug 2022 12:17:14 +0200 Subject: [PATCH 4/7] [] Resolving GodotCPP Compilation Issue: Missing exposed enum definitions in generated headers. # - Missing exposed enums for classes 'System', 'Entity2D', 'Entity3D', and 'DynamicQuery'. (Space and Phase enumerations) --- iterators/dynamic_query.cpp | 3 +++ modules/godot/nodes/ecs_utilities.cpp | 7 +++++++ modules/godot/nodes/entity.cpp | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/iterators/dynamic_query.cpp b/iterators/dynamic_query.cpp index ea9d3668..74c354ae 100644 --- a/iterators/dynamic_query.cpp +++ b/iterators/dynamic_query.cpp @@ -27,6 +27,9 @@ void DynamicQuery::_bind_methods() { ClassDB::bind_method(D_METHOD("get_current_entity_id"), &DynamicQuery::script_get_current_entity_id); ClassDB::bind_method(D_METHOD("count"), &DynamicQuery::count); + + BIND_ENUM_CONSTANT(LOCAL); + BIND_ENUM_CONSTANT(GLOBAL); } DynamicQuery::DynamicQuery() { diff --git a/modules/godot/nodes/ecs_utilities.cpp b/modules/godot/nodes/ecs_utilities.cpp index 7816ca53..e44c6d00 100644 --- a/modules/godot/nodes/ecs_utilities.cpp +++ b/modules/godot/nodes/ecs_utilities.cpp @@ -27,6 +27,13 @@ void System::_bind_methods() { BIND_ENUM_CONSTANT(IMMUTABLE); BIND_ENUM_CONSTANT(MUTABLE); + BIND_ENUM_CONSTANT(PHASE_CONFIG); + BIND_ENUM_CONSTANT(PHASE_INPUT); + BIND_ENUM_CONSTANT(PHASE_PRE_PROCESS); + BIND_ENUM_CONSTANT(PHASE_PROCESS); + BIND_ENUM_CONSTANT(PHASE_POST_PROCESS); + BIND_ENUM_CONSTANT(PHASE_PRE_RENDER); + ClassDB::add_virtual_method(get_class_static(), MethodInfo("_prepare")); // TODO how to define `_execute`? It has dynamic argument, depending on the `_prepare` function. } diff --git a/modules/godot/nodes/entity.cpp b/modules/godot/nodes/entity.cpp index aefecc3a..67c4ad20 100644 --- a/modules/godot/nodes/entity.cpp +++ b/modules/godot/nodes/entity.cpp @@ -45,6 +45,9 @@ void Entity3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_reference_by_nodepath", "active"), &Entity3D::set_reference_by_nodepath); ClassDB::bind_method(D_METHOD("get_reference_by_nodepath"), &Entity3D::get_reference_by_nodepath); + BIND_ENUM_CONSTANT(LOCAL); + BIND_ENUM_CONSTANT(GLOBAL); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sync_transform"), "set_sync_transform", "get_sync_transform"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "reference_by_nodepath"), "set_reference_by_nodepath", "get_reference_by_nodepath"); } @@ -67,6 +70,9 @@ void Entity2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_reference_by_nodepath", "active"), &Entity2D::set_reference_by_nodepath); ClassDB::bind_method(D_METHOD("get_reference_by_nodepath"), &Entity2D::get_reference_by_nodepath); + BIND_ENUM_CONSTANT(LOCAL); + BIND_ENUM_CONSTANT(GLOBAL); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sync_transform"), "set_sync_transform", "get_sync_transform"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "reference_by_nodepath"), "set_reference_by_nodepath", "get_reference_by_nodepath"); } From a8ef19114da66a127e717138a6690e8e7c8079e5 Mon Sep 17 00:00:00 2001 From: TDRChan Date: Thu, 11 Aug 2022 13:35:25 +0200 Subject: [PATCH 5/7] [] Resolving GodotCPP Compilation Issue: 'mutable' parameter conflicting with mutable keyword. # - In the generated "dynamic_querry.h/.cpp" files of GodotCPP - when registering the following functions to GDScript; 'with_component', 'maybe_component', and 'changed_component' in Godot - the 'mutable' parameter was conflicting with the C++ 'mutable' keyword which the compiler doesn't like. - Changed other functions' "p_parameter" to "p_is_parameter" for consistency. --- iterators/dynamic_query.cpp | 18 +++++++++--------- iterators/dynamic_query.h | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/iterators/dynamic_query.cpp b/iterators/dynamic_query.cpp index 74c354ae..5448c5c3 100644 --- a/iterators/dynamic_query.cpp +++ b/iterators/dynamic_query.cpp @@ -7,9 +7,9 @@ using godex::DynamicQuery; void DynamicQuery::_bind_methods() { ClassDB::bind_method(D_METHOD("set_space", "space"), &DynamicQuery::set_space); - ClassDB::bind_method(D_METHOD("with_component", "component_id", "mutable"), &DynamicQuery::with_component); - ClassDB::bind_method(D_METHOD("maybe_component", "component_id", "mutable"), &DynamicQuery::maybe_component); - ClassDB::bind_method(D_METHOD("changed_component", "component_id", "mutable"), &DynamicQuery::changed_component); + ClassDB::bind_method(D_METHOD("with_component", "component_id", "is_mutable"), &DynamicQuery::with_component); + ClassDB::bind_method(D_METHOD("maybe_component", "component_id", "is_mutable"), &DynamicQuery::maybe_component); + ClassDB::bind_method(D_METHOD("changed_component", "component_id", "is_mutable"), &DynamicQuery::changed_component); ClassDB::bind_method(D_METHOD("not_component", "component_id"), &DynamicQuery::not_component); ClassDB::bind_method(D_METHOD("is_valid"), &DynamicQuery::is_valid); @@ -39,23 +39,23 @@ void DynamicQuery::set_space(Space p_space) { space = p_space; } -void DynamicQuery::with_component(uint32_t p_component_id, bool p_mutable) { - _with_component(p_component_id, p_mutable, WITH_MODE); +void DynamicQuery::with_component(uint32_t p_component_id, bool p_is_mutable) { + _with_component(p_component_id, p_is_mutable, WITH_MODE); } void DynamicQuery::maybe_component(uint32_t p_component_id, bool p_mutable) { _with_component(p_component_id, p_mutable, MAYBE_MODE); } -void DynamicQuery::changed_component(uint32_t p_component_id, bool p_mutable) { - _with_component(p_component_id, p_mutable, CHANGED_MODE); +void DynamicQuery::changed_component(uint32_t p_component_id, bool p_is_mutable) { + _with_component(p_component_id, p_is_mutable, CHANGED_MODE); } void DynamicQuery::not_component(uint32_t p_component_id) { _with_component(p_component_id, false, WITHOUT_MODE); } -void DynamicQuery::_with_component(uint32_t p_component_id, bool p_mutable, FetchMode p_mode) { +void DynamicQuery::_with_component(uint32_t p_component_id, bool p_is_mutable, FetchMode p_mode) { ERR_FAIL_COND_MSG(is_valid() == false, "This query is not valid."); ERR_FAIL_COND_MSG(can_change == false, "This query can't change at this point, you have to `clear` it."); if (unlikely(ECS::verify_component_id(p_component_id) == false)) { @@ -69,7 +69,7 @@ void DynamicQuery::_with_component(uint32_t p_component_id, bool p_mutable, Fetc DynamicQueryElement data; data.id = p_component_id; data.name = ECS::get_component_name(p_component_id); - data.mutability = p_mutable; + data.mutability = p_is_mutable; data.mode = p_mode; data.entity_list_index = UINT32_MAX; elements.push_back(data); diff --git a/iterators/dynamic_query.h b/iterators/dynamic_query.h index 7881d812..90e9f588 100644 --- a/iterators/dynamic_query.h +++ b/iterators/dynamic_query.h @@ -57,14 +57,14 @@ class DynamicQuery : public GodexWorldFetcher { void set_space(Space p_space); /// Add component. - void with_component(uint32_t p_component_id, bool p_mutable = false); - void maybe_component(uint32_t p_component_id, bool p_mutable = false); - void changed_component(uint32_t p_component_id, bool p_mutable = false); + void with_component(uint32_t p_component_id, bool p_is_mutable = false); + void maybe_component(uint32_t p_component_id, bool p_is_mutable = false); + void changed_component(uint32_t p_component_id, bool p_is_mutable = false); /// Excludes this component from the query. void not_component(uint32_t p_component_id); - void _with_component(uint32_t p_component_id, bool p_mutable, FetchMode p_mode); + void _with_component(uint32_t p_component_id, bool p_is_mutable, FetchMode p_mode); /// Returns true if this query is valid. bool is_valid() const; From bf985451ef1bb559d877d5677a97f849d717c46b Mon Sep 17 00:00:00 2001 From: TDRChan Date: Thu, 11 Aug 2022 13:45:04 +0200 Subject: [PATCH 6/7] [] Fixing minor issue where the default value for 'is_mutable' wasn't set to false. # - The following functions; 'with_component' 'maybe_component' 'changed_component' have the 'mutable' parameter set to false by default, so reflecting that in the exposed functions. --- iterators/dynamic_query.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iterators/dynamic_query.cpp b/iterators/dynamic_query.cpp index 5448c5c3..ee6467e8 100644 --- a/iterators/dynamic_query.cpp +++ b/iterators/dynamic_query.cpp @@ -7,9 +7,9 @@ using godex::DynamicQuery; void DynamicQuery::_bind_methods() { ClassDB::bind_method(D_METHOD("set_space", "space"), &DynamicQuery::set_space); - ClassDB::bind_method(D_METHOD("with_component", "component_id", "is_mutable"), &DynamicQuery::with_component); - ClassDB::bind_method(D_METHOD("maybe_component", "component_id", "is_mutable"), &DynamicQuery::maybe_component); - ClassDB::bind_method(D_METHOD("changed_component", "component_id", "is_mutable"), &DynamicQuery::changed_component); + ClassDB::bind_method(D_METHOD("with_component", "component_id", "is_mutable"), &DynamicQuery::with_component, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("maybe_component", "component_id", "is_mutable"), &DynamicQuery::maybe_component, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("changed_component", "component_id", "is_mutable"), &DynamicQuery::changed_component, DEFVAL(false)); ClassDB::bind_method(D_METHOD("not_component", "component_id"), &DynamicQuery::not_component); ClassDB::bind_method(D_METHOD("is_valid"), &DynamicQuery::is_valid); From 5ff522427a9ac5381ed88a4c1fe0f4052ef38a73 Mon Sep 17 00:00:00 2001 From: TDRChan Date: Fri, 19 Aug 2022 17:18:53 +0200 Subject: [PATCH 7/7] [] Fixed an issue where the 'PHASE_FINALIZE_PROCESS' flag for the 'Process' enum was missing for binding. # --- ecs.cpp | 1 + modules/godot/nodes/ecs_utilities.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/ecs.cpp b/ecs.cpp index 9c75da92..1d425686 100644 --- a/ecs.cpp +++ b/ecs.cpp @@ -119,6 +119,7 @@ void ECS::_bind_methods() { BIND_ENUM_CONSTANT(PHASE_PRE_PROCESS); BIND_ENUM_CONSTANT(PHASE_PROCESS); BIND_ENUM_CONSTANT(PHASE_POST_PROCESS); + BIND_ENUM_CONSTANT(PHASE_FINALIZE_PROCESS); BIND_ENUM_CONSTANT(PHASE_PRE_RENDER); } diff --git a/modules/godot/nodes/ecs_utilities.cpp b/modules/godot/nodes/ecs_utilities.cpp index e44c6d00..a0ab02df 100644 --- a/modules/godot/nodes/ecs_utilities.cpp +++ b/modules/godot/nodes/ecs_utilities.cpp @@ -32,6 +32,7 @@ void System::_bind_methods() { BIND_ENUM_CONSTANT(PHASE_PRE_PROCESS); BIND_ENUM_CONSTANT(PHASE_PROCESS); BIND_ENUM_CONSTANT(PHASE_POST_PROCESS); + BIND_ENUM_CONSTANT(PHASE_FINALIZE_PROCESS); BIND_ENUM_CONSTANT(PHASE_PRE_RENDER); ClassDB::add_virtual_method(get_class_static(), MethodInfo("_prepare"));