diff --git a/register_types.cpp b/register_types.cpp index aaa2990..3c26a10 100644 --- a/register_types.cpp +++ b/register_types.cpp @@ -22,6 +22,8 @@ SOFTWARE. #include "register_types.h" +#include "core/object/class_db.h" + #include "library/voxel_surface.h" #include "library/voxel_surface_simple.h" @@ -77,73 +79,77 @@ SOFTWARE. #include "world/jobs/voxel_job.h" #include "world/jobs/voxel_light_job.h" +#include "world/jobs/voxel_mesher_job_step.h" #include "world/jobs/voxel_prop_job.h" #include "world/jobs/voxel_terrain_job.h" -#include "world/jobs/voxel_mesher_job_step.h" -void register_voxelman_types() { - ClassDB::register_class(); - ClassDB::register_class(); +void initialize_voxelman_module(ModuleInitializationLevel p_level) { + if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) { + GDREGISTER_CLASS(VoxelMesher); + GDREGISTER_CLASS(VoxelMesherDefault); - ClassDB::register_class(); - ClassDB::register_class(); + GDREGISTER_CLASS(VoxelMesherMarchingCubes); + GDREGISTER_CLASS(MarchingCubesCellData); - ClassDB::register_class(); - ClassDB::register_class(); + GDREGISTER_CLASS(VoxelSurface); + GDREGISTER_CLASS(VoxelSurfaceSimple); - ClassDB::register_class(); - ClassDB::register_class(); + GDREGISTER_CLASS(VoxelLibrary); + GDREGISTER_CLASS(VoxelLibrarySimple); - ClassDB::register_class(); + GDREGISTER_CLASS(VoxelMaterialCache); #ifdef TEXTURE_PACKER_PRESENT - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + GDREGISTER_CLASS(VoxelSurfaceMerger); + GDREGISTER_CLASS(VoxelLibraryMerger); + GDREGISTER_CLASS(VoxelLibraryMergerPCM); + GDREGISTER_CLASS(VoxelMaterialCachePCM); #endif - ClassDB::register_class(); - ClassDB::register_class(); + GDREGISTER_CLASS(VoxelLight); + GDREGISTER_CLASS(VoxelLightNode); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + GDREGISTER_CLASS(VoxelWorld); + GDREGISTER_CLASS(VoxelChunk); + GDREGISTER_CLASS(VoxelStructure); + GDREGISTER_CLASS(BlockVoxelStructure); + GDREGISTER_CLASS(EnvironmentData); - ClassDB::register_class(); - ClassDB::register_class(); + GDREGISTER_CLASS(VoxelChunkDefault); + GDREGISTER_CLASS(VoxelWorldDefault); - ClassDB::register_class(); - ClassDB::register_class(); + GDREGISTER_CLASS(VoxelMesherCubic); + GDREGISTER_CLASS(VoxelCubePoints); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + GDREGISTER_CLASS(VoxelMesherBlocky); + GDREGISTER_CLASS(VoxelWorldBlocky); + GDREGISTER_CLASS(VoxelChunkBlocky); + GDREGISTER_CLASS(VoxelMesherLiquidBlocky); - ClassDB::register_class(); - ClassDB::register_class(); + GDREGISTER_CLASS(VoxelWorldMarchingCubes); + GDREGISTER_CLASS(VoxelChunkMarchingCubes); - ClassDB::register_class(); - ClassDB::register_class(); + GDREGISTER_CLASS(VoxelWorldCubic); + GDREGISTER_CLASS(VoxelChunkCubic); - ClassDB::register_class(); - ClassDB::register_class(); + GDREGISTER_CLASS(VoxelLevelGenerator); + GDREGISTER_CLASS(VoxelLevelGeneratorFlat); - ClassDB::register_class(); + GDREGISTER_CLASS(WorldArea); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + GDREGISTER_CLASS(VoxelJob); + GDREGISTER_CLASS(VoxelTerrainJob); + GDREGISTER_CLASS(VoxelMesherJobStep); + GDREGISTER_CLASS(VoxelLightJob); + GDREGISTER_CLASS(VoxelPropJob); + } #ifdef TOOLS_ENABLED - EditorPlugins::add_by_type(); + if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); + } #endif } -void unregister_voxelman_types() { +void uninitialize_voxelman_module(ModuleInitializationLevel p_level) { } diff --git a/register_types.h b/register_types.h index 9bb7429..6bcff9e 100644 --- a/register_types.h +++ b/register_types.h @@ -20,10 +20,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef VOXEL_REGISTER_TYPES_H -#define VOXEL_REGISTER_TYPES_H +#ifndef VOXELMAN_REGISTER_TYPES_H +#define VOXELMAN_REGISTER_TYPES_H -void register_voxelman_types(); -void unregister_voxelman_types(); +#include "modules/register_module_types.h" + +void initialize_voxelman_module(ModuleInitializationLevel p_level); +void uninitialize_voxelman_module(ModuleInitializationLevel p_level); #endif