More include and macro cleanups.

This commit is contained in:
Relintai 2022-03-18 04:10:09 +01:00
parent 48805f5f8f
commit 029467ab2c
79 changed files with 258 additions and 345 deletions

View File

@ -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<SpellCastInfo> info = Ref<SpellCastInfo>(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<SpellCastInfo> 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<SpellCastInfo> info(memnew(SpellCastInfo()));
@ -1834,7 +1834,7 @@ void Spell::_cast_finishs(Ref<SpellCastInfo> 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<SpellCastInfo> 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<SpellCastInfo> 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<AuraData> aura, float delta) {
}
void Spell::_setup_aura_data(Ref<AuraData> data, Ref<AuraApplyInfo> info) {
ERR_FAIL_COND(!INSTANCE_VALIDATE(info->caster_get()));
ERR_FAIL_COND(!ObjectDB::instance_validate(info->caster_get()));
data->set_aura(Ref<Spell>(this));
data->set_aura_id(get_id());
@ -2167,7 +2167,7 @@ void Spell::_aura_calculate_initial_damage(Ref<AuraData> aura_data, Ref<AuraAppl
}
void Spell::_handle_aura_damage(Ref<AuraData> aura_data, Ref<SpellDamageInfo> 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<AuraData> aura_data, Ref<AuraApplyI
}
void Spell::_handle_aura_heal(Ref<AuraData> aura_data, Ref<SpellHealInfo> info) {
if (info->dealer_get() && !INSTANCE_VALIDATE(info->dealer_get())) {
if (info->dealer_get() && !ObjectDB::instance_validate(info->dealer_get())) {
info->dealer_set(NULL);
}

View File

@ -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)

View File

@ -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>(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>(entity);
@ -274,7 +274,7 @@ bool EntityAI::equip_should_deny(Entity *entity, int equip_slot, Ref<ItemInstanc
return false;
}
bool EntityAI::equip_should_deny_bind(Node *entity, int equip_slot, Ref<ItemInstance> item) {
ERR_FAIL_COND_V(!INSTANCE_VALIDATE(entity), false);
ERR_FAIL_COND_V(!ObjectDB::instance_validate(entity), false);
Entity *e = Object::cast_to<Entity>(entity);
@ -288,7 +288,7 @@ void EntityAI::equip_son_success(Entity *entity, int equip_slot, Ref<ItemInstanc
call("_equip_son_success", entity, equip_slot, item, old_item, bag_slot);
}
void EntityAI::equip_son_success_bind(Node *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
Entity *e = Object::cast_to<Entity>(entity);
@ -302,7 +302,7 @@ void EntityAI::equip_son_fail(Entity *entity, int equip_slot, Ref<ItemInstance>
call("_equip_son_fail", entity, equip_slot, item, old_item, bag_slot);
}
void EntityAI::equip_son_fail_bind(Node *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
Entity *e = Object::cast_to<Entity>(entity);
@ -316,7 +316,7 @@ void EntityAI::equip_con_success(Entity *entity, int equip_slot, Ref<ItemInstanc
call("_equip_con_success", entity, equip_slot, item, old_item, bag_slot);
}
void EntityAI::equip_con_success_bind(Node *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
Entity *e = Object::cast_to<Entity>(entity);
@ -330,7 +330,7 @@ void EntityAI::equip_con_fail(Entity *entity, int equip_slot, Ref<ItemInstance>
call("_equip_con_fail", entity, equip_slot, item, old_item, bag_slot);
}
void EntityAI::equip_con_fail_bind(Node *entity, int equip_slot, Ref<ItemInstance> item, Ref<ItemInstance> old_item, int bag_slot) {
ERR_FAIL_COND(!INSTANCE_VALIDATE(entity));
ERR_FAIL_COND(!ObjectDB::instance_validate(entity));
Entity *e = Object::cast_to<Entity>(entity);

View File

@ -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());

View File

@ -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>(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>(entity);

View File

@ -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<ItemInstance> 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<Entity>(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<EntityEnums::EntityRelationType>(static_cast<int>(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<Entity>(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<EntityEnums::EntityRelationType>(static_cast<int>(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<EntityAI> 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<Entity>(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<ItemInstance> 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<ItemInstance> 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<AuraData> Entity::aura_gets_with_group_by(Entity *caster, Ref<AuraGroup> aur
return Ref<AuraData>();
}
Ref<AuraData> Entity::aura_gets_with_group_by_bind(Node *caster, Ref<AuraGroup> aura_group) {
if (!INSTANCE_VALIDATE(caster)) {
if (!ObjectDB::instance_validate(caster)) {
return Ref<AuraData>();
}
@ -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<Entity>(p_entity);
Entity *old_target = Object::cast_to<Entity>(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;

View File

@ -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);

View File

@ -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;

View File

@ -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<Entity>(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;

View File

@ -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<Entity>(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;

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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"

View File

@ -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<Variant> 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

View File

@ -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)

View File

@ -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:

View File

@ -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"

View File

@ -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());

View File

@ -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> world = _prop_instace->GET_WORLD();
Ref<World> world = _prop_instace->get_world();
if (world.is_valid() && world->get_space() != RID()) {
PhysicsServer::get_singleton()->body_set_space(body, world->get_space());

View File

@ -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"

View File

@ -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"

View File

@ -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<Variant> 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__);

View File

@ -101,7 +101,7 @@ void TerrainLibrary::material_set(const int index, const Ref<Material> &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<Material> &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<Material> &val
}
void TerrainLibrary::prop_material_remove(const int index) {
_prop_materials.VREMOVE(index);
_prop_materials.remove(index);
}
int TerrainLibrary::prop_material_get_num() const {

View File

@ -77,7 +77,7 @@ void TerrainLibrarySimple::terra_surface_set(const int index, Ref<TerrainSurface
}
void TerrainLibrarySimple::terra_surface_remove(const int index) {
_terra_surfaces.VREMOVE(index);
_terra_surfaces.remove(index);
}
int TerrainLibrarySimple::terra_surface_get_num() const {

View File

@ -87,7 +87,7 @@ void TerrainMaterialCache::material_set(const int index, const Ref<Material> &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<TerrainSurface> 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> &texture) {
void TerrainMaterialCache::additional_texture_remove(const Ref<Texture> &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> &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();

View File

@ -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;

View File

@ -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<Vector3> 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<TerrainLibrary> &library) {

View File

@ -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"

View File

@ -28,7 +28,7 @@ SOFTWARE.
#include "../defines.h"
#include pool_vector_h
#include "core/pool_vector.h"
#include "terrain_chunk.h"

View File

@ -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> world = get_voxel_world()->GET_WORLD();
Ref<World> 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> world = get_voxel_world()->GET_WORLD();
Ref<World> 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());

View File

@ -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;
}

View File

@ -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> world = chunk->get_voxel_world()->GET_WORLD();
Ref<World> 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());

View File

@ -28,7 +28,7 @@ SOFTWARE.
#include "../../defines.h"
#include pool_vector_h
#include "core/pool_vector.h"
class TerrainMesher;

View File

@ -261,7 +261,7 @@ void TerrainChunk::job_set(int index, const Ref<TerrainJob> &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<TerrainJob> &job) {
_jobs.push_back(job);
@ -610,12 +610,12 @@ void TerrainChunk::voxel_structure_remove(const Ref<TerrainStructure> &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<Variant> &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();

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -187,7 +187,7 @@ void TerrainWorld::world_area_add(const Ref<TerrainWorldArea> &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<TerrainStructure> &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<TerrainChunk> 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<TerrainChunk> TerrainWorld::chunk_remove_index(const int index) {
Ref<TerrainChunk> 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<TerrainChunk> chunk) {
Ref<TerrainChunk> TerrainWorld::_create_chunk(const int x, const int z, Ref<TerrainChunk> chunk) {
if (!chunk.is_valid()) {
chunk.INSTANCE();
chunk.instance();
}
//no meshers here
@ -554,7 +554,7 @@ Ref<TerrainChunk> 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<TerrainChunk> 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<PropData> &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<PropData> &prop, cons
if (light_data.is_valid()) {
Ref<TerrainLight> 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<TerrainChunk> 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<TerrainChunk> chunk = _generation_queue.get(0);
_generation_queue.VREMOVE(0);
_generation_queue.remove(0);
ERR_FAIL_COND(!chunk.is_valid());

View File

@ -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"

View File

@ -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<InputEvent> &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;

View File

@ -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<Variant> 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__);

View File

@ -77,7 +77,7 @@ void Terrain2DLibrarySimple::terra_surface_set(const int index, Ref<Terrain2DSur
}
void Terrain2DLibrarySimple::terra_surface_remove(const int index) {
_terra_surfaces.VREMOVE(index);
_terra_surfaces.remove(index);
}
int Terrain2DLibrarySimple::terra_surface_get_num() const {

View File

@ -98,7 +98,7 @@ void Terrain2DMaterialCache::surface_set(int index, Ref<Terrain2DSurface> 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> &texture)
void Terrain2DMaterialCache::additional_texture_remove(const Ref<Texture> &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<Texture> &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();

View File

@ -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"

View File

@ -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<Color> 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<Terrain2DLibrary> &library) {

View File

@ -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 {

View File

@ -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);

View File

@ -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());

View File

@ -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;
}

View File

@ -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);

View File

@ -297,7 +297,7 @@ void Terrain2DChunk::job_set(int index, const Ref<Terrain2DJob> &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<Terrain2DJob> &job) {
_jobs.push_back(job);
@ -647,12 +647,12 @@ void Terrain2DChunk::voxel_structure_remove(const Ref<Terrain2DStructure> &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<Variant> &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();

View File

@ -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)

View File

@ -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"

View File

@ -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:

View File

@ -231,7 +231,7 @@ void Terrain2DWorld::world_area_add(const Ref<Terrain2DWorldArea> &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<Terrain2DStructure> &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<Terrain2DChunk> 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<Terrain2DChunk> Terrain2DWorld::chunk_remove_index(const int index) {
Ref<Terrain2DChunk> 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<Terrain2DChunk> chunk) {
Ref<Terrain2DChunk> Terrain2DWorld::_create_chunk(const int x, const int y, Ref<Terrain2DChunk> chunk) {
if (!chunk.is_valid()) {
chunk.INSTANCE();
chunk.instance();
}
//no meshers here
@ -607,7 +607,7 @@ Ref<Terrain2DChunk> 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<Terrain2DChunk> 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<Prop2DData> &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<Prop2DData> &prop,
if (light_data.is_valid()) {
Ref<Terrain2DLight> 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<Terrain2DChunk> 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<Terrain2DChunk> chunk = _generation_queue.get(0);
_generation_queue.VREMOVE(0);
_generation_queue.remove(0);
ERR_FAIL_COND(!chunk.is_valid());

View File

@ -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<InputEvent> &p_event) {
if (!_world || !_world->get_editable()) {

View File

@ -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<Variant> 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

View File

@ -112,7 +112,7 @@ void VoxelLibraryMerger::voxel_surface_set(const int index, Ref<VoxelSurface> 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<PropData> &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);

View File

@ -87,7 +87,7 @@ void VoxelMaterialCache::material_set(const int index, const Ref<Material> &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<VoxelSurface> 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> &texture) {
void VoxelMaterialCache::additional_texture_remove(const Ref<Texture> &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> &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();

View File

@ -26,7 +26,7 @@ SOFTWARE.
#include "../../defines.h"
#include visual_server_h
#include "servers/visual_server.h"
void VoxelMesherCubic::_add_chunk(Ref<VoxelChunk> p_chunk) {
Ref<VoxelChunkDefault> chunk = p_chunk;
@ -49,7 +49,7 @@ void VoxelMesherCubic::_add_chunk(Ref<VoxelChunk> p_chunk) {
float voxel_scale = get_voxel_scale();
Ref<VoxelCubePoints> 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);

View File

@ -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;

View File

@ -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"

View File

@ -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;

View File

@ -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);

View File

@ -42,10 +42,10 @@ Ref<VoxelChunk> VoxelWorldBlocky::_create_chunk(int x, int y, int z, Ref<VoxelCh
if (chunk->job_get_count() == 0) {
Ref<VoxelLightJob> lj;
lj.INSTANCE();
lj.instance();
Ref<VoxelTerrainJob> tj;
tj.INSTANCE();
tj.instance();
Ref<VoxelMesherJobStep> s;
s.instance();
@ -80,7 +80,7 @@ Ref<VoxelChunk> VoxelWorldBlocky::_create_chunk(int x, int y, int z, Ref<VoxelCh
tj->add_liquid_mesher(Ref<VoxelMesher>(memnew(VoxelMesherLiquidBlocky())));
Ref<VoxelPropJob> pj;
pj.INSTANCE();
pj.instance();
pj->set_prop_mesher(Ref<VoxelMesher>(memnew(VoxelMesherBlocky)));
s.instance();

View File

@ -40,10 +40,10 @@ Ref<VoxelChunk> VoxelWorldCubic::_create_chunk(int x, int y, int z, Ref<VoxelChu
if (chunk->job_get_count() == 0) {
Ref<VoxelLightJob> lj;
lj.INSTANCE();
lj.instance();
Ref<VoxelTerrainJob> tj;
tj.INSTANCE();
tj.instance();
Ref<VoxelMesherJobStep> s;
s.instance();
@ -81,7 +81,7 @@ Ref<VoxelChunk> VoxelWorldCubic::_create_chunk(int x, int y, int z, Ref<VoxelChu
//add_liquid_mesher(Ref<VoxelMesher>(memnew(VoxelMesherLiquidMarchingCubes())));
Ref<VoxelPropJob> pj;
pj.INSTANCE();
pj.instance();
pj->set_prop_mesher(Ref<VoxelMesher>(memnew(VoxelMesherCubic)));
s.instance();

View File

@ -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> world = get_voxel_world()->GET_WORLD();
Ref<World> 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> world = get_voxel_world()->GET_WORLD();
Ref<World> 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());

View File

@ -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;
}

View File

@ -27,7 +27,7 @@ SOFTWARE.
#include "../defines.h"
#include light_h
#include "scene/3d/light.h"
#include "core/reference.h"

View File

@ -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<OpenSimplexNoise> 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];

View File

@ -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> world = chunk->get_voxel_world()->GET_WORLD();
Ref<World> 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());

View File

@ -49,7 +49,7 @@ void VoxelTerrainJob::set_mesher(int index, const Ref<VoxelMesher> &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<VoxelMesher> &mesher) {
_meshers.push_back(mesher);
@ -71,7 +71,7 @@ void VoxelTerrainJob::set_liquid_mesher(int index, const Ref<VoxelMesher> &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<VoxelMesher> &mesher) {
_liquid_meshers.push_back(mesher);

View File

@ -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);

View File

@ -40,10 +40,10 @@ Ref<VoxelChunk> VoxelWorldMarchingCubes::_create_chunk(int x, int y, int z, Ref<
if (chunk->job_get_count() == 0) {
Ref<VoxelLightJob> lj;
lj.INSTANCE();
lj.instance();
Ref<VoxelTerrainJob> tj;
tj.INSTANCE();
tj.instance();
Ref<VoxelMesherJobStep> s;
s.instance();
@ -82,7 +82,7 @@ Ref<VoxelChunk> VoxelWorldMarchingCubes::_create_chunk(int x, int y, int z, Ref<
//add_liquid_mesher(Ref<VoxelMesher>(memnew(VoxelMesherLiquidMarchingCubes())));
Ref<VoxelPropJob> pj;
pj.INSTANCE();
pj.instance();
pj->set_prop_mesher(Ref<VoxelMesher>(memnew(VoxelMesherMarchingCubes)));
s.instance();

View File

@ -655,7 +655,7 @@ void VoxelChunk::voxel_structures_set(const Vector<Variant> &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());

View File

@ -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;

View File

@ -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:

View File

@ -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"

View File

@ -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<InputEvent> &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;