mirror of
https://github.com/Relintai/voxelman.git
synced 2025-01-25 15:09:18 +01:00
Better error messages when no materials are set into the VoxelLibrary.
This commit is contained in:
parent
e5bae8fb7e
commit
048469148a
@ -50,13 +50,13 @@ bool VoxelLibrary::_supports_caching() {
|
||||
|
||||
//Materials
|
||||
Ref<Material> VoxelLibrary::material_get(const int index) {
|
||||
ERR_FAIL_INDEX_V(index, _materials.size(), Ref<Material>(NULL));
|
||||
ERR_FAIL_INDEX_V(index, _materials.size(), Ref<Material>());
|
||||
|
||||
return _materials[index];
|
||||
}
|
||||
|
||||
Ref<Material> VoxelLibrary::material_lod_get(const int index) {
|
||||
ERR_FAIL_COND_V(_materials.size() == 0, Ref<Material>(NULL));
|
||||
ERR_FAIL_COND_V_MSG(_materials.size() == 0, Ref<Material>(), "Error! You should to add at least one material to VoxelLibrary! (By default it will use up to 5. See VoxelWorldDefault::_create_chunk().)");
|
||||
|
||||
if (index < 0) {
|
||||
return _materials[0];
|
||||
@ -134,13 +134,13 @@ void VoxelLibrary::materials_set(const Vector<Variant> &materials) {
|
||||
|
||||
//Liquid Materials
|
||||
Ref<Material> VoxelLibrary::liquid_material_get(const int index) {
|
||||
ERR_FAIL_INDEX_V(index, _liquid_materials.size(), Ref<Material>(NULL));
|
||||
ERR_FAIL_INDEX_V(index, _liquid_materials.size(), Ref<Material>());
|
||||
|
||||
return _liquid_materials[index];
|
||||
}
|
||||
|
||||
Ref<Material> VoxelLibrary::liquid_material_lod_get(const int index) {
|
||||
ERR_FAIL_COND_V(_materials.size() == 0, Ref<Material>(NULL));
|
||||
ERR_FAIL_COND_V_MSG(_materials.size() == 0, Ref<Material>(), "Error! You should to add at least one liquid to VoxelLibrary! (By default it will use up to 5. See VoxelWorldDefault::_create_chunk().)");
|
||||
|
||||
if (index < 0) {
|
||||
return _liquid_materials[0];
|
||||
@ -219,13 +219,13 @@ void VoxelLibrary::liquid_materials_set(const Vector<Variant> &materials) {
|
||||
|
||||
//Prop Materials
|
||||
Ref<Material> VoxelLibrary::prop_material_get(const int index) {
|
||||
ERR_FAIL_INDEX_V(index, _prop_materials.size(), Ref<Material>(NULL));
|
||||
ERR_FAIL_INDEX_V(index, _prop_materials.size(), Ref<Material>());
|
||||
|
||||
return _prop_materials[index];
|
||||
}
|
||||
|
||||
Ref<Material> VoxelLibrary::prop_material_lod_get(const int index) {
|
||||
ERR_FAIL_COND_V(_prop_materials.size() == 0, Ref<Material>(NULL));
|
||||
ERR_FAIL_COND_V_MSG(_prop_materials.size() == 0, Ref<Material>(), "Error! You should to add at least one material to VoxelLibrary!");
|
||||
|
||||
if (index < 0) {
|
||||
return _prop_materials[0];
|
||||
|
Loading…
Reference in New Issue
Block a user