diff --git a/voxel_library.cpp b/voxel_library.cpp index fdb4849..d20795a 100644 --- a/voxel_library.cpp +++ b/voxel_library.cpp @@ -27,7 +27,6 @@ void VoxelLibrary::load_default() { create_voxel(1, "solid") ->set_transparent(false) ->set_geometry_type(Voxel::GEOMETRY_CUBE); - _max_count = 2; } // TODO Add a way to add voxels @@ -52,6 +51,7 @@ bool VoxelLibrary::_set(const StringName &p_name, const Variant &p_value) { _voxel_types[idx] = voxel; if(voxel.is_valid()) { voxel->set_library(Ref(this)); + voxel->set_id(idx); } // Note: if the voxel is set to null, we could set the previous one's library reference to null. // however it Voxels use a weak reference, so it's not really needed @@ -105,9 +105,6 @@ Ref VoxelLibrary::create_voxel(int id, String name) { voxel->set_id(id); voxel->set_voxel_name(name); _voxel_types[id] = voxel; - if(id >= _max_count) { - _max_count = id + 1; - } return voxel; } diff --git a/voxel_library.h b/voxel_library.h index 0b02d51..a579c09 100644 --- a/voxel_library.h +++ b/voxel_library.h @@ -39,7 +39,6 @@ protected: private: Ref _voxel_types[MAX_VOXEL_TYPES]; - int _max_count; int _atlas_size; };