From 029467ab2c8866d8bf28a7d0762ef93bf1095061 Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 18 Mar 2022 04:10:09 +0100 Subject: [PATCH] More include and macro cleanups. --- .../entity_spell_system/data/spells/spell.cpp | 18 +++--- modules/entity_spell_system/defines.h | 2 - .../entities/ai/entity_ai.cpp | 22 +++---- .../entities/auras/aura_data.cpp | 2 +- .../entities/data/entity_data.cpp | 10 +-- .../entity_spell_system/entities/entity.cpp | 64 +++++++++---------- .../formations/ai_formation.cpp | 2 +- .../infos/spell_cast_info.cpp | 10 +-- .../pipelines/spell_damage_info.cpp | 6 +- .../pipelines/spell_heal_info.cpp | 6 +- .../skeleton/character_skeleton_2d.cpp | 6 +- .../skeleton/character_skeleton_3d.cpp | 6 +- .../nodes/mesh_data_instance.cpp | 2 +- modules/mesh_utils/defines.h | 15 ----- modules/mesh_utils/mesh_merger.cpp | 2 +- modules/mesh_utils/mesh_merger.h | 7 +- modules/mesh_utils/mesh_utils.cpp | 2 +- modules/props/prop_instance_merger.cpp | 10 +-- modules/props/prop_instance_prop_job.cpp | 4 +- modules/props/tiled_wall/tiled_wall.cpp | 2 +- modules/props_2d/tiled_wall/tiled_wall_2d.cpp | 2 +- modules/terraman/defines.h | 17 ----- modules/terraman/library/terrain_library.cpp | 6 +- .../library/terrain_library_simple.cpp | 2 +- .../library/terrain_material_cache.cpp | 8 +-- .../default/terrain_mesher_default.cpp | 4 +- modules/terraman/meshers/terrain_mesher.cpp | 12 ++-- modules/terraman/meshers/terrain_mesher.h | 4 +- .../terraman/world/block_terrain_structure.h | 2 +- .../world/default/terrain_chunk_default.cpp | 16 ++--- .../world/default/terrain_world_default.cpp | 4 +- .../terraman/world/jobs/terrain_prop_job.cpp | 2 +- .../terraman/world/jobs/terrain_terrain_job.h | 2 +- modules/terraman/world/terrain_chunk.cpp | 14 ++-- modules/terraman/world/terrain_chunk.h | 2 +- .../terraman/world/terrain_environment_data.h | 2 +- modules/terraman/world/terrain_structure.h | 2 +- modules/terraman/world/terrain_world.cpp | 28 ++++---- modules/terraman/world/terrain_world.h | 2 +- .../terraman/world/terrain_world_editor.cpp | 8 +-- modules/terraman_2d/defines.h | 16 ----- .../library/terrain_2d_library_simple.cpp | 2 +- .../library/terrain_2d_material_cache.cpp | 6 +- .../default/terrain_2d_mesher_default.cpp | 4 +- .../terraman_2d/meshers/terrain_2d_mesher.cpp | 12 ++-- .../terraman_2d/meshers/terrain_2d_mesher.h | 8 +-- .../world/block_terrain_2d_structure.h | 4 +- .../default/terrain_2d_chunk_default.cpp | 8 +-- .../default/terrain_2d_world_default.cpp | 2 +- .../world/jobs/terrain_2d_terrain_job.h | 6 +- .../terraman_2d/world/terrain_2d_chunk.cpp | 14 ++-- modules/terraman_2d/world/terrain_2d_chunk.h | 4 +- .../world/terrain_2d_environment_data.h | 2 +- .../terraman_2d/world/terrain_2d_structure.h | 5 +- .../terraman_2d/world/terrain_2d_world.cpp | 28 ++++---- .../world/terrain_2d_world_editor.cpp | 6 +- modules/voxelman/defines.h | 17 ----- .../voxelman/library/voxel_library_merger.cpp | 8 +-- .../voxelman/library/voxel_material_cache.cpp | 8 +-- .../meshers/cubic/voxel_mesher_cubic.cpp | 4 +- .../meshers/default/voxel_mesher_default.cpp | 4 +- modules/voxelman/meshers/voxel_mesher.cpp | 2 +- modules/voxelman/meshers/voxel_mesher.h | 8 +-- .../voxelman/world/block_voxel_structure.h | 4 +- .../world/blocky/voxel_world_blocky.cpp | 6 +- .../world/cubic/voxel_world_cubic.cpp | 6 +- .../world/default/voxel_chunk_default.cpp | 16 ++--- .../world/default/voxel_world_default.cpp | 4 +- modules/voxelman/world/environment_data.h | 2 +- modules/voxelman/world/jobs/voxel_job.cpp | 10 +-- .../voxelman/world/jobs/voxel_prop_job.cpp | 2 +- .../voxelman/world/jobs/voxel_terrain_job.cpp | 4 +- .../voxelman/world/jobs/voxel_terrain_job.h | 6 +- .../voxel_world_marching_cubes.cpp | 6 +- modules/voxelman/world/voxel_chunk.cpp | 2 +- modules/voxelman/world/voxel_chunk.h | 4 +- modules/voxelman/world/voxel_structure.h | 6 +- modules/voxelman/world/voxel_world.h | 2 +- modules/voxelman/world/voxel_world_editor.cpp | 8 +-- 79 files changed, 258 insertions(+), 345 deletions(-) diff --git a/modules/entity_spell_system/data/spells/spell.cpp b/modules/entity_spell_system/data/spells/spell.cpp index 28d3b05e4..f472a63f5 100644 --- a/modules/entity_spell_system/data/spells/spell.cpp +++ b/modules/entity_spell_system/data/spells/spell.cpp @@ -966,7 +966,7 @@ void Spell::aura_stat_attribute_set_percent_mod(int index, float value) { //// Spell System //// void Spell::cast_starts_simple(Entity *caster, float spell_scale) { - ERR_FAIL_COND(!caster || !INSTANCE_VALIDATE(caster)); + ERR_FAIL_COND(!caster || !ObjectDB::instance_validate(caster)); Ref info = Ref(memnew(SpellCastInfo())); @@ -981,7 +981,7 @@ void Spell::cast_starts_simple(Entity *caster, float spell_scale) { } void Spell::cast_interrupts_simple(Entity *caster) { - ERR_FAIL_COND(!caster || !INSTANCE_VALIDATE(caster)); + ERR_FAIL_COND(!caster || !ObjectDB::instance_validate(caster)); Ref info(memnew(SpellCastInfo())); @@ -992,7 +992,7 @@ void Spell::cast_interrupts_simple(Entity *caster) { } void Spell::cast_starts_triggered_simple(Entity *caster) { - ERR_FAIL_COND(!caster || !INSTANCE_VALIDATE(caster)); + ERR_FAIL_COND(!caster || !ObjectDB::instance_validate(caster)); Ref info(memnew(SpellCastInfo())); @@ -1834,7 +1834,7 @@ void Spell::_cast_finishs(Ref info) { info->caster_get()->notification_scast(SpellEnums::NOTIFICATION_CAST_FINISHED, info); info->caster_get()->cast_spell_successs(info); - if (INSTANCE_VALIDATE(info->target_get())) { + if (ObjectDB::instance_validate(info->target_get())) { info->target_get()->notification_scast(SpellEnums::NOTIFICATION_CAST_FINISHED_TARGET, info); } @@ -1887,7 +1887,7 @@ void Spell::_handle_projectile(Ref info) { Node *p = info->caster_get()->get_parent(); - ERR_FAIL_COND(!INSTANCE_VALIDATE(p)); + ERR_FAIL_COND(!ObjectDB::instance_validate(p)); p->add_child(projectile); @@ -1913,7 +1913,7 @@ void Spell::_handle_effect(Ref info) { # return */ - bool has_target = INSTANCE_VALIDATE(info->target_get()); + bool has_target = ObjectDB::instance_validate(info->target_get()); if (_target_type == SPELL_TARGET_TYPE_TARGET) { if (!has_target) @@ -2121,7 +2121,7 @@ void Spell::_aura_supdate(Ref aura, float delta) { } void Spell::_setup_aura_data(Ref data, Ref info) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(info->caster_get())); + ERR_FAIL_COND(!ObjectDB::instance_validate(info->caster_get())); data->set_aura(Ref(this)); data->set_aura_id(get_id()); @@ -2167,7 +2167,7 @@ void Spell::_aura_calculate_initial_damage(Ref aura_data, Ref aura_data, Ref info) { - if (info->dealer_get() && !INSTANCE_VALIDATE(info->dealer_get())) { + if (info->dealer_get() && !ObjectDB::instance_validate(info->dealer_get())) { info->dealer_set(NULL); } @@ -2204,7 +2204,7 @@ void Spell::_aura_calculate_initial_heal(Ref aura_data, Ref aura_data, Ref info) { - if (info->dealer_get() && !INSTANCE_VALIDATE(info->dealer_get())) { + if (info->dealer_get() && !ObjectDB::instance_validate(info->dealer_get())) { info->dealer_set(NULL); } diff --git a/modules/entity_spell_system/defines.h b/modules/entity_spell_system/defines.h index 47ce158a3..bc3789aa1 100644 --- a/modules/entity_spell_system/defines.h +++ b/modules/entity_spell_system/defines.h @@ -16,8 +16,6 @@ arr_into.push_back(e); \ } - -#define INSTANCE_VALIDATE(var) ObjectDB::instance_validate(var) #define CONNECT(sig, obj, target_method_class, method) connect(sig, obj, #method) #define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, obj, #method) diff --git a/modules/entity_spell_system/entities/ai/entity_ai.cpp b/modules/entity_spell_system/entities/ai/entity_ai.cpp index 86c358652..c2fbdb5c4 100644 --- a/modules/entity_spell_system/entities/ai/entity_ai.cpp +++ b/modules/entity_spell_system/entities/ai/entity_ai.cpp @@ -108,26 +108,26 @@ String EntityAI::get_editor_description() const { } void EntityAI::update(float delta) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(_owner)); + ERR_FAIL_COND(!ObjectDB::instance_validate(_owner)); if (has_method("_update")) call("_update", delta); } void EntityAI::pet_update(float delta) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(_owner)); + ERR_FAIL_COND(!ObjectDB::instance_validate(_owner)); if (has_method("_pet_update")) call("_pet_update", delta); } void EntityAI::move(float delta) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(_owner)); + ERR_FAIL_COND(!ObjectDB::instance_validate(_owner)); if (has_method("_move")) call("_move", delta); } void EntityAI::pet_move(float delta) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(_owner)); + ERR_FAIL_COND(!ObjectDB::instance_validate(_owner)); if (has_method("_pet_move")) call("_pet_move", delta); @@ -231,7 +231,7 @@ void EntityAI::notification_sxp_gained(Entity *entity, int value) { call("_notification_sxp_gained", entity, value); } void EntityAI::notification_sxp_gained_bind(Node *entity, int value) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(entity)); + ERR_FAIL_COND(!ObjectDB::instance_validate(entity)); Entity *e = Object::cast_to(entity); @@ -245,7 +245,7 @@ void EntityAI::notification_slevel_up(Entity *entity, int value) { call("_notification_slevel_up", entity); } void EntityAI::notification_slevel_up_bind(Node *entity, int value) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(entity)); + ERR_FAIL_COND(!ObjectDB::instance_validate(entity)); Entity *e = Object::cast_to(entity); @@ -274,7 +274,7 @@ bool EntityAI::equip_should_deny(Entity *entity, int equip_slot, Ref item) { - ERR_FAIL_COND_V(!INSTANCE_VALIDATE(entity), false); + ERR_FAIL_COND_V(!ObjectDB::instance_validate(entity), false); Entity *e = Object::cast_to(entity); @@ -288,7 +288,7 @@ void EntityAI::equip_son_success(Entity *entity, int equip_slot, Ref item, Ref old_item, int bag_slot) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(entity)); + ERR_FAIL_COND(!ObjectDB::instance_validate(entity)); Entity *e = Object::cast_to(entity); @@ -302,7 +302,7 @@ void EntityAI::equip_son_fail(Entity *entity, int equip_slot, Ref call("_equip_son_fail", entity, equip_slot, item, old_item, bag_slot); } void EntityAI::equip_son_fail_bind(Node *entity, int equip_slot, Ref item, Ref old_item, int bag_slot) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(entity)); + ERR_FAIL_COND(!ObjectDB::instance_validate(entity)); Entity *e = Object::cast_to(entity); @@ -316,7 +316,7 @@ void EntityAI::equip_con_success(Entity *entity, int equip_slot, Ref item, Ref old_item, int bag_slot) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(entity)); + ERR_FAIL_COND(!ObjectDB::instance_validate(entity)); Entity *e = Object::cast_to(entity); @@ -330,7 +330,7 @@ void EntityAI::equip_con_fail(Entity *entity, int equip_slot, Ref call("_equip_con_fail", entity, equip_slot, item, old_item, bag_slot); } void EntityAI::equip_con_fail_bind(Node *entity, int equip_slot, Ref item, Ref old_item, int bag_slot) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(entity)); + ERR_FAIL_COND(!ObjectDB::instance_validate(entity)); Entity *e = Object::cast_to(entity); diff --git a/modules/entity_spell_system/entities/auras/aura_data.cpp b/modules/entity_spell_system/entities/auras/aura_data.cpp index d0d06c0f4..a4ccf55de 100644 --- a/modules/entity_spell_system/entities/auras/aura_data.cpp +++ b/modules/entity_spell_system/entities/auras/aura_data.cpp @@ -265,7 +265,7 @@ void AuraData::set_slow(float value) { } void AuraData::resolve_references(Node *owner) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(owner)); + ERR_FAIL_COND(!ObjectDB::instance_validate(owner)); ERR_FAIL_COND(!owner->is_inside_tree()); diff --git a/modules/entity_spell_system/entities/data/entity_data.cpp b/modules/entity_spell_system/entities/data/entity_data.cpp index 9e5c28890..2eb89dce4 100644 --- a/modules/entity_spell_system/entities/data/entity_data.cpp +++ b/modules/entity_spell_system/entities/data/entity_data.cpp @@ -191,7 +191,7 @@ String EntityData::generate_name() { //// SETUP //// void EntityData::setup_resources(Entity *entity) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(entity)); + ERR_FAIL_COND(!ObjectDB::instance_validate(entity)); if (_entity_class_data.is_valid()) _entity_class_data->setup_resources(entity); @@ -201,7 +201,7 @@ void EntityData::setup_resources(Entity *entity) { } bool EntityData::cans_interact(Entity *entity) { - ERR_FAIL_COND_V(!INSTANCE_VALIDATE(entity), false); + ERR_FAIL_COND_V(!ObjectDB::instance_validate(entity), false); if (has_method("_cans_interact")) return call("_cans_interact", entity); @@ -210,7 +210,7 @@ bool EntityData::cans_interact(Entity *entity) { } bool EntityData::cans_interact_bind(Node *entity) { - ERR_FAIL_COND_V(!INSTANCE_VALIDATE(entity), false); + ERR_FAIL_COND_V(!ObjectDB::instance_validate(entity), false); Entity *e = Object::cast_to(entity); @@ -220,14 +220,14 @@ bool EntityData::cans_interact_bind(Node *entity) { } void EntityData::sinteract(Entity *entity) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(entity)); + ERR_FAIL_COND(!ObjectDB::instance_validate(entity)); if (has_method("_sinteract")) call("_sinteract", entity); } void EntityData::sinteract_bind(Node *entity) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(entity)); + ERR_FAIL_COND(!ObjectDB::instance_validate(entity)); Entity *e = Object::cast_to(entity); diff --git a/modules/entity_spell_system/entities/entity.cpp b/modules/entity_spell_system/entities/entity.cpp index da38610c7..4ad5d2117 100644 --- a/modules/entity_spell_system/entities/entity.cpp +++ b/modules/entity_spell_system/entities/entity.cpp @@ -177,7 +177,7 @@ void Entity::set_body_path(NodePath value) { set_body(get_node_or_null(_body_path)); - if (INSTANCE_VALIDATE(_body)) + if (ObjectDB::instance_validate(_body)) _body->set_owner(this); } Node *Entity::get_body() { @@ -233,7 +233,7 @@ Node *Entity::get_character_skeleton() { void Entity::set_character_skeleton(Node *skeleton) { _character_skeleton = skeleton; - if (INSTANCE_VALIDATE(_character_skeleton) && _character_skeleton->has_method("add_model_visual")) { + if (ObjectDB::instance_validate(_character_skeleton) && _character_skeleton->has_method("add_model_visual")) { for (int i = 0; i < _c_equipment.size(); ++i) { Ref ii = _c_equipment[i]; @@ -265,7 +265,7 @@ void Entity::setc_guid(int value) { //Transforms Transform Entity::get_transform_3d(bool only_stored) const { if (!only_stored && _body_3d) { - ERR_FAIL_COND_V(!INSTANCE_VALIDATE(_body_3d), _transform); + ERR_FAIL_COND_V(!ObjectDB::instance_validate(_body_3d), _transform); return _body_3d->get_transform(); } @@ -274,7 +274,7 @@ Transform Entity::get_transform_3d(bool only_stored) const { } void Entity::set_transform_3d(const Transform &transform, bool only_stored) { if (!only_stored && _body_3d) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(_body_3d)); + ERR_FAIL_COND(!ObjectDB::instance_validate(_body_3d)); return _body_3d->set_transform(transform); } @@ -284,7 +284,7 @@ void Entity::set_transform_3d(const Transform &transform, bool only_stored) { Transform2D Entity::get_transform_2d(bool only_stored) const { if (!only_stored && _body_2d) { - ERR_FAIL_COND_V(!INSTANCE_VALIDATE(_body_2d), _transform_2d); + ERR_FAIL_COND_V(!ObjectDB::instance_validate(_body_2d), _transform_2d); return _body_2d->get_transform(); } @@ -293,7 +293,7 @@ Transform2D Entity::get_transform_2d(bool only_stored) const { } void Entity::set_transform_2d(const Transform2D &transform, bool only_stored) { if (!only_stored && _body_2d) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(_body_2d)); + ERR_FAIL_COND(!ObjectDB::instance_validate(_body_2d)); return _body_2d->set_transform(_transform_2d); } @@ -339,12 +339,12 @@ void Entity::setc_entity_type(int value) { EntityEnums::EntityRelationType Entity::gets_relation_to_bind(Node *to) { Entity *e = Object::cast_to(to); - ERR_FAIL_COND_V(!INSTANCE_VALIDATE(e), EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL); + ERR_FAIL_COND_V(!ObjectDB::instance_validate(e), EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL); return gets_relation_to(e); } EntityEnums::EntityRelationType Entity::gets_relation_to(Entity *to) { - ERR_FAIL_COND_V(!INSTANCE_VALIDATE(to), EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL); + ERR_FAIL_COND_V(!ObjectDB::instance_validate(to), EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL); return static_cast(static_cast(call("_gets_relation_to", to))); } @@ -359,12 +359,12 @@ EntityEnums::EntityRelationType Entity::_gets_relation_to(Node *to) { EntityEnums::EntityRelationType Entity::getc_relation_to_bind(Node *to) { Entity *e = Object::cast_to(to); - ERR_FAIL_COND_V(!INSTANCE_VALIDATE(e), EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL); + ERR_FAIL_COND_V(!ObjectDB::instance_validate(e), EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL); return getc_relation_to(e); } EntityEnums::EntityRelationType Entity::getc_relation_to(Entity *to) { - ERR_FAIL_COND_V(!INSTANCE_VALIDATE(to), EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL); + ERR_FAIL_COND_V(!ObjectDB::instance_validate(to), EntityEnums::ENTITY_RELATION_TYPE_NEUTRAL); return static_cast(static_cast(call("_getc_relation_to", to))); } @@ -451,7 +451,7 @@ int Entity::getc_model_index() { void Entity::setc_model_index(int value) { _c_model_index = value; - if (INSTANCE_VALIDATE(_character_skeleton)) { + if (ObjectDB::instance_validate(_character_skeleton)) { if (_character_skeleton->has_method("set_model_index")) _character_skeleton->call("set_model_index", _c_model_index); } @@ -956,7 +956,7 @@ void Entity::sets_ai(Ref value) { //// Pets //// void Entity::pet_adds(Entity *entity) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(entity)); + ERR_FAIL_COND(!ObjectDB::instance_validate(entity)); //the owner always want to see his pet, and you pet will always want to see the owner sees_adds(entity); @@ -998,12 +998,12 @@ void Entity::pet_removes_index(int index) { for (int i = 0; i < _s_pets.size(); ++i) { Entity *pet = _s_pets.get(index); - ERR_CONTINUE(!INSTANCE_VALIDATE(pet)); + ERR_CONTINUE(!ObjectDB::instance_validate(pet)); _s_pets.get(i)->pet_sets_formation_index(i); } - ERR_FAIL_COND(!INSTANCE_VALIDATE(entity)); + ERR_FAIL_COND(!ObjectDB::instance_validate(entity)); entity->pet_sets_owner(NULL); @@ -1036,13 +1036,13 @@ void Entity::pet_addc_path(NodePath path) { Entity *entity = Object::cast_to(n); - ERR_FAIL_COND(!INSTANCE_VALIDATE(entity)); + ERR_FAIL_COND(!ObjectDB::instance_validate(entity)); pet_addc(entity); } void Entity::pet_addc(Entity *entity) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(entity)); + ERR_FAIL_COND(!ObjectDB::instance_validate(entity)); _c_pets.push_back(entity); @@ -2436,7 +2436,7 @@ void Entity::_equip_applyc_item(Ref item) { ERR_FAIL_COND(!it.is_valid()); - if (it->get_model_visual().is_valid() && INSTANCE_VALIDATE(_character_skeleton)) { + if (it->get_model_visual().is_valid() && ObjectDB::instance_validate(_character_skeleton)) { if (_character_skeleton->has_method("add_model_visual")) _character_skeleton->call("add_model_visual", it->get_model_visual()); } @@ -2448,7 +2448,7 @@ void Entity::_equip_deapplyc_item(Ref item) { ERR_FAIL_COND(!it.is_valid()); - if (it->get_model_visual().is_valid() && INSTANCE_VALIDATE(_character_skeleton)) { + if (it->get_model_visual().is_valid() && ObjectDB::instance_validate(_character_skeleton)) { if (_character_skeleton->has_method("remove_model_visual")) _character_skeleton->call("remove_model_visual", it->get_model_visual()); } @@ -2857,7 +2857,7 @@ bool Entity::canc_interact() { return call("_canc_interact"); } - if (!INSTANCE_VALIDATE(_c_target)) { + if (!ObjectDB::instance_validate(_c_target)) { return false; } @@ -3558,7 +3558,7 @@ Ref Entity::aura_gets_with_group_by(Entity *caster, Ref aur return Ref(); } Ref Entity::aura_gets_with_group_by_bind(Node *caster, Ref aura_group) { - if (!INSTANCE_VALIDATE(caster)) { + if (!ObjectDB::instance_validate(caster)) { return Ref(); } @@ -4596,7 +4596,7 @@ Entity *Entity::gets_target() { void Entity::sets_target(Node *p_target) { Entity *original_target = _s_target; - if (!INSTANCE_VALIDATE(original_target)) { + if (!ObjectDB::instance_validate(original_target)) { original_target = NULL; _s_target = NULL; } @@ -4646,7 +4646,7 @@ Entity *Entity::getc_target() { void Entity::setc_target(Node *p_target) { Entity *original_target = _c_target; - if (!INSTANCE_VALIDATE(original_target)) { + if (!ObjectDB::instance_validate(original_target)) { original_target = NULL; _c_target = NULL; } @@ -5648,7 +5648,7 @@ Entity *Entity::sees_gets(int index) { void Entity::sees_removes_index(int index) { Entity *e = _s_sees.get(index); - if (unlikely(!INSTANCE_VALIDATE(e))) { + if (unlikely(!ObjectDB::instance_validate(e))) { _s_sees.remove(index); return; } @@ -5658,7 +5658,7 @@ void Entity::sees_removes_index(int index) { _s_sees.remove(index); } void Entity::sees_removes(Entity *entity) { - if (unlikely(!INSTANCE_VALIDATE(entity))) { + if (unlikely(!ObjectDB::instance_validate(entity))) { _s_sees.erase(entity); return; } @@ -5675,7 +5675,7 @@ void Entity::sees_removes_bind(Node *entity) { sees_removes(e); } void Entity::sees_adds(Entity *entity) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(entity)); + ERR_FAIL_COND(!ObjectDB::instance_validate(entity)); entity->seen_by_adds(this); @@ -5716,7 +5716,7 @@ void Entity::seen_by_removes_bind(Node *entity) { seen_by_removes(e); } void Entity::seen_by_adds(Entity *entity) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(entity)); + ERR_FAIL_COND(!ObjectDB::instance_validate(entity)); for (int i = 0; i < _s_seen_by.size(); ++i) { if (_s_seen_by.get(i) == entity) @@ -5750,7 +5750,7 @@ void Entity::vrpc(const StringName &p_method, VARIANT_ARG_DECLARE) { for (int i = 0; i < _s_seen_by.size(); ++i) { Entity *e = _s_seen_by.get(i); - if (unlikely(!INSTANCE_VALIDATE(e))) { + if (unlikely(!ObjectDB::instance_validate(e))) { _s_seen_by.remove(i); --i; continue; @@ -6298,10 +6298,10 @@ void Entity::_con_target_changed(Node *p_entity, Node *p_old_target) { //Entity *entity = Object::cast_to(p_entity); Entity *old_target = Object::cast_to(p_old_target); - if (INSTANCE_VALIDATE(old_target)) + if (ObjectDB::instance_validate(old_target)) old_target->notification_cuntargeted(); - if (INSTANCE_VALIDATE(getc_target())) { + if (ObjectDB::instance_validate(getc_target())) { getc_target()->notification_ctargeted(); if (canc_interact()) @@ -6513,7 +6513,7 @@ void Entity::_notification(int p_what) { case NOTIFICATION_INSTANCED: { set_body(get_node_or_null(_body_path)); - if (INSTANCE_VALIDATE(_body)) + if (ObjectDB::instance_validate(_body)) _body->set_owner(this); _character_skeleton = get_node_or_null(_character_skeleton_path); @@ -6530,7 +6530,7 @@ void Entity::_notification(int p_what) { if (!_body) { set_body(get_node_or_null(_body_path)); - if (INSTANCE_VALIDATE(_body)) + if (ObjectDB::instance_validate(_body)) _body->set_owner(this); } @@ -6554,7 +6554,7 @@ void Entity::_notification(int p_what) { for (int i = 0; i < _s_seen_by.size(); ++i) { Entity *e = _s_seen_by.get(i); - if (INSTANCE_VALIDATE(e)) + if (ObjectDB::instance_validate(e)) e->sees_removes(this); } } break; diff --git a/modules/entity_spell_system/formations/ai_formation.cpp b/modules/entity_spell_system/formations/ai_formation.cpp index 6be306f3d..94f146924 100644 --- a/modules/entity_spell_system/formations/ai_formation.cpp +++ b/modules/entity_spell_system/formations/ai_formation.cpp @@ -62,7 +62,7 @@ String AIFormation::get_editor_description() const { } Vector3 AIFormation::get_position(int slot_index) { - ERR_FAIL_COND_V(!INSTANCE_VALIDATE(_owner), Vector3()); + ERR_FAIL_COND_V(!ObjectDB::instance_validate(_owner), Vector3()); if (has_method("_get_position")) return call("_get_position", slot_index); diff --git a/modules/entity_spell_system/infos/spell_cast_info.cpp b/modules/entity_spell_system/infos/spell_cast_info.cpp index e039281c5..abda7cd28 100644 --- a/modules/entity_spell_system/infos/spell_cast_info.cpp +++ b/modules/entity_spell_system/infos/spell_cast_info.cpp @@ -34,7 +34,7 @@ SOFTWARE. //// SpellCastInfo //// Entity *SpellCastInfo::caster_get() { - if (_caster && !INSTANCE_VALIDATE(_caster)) { + if (_caster && !ObjectDB::instance_validate(_caster)) { _caster = NULL; } @@ -58,7 +58,7 @@ void SpellCastInfo::caster_set_bind(Node *caster) { } Entity *SpellCastInfo::target_get() { - if (_target && !INSTANCE_VALIDATE(_target)) { + if (_target && !ObjectDB::instance_validate(_target)) { _target = NULL; } @@ -163,7 +163,7 @@ void SpellCastInfo::physics_process(float delta) { } void SpellCastInfo::resolve_references(Node *owner) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(owner)); + ERR_FAIL_COND(!ObjectDB::instance_validate(owner)); ERR_FAIL_COND(!owner->is_inside_tree()); @@ -183,10 +183,10 @@ void SpellCastInfo::resolve_references(Node *owner) { Dictionary SpellCastInfo::to_dict() { Dictionary dict; - if (INSTANCE_VALIDATE(_caster)) + if (ObjectDB::instance_validate(_caster)) dict["caster"] = _caster->get_path(); - if (INSTANCE_VALIDATE(_target)) + if (ObjectDB::instance_validate(_target)) dict["target"] = _target->get_path(); dict["has_cast_time"] = _has_cast_time; diff --git a/modules/entity_spell_system/pipelines/spell_damage_info.cpp b/modules/entity_spell_system/pipelines/spell_damage_info.cpp index 4651bbb81..433bc4acd 100644 --- a/modules/entity_spell_system/pipelines/spell_damage_info.cpp +++ b/modules/entity_spell_system/pipelines/spell_damage_info.cpp @@ -162,7 +162,7 @@ void SpellDamageInfo::reset() { } void SpellDamageInfo::resolve_references(Node *owner) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(owner)); + ERR_FAIL_COND(!ObjectDB::instance_validate(owner)); ERR_FAIL_COND(!owner->is_inside_tree()); _dealer = Object::cast_to(owner->get_node_or_null(_dealer_path)); @@ -178,10 +178,10 @@ void SpellDamageInfo::resolve_references(Node *owner) { Dictionary SpellDamageInfo::to_dict() { Dictionary dict; - if (INSTANCE_VALIDATE(_dealer)) + if (ObjectDB::instance_validate(_dealer)) dict["dealer_path"] = _dealer->get_path(); - if (INSTANCE_VALIDATE(_receiver)) + if (ObjectDB::instance_validate(_receiver)) dict["receiver_path"] = _receiver->get_path(); dict["immune"] = _immune; diff --git a/modules/entity_spell_system/pipelines/spell_heal_info.cpp b/modules/entity_spell_system/pipelines/spell_heal_info.cpp index ccfca000c..e94244e78 100644 --- a/modules/entity_spell_system/pipelines/spell_heal_info.cpp +++ b/modules/entity_spell_system/pipelines/spell_heal_info.cpp @@ -163,7 +163,7 @@ void SpellHealInfo::reset() { } void SpellHealInfo::resolve_references(Node *owner) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(owner)); + ERR_FAIL_COND(!ObjectDB::instance_validate(owner)); ERR_FAIL_COND(!owner->is_inside_tree()); _dealer = Object::cast_to(owner->get_node_or_null(_dealer_path)); @@ -179,10 +179,10 @@ void SpellHealInfo::resolve_references(Node *owner) { Dictionary SpellHealInfo::to_dict() { Dictionary dict; - if (INSTANCE_VALIDATE(_dealer)) + if (ObjectDB::instance_validate(_dealer)) dict["dealer_path"] = _dealer->get_path(); - if (INSTANCE_VALIDATE(_receiver)) + if (ObjectDB::instance_validate(_receiver)) dict["receiver_path"] = _receiver->get_path(); dict["immune"] = _immune; diff --git a/modules/entity_spell_system/skeleton/character_skeleton_2d.cpp b/modules/entity_spell_system/skeleton/character_skeleton_2d.cpp index 148d11abe..e02d8c8fb 100644 --- a/modules/entity_spell_system/skeleton/character_skeleton_2d.cpp +++ b/modules/entity_spell_system/skeleton/character_skeleton_2d.cpp @@ -89,7 +89,7 @@ void CharacterSkeleton2D::common_attach_point_add(const EntityEnums::CommonChara Node *n = _attach_point_nodes[index].node; - if (INSTANCE_VALIDATE(n) && n->has_method("add")) { + if (ObjectDB::instance_validate(n) && n->has_method("add")) { n->call("add", scene); } } @@ -100,7 +100,7 @@ void CharacterSkeleton2D::common_attach_point_add_timed(const EntityEnums::Commo Node *n = _attach_point_nodes[index].node; - if (INSTANCE_VALIDATE(n) && n->has_method("add_timed")) { + if (ObjectDB::instance_validate(n) && n->has_method("add_timed")) { n->call("add_timed", scene, time); } } @@ -111,7 +111,7 @@ void CharacterSkeleton2D::common_attach_point_remove(const EntityEnums::CommonCh Node *n = _attach_point_nodes[index].node; - if (INSTANCE_VALIDATE(n) && n->has_method("remove")) { + if (ObjectDB::instance_validate(n) && n->has_method("remove")) { n->call("remove", scene); } } diff --git a/modules/entity_spell_system/skeleton/character_skeleton_3d.cpp b/modules/entity_spell_system/skeleton/character_skeleton_3d.cpp index 98ee2fc6f..6940d61de 100644 --- a/modules/entity_spell_system/skeleton/character_skeleton_3d.cpp +++ b/modules/entity_spell_system/skeleton/character_skeleton_3d.cpp @@ -89,7 +89,7 @@ void CharacterSkeleton3D::common_attach_point_add(const EntityEnums::CommonChara Node *n = _attach_point_nodes[index].node; - if (INSTANCE_VALIDATE(n) && n->has_method("add")) { + if (ObjectDB::instance_validate(n) && n->has_method("add")) { n->call("add", scene); } } @@ -100,7 +100,7 @@ void CharacterSkeleton3D::common_attach_point_add_timed(const EntityEnums::Commo Node *n = _attach_point_nodes[index].node; - if (INSTANCE_VALIDATE(n) && n->has_method("add_timed")) { + if (ObjectDB::instance_validate(n) && n->has_method("add_timed")) { n->call("add_timed", scene, time); } } @@ -111,7 +111,7 @@ void CharacterSkeleton3D::common_attach_point_remove(const EntityEnums::CommonCh Node *n = _attach_point_nodes[index].node; - if (INSTANCE_VALIDATE(n) && n->has_method("remove")) { + if (ObjectDB::instance_validate(n) && n->has_method("remove")) { n->call("remove", scene); } } diff --git a/modules/mesh_data_resource/nodes/mesh_data_instance.cpp b/modules/mesh_data_resource/nodes/mesh_data_instance.cpp index f0b1957ec..56b5aaa48 100644 --- a/modules/mesh_data_resource/nodes/mesh_data_instance.cpp +++ b/modules/mesh_data_resource/nodes/mesh_data_instance.cpp @@ -4,7 +4,7 @@ #include "core/image.h" -#define GET_WORLD get_world + #if TEXTURE_PACKER_PRESENT #include "../../texture_packer/texture_resource/packer_image_resource.h" diff --git a/modules/mesh_utils/defines.h b/modules/mesh_utils/defines.h index 0c3ae1381..9e1e6f433 100644 --- a/modules/mesh_utils/defines.h +++ b/modules/mesh_utils/defines.h @@ -2,19 +2,6 @@ #ifndef MESH_UTILS_DEFINES_H #define MESH_UTILS_DEFINES_H -#define core_input_h "core/os/input.h" -#define spatial_editor_plugin_h "editor/plugins/spatial_editor_plugin.h" -#define camera_h "scene/3d/camera.h" -#define spatial_h "scene/3d/spatial.h" -#define navigation_h "scene/3d/navigation.h" -#define light_h "scene/3d/light.h" -#define visual_server_h "servers/visual_server.h" -#define mesh_instance_h "scene/3d/mesh_instance.h" -#define pool_vector_h "core/pool_vector.h" -#define physics_server_h "servers/physics_server.h" -#define immediate_geometry_h "scene/3d/immediate_geometry.h" -#define include_pool_vector - #define VARIANT_ARRAY_GET(arr) \ Vector r; \ for (int i = 0; i < arr.size(); i++) { \ @@ -29,9 +16,7 @@ arr_into.push_back(e); \ } -#define INSTANCE_VALIDATE(var) ObjectDB::instance_validate(var) #define CONNECT(sig, obj, target_method_class, method) connect(sig, obj, #method) #define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, obj, #method) -#define GET_WORLD get_world #endif diff --git a/modules/mesh_utils/mesh_merger.cpp b/modules/mesh_utils/mesh_merger.cpp index d352ba05d..4bf0b659b 100644 --- a/modules/mesh_utils/mesh_merger.cpp +++ b/modules/mesh_utils/mesh_merger.cpp @@ -24,7 +24,7 @@ SOFTWARE. #include "defines.h" -#include mesh_instance_h +#include "scene/3d/mesh_instance.h" bool MeshMerger::Vertex::operator==(const Vertex &p_vertex) const { if (vertex != p_vertex.vertex) diff --git a/modules/mesh_utils/mesh_merger.h b/modules/mesh_utils/mesh_merger.h index 3f31c5b31..0df9aaf9f 100644 --- a/modules/mesh_utils/mesh_merger.h +++ b/modules/mesh_utils/mesh_merger.h @@ -30,9 +30,8 @@ SOFTWARE. #include "defines.h" -#include pool_vector_h -include_pool_vector -#include mesh_instance_h +#include "core/pool_vector.h" +#include "scene/3d/mesh_instance.h" #include "core/math/rect2.h" #include "core/math/vector2.h" @@ -45,7 +44,7 @@ include_pool_vector #include "../mesh_data_resource/mesh_data_resource.h" #endif - class MeshMerger : public Reference { +class MeshMerger : public Reference { GDCLASS(MeshMerger, Reference); public: diff --git a/modules/mesh_utils/mesh_utils.cpp b/modules/mesh_utils/mesh_utils.cpp index a52c8dafd..b7bbd485f 100644 --- a/modules/mesh_utils/mesh_utils.cpp +++ b/modules/mesh_utils/mesh_utils.cpp @@ -25,7 +25,7 @@ SOFTWARE. #include "core/variant.h" #include "scene/resources/mesh.h" -#include visual_server_h +#include "servers/visual_server.h" #include "xatlas/xatlas.h" diff --git a/modules/props/prop_instance_merger.cpp b/modules/props/prop_instance_merger.cpp index 527eee162..d15d2f66f 100644 --- a/modules/props/prop_instance_merger.cpp +++ b/modules/props/prop_instance_merger.cpp @@ -18,7 +18,7 @@ #include "servers/visual_server.h" -#define GET_WORLD get_world + #if MESH_DATA_RESOURCE_PRESENT //define PROPS_PRESENT, so things compile. That module's scsub will define this too while compiling, @@ -183,8 +183,8 @@ void PropInstanceMerger::meshes_create(const int num) { for (int i = 0; i < num; ++i) { RID mesh_instance_rid = VS::get_singleton()->instance_create(); - if (GET_WORLD().is_valid()) - VS::get_singleton()->instance_set_scenario(mesh_instance_rid, GET_WORLD()->get_scenario()); + if (get_world().is_valid()) + VS::get_singleton()->instance_set_scenario(mesh_instance_rid, get_world()->get_scenario()); RID mesh_rid = VS::get_singleton()->mesh_create(); @@ -373,8 +373,8 @@ void PropInstanceMerger::debug_mesh_allocate() { if (_debug_mesh_instance == RID()) { _debug_mesh_instance = VisualServer::get_singleton()->instance_create(); - if (GET_WORLD().is_valid()) - VS::get_singleton()->instance_set_scenario(_debug_mesh_instance, GET_WORLD()->get_scenario()); + if (get_world().is_valid()) + VS::get_singleton()->instance_set_scenario(_debug_mesh_instance, get_world()->get_scenario()); VS::get_singleton()->instance_set_base(_debug_mesh_instance, _debug_mesh_rid); VS::get_singleton()->instance_set_transform(_debug_mesh_instance, get_transform()); diff --git a/modules/props/prop_instance_prop_job.cpp b/modules/props/prop_instance_prop_job.cpp index 61f2f8d04..1bab4cc0b 100644 --- a/modules/props/prop_instance_prop_job.cpp +++ b/modules/props/prop_instance_prop_job.cpp @@ -22,7 +22,7 @@ SOFTWARE. #include "prop_instance_prop_job.h" -#define GET_WORLD get_world + #include "jobs/prop_mesher_job_step.h" #include "lights/prop_light.h" @@ -234,7 +234,7 @@ void PropInstancePropJob::phase_physics_process() { PhysicsServer::get_singleton()->body_set_collision_mask(body, _prop_instace->get_collision_mask()); if (_prop_instace->is_inside_tree() && _prop_instace->is_inside_world()) { - Ref world = _prop_instace->GET_WORLD(); + Ref world = _prop_instace->get_world(); if (world.is_valid() && world->get_space() != RID()) { PhysicsServer::get_singleton()->body_set_space(body, world->get_space()); diff --git a/modules/props/tiled_wall/tiled_wall.cpp b/modules/props/tiled_wall/tiled_wall.cpp index 39997a10c..01027180a 100644 --- a/modules/props/tiled_wall/tiled_wall.cpp +++ b/modules/props/tiled_wall/tiled_wall.cpp @@ -4,7 +4,7 @@ #include "core/image.h" -#define GET_WORLD get_world + #if TEXTURE_PACKER_PRESENT #include "../../texture_packer/texture_resource/packer_image_resource.h" diff --git a/modules/props_2d/tiled_wall/tiled_wall_2d.cpp b/modules/props_2d/tiled_wall/tiled_wall_2d.cpp index 57025a338..b443dd40a 100644 --- a/modules/props_2d/tiled_wall/tiled_wall_2d.cpp +++ b/modules/props_2d/tiled_wall/tiled_wall_2d.cpp @@ -4,7 +4,7 @@ #include "core/image.h" -#define GET_WORLD get_world + #if TEXTURE_PACKER_PRESENT #include "../../texture_packer/texture_resource/packer_image_resource.h" diff --git a/modules/terraman/defines.h b/modules/terraman/defines.h index 293a0d978..9f71cf69e 100644 --- a/modules/terraman/defines.h +++ b/modules/terraman/defines.h @@ -2,19 +2,6 @@ #ifndef TERRAIN_DEFINES_H #define TERRAIN_DEFINES_H -#define core_input_h "core/os/input.h" -#define spatial_editor_plugin_h "editor/plugins/spatial_editor_plugin.h" -#define camera_h "scene/3d/camera.h" -#define spatial_h "scene/3d/spatial.h" -#define navigation_h "scene/3d/navigation.h" -#define light_h "scene/3d/light.h" -#define visual_server_h "servers/visual_server.h" -#define mesh_instance_h "scene/3d/mesh_instance.h" -#define pool_vector_h "core/pool_vector.h" -#define physics_server_h "servers/physics_server.h" -#define immediate_geometry_h "scene/3d/immediate_geometry.h" -#define include_pool_vector - #define VARIANT_ARRAY_GET(arr) \ Vector r; \ for (int i = 0; i < arr.size(); i++) { \ @@ -29,12 +16,8 @@ arr_into.push_back(e); \ } -#define INSTANCE_VALIDATE(var) ObjectDB::instance_validate(var) #define CONNECT(sig, obj, target_method_class, method) connect(sig, obj, #method) #define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, obj, #method) -#define GET_WORLD get_world -#define INSTANCE instance -#define VREMOVE remove #define CALL(func, ...) \ call(#func, ##__VA_ARGS__); diff --git a/modules/terraman/library/terrain_library.cpp b/modules/terraman/library/terrain_library.cpp index b92de1fa0..6309db49e 100644 --- a/modules/terraman/library/terrain_library.cpp +++ b/modules/terraman/library/terrain_library.cpp @@ -101,7 +101,7 @@ void TerrainLibrary::material_set(const int index, const Ref &value) { } void TerrainLibrary::material_remove(const int index) { - _materials.VREMOVE(index); + _materials.remove(index); } int TerrainLibrary::material_get_num() const { @@ -181,7 +181,7 @@ void TerrainLibrary::liquid_material_set(const int index, const Ref &v } void TerrainLibrary::liquid_material_remove(const int index) { - _liquid_materials.VREMOVE(index); + _liquid_materials.remove(index); } int TerrainLibrary::liquid_material_get_num() const { @@ -261,7 +261,7 @@ void TerrainLibrary::prop_material_set(const int index, const Ref &val } void TerrainLibrary::prop_material_remove(const int index) { - _prop_materials.VREMOVE(index); + _prop_materials.remove(index); } int TerrainLibrary::prop_material_get_num() const { diff --git a/modules/terraman/library/terrain_library_simple.cpp b/modules/terraman/library/terrain_library_simple.cpp index 80fd22799..17db3e625 100644 --- a/modules/terraman/library/terrain_library_simple.cpp +++ b/modules/terraman/library/terrain_library_simple.cpp @@ -77,7 +77,7 @@ void TerrainLibrarySimple::terra_surface_set(const int index, Ref &va } void TerrainMaterialCache::material_remove(const int index) { - _materials.VREMOVE(index); + _materials.remove(index); } int TerrainMaterialCache::material_get_num() const { @@ -148,7 +148,7 @@ void TerrainMaterialCache::surface_set(int index, Ref value) { _surfaces.set(index, value); } void TerrainMaterialCache::surface_remove(const int index) { - _surfaces.VREMOVE(index); + _surfaces.remove(index); } int TerrainMaterialCache::surface_get_num() const { return _surfaces.size(); @@ -163,7 +163,7 @@ void TerrainMaterialCache::additional_texture_add(const Ref &texture) { void TerrainMaterialCache::additional_texture_remove(const Ref &texture) { for (int i = 0; i < _additional_textures.size(); ++i) { if (_additional_textures[i] == texture) { - _additional_textures.VREMOVE(i); + _additional_textures.remove(i); return; } } @@ -171,7 +171,7 @@ void TerrainMaterialCache::additional_texture_remove(const Ref &texture void TerrainMaterialCache::additional_texture_remove_index(const int index) { ERR_FAIL_INDEX(index, _additional_textures.size()); - _additional_textures.VREMOVE(index); + _additional_textures.remove(index); } void TerrainMaterialCache::additional_textures_clear() { _additional_textures.clear(); diff --git a/modules/terraman/meshers/default/terrain_mesher_default.cpp b/modules/terraman/meshers/default/terrain_mesher_default.cpp index 3b4265af2..dc7112e69 100644 --- a/modules/terraman/meshers/default/terrain_mesher_default.cpp +++ b/modules/terraman/meshers/default/terrain_mesher_default.cpp @@ -26,8 +26,8 @@ SOFTWARE. #include "../../defines.h" -#include visual_server_h -#include mesh_instance_h +#include "servers/visual_server.h" +#include "scene/3d/mesh_instance.h" _FORCE_INLINE_ int TerrainMesherDefault::get_build_flags() const { return _build_flags; diff --git a/modules/terraman/meshers/terrain_mesher.cpp b/modules/terraman/meshers/terrain_mesher.cpp index 3cd3353a6..44e93b56d 100644 --- a/modules/terraman/meshers/terrain_mesher.cpp +++ b/modules/terraman/meshers/terrain_mesher.cpp @@ -24,7 +24,7 @@ SOFTWARE. #include "../defines.h" -#include mesh_instance_h +#include "scene/3d/mesh_instance.h" #include "../world/default/terrain_chunk_default.h" #include "../world/terrain_chunk.h" @@ -334,7 +334,7 @@ void TerrainMesher::remove_doubles() { for (int j = 0; j < indices.size(); ++j) { int index = indices[j]; - _vertices.VREMOVE(index); + _vertices.remove(index); //make all indices that were bigger than the one we replaced one lower for (int k = 0; k < _indices.size(); ++k) { @@ -386,8 +386,8 @@ void TerrainMesher::remove_doubles_hashed() { for (int j = 0; j < indices.size(); ++j) { int index = indices[j]; - hashes.VREMOVE(index); - _vertices.VREMOVE(index); + hashes.remove(index); + _vertices.remove(index); //make all indices that were bigger than the one we replaced one lower for (int k = 0; k < _indices.size(); ++k) { @@ -730,7 +730,7 @@ Vector3 TerrainMesher::get_vertex(const int idx) const { } void TerrainMesher::remove_vertex(const int idx) { - _vertices.VREMOVE(idx); + _vertices.remove(idx); } PoolVector TerrainMesher::get_normals() const { @@ -878,7 +878,7 @@ int TerrainMesher::get_index(const int idx) const { } void TerrainMesher::remove_index(const int idx) { - _indices.VREMOVE(idx); + _indices.remove(idx); } TerrainMesher::TerrainMesher(const Ref &library) { diff --git a/modules/terraman/meshers/terrain_mesher.h b/modules/terraman/meshers/terrain_mesher.h index 7ff755516..0f971d969 100644 --- a/modules/terraman/meshers/terrain_mesher.h +++ b/modules/terraman/meshers/terrain_mesher.h @@ -28,9 +28,9 @@ SOFTWARE. #include "../defines.h" -#include pool_vector_h +#include "core/pool_vector.h" -#include mesh_instance_h +#include "scene/3d/mesh_instance.h" #include "core/math/rect2.h" #include "core/math/vector2.h" diff --git a/modules/terraman/world/block_terrain_structure.h b/modules/terraman/world/block_terrain_structure.h index 48f706dc5..66b010b9c 100644 --- a/modules/terraman/world/block_terrain_structure.h +++ b/modules/terraman/world/block_terrain_structure.h @@ -28,7 +28,7 @@ SOFTWARE. #include "../defines.h" -#include pool_vector_h +#include "core/pool_vector.h" #include "terrain_chunk.h" diff --git a/modules/terraman/world/default/terrain_chunk_default.cpp b/modules/terraman/world/default/terrain_chunk_default.cpp index c04750058..d05a60ab7 100644 --- a/modules/terraman/world/default/terrain_chunk_default.cpp +++ b/modules/terraman/world/default/terrain_chunk_default.cpp @@ -24,8 +24,8 @@ SOFTWARE. #include "../../defines.h" -#include visual_server_h -#include physics_server_h +#include "servers/visual_server.h" +#include "servers/physics_server.h" #include "../../../opensimplex/open_simplex_noise.h" #include "../../meshers/default/terrain_mesher_default.h" @@ -302,8 +302,8 @@ void TerrainChunkDefault::meshes_create(const int mesh_index, const int mesh_cou for (int i = 0; i < mesh_count; ++i) { RID mesh_instance_rid = VS::get_singleton()->instance_create(); - if (get_voxel_world()->GET_WORLD().is_valid()) - VS::get_singleton()->instance_set_scenario(mesh_instance_rid, get_voxel_world()->GET_WORLD()->get_scenario()); + if (get_voxel_world()->get_world().is_valid()) + VS::get_singleton()->instance_set_scenario(mesh_instance_rid, get_voxel_world()->get_world()->get_scenario()); RID mesh_rid = VS::get_singleton()->mesh_create(); @@ -382,7 +382,7 @@ void TerrainChunkDefault::colliders_create(const int mesh_index, const int layer PhysicsServer::get_singleton()->body_set_state(body_rid, PhysicsServer::BODY_STATE_TRANSFORM, get_transform()); if (get_voxel_world()->is_inside_tree() && get_voxel_world()->is_inside_world()) { - Ref world = get_voxel_world()->GET_WORLD(); + Ref world = get_voxel_world()->get_world(); if (world.is_valid() && world->get_space() != RID()) PhysicsServer::get_singleton()->body_set_space(body_rid, world->get_space()); @@ -420,7 +420,7 @@ void TerrainChunkDefault::colliders_create_area(const int mesh_index, const int PhysicsServer::get_singleton()->area_set_collision_mask(area_rid, layer_mask); if (get_voxel_world()->is_inside_tree() && get_voxel_world()->is_inside_world()) { - Ref world = get_voxel_world()->GET_WORLD(); + Ref world = get_voxel_world()->get_world(); if (world.is_valid() && world->get_space() != RID()) PhysicsServer::get_singleton()->area_set_space(area_rid, world->get_space()); @@ -533,8 +533,8 @@ void TerrainChunkDefault::debug_mesh_allocate() { if (_debug_mesh_instance == RID()) { _debug_mesh_instance = VisualServer::get_singleton()->instance_create(); - if (get_voxel_world()->GET_WORLD().is_valid()) - VS::get_singleton()->instance_set_scenario(_debug_mesh_instance, get_voxel_world()->GET_WORLD()->get_scenario()); + if (get_voxel_world()->get_world().is_valid()) + VS::get_singleton()->instance_set_scenario(_debug_mesh_instance, get_voxel_world()->get_world()->get_scenario()); VS::get_singleton()->instance_set_base(_debug_mesh_instance, _debug_mesh_rid); VS::get_singleton()->instance_set_transform(_debug_mesh_instance, get_transform()); diff --git a/modules/terraman/world/default/terrain_world_default.cpp b/modules/terraman/world/default/terrain_world_default.cpp index fc6bb162e..dad34ffd7 100644 --- a/modules/terraman/world/default/terrain_world_default.cpp +++ b/modules/terraman/world/default/terrain_world_default.cpp @@ -143,7 +143,7 @@ PoolColorArray TerrainWorldDefault::get_vertex_colors(const Transform &transform } void TerrainWorldDefault::_update_lods() { - if (!get_player() || !INSTANCE_VALIDATE(get_player())) { + if (!get_player() || !ObjectDB::instance_validate(get_player())) { return; } @@ -307,7 +307,7 @@ void TerrainWorldDefault::_notification(int p_what) { return; } - if (!INSTANCE_VALIDATE(get_player())) { + if (!ObjectDB::instance_validate(get_player())) { set_player(NULL); return; } diff --git a/modules/terraman/world/jobs/terrain_prop_job.cpp b/modules/terraman/world/jobs/terrain_prop_job.cpp index 20cebf83e..8a73ecbb0 100644 --- a/modules/terraman/world/jobs/terrain_prop_job.cpp +++ b/modules/terraman/world/jobs/terrain_prop_job.cpp @@ -107,7 +107,7 @@ void TerrainPropJob::phase_physics_process() { PhysicsServer::get_singleton()->body_set_collision_mask(body, 1); if (chunk->get_voxel_world()->is_inside_tree() && chunk->get_voxel_world()->is_inside_world()) { - Ref world = chunk->get_voxel_world()->GET_WORLD(); + Ref world = chunk->get_voxel_world()->get_world(); if (world.is_valid() && world->get_space() != RID()) { PhysicsServer::get_singleton()->body_set_space(body, world->get_space()); diff --git a/modules/terraman/world/jobs/terrain_terrain_job.h b/modules/terraman/world/jobs/terrain_terrain_job.h index 78f0b3934..213ec7882 100644 --- a/modules/terraman/world/jobs/terrain_terrain_job.h +++ b/modules/terraman/world/jobs/terrain_terrain_job.h @@ -28,7 +28,7 @@ SOFTWARE. #include "../../defines.h" -#include pool_vector_h +#include "core/pool_vector.h" class TerrainMesher; diff --git a/modules/terraman/world/terrain_chunk.cpp b/modules/terraman/world/terrain_chunk.cpp index 1bc965d3f..e008af4a6 100644 --- a/modules/terraman/world/terrain_chunk.cpp +++ b/modules/terraman/world/terrain_chunk.cpp @@ -261,7 +261,7 @@ void TerrainChunk::job_set(int index, const Ref &job) { void TerrainChunk::job_remove(const int index) { ERR_FAIL_INDEX(index, _jobs.size()); - _jobs.VREMOVE(index); + _jobs.remove(index); } void TerrainChunk::job_add(const Ref &job) { _jobs.push_back(job); @@ -610,12 +610,12 @@ void TerrainChunk::voxel_structure_remove(const Ref &structure int index = _voxel_structures.find(structure); if (index != -1) - _voxel_structures.VREMOVE(index); + _voxel_structures.remove(index); } void TerrainChunk::voxel_structure_remove_index(const int index) { ERR_FAIL_INDEX(index, _voxel_structures.size()); - _voxel_structures.VREMOVE(index); + _voxel_structures.remove(index); } void TerrainChunk::voxel_structure_clear() { _voxel_structures.clear(); @@ -647,7 +647,7 @@ void TerrainChunk::voxel_structures_set(const Vector &structures) { } void TerrainChunk::build() { - ERR_FAIL_COND(!INSTANCE_VALIDATE(get_voxel_world())); + ERR_FAIL_COND(!ObjectDB::instance_validate(get_voxel_world())); ERR_FAIL_COND(!get_voxel_world()->is_inside_tree()); ERR_FAIL_COND(!is_in_tree()); @@ -735,7 +735,7 @@ int TerrainChunk::prop_get_count() const { void TerrainChunk::prop_remove(const int index) { ERR_FAIL_INDEX(index, _props.size()); - _props.VREMOVE(index); + _props.remove(index); } void TerrainChunk::props_clear() { _props.clear(); @@ -893,7 +893,7 @@ int TerrainChunk::mesh_data_resource_get_count() const { void TerrainChunk::mesh_data_resource_remove(const int index) { ERR_FAIL_INDEX(index, _mesh_data_resources.size()); - _mesh_data_resources.VREMOVE(index); + _mesh_data_resources.remove(index); } void TerrainChunk::mesh_data_resource_clear() { _mesh_data_resources.clear(); @@ -968,7 +968,7 @@ int TerrainChunk::collider_get_count() const { void TerrainChunk::collider_remove(const int index) { ERR_FAIL_INDEX(index, _colliders.size()); - _colliders.VREMOVE(index); + _colliders.remove(index); } void TerrainChunk::colliders_clear() { _colliders.clear(); diff --git a/modules/terraman/world/terrain_chunk.h b/modules/terraman/world/terrain_chunk.h index 12f12f8cc..f1f02529f 100644 --- a/modules/terraman/world/terrain_chunk.h +++ b/modules/terraman/world/terrain_chunk.h @@ -29,7 +29,7 @@ SOFTWARE. #include "../defines.h" -#include pool_vector_h +#include "core/pool_vector.h" #include "core/os/mutex.h" #include "core/os/thread.h" diff --git a/modules/terraman/world/terrain_environment_data.h b/modules/terraman/world/terrain_environment_data.h index 096892660..470540c51 100644 --- a/modules/terraman/world/terrain_environment_data.h +++ b/modules/terraman/world/terrain_environment_data.h @@ -27,7 +27,7 @@ SOFTWARE. #include "../defines.h" -#include light_h +#include "scene/3d/light.h" #include "scene/3d/world_environment.h" #include "scene/main/node.h" diff --git a/modules/terraman/world/terrain_structure.h b/modules/terraman/world/terrain_structure.h index e8edb1c60..0ec5756e6 100644 --- a/modules/terraman/world/terrain_structure.h +++ b/modules/terraman/world/terrain_structure.h @@ -27,7 +27,7 @@ SOFTWARE. #include "../defines.h" -#include pool_vector_h +#include "core/pool_vector.h" #include "core/math/aabb.h" #include "terrain_chunk.h" diff --git a/modules/terraman/world/terrain_world.cpp b/modules/terraman/world/terrain_world.cpp index 6f625944b..6c22084a3 100644 --- a/modules/terraman/world/terrain_world.cpp +++ b/modules/terraman/world/terrain_world.cpp @@ -187,7 +187,7 @@ void TerrainWorld::world_area_add(const Ref &area) { void TerrainWorld::world_area_remove(const int index) { ERR_FAIL_INDEX(index, _world_areas.size()); - _world_areas.VREMOVE(index); + _world_areas.remove(index); } void TerrainWorld::world_areas_clear() { _world_areas.clear(); @@ -213,12 +213,12 @@ void TerrainWorld::voxel_structure_remove(const Ref &structure int index = _voxel_structures.find(structure); if (index != -1) - _voxel_structures.VREMOVE(index); + _voxel_structures.remove(index); } void TerrainWorld::voxel_structure_remove_index(const int index) { ERR_FAIL_INDEX(index, _voxel_structures.size()); - _voxel_structures.VREMOVE(index); + _voxel_structures.remove(index); } void TerrainWorld::voxel_structures_clear() { _voxel_structures.clear(); @@ -300,7 +300,7 @@ Ref TerrainWorld::chunk_remove(const int x, const int z) { for (int i = 0; i < _chunks_vector.size(); ++i) { if (_chunks_vector.get(i) == chunk) { - _chunks_vector.VREMOVE(i); + _chunks_vector.remove(i); break; } } @@ -326,7 +326,7 @@ Ref TerrainWorld::chunk_remove_index(const int index) { Ref chunk = _chunks_vector.get(index); chunk->exit_tree(); - _chunks_vector.VREMOVE(index); + _chunks_vector.remove(index); _chunks.erase(IntPos(chunk->get_position_x(), chunk->get_position_z())); _generation_queue.erase(chunk); @@ -403,7 +403,7 @@ void TerrainWorld::chunk_setup(Ref chunk) { Ref TerrainWorld::_create_chunk(const int x, const int z, Ref chunk) { if (!chunk.is_valid()) { - chunk.INSTANCE(); + chunk.instance(); } //no meshers here @@ -554,7 +554,7 @@ Ref TerrainWorld::generation_queue_get_index(int index) { void TerrainWorld::generation_queue_remove_index(int index) { ERR_FAIL_INDEX(index, _generation_queue.size()); - _generation_queue.VREMOVE(index); + _generation_queue.remove(index); } int TerrainWorld::generation_queue_get_size() const { return _generation_queue.size(); @@ -573,7 +573,7 @@ Ref TerrainWorld::generation_get_index(const int index) { void TerrainWorld::generation_remove_index(const int index) { ERR_FAIL_INDEX(index, _generating.size()); - _generating.VREMOVE(index); + _generating.remove(index); } int TerrainWorld::generation_get_size() const { return _generating.size(); @@ -626,7 +626,7 @@ void TerrainWorld::prop_add(Transform transform, const Ref &prop, cons if (!sc.is_valid()) continue; - Node *n = sc->INSTANCE(); + Node *n = sc->instance(); add_child(n); n->set_owner(this); @@ -643,7 +643,7 @@ void TerrainWorld::prop_add(Transform transform, const Ref &prop, cons if (light_data.is_valid()) { Ref light; - light.INSTANCE(); + light.instance(); light->set_world_position(wp.x / get_voxel_scale(), wp.y / get_voxel_scale(), wp.z / get_voxel_scale()); light->set_color(light_data->get_light_color()); @@ -990,19 +990,19 @@ void TerrainWorld::_notification(int p_what) { Ref chunk = _generating.get(i); if (!chunk.is_valid()) { - _generating.VREMOVE(i); + _generating.remove(i); --i; continue; } if (!chunk->get_is_generating()) { - _generating.VREMOVE(i); + _generating.remove(i); --i; continue; } if (chunk->is_build_aborted() && chunk->is_safe_to_delete()) { - _generating.VREMOVE(i); + _generating.remove(i); --i; continue; } @@ -1016,7 +1016,7 @@ void TerrainWorld::_notification(int p_what) { while (_generating.size() < _max_concurrent_generations && _generation_queue.size() != 0) { Ref chunk = _generation_queue.get(0); - _generation_queue.VREMOVE(0); + _generation_queue.remove(0); ERR_FAIL_COND(!chunk.is_valid()); diff --git a/modules/terraman/world/terrain_world.h b/modules/terraman/world/terrain_world.h index 9244a4041..4017d2086 100644 --- a/modules/terraman/world/terrain_world.h +++ b/modules/terraman/world/terrain_world.h @@ -27,7 +27,7 @@ SOFTWARE. #include "../defines.h" -#include navigation_h +#include "scene/3d/navigation.h" #include "../areas/terrain_world_area.h" #include "../level_generator/terrain_level_generator.h" diff --git a/modules/terraman/world/terrain_world_editor.cpp b/modules/terraman/world/terrain_world_editor.cpp index ede2fe35c..c3595455d 100644 --- a/modules/terraman/world/terrain_world_editor.cpp +++ b/modules/terraman/world/terrain_world_editor.cpp @@ -38,9 +38,9 @@ SOFTWARE. #include "../defines.h" -#include core_input_h -#include spatial_editor_plugin_h -#include camera_h +#include "core/os/input.h" +#include "editor/plugins/spatial_editor_plugin.h" +#include "scene/3d/camera.h" bool TerrainWorldEditor::forward_spatial_input_event(Camera *p_camera, const Ref &p_event) { if (!_world || !_world->get_editable()) { @@ -81,7 +81,7 @@ bool TerrainWorldEditor::do_input_action(Camera *p_camera, const Point2 &p_point from = local_xform.xform(from); to = local_xform.xform(to); - PhysicsDirectSpaceState *ss = _world->GET_WORLD()->get_direct_space_state(); + PhysicsDirectSpaceState *ss = _world->get_world()->get_direct_space_state(); PhysicsDirectSpaceState::RayResult res; diff --git a/modules/terraman_2d/defines.h b/modules/terraman_2d/defines.h index a1945651f..27f0ee12f 100644 --- a/modules/terraman_2d/defines.h +++ b/modules/terraman_2d/defines.h @@ -2,19 +2,6 @@ #ifndef TERRAIN_2D_DEFINES_H #define TERRAIN_2D_DEFINES_H -#define core_input_h "core/os/input.h" -#define spatial_editor_plugin_h "editor/plugins/spatial_editor_plugin.h" -#define camera_h "scene/3d/camera.h" -#define spatial_h "scene/3d/spatial.h" -#define navigation_h "scene/3d/navigation.h" -#define light_h "scene/3d/light.h" -#define visual_server_h "servers/visual_server.h" -#define mesh_instance_h "scene/3d/mesh_instance.h" -#define pool_vector_h "core/pool_vector.h" -#define physics_server_h "servers/physics_server.h" -#define immediate_geometry_h "scene/3d/immediate_geometry.h" -#define include_pool_vector - #define VARIANT_ARRAY_GET(arr) \ Vector r; \ for (int i = 0; i < arr.size(); i++) { \ @@ -29,11 +16,8 @@ arr_into.push_back(e); \ } -#define INSTANCE_VALIDATE(var) ObjectDB::instance_validate(var) #define CONNECT(sig, obj, target_method_class, method) connect(sig, obj, #method) #define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, obj, #method) -#define INSTANCE instance -#define VREMOVE remove #define CALL(func, ...) \ call(#func, ##__VA_ARGS__); diff --git a/modules/terraman_2d/library/terrain_2d_library_simple.cpp b/modules/terraman_2d/library/terrain_2d_library_simple.cpp index ba9d96597..4dc0b2738 100644 --- a/modules/terraman_2d/library/terrain_2d_library_simple.cpp +++ b/modules/terraman_2d/library/terrain_2d_library_simple.cpp @@ -77,7 +77,7 @@ void Terrain2DLibrarySimple::terra_surface_set(const int index, Ref value) _surfaces.set(index, value); } void Terrain2DMaterialCache::surface_remove(const int index) { - _surfaces.VREMOVE(index); + _surfaces.remove(index); } int Terrain2DMaterialCache::surface_get_num() const { return _surfaces.size(); @@ -113,7 +113,7 @@ void Terrain2DMaterialCache::additional_texture_add(const Ref &texture) void Terrain2DMaterialCache::additional_texture_remove(const Ref &texture) { for (int i = 0; i < _additional_textures.size(); ++i) { if (_additional_textures[i] == texture) { - _additional_textures.VREMOVE(i); + _additional_textures.remove(i); return; } } @@ -121,7 +121,7 @@ void Terrain2DMaterialCache::additional_texture_remove(const Ref &textu void Terrain2DMaterialCache::additional_texture_remove_index(const int index) { ERR_FAIL_INDEX(index, _additional_textures.size()); - _additional_textures.VREMOVE(index); + _additional_textures.remove(index); } void Terrain2DMaterialCache::additional_textures_clear() { _additional_textures.clear(); diff --git a/modules/terraman_2d/meshers/default/terrain_2d_mesher_default.cpp b/modules/terraman_2d/meshers/default/terrain_2d_mesher_default.cpp index 65554ff98..b8358ff0c 100644 --- a/modules/terraman_2d/meshers/default/terrain_2d_mesher_default.cpp +++ b/modules/terraman_2d/meshers/default/terrain_2d_mesher_default.cpp @@ -27,8 +27,8 @@ SOFTWARE. #include "../../defines.h" -#include visual_server_h -#include mesh_instance_h +#include "servers/visual_server.h" +#include "scene/3d/mesh_instance.h" #include "servers/physics_2d_server.h" #include "scene/resources/world_2d.h" diff --git a/modules/terraman_2d/meshers/terrain_2d_mesher.cpp b/modules/terraman_2d/meshers/terrain_2d_mesher.cpp index 0d3af915e..a29a3a6be 100644 --- a/modules/terraman_2d/meshers/terrain_2d_mesher.cpp +++ b/modules/terraman_2d/meshers/terrain_2d_mesher.cpp @@ -24,7 +24,7 @@ SOFTWARE. #include "../defines.h" -#include mesh_instance_h +#include "scene/3d/mesh_instance.h" #include "../world/default/terrain_2d_chunk_default.h" #include "../world/terrain_2d_chunk.h" @@ -244,7 +244,7 @@ void Terrain2DMesher::remove_doubles() { for (int j = 0; j < indices.size(); ++j) { int index = indices[j]; - _vertices.VREMOVE(index); + _vertices.remove(index); //make all indices that were bigger than the one we replaced one lower for (int k = 0; k < _indices.size(); ++k) { @@ -296,8 +296,8 @@ void Terrain2DMesher::remove_doubles_hashed() { for (int j = 0; j < indices.size(); ++j) { int index = indices[j]; - hashes.VREMOVE(index); - _vertices.VREMOVE(index); + hashes.remove(index); + _vertices.remove(index); //make all indices that were bigger than the one we replaced one lower for (int k = 0; k < _indices.size(); ++k) { @@ -752,7 +752,7 @@ Vector2 Terrain2DMesher::get_vertex(const int idx) const { } void Terrain2DMesher::remove_vertex(const int idx) { - _vertices.VREMOVE(idx); + _vertices.remove(idx); } PoolVector Terrain2DMesher::get_colors() const { @@ -838,7 +838,7 @@ int Terrain2DMesher::get_index(const int idx) const { } void Terrain2DMesher::remove_index(const int idx) { - _indices.VREMOVE(idx); + _indices.remove(idx); } Terrain2DMesher::Terrain2DMesher(const Ref &library) { diff --git a/modules/terraman_2d/meshers/terrain_2d_mesher.h b/modules/terraman_2d/meshers/terrain_2d_mesher.h index 733bb9917..d252b30f3 100644 --- a/modules/terraman_2d/meshers/terrain_2d_mesher.h +++ b/modules/terraman_2d/meshers/terrain_2d_mesher.h @@ -28,10 +28,8 @@ SOFTWARE. #include "../defines.h" -#include pool_vector_h -include_pool_vector - -#include mesh_instance_h +#include "core/pool_vector.h" +#include "scene/3d/mesh_instance.h" #include "core/math/rect2.h" #include "core/math/vector2.h" @@ -48,7 +46,7 @@ include_pool_vector #include "../library/terrain_2d_library.h" - class Terrain2DLibrary; +class Terrain2DLibrary; class Terrain2DChunk; class Terrain2DMesher : public Reference { diff --git a/modules/terraman_2d/world/block_terrain_2d_structure.h b/modules/terraman_2d/world/block_terrain_2d_structure.h index 75e63d70a..80a5a1440 100644 --- a/modules/terraman_2d/world/block_terrain_2d_structure.h +++ b/modules/terraman_2d/world/block_terrain_2d_structure.h @@ -28,11 +28,9 @@ SOFTWARE. #include "../defines.h" -#include pool_vector_h -include_pool_vector +#include "core/pool_vector.h" #include "terrain_2d_chunk.h" - ; class BlockTerrain2DStructure : public Terrain2DStructure { GDCLASS(BlockTerrain2DStructure, Terrain2DStructure); diff --git a/modules/terraman_2d/world/default/terrain_2d_chunk_default.cpp b/modules/terraman_2d/world/default/terrain_2d_chunk_default.cpp index a59f6ae73..c1461c62d 100644 --- a/modules/terraman_2d/world/default/terrain_2d_chunk_default.cpp +++ b/modules/terraman_2d/world/default/terrain_2d_chunk_default.cpp @@ -24,8 +24,8 @@ SOFTWARE. #include "../../defines.h" -#include visual_server_h -#include physics_server_h +#include "servers/visual_server.h" +#include "servers/physics_server.h" #include "../../../opensimplex/open_simplex_noise.h" #include "../../meshers/default/terrain_2d_mesher_default.h" @@ -493,8 +493,8 @@ void Terrain2DChunkDefault::debug_mesh_allocate() { if (_debug_mesh_instance == RID()) { _debug_mesh_instance = VisualServer::get_singleton()->instance_create(); - //if (get_voxel_world()->GET_WORLD().is_valid()) - // VS::get_singleton()->instance_set_scenario(_debug_mesh_instance, get_voxel_world()->GET_WORLD()->get_scenario()); + //if (get_voxel_world()->get_world().is_valid()) + // VS::get_singleton()->instance_set_scenario(_debug_mesh_instance, get_voxel_world()->get_world()->get_scenario()); VS::get_singleton()->instance_set_base(_debug_mesh_instance, _debug_mesh_rid); //VS::get_singleton()->instance_set_transform(_debug_mesh_instance, get_transform()); diff --git a/modules/terraman_2d/world/default/terrain_2d_world_default.cpp b/modules/terraman_2d/world/default/terrain_2d_world_default.cpp index 68add1354..b00bf30eb 100644 --- a/modules/terraman_2d/world/default/terrain_2d_world_default.cpp +++ b/modules/terraman_2d/world/default/terrain_2d_world_default.cpp @@ -202,7 +202,7 @@ void Terrain2DWorldDefault::_notification(int p_what) { return; } - if (!INSTANCE_VALIDATE(get_player())) { + if (!ObjectDB::instance_validate(get_player())) { set_player(NULL); return; } diff --git a/modules/terraman_2d/world/jobs/terrain_2d_terrain_job.h b/modules/terraman_2d/world/jobs/terrain_2d_terrain_job.h index 9e17bb88f..83806c553 100644 --- a/modules/terraman_2d/world/jobs/terrain_2d_terrain_job.h +++ b/modules/terraman_2d/world/jobs/terrain_2d_terrain_job.h @@ -26,11 +26,9 @@ SOFTWARE. #include "../../defines.h" -#include pool_vector_h +#include "core/pool_vector.h" -include_pool_vector - - class Terrain2DMesher; +class Terrain2DMesher; class Terrain2DTerrain2DJob : public Terrain2DJob { GDCLASS(Terrain2DTerrain2DJob, Terrain2DJob); diff --git a/modules/terraman_2d/world/terrain_2d_chunk.cpp b/modules/terraman_2d/world/terrain_2d_chunk.cpp index 7dc4fcbfa..a1c80a558 100644 --- a/modules/terraman_2d/world/terrain_2d_chunk.cpp +++ b/modules/terraman_2d/world/terrain_2d_chunk.cpp @@ -297,7 +297,7 @@ void Terrain2DChunk::job_set(int index, const Ref &job) { void Terrain2DChunk::job_remove(const int index) { ERR_FAIL_INDEX(index, _jobs.size()); - _jobs.VREMOVE(index); + _jobs.remove(index); } void Terrain2DChunk::job_add(const Ref &job) { _jobs.push_back(job); @@ -647,12 +647,12 @@ void Terrain2DChunk::voxel_structure_remove(const Ref &struc int index = _voxel_structures.find(structure); if (index != -1) - _voxel_structures.VREMOVE(index); + _voxel_structures.remove(index); } void Terrain2DChunk::voxel_structure_remove_index(const int index) { ERR_FAIL_INDEX(index, _voxel_structures.size()); - _voxel_structures.VREMOVE(index); + _voxel_structures.remove(index); } void Terrain2DChunk::voxel_structure_clear() { _voxel_structures.clear(); @@ -683,7 +683,7 @@ void Terrain2DChunk::voxel_structures_set(const Vector &structures) { } void Terrain2DChunk::build() { - ERR_FAIL_COND(!INSTANCE_VALIDATE(get_voxel_world())); + ERR_FAIL_COND(!ObjectDB::instance_validate(get_voxel_world())); ERR_FAIL_COND(!get_voxel_world()->is_inside_tree()); ERR_FAIL_COND(!is_in_tree()); @@ -771,7 +771,7 @@ int Terrain2DChunk::prop_get_count() const { void Terrain2DChunk::prop_remove(const int index) { ERR_FAIL_INDEX(index, _props.size()); - _props.VREMOVE(index); + _props.remove(index); } void Terrain2DChunk::props_clear() { _props.clear(); @@ -942,7 +942,7 @@ int Terrain2DChunk::mesh_data_resource_get_count() const { void Terrain2DChunk::mesh_data_resource_remove(const int index) { ERR_FAIL_INDEX(index, _mesh_data_resources.size()); - _mesh_data_resources.VREMOVE(index); + _mesh_data_resources.remove(index); } void Terrain2DChunk::mesh_data_resource_clear() { _mesh_data_resources.clear(); @@ -1017,7 +1017,7 @@ int Terrain2DChunk::collider_get_count() const { void Terrain2DChunk::collider_remove(const int index) { ERR_FAIL_INDEX(index, _colliders.size()); - _colliders.VREMOVE(index); + _colliders.remove(index); } void Terrain2DChunk::colliders_clear() { _colliders.clear(); diff --git a/modules/terraman_2d/world/terrain_2d_chunk.h b/modules/terraman_2d/world/terrain_2d_chunk.h index 7645be6e6..1b416a4c9 100644 --- a/modules/terraman_2d/world/terrain_2d_chunk.h +++ b/modules/terraman_2d/world/terrain_2d_chunk.h @@ -29,8 +29,7 @@ SOFTWARE. #include "../defines.h" -#include pool_vector_h -include_pool_vector +#include "core/pool_vector.h" #include "core/os/mutex.h" #include "core/os/thread.h" @@ -52,7 +51,6 @@ include_pool_vector #include "../library/terrain_2d_library.h" #include "../library/terrain_2d_surface.h" - ; //hackfix for a clang format issue //debug meshes update //light ppu -> max(cell_size.x, cell_zise.y) diff --git a/modules/terraman_2d/world/terrain_2d_environment_data.h b/modules/terraman_2d/world/terrain_2d_environment_data.h index e7e413eb2..ff1337a35 100644 --- a/modules/terraman_2d/world/terrain_2d_environment_data.h +++ b/modules/terraman_2d/world/terrain_2d_environment_data.h @@ -27,7 +27,7 @@ SOFTWARE. #include "../defines.h" -#include light_h +#include "scene/3d/light.h" #include "scene/3d/world_environment.h" #include "scene/main/node.h" diff --git a/modules/terraman_2d/world/terrain_2d_structure.h b/modules/terraman_2d/world/terrain_2d_structure.h index af0315dd3..5b1487d91 100644 --- a/modules/terraman_2d/world/terrain_2d_structure.h +++ b/modules/terraman_2d/world/terrain_2d_structure.h @@ -27,12 +27,11 @@ SOFTWARE. #include "../defines.h" -#include pool_vector_h -include_pool_vector +#include "core/pool_vector.h" #include "core/math/rect2.h" #include "terrain_2d_chunk.h" - class Terrain2DStructure : public Resource { +class Terrain2DStructure : public Resource { GDCLASS(Terrain2DStructure, Resource); public: diff --git a/modules/terraman_2d/world/terrain_2d_world.cpp b/modules/terraman_2d/world/terrain_2d_world.cpp index 4bf5710af..6a3584090 100644 --- a/modules/terraman_2d/world/terrain_2d_world.cpp +++ b/modules/terraman_2d/world/terrain_2d_world.cpp @@ -231,7 +231,7 @@ void Terrain2DWorld::world_area_add(const Ref &area) { void Terrain2DWorld::world_area_remove(const int index) { ERR_FAIL_INDEX(index, _world_areas.size()); - _world_areas.VREMOVE(index); + _world_areas.remove(index); } void Terrain2DWorld::world_areas_clear() { _world_areas.clear(); @@ -257,12 +257,12 @@ void Terrain2DWorld::voxel_structure_remove(const Ref &struc int index = _voxel_structures.find(structure); if (index != -1) - _voxel_structures.VREMOVE(index); + _voxel_structures.remove(index); } void Terrain2DWorld::voxel_structure_remove_index(const int index) { ERR_FAIL_INDEX(index, _voxel_structures.size()); - _voxel_structures.VREMOVE(index); + _voxel_structures.remove(index); } void Terrain2DWorld::voxel_structures_clear() { _voxel_structures.clear(); @@ -345,7 +345,7 @@ Ref Terrain2DWorld::chunk_remove(const int x, const int z) { for (int i = 0; i < _chunks_vector.size(); ++i) { if (_chunks_vector.get(i) == chunk) { - _chunks_vector.VREMOVE(i); + _chunks_vector.remove(i); break; } } @@ -372,7 +372,7 @@ Ref Terrain2DWorld::chunk_remove_index(const int index) { Ref chunk = _chunks_vector.get(index); chunk->exit_tree(); - _chunks_vector.VREMOVE(index); + _chunks_vector.remove(index); _chunks.erase(IntPos(chunk->get_position_x(), chunk->get_position_y())); _generation_queue.erase(chunk); @@ -452,7 +452,7 @@ void Terrain2DWorld::chunk_setup(Ref chunk) { Ref Terrain2DWorld::_create_chunk(const int x, const int y, Ref chunk) { if (!chunk.is_valid()) { - chunk.INSTANCE(); + chunk.instance(); } //no meshers here @@ -607,7 +607,7 @@ Ref Terrain2DWorld::generation_queue_get_index(int index) { void Terrain2DWorld::generation_queue_remove_index(int index) { ERR_FAIL_INDEX(index, _generation_queue.size()); - _generation_queue.VREMOVE(index); + _generation_queue.remove(index); } int Terrain2DWorld::generation_queue_get_size() const { return _generation_queue.size(); @@ -626,7 +626,7 @@ Ref Terrain2DWorld::generation_get_index(const int index) { void Terrain2DWorld::generation_remove_index(const int index) { ERR_FAIL_INDEX(index, _generating.size()); - _generating.VREMOVE(index); + _generating.remove(index); } int Terrain2DWorld::generation_get_size() const { return _generating.size(); @@ -681,7 +681,7 @@ void Terrain2DWorld::prop_add(Transform transform, const Ref &prop, if (!sc.is_valid()) continue; - Node *n = sc->INSTANCE(); + Node *n = sc->instance(); add_child(n); n->set_owner(this); @@ -698,7 +698,7 @@ void Terrain2DWorld::prop_add(Transform transform, const Ref &prop, if (light_data.is_valid()) { Ref light; - light.INSTANCE(); + light.instance(); light->set_world_position(wp.x / get_voxel_scale(), wp.y / get_voxel_scale()); light->set_color(light_data->get_light_color()); @@ -1048,20 +1048,20 @@ void Terrain2DWorld::_notification(int p_what) { Ref chunk = _generating.get(i); if (!chunk.is_valid()) { - _generating.VREMOVE(i); + _generating.remove(i); --i; continue; } if (!chunk->get_is_generating()) { - _generating.VREMOVE(i); + _generating.remove(i); --i; needs_update = true; continue; } if (chunk->is_build_aborted() && chunk->is_safe_to_delete()) { - _generating.VREMOVE(i); + _generating.remove(i); --i; continue; } @@ -1079,7 +1079,7 @@ void Terrain2DWorld::_notification(int p_what) { while (_generating.size() < _max_concurrent_generations && _generation_queue.size() != 0) { Ref chunk = _generation_queue.get(0); - _generation_queue.VREMOVE(0); + _generation_queue.remove(0); ERR_FAIL_COND(!chunk.is_valid()); diff --git a/modules/terraman_2d/world/terrain_2d_world_editor.cpp b/modules/terraman_2d/world/terrain_2d_world_editor.cpp index 95522cab8..aa3d16ee8 100644 --- a/modules/terraman_2d/world/terrain_2d_world_editor.cpp +++ b/modules/terraman_2d/world/terrain_2d_world_editor.cpp @@ -36,9 +36,9 @@ SOFTWARE. #include "../defines.h" -#include core_input_h -#include spatial_editor_plugin_h -#include camera_h +#include "core/os/input.h" +#include "editor/plugins/spatial_editor_plugin.h" +#include "scene/3d/camera.h" bool Terrain2DWorldEditor::forward_spatial_input_event(Camera *p_camera, const Ref &p_event) { if (!_world || !_world->get_editable()) { diff --git a/modules/voxelman/defines.h b/modules/voxelman/defines.h index 978ef8c1a..741cd8e78 100644 --- a/modules/voxelman/defines.h +++ b/modules/voxelman/defines.h @@ -2,19 +2,6 @@ #ifndef VOXEL_DEFINES_H #define VOXEL_DEFINES_H -#define core_input_h "core/os/input.h" -#define spatial_editor_plugin_h "editor/plugins/spatial_editor_plugin.h" -#define camera_h "scene/3d/camera.h" -#define spatial_h "scene/3d/spatial.h" -#define navigation_h "scene/3d/navigation.h" -#define light_h "scene/3d/light.h" -#define visual_server_h "servers/visual_server.h" -#define mesh_instance_h "scene/3d/mesh_instance.h" -#define pool_vector_h "core/pool_vector.h" -#define physics_server_h "servers/physics_server.h" -#define immediate_geometry_h "scene/3d/immediate_geometry.h" -#define include_pool_vector - #define VARIANT_ARRAY_GET(arr) \ Vector r; \ for (int i = 0; i < arr.size(); i++) { \ @@ -29,11 +16,7 @@ arr_into.push_back(e); \ } -#define INSTANCE_VALIDATE(var) ObjectDB::instance_validate(var) #define CONNECT(sig, obj, target_method_class, method) connect(sig, obj, #method) #define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, obj, #method) -#define GET_WORLD get_world -#define INSTANCE instance -#define VREMOVE remove #endif diff --git a/modules/voxelman/library/voxel_library_merger.cpp b/modules/voxelman/library/voxel_library_merger.cpp index e1b178e67..ed3f3d167 100644 --- a/modules/voxelman/library/voxel_library_merger.cpp +++ b/modules/voxelman/library/voxel_library_merger.cpp @@ -112,7 +112,7 @@ void VoxelLibraryMerger::voxel_surface_set(const int index, Ref va } void VoxelLibraryMerger::voxel_surface_remove(const int index) { - _voxel_surfaces.VREMOVE(index); + _voxel_surfaces.remove(index); } int VoxelLibraryMerger::voxel_surface_get_num() const { @@ -171,7 +171,7 @@ void VoxelLibraryMerger::set_prop(const int index, const Ref &value) { void VoxelLibraryMerger::remove_prop(const int index) { ERR_FAIL_INDEX(index, _props.size()); - _props.VREMOVE(index); + _props.remove(index); } int VoxelLibraryMerger::get_num_props() const { return _props.size(); @@ -365,7 +365,7 @@ void VoxelLibraryMerger::_setup_material_albedo(const int material_index, const } VoxelLibraryMerger::VoxelLibraryMerger() { - _packer.INSTANCE(); + _packer.instance(); _packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); @@ -373,7 +373,7 @@ VoxelLibraryMerger::VoxelLibraryMerger() { _packer->set_keep_original_atlases(false); _packer->set_margin(0); - _prop_packer.INSTANCE(); + _prop_packer.instance(); _prop_packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); diff --git a/modules/voxelman/library/voxel_material_cache.cpp b/modules/voxelman/library/voxel_material_cache.cpp index 35a51c765..d5697d2e1 100644 --- a/modules/voxelman/library/voxel_material_cache.cpp +++ b/modules/voxelman/library/voxel_material_cache.cpp @@ -87,7 +87,7 @@ void VoxelMaterialCache::material_set(const int index, const Ref &valu } void VoxelMaterialCache::material_remove(const int index) { - _materials.VREMOVE(index); + _materials.remove(index); } int VoxelMaterialCache::material_get_num() const { @@ -148,7 +148,7 @@ void VoxelMaterialCache::surface_set(int index, Ref value) { _surfaces.set(index, value); } void VoxelMaterialCache::surface_remove(const int index) { - _surfaces.VREMOVE(index); + _surfaces.remove(index); } int VoxelMaterialCache::surface_get_num() const { return _surfaces.size(); @@ -163,7 +163,7 @@ void VoxelMaterialCache::additional_texture_add(const Ref &texture) { void VoxelMaterialCache::additional_texture_remove(const Ref &texture) { for (int i = 0; i < _additional_textures.size(); ++i) { if (_additional_textures[i] == texture) { - _additional_textures.VREMOVE(i); + _additional_textures.remove(i); return; } } @@ -171,7 +171,7 @@ void VoxelMaterialCache::additional_texture_remove(const Ref &texture) void VoxelMaterialCache::additional_texture_remove_index(const int index) { ERR_FAIL_INDEX(index, _additional_textures.size()); - _additional_textures.VREMOVE(index); + _additional_textures.remove(index); } void VoxelMaterialCache::additional_textures_clear() { _additional_textures.clear(); diff --git a/modules/voxelman/meshers/cubic/voxel_mesher_cubic.cpp b/modules/voxelman/meshers/cubic/voxel_mesher_cubic.cpp index 92d943647..9fa019680 100644 --- a/modules/voxelman/meshers/cubic/voxel_mesher_cubic.cpp +++ b/modules/voxelman/meshers/cubic/voxel_mesher_cubic.cpp @@ -26,7 +26,7 @@ SOFTWARE. #include "../../defines.h" -#include visual_server_h +#include "servers/visual_server.h" void VoxelMesherCubic::_add_chunk(Ref p_chunk) { Ref chunk = p_chunk; @@ -49,7 +49,7 @@ void VoxelMesherCubic::_add_chunk(Ref p_chunk) { float voxel_scale = get_voxel_scale(); Ref cube_points; - cube_points.INSTANCE(); + cube_points.instance(); cube_points->set_channel_index_type(_channel_index_type); cube_points->set_channel_index_isolevel(_channel_index_isolevel); diff --git a/modules/voxelman/meshers/default/voxel_mesher_default.cpp b/modules/voxelman/meshers/default/voxel_mesher_default.cpp index b91a272f3..131651583 100644 --- a/modules/voxelman/meshers/default/voxel_mesher_default.cpp +++ b/modules/voxelman/meshers/default/voxel_mesher_default.cpp @@ -26,8 +26,8 @@ SOFTWARE. #include "../../defines.h" -#include visual_server_h -#include mesh_instance_h +#include "servers/visual_server.h" +#include "scene/3d/mesh_instance.h" _FORCE_INLINE_ int VoxelMesherDefault::get_build_flags() const { return _build_flags; diff --git a/modules/voxelman/meshers/voxel_mesher.cpp b/modules/voxelman/meshers/voxel_mesher.cpp index 02cd6467c..b3f61e35f 100644 --- a/modules/voxelman/meshers/voxel_mesher.cpp +++ b/modules/voxelman/meshers/voxel_mesher.cpp @@ -24,7 +24,7 @@ SOFTWARE. #include "../defines.h" -#include mesh_instance_h +#include "scene/3d/mesh_instance.h" #include "../world/default/voxel_chunk_default.h" #include "../world/voxel_chunk.h" diff --git a/modules/voxelman/meshers/voxel_mesher.h b/modules/voxelman/meshers/voxel_mesher.h index adbb2c0ce..82766ed48 100644 --- a/modules/voxelman/meshers/voxel_mesher.h +++ b/modules/voxelman/meshers/voxel_mesher.h @@ -28,10 +28,8 @@ SOFTWARE. #include "../defines.h" -#include pool_vector_h -include_pool_vector - -#include mesh_instance_h +#include "core/pool_vector.h" +#include "scene/3d/mesh_instance.h" #include "core/math/rect2.h" #include "core/math/vector2.h" @@ -46,7 +44,7 @@ include_pool_vector #include "../library/voxel_library.h" - const double PI_2 = 3.141592653589793238463 / 2; +const double PI_2 = 3.141592653589793238463 / 2; const double PI = 3.141592653589793238463; class VoxelLibrary; diff --git a/modules/voxelman/world/block_voxel_structure.h b/modules/voxelman/world/block_voxel_structure.h index a1ce68b87..217b70a74 100644 --- a/modules/voxelman/world/block_voxel_structure.h +++ b/modules/voxelman/world/block_voxel_structure.h @@ -28,11 +28,9 @@ SOFTWARE. #include "../defines.h" -#include pool_vector_h -include_pool_vector +#include "core/pool_vector.h" #include "voxel_chunk.h" - ; class BlockVoxelStructure : public VoxelStructure { GDCLASS(BlockVoxelStructure, VoxelStructure); diff --git a/modules/voxelman/world/blocky/voxel_world_blocky.cpp b/modules/voxelman/world/blocky/voxel_world_blocky.cpp index 72da0c302..04b0844bb 100644 --- a/modules/voxelman/world/blocky/voxel_world_blocky.cpp +++ b/modules/voxelman/world/blocky/voxel_world_blocky.cpp @@ -42,10 +42,10 @@ Ref VoxelWorldBlocky::_create_chunk(int x, int y, int z, Refjob_get_count() == 0) { Ref lj; - lj.INSTANCE(); + lj.instance(); Ref tj; - tj.INSTANCE(); + tj.instance(); Ref s; s.instance(); @@ -80,7 +80,7 @@ Ref VoxelWorldBlocky::_create_chunk(int x, int y, int z, Refadd_liquid_mesher(Ref(memnew(VoxelMesherLiquidBlocky()))); Ref pj; - pj.INSTANCE(); + pj.instance(); pj->set_prop_mesher(Ref(memnew(VoxelMesherBlocky))); s.instance(); diff --git a/modules/voxelman/world/cubic/voxel_world_cubic.cpp b/modules/voxelman/world/cubic/voxel_world_cubic.cpp index d2ac7c151..978aaf91b 100644 --- a/modules/voxelman/world/cubic/voxel_world_cubic.cpp +++ b/modules/voxelman/world/cubic/voxel_world_cubic.cpp @@ -40,10 +40,10 @@ Ref VoxelWorldCubic::_create_chunk(int x, int y, int z, Refjob_get_count() == 0) { Ref lj; - lj.INSTANCE(); + lj.instance(); Ref tj; - tj.INSTANCE(); + tj.instance(); Ref s; s.instance(); @@ -81,7 +81,7 @@ Ref VoxelWorldCubic::_create_chunk(int x, int y, int z, Ref(memnew(VoxelMesherLiquidMarchingCubes()))); Ref pj; - pj.INSTANCE(); + pj.instance(); pj->set_prop_mesher(Ref(memnew(VoxelMesherCubic))); s.instance(); diff --git a/modules/voxelman/world/default/voxel_chunk_default.cpp b/modules/voxelman/world/default/voxel_chunk_default.cpp index 55d9d7ff4..b8f8c8ec9 100644 --- a/modules/voxelman/world/default/voxel_chunk_default.cpp +++ b/modules/voxelman/world/default/voxel_chunk_default.cpp @@ -24,8 +24,8 @@ SOFTWARE. #include "../../defines.h" -#include visual_server_h -#include physics_server_h +#include "servers/visual_server.h" +#include "servers/physics_server.h" #include "../../../opensimplex/open_simplex_noise.h" #include "../../meshers/default/voxel_mesher_default.h" @@ -300,8 +300,8 @@ void VoxelChunkDefault::meshes_create(const int mesh_index, const int mesh_count for (int i = 0; i < mesh_count; ++i) { RID mesh_instance_rid = VS::get_singleton()->instance_create(); - if (get_voxel_world()->GET_WORLD().is_valid()) - VS::get_singleton()->instance_set_scenario(mesh_instance_rid, get_voxel_world()->GET_WORLD()->get_scenario()); + if (get_voxel_world()->get_world().is_valid()) + VS::get_singleton()->instance_set_scenario(mesh_instance_rid, get_voxel_world()->get_world()->get_scenario()); RID mesh_rid = VS::get_singleton()->mesh_create(); @@ -380,7 +380,7 @@ void VoxelChunkDefault::colliders_create(const int mesh_index, const int layer_m PhysicsServer::get_singleton()->body_set_state(body_rid, PhysicsServer::BODY_STATE_TRANSFORM, get_transform()); if (get_voxel_world()->is_inside_tree() && get_voxel_world()->is_inside_world()) { - Ref world = get_voxel_world()->GET_WORLD(); + Ref world = get_voxel_world()->get_world(); if (world.is_valid() && world->get_space() != RID()) PhysicsServer::get_singleton()->body_set_space(body_rid, world->get_space()); @@ -418,7 +418,7 @@ void VoxelChunkDefault::colliders_create_area(const int mesh_index, const int la PhysicsServer::get_singleton()->area_set_collision_mask(area_rid, layer_mask); if (get_voxel_world()->is_inside_tree() && get_voxel_world()->is_inside_world()) { - Ref world = get_voxel_world()->GET_WORLD(); + Ref world = get_voxel_world()->get_world(); if (world.is_valid() && world->get_space() != RID()) PhysicsServer::get_singleton()->area_set_space(area_rid, world->get_space()); @@ -531,8 +531,8 @@ void VoxelChunkDefault::debug_mesh_allocate() { if (_debug_mesh_instance == RID()) { _debug_mesh_instance = VisualServer::get_singleton()->instance_create(); - if (get_voxel_world()->GET_WORLD().is_valid()) - VS::get_singleton()->instance_set_scenario(_debug_mesh_instance, get_voxel_world()->GET_WORLD()->get_scenario()); + if (get_voxel_world()->get_world().is_valid()) + VS::get_singleton()->instance_set_scenario(_debug_mesh_instance, get_voxel_world()->get_world()->get_scenario()); VS::get_singleton()->instance_set_base(_debug_mesh_instance, _debug_mesh_rid); VS::get_singleton()->instance_set_transform(_debug_mesh_instance, get_transform()); diff --git a/modules/voxelman/world/default/voxel_world_default.cpp b/modules/voxelman/world/default/voxel_world_default.cpp index 0a5fee021..580cce598 100644 --- a/modules/voxelman/world/default/voxel_world_default.cpp +++ b/modules/voxelman/world/default/voxel_world_default.cpp @@ -150,7 +150,7 @@ PoolColorArray VoxelWorldDefault::get_vertex_colors(const Transform &transform, } void VoxelWorldDefault::_update_lods() { - if (!get_player() || !INSTANCE_VALIDATE(get_player())) { + if (!get_player() || !ObjectDB::instance_validate(get_player())) { return; } @@ -319,7 +319,7 @@ void VoxelWorldDefault::_notification(int p_what) { return; } - if (!INSTANCE_VALIDATE(get_player())) { + if (!ObjectDB::instance_validate(get_player())) { set_player(NULL); return; } diff --git a/modules/voxelman/world/environment_data.h b/modules/voxelman/world/environment_data.h index 594f5968a..10c5f3297 100644 --- a/modules/voxelman/world/environment_data.h +++ b/modules/voxelman/world/environment_data.h @@ -27,7 +27,7 @@ SOFTWARE. #include "../defines.h" -#include light_h +#include "scene/3d/light.h" #include "core/reference.h" diff --git a/modules/voxelman/world/jobs/voxel_job.cpp b/modules/voxelman/world/jobs/voxel_job.cpp index 2ec387a6e..e3a7a2bc2 100644 --- a/modules/voxelman/world/jobs/voxel_job.cpp +++ b/modules/voxelman/world/jobs/voxel_job.cpp @@ -163,7 +163,7 @@ void VoxelJob::generate_random_ao(int seed, int octaves, int period, float persi int position_z = _chunk->get_position_z(); Ref noise; - noise.INSTANCE(); + noise.instance(); noise->set_seed(seed); noise->set_octaves(octaves); @@ -218,14 +218,14 @@ Array VoxelJob::merge_mesh_array(Array arr) const { int rem = equals[k]; int remk = rem - k; - verts.VREMOVE(remk); + verts.remove(remk); if (has_normals) - normals.VREMOVE(remk); + normals.remove(remk); if (has_uvs) - uvs.VREMOVE(remk); + uvs.remove(remk); if (has_colors) - colors.VREMOVE(remk); + colors.remove(remk); for (int j = 0; j < indices.size(); ++j) { int indx = indices[j]; diff --git a/modules/voxelman/world/jobs/voxel_prop_job.cpp b/modules/voxelman/world/jobs/voxel_prop_job.cpp index bb3073ce6..a67ee8920 100644 --- a/modules/voxelman/world/jobs/voxel_prop_job.cpp +++ b/modules/voxelman/world/jobs/voxel_prop_job.cpp @@ -108,7 +108,7 @@ void VoxelPropJob::phase_physics_process() { PhysicsServer::get_singleton()->body_set_collision_mask(body, 1); if (chunk->get_voxel_world()->is_inside_tree() && chunk->get_voxel_world()->is_inside_world()) { - Ref world = chunk->get_voxel_world()->GET_WORLD(); + Ref world = chunk->get_voxel_world()->get_world(); if (world.is_valid() && world->get_space() != RID()) { PhysicsServer::get_singleton()->body_set_space(body, world->get_space()); diff --git a/modules/voxelman/world/jobs/voxel_terrain_job.cpp b/modules/voxelman/world/jobs/voxel_terrain_job.cpp index aa2362f79..4d626be87 100644 --- a/modules/voxelman/world/jobs/voxel_terrain_job.cpp +++ b/modules/voxelman/world/jobs/voxel_terrain_job.cpp @@ -49,7 +49,7 @@ void VoxelTerrainJob::set_mesher(int index, const Ref &mesher) { void VoxelTerrainJob::remove_mesher(const int index) { ERR_FAIL_INDEX(index, _meshers.size()); - _meshers.VREMOVE(index); + _meshers.remove(index); } void VoxelTerrainJob::add_mesher(const Ref &mesher) { _meshers.push_back(mesher); @@ -71,7 +71,7 @@ void VoxelTerrainJob::set_liquid_mesher(int index, const Ref &meshe void VoxelTerrainJob::remove_liquid_mesher(const int index) { ERR_FAIL_INDEX(index, _liquid_meshers.size()); - _liquid_meshers.VREMOVE(index); + _liquid_meshers.remove(index); } void VoxelTerrainJob::add_liquid_mesher(const Ref &mesher) { _liquid_meshers.push_back(mesher); diff --git a/modules/voxelman/world/jobs/voxel_terrain_job.h b/modules/voxelman/world/jobs/voxel_terrain_job.h index c4b2addf7..8e6831cb8 100644 --- a/modules/voxelman/world/jobs/voxel_terrain_job.h +++ b/modules/voxelman/world/jobs/voxel_terrain_job.h @@ -28,11 +28,9 @@ SOFTWARE. #include "voxel_mesher_job_step.h" -#include pool_vector_h +#include "core/pool_vector.h" -include_pool_vector - - class VoxelMesher; +class VoxelMesher; class VoxelTerrainJob : public VoxelJob { GDCLASS(VoxelTerrainJob, VoxelJob); diff --git a/modules/voxelman/world/marching_cubes/voxel_world_marching_cubes.cpp b/modules/voxelman/world/marching_cubes/voxel_world_marching_cubes.cpp index fd440c6bb..a0b056885 100644 --- a/modules/voxelman/world/marching_cubes/voxel_world_marching_cubes.cpp +++ b/modules/voxelman/world/marching_cubes/voxel_world_marching_cubes.cpp @@ -40,10 +40,10 @@ Ref VoxelWorldMarchingCubes::_create_chunk(int x, int y, int z, Ref< if (chunk->job_get_count() == 0) { Ref lj; - lj.INSTANCE(); + lj.instance(); Ref tj; - tj.INSTANCE(); + tj.instance(); Ref s; s.instance(); @@ -82,7 +82,7 @@ Ref VoxelWorldMarchingCubes::_create_chunk(int x, int y, int z, Ref< //add_liquid_mesher(Ref(memnew(VoxelMesherLiquidMarchingCubes()))); Ref pj; - pj.INSTANCE(); + pj.instance(); pj->set_prop_mesher(Ref(memnew(VoxelMesherMarchingCubes))); s.instance(); diff --git a/modules/voxelman/world/voxel_chunk.cpp b/modules/voxelman/world/voxel_chunk.cpp index 5bd1767f2..98db91c96 100644 --- a/modules/voxelman/world/voxel_chunk.cpp +++ b/modules/voxelman/world/voxel_chunk.cpp @@ -655,7 +655,7 @@ void VoxelChunk::voxel_structures_set(const Vector &structures) { } void VoxelChunk::build() { - ERR_FAIL_COND(!INSTANCE_VALIDATE(get_voxel_world())); + ERR_FAIL_COND(!ObjectDB::instance_validate(get_voxel_world())); ERR_FAIL_COND(!get_voxel_world()->is_inside_tree()); ERR_FAIL_COND(!is_in_tree()); diff --git a/modules/voxelman/world/voxel_chunk.h b/modules/voxelman/world/voxel_chunk.h index 2ac260090..5144f5f15 100644 --- a/modules/voxelman/world/voxel_chunk.h +++ b/modules/voxelman/world/voxel_chunk.h @@ -29,8 +29,7 @@ SOFTWARE. #include "../defines.h" -#include pool_vector_h -include_pool_vector +#include "core/pool_vector.h" #include "core/os/mutex.h" #include "core/os/thread.h" @@ -50,7 +49,6 @@ include_pool_vector #include "../library/voxel_library.h" #include "../library/voxel_surface.h" -; //hackfix for a clang format issue class VoxelJob; class VoxelWorld; diff --git a/modules/voxelman/world/voxel_structure.h b/modules/voxelman/world/voxel_structure.h index d917af74d..ae7485e55 100644 --- a/modules/voxelman/world/voxel_structure.h +++ b/modules/voxelman/world/voxel_structure.h @@ -22,18 +22,16 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - #include "core/hash_map.h" #include "core/resource.h" #include "../defines.h" -#include pool_vector_h -include_pool_vector +#include "core/pool_vector.h" #include "core/math/aabb.h" #include "voxel_chunk.h" - class VoxelStructure : public Resource { +class VoxelStructure : public Resource { GDCLASS(VoxelStructure, Resource); public: diff --git a/modules/voxelman/world/voxel_world.h b/modules/voxelman/world/voxel_world.h index cef1e4032..b9f5cf091 100644 --- a/modules/voxelman/world/voxel_world.h +++ b/modules/voxelman/world/voxel_world.h @@ -27,7 +27,7 @@ SOFTWARE. #include "../defines.h" -#include navigation_h +#include "scene/3d/navigation.h" #include "../areas/world_area.h" #include "../level_generator/voxel_level_generator.h" diff --git a/modules/voxelman/world/voxel_world_editor.cpp b/modules/voxelman/world/voxel_world_editor.cpp index 773ec8d14..f50c39630 100644 --- a/modules/voxelman/world/voxel_world_editor.cpp +++ b/modules/voxelman/world/voxel_world_editor.cpp @@ -38,9 +38,9 @@ SOFTWARE. #include "../defines.h" -#include core_input_h -#include spatial_editor_plugin_h -#include camera_h +#include "core/os/input.h" +#include "editor/plugins/spatial_editor_plugin.h" +#include "scene/3d/camera.h" bool VoxelWorldEditor::forward_spatial_input_event(Camera *p_camera, const Ref &p_event) { if (!_world || !_world->get_editable()) { @@ -81,7 +81,7 @@ bool VoxelWorldEditor::do_input_action(Camera *p_camera, const Point2 &p_point, from = local_xform.xform(from); to = local_xform.xform(to); - PhysicsDirectSpaceState *ss = _world->GET_WORLD()->get_direct_space_state(); + PhysicsDirectSpaceState *ss = _world->get_world()->get_direct_space_state(); PhysicsDirectSpaceState::RayResult res;