diff --git a/clutter/ground_clutter_foliage.cpp b/clutter/ground_clutter_foliage.cpp index fb22115..7ca2b41 100644 --- a/clutter/ground_clutter_foliage.cpp +++ b/clutter/ground_clutter_foliage.cpp @@ -4,12 +4,12 @@ int GroundClutterFoliage::get_texture_count() const { return _textures.size(); } Ref GroundClutterFoliage::get_texture(const int index) { - ERR_FAIL_COND_V(index, _textures.size(), Ref()); + ERR_FAIL_INDEX_V(index, _textures.size(), Ref()); return _textures.get(index); } void GroundClutterFoliage::remove_texture(const int index) { - ERR_FAIL_COND(index, _textures.size()); + ERR_FAIL_INDEX(index, _textures.size()); _textures.remove(index); } @@ -25,8 +25,8 @@ GroundClutterFoliage::~GroundClutterFoliage() { } void GroundClutterFoliage::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_texture_count"), &VoxelMesher::get_texture_count); - ClassDB::bind_method(D_METHOD("get_texture", "index"), &VoxelMesher::get_texture); - ClassDB::bind_method(D_METHOD("remove_texture", "index"), &VoxelMesher::remove_texture); - ClassDB::bind_method(D_METHOD("add_texture", "texture"), &VoxelMesher::add_texture); + ClassDB::bind_method(D_METHOD("get_texture_count"), &GroundClutterFoliage::get_texture_count); + ClassDB::bind_method(D_METHOD("get_texture", "index"), &GroundClutterFoliage::get_texture); + ClassDB::bind_method(D_METHOD("remove_texture", "index"), &GroundClutterFoliage::remove_texture); + ClassDB::bind_method(D_METHOD("add_texture", "texture"), &GroundClutterFoliage::add_texture); } diff --git a/library/voxel_surface.cpp b/library/voxel_surface.cpp index 5e30b99..e3dd785 100644 --- a/library/voxel_surface.cpp +++ b/library/voxel_surface.cpp @@ -21,6 +21,13 @@ void VoxelSurface::set_rect(const VoxelSurfaceSides side, const Rect2 rect) { _rects[side] = rect; } +Ref VoxelSurface::get_clutter() { + return _clutter; +} +void VoxelSurface::set_clutter(Ref clutter) { + _clutter = clutter; +} + Ref VoxelSurface::get_library() const { return Ref(_library); } @@ -66,6 +73,10 @@ void VoxelSurface::_bind_methods() { ClassDB::bind_method(D_METHOD("is_transparent"), &VoxelSurface::is_transparent); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "transparent"), "set_transparent", "is_transparent"); + ClassDB::bind_method(D_METHOD("get_clutter", "transparent"), &VoxelSurface::get_clutter); + ClassDB::bind_method(D_METHOD("set_clutter"), &VoxelSurface::set_clutter); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "clutter", PROPERTY_HINT_RESOURCE_TYPE, "GroundClutter"), "set_clutter", "get_clutter"); + ClassDB::bind_method(D_METHOD("get_rect", "side"), &VoxelSurface::get_rect); ClassDB::bind_method(D_METHOD("set_rect", "side", "rect"), &VoxelSurface::set_rect); diff --git a/library/voxel_surface.h b/library/voxel_surface.h index 4623b05..5055151 100644 --- a/library/voxel_surface.h +++ b/library/voxel_surface.h @@ -9,6 +9,7 @@ #include "scene/resources/material.h" #include "voxelman_library.h" +#include "../clutter/ground_clutter.h" class VoxelmanLibrary; @@ -51,6 +52,9 @@ public: Rect2 get_rect(const VoxelSurfaceSides side) const; void set_rect(const VoxelSurfaceSides side, const Rect2 rect); + Ref get_clutter(); + void set_clutter(Ref clutter); + Ref get_library() const; void set_library(Ref library); @@ -69,6 +73,7 @@ protected: int _id; bool _is_transparent; Rect2 _rects[VOXEL_SIDES_COUNT]; + Ref _clutter; }; VARIANT_ENUM_CAST(VoxelSurface::VoxelSurfaceSides);