From 768728139ede479dad006913e2f86d3f85edae57 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 29 Jul 2020 00:02:42 +0200 Subject: [PATCH] Fix compile for 4.0. --- defines.h | 1 + library/voxelman_library.cpp | 14 ++------------ library/voxelman_library.h | 13 ++++++++++--- world/default/voxel_chunk_default.h | 2 +- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/defines.h b/defines.h index 3afcef9..873b64d 100644 --- a/defines.h +++ b/defines.h @@ -62,6 +62,7 @@ #define MeshInstance MeshInstance3D #define Camera Camera3D #define ToolButton Button +#define Shape Shape3D typedef class World3D World; diff --git a/library/voxelman_library.cpp b/library/voxelman_library.cpp index 711baf0..013678a 100644 --- a/library/voxelman_library.cpp +++ b/library/voxelman_library.cpp @@ -159,21 +159,11 @@ void VoxelmanLibrary::clear_prop_materials() { } Vector VoxelmanLibrary::get_prop_materials() { - Vector r; - for (int i = 0; i < _prop_materials.size(); i++) { - r.push_back(_prop_materials[i].get_ref_ptr()); - } - return r; + VARIANT_ARRAY_GET(_prop_materials); } void VoxelmanLibrary::set_prop_materials(const Vector &materials) { - _prop_materials.clear(); - - for (int i = 0; i < materials.size(); i++) { - Ref material = Ref(materials[i]); - - _prop_materials.push_back(material); - } + VARIANT_ARRAY_SET(materials, _prop_materials, Material); } //Surfaces diff --git a/library/voxelman_library.h b/library/voxelman_library.h index aa65e20..5e74c68 100644 --- a/library/voxelman_library.h +++ b/library/voxelman_library.h @@ -23,12 +23,19 @@ SOFTWARE. #ifndef VOXELMAN_LIBRARY_H #define VOXELMAN_LIBRARY_H +#include "core/math/rect2.h" #include "core/resource.h" #include "scene/resources/material.h" #include "../data/voxel_light.h" #include "voxel_surface.h" +#include "../defines.h" + +#if GODOT4 +#define Texture Texture2D +#endif + class VoxelSurface; class VoxelMesher; class PackedScene; @@ -118,9 +125,9 @@ protected: private: bool _initialized; - Vector > _materials; - Vector > _liquid_materials; - Vector > _prop_materials; + Vector> _materials; + Vector> _liquid_materials; + Vector> _prop_materials; }; #endif // VOXEL_LIBRARY_H diff --git a/world/default/voxel_chunk_default.h b/world/default/voxel_chunk_default.h index b362702..e34c684 100644 --- a/world/default/voxel_chunk_default.h +++ b/world/default/voxel_chunk_default.h @@ -290,7 +290,7 @@ protected: ActiveBuildPhaseType _active_build_phase_type; - Vector > _lights; + Vector> _lights; }; VARIANT_ENUM_CAST(VoxelChunkDefault::DefaultChannels);