From 8124f19c5df27ae8faedbd48de6a8647132dadf7 Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 27 Oct 2020 12:56:34 +0100 Subject: [PATCH] Same treatment to props related methods in VoxelChunk. --- world/voxel_chunk.cpp | 24 ++++++++++++------------ world/voxel_chunk.h | 12 ++++++------ world/voxel_world.cpp | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/world/voxel_chunk.cpp b/world/voxel_chunk.cpp index e8b9f04..4eb7eaa 100644 --- a/world/voxel_chunk.cpp +++ b/world/voxel_chunk.cpp @@ -668,7 +668,7 @@ void VoxelChunk::clear_baked_lights() { } #if PROPS_PRESENT -void VoxelChunk::add_prop(const Transform &tarnsform, const Ref &prop) { +void VoxelChunk::prop_add(const Transform &tarnsform, const Ref &prop) { ERR_FAIL_COND(!prop.is_valid()); PropDataStore s; @@ -677,25 +677,25 @@ void VoxelChunk::add_prop(const Transform &tarnsform, const Ref &prop) _props.push_back(s); } -Ref VoxelChunk::get_prop(int index) { +Ref VoxelChunk::prop_get(int index) { ERR_FAIL_INDEX_V(index, _props.size(), Ref()); return _props.get(index).prop; } -Transform VoxelChunk::get_prop_tarnsform(const int index) { +Transform VoxelChunk::prop_get_tarnsform(const int index) { ERR_FAIL_INDEX_V(index, _props.size(), Transform()); return _props.get(index).transform; } -int VoxelChunk::get_prop_count() const { +int VoxelChunk::prop_get_count() const { return _props.size(); } -void VoxelChunk::remove_prop(const int index) { +void VoxelChunk::prop_remove(const int index) { ERR_FAIL_INDEX(index, _props.size()); _props.remove(index); } -void VoxelChunk::clear_props() { +void VoxelChunk::props_clear() { _props.clear(); } #endif @@ -1032,7 +1032,7 @@ VoxelChunk::~VoxelChunk() { } #if PROPS_PRESENT - clear_props(); + props_clear(); #endif #if MESH_DATA_RESOURCE_PRESENT @@ -1377,11 +1377,11 @@ void VoxelChunk::_bind_methods() { //Meshes #if PROPS_PRESENT - ClassDB::bind_method(D_METHOD("add_prop", "prop"), &VoxelChunk::add_prop); - ClassDB::bind_method(D_METHOD("get_prop", "index"), &VoxelChunk::get_prop); - ClassDB::bind_method(D_METHOD("get_prop_count"), &VoxelChunk::get_prop_count); - ClassDB::bind_method(D_METHOD("remove_prop", "index"), &VoxelChunk::remove_prop); - ClassDB::bind_method(D_METHOD("clear_props"), &VoxelChunk::clear_props); + ClassDB::bind_method(D_METHOD("prop_add", "prop"), &VoxelChunk::prop_add); + ClassDB::bind_method(D_METHOD("prop_get", "index"), &VoxelChunk::prop_get); + ClassDB::bind_method(D_METHOD("prop_get_count"), &VoxelChunk::prop_get_count); + ClassDB::bind_method(D_METHOD("prop_remove", "index"), &VoxelChunk::prop_remove); + ClassDB::bind_method(D_METHOD("props_clear"), &VoxelChunk::props_clear); #endif #if MESH_DATA_RESOURCE_PRESENT diff --git a/world/voxel_chunk.h b/world/voxel_chunk.h index 2c13492..d4f7a51 100644 --- a/world/voxel_chunk.h +++ b/world/voxel_chunk.h @@ -211,12 +211,12 @@ public: void clear_baked_lights(); #if PROPS_PRESENT - void add_prop(const Transform &tarnsform, const Ref &prop); - Ref get_prop(const int index); - Transform get_prop_tarnsform(const int index); - int get_prop_count() const; - void remove_prop(const int index); - void clear_props(); + void prop_add(const Transform &tarnsform, const Ref &prop); + Ref prop_get(const int index); + Transform prop_get_tarnsform(const int index); + int prop_get_count() const; + void prop_remove(const int index); + void props_clear(); #endif #if MESH_DATA_RESOURCE_PRESENT diff --git a/world/voxel_world.cpp b/world/voxel_world.cpp index d00c191..62b3f14 100644 --- a/world/voxel_world.cpp +++ b/world/voxel_world.cpp @@ -550,7 +550,7 @@ void VoxelWorld::add_prop(Transform tarnsform, const Ref &prop, const wp = tarnsform.xform(wp); Ref chunk = get_or_create_chunk_at_world_position(wp); - chunk->add_prop(tarnsform, prop); + chunk->prop_add(tarnsform, prop); int count = prop->get_prop_count(); for (int i = 0; i < count; ++i) {