mirror of
https://github.com/Relintai/terraman.git
synced 2025-04-25 21:45:00 +02:00
Better error messages when no materials are set into the Terrainibrary.
This commit is contained in:
parent
fe4ff0d86c
commit
27e42b9087
@ -161,13 +161,13 @@ bool TerrainLibrary::_supports_caching() {
|
||||
|
||||
//Materials
|
||||
Ref<Material> TerrainLibrary::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> TerrainLibrary::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 TerrainLibrary! (By default it will use up to 5. See VoxelWorldDefault::_create_chunk().)");
|
||||
|
||||
if (index < 0) {
|
||||
return _materials[0];
|
||||
@ -241,13 +241,13 @@ void TerrainLibrary::materials_set(const Vector<Variant> &materials) {
|
||||
|
||||
//Liquid Materials
|
||||
Ref<Material> TerrainLibrary::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> TerrainLibrary::liquid_material_lod_get(const int index) {
|
||||
ERR_FAIL_COND_V(_materials.size() == 0, Ref<Material>(NULL));
|
||||
ERR_FAIL_COND_V_MSG(_liquid_materials.size() == 0, Ref<Material>(), "Error! You should to add at least one liquid to TerrainLibrary! (By default it will use up to 5. See VoxelWorldDefault::_create_chunk().)");
|
||||
|
||||
if (index < 0) {
|
||||
return _liquid_materials[0];
|
||||
@ -321,13 +321,13 @@ void TerrainLibrary::liquid_materials_set(const Vector<Variant> &materials) {
|
||||
|
||||
//Prop Materials
|
||||
Ref<Material> TerrainLibrary::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> TerrainLibrary::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 TerrainLibrary!");
|
||||
|
||||
if (index < 0) {
|
||||
return _prop_materials[0];
|
||||
|
Loading…
Reference in New Issue
Block a user