mirror of
https://github.com/Relintai/mesh_data_resource.git
synced 2025-02-20 17:14:31 +01:00
Tiny improvement to mesh data intance's logic.
This commit is contained in:
parent
3199cbe1a5
commit
efb1d42957
@ -15,8 +15,6 @@
|
|||||||
#include "../../texture_packer/texture_resource/packer_image_resource.h"
|
#include "../../texture_packer/texture_resource/packer_image_resource.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool MeshDataInstance::get_snap_to_mesh() const {
|
bool MeshDataInstance::get_snap_to_mesh() const {
|
||||||
return _snap_to_mesh;
|
return _snap_to_mesh;
|
||||||
}
|
}
|
||||||
@ -90,19 +88,20 @@ void MeshDataInstance::refresh() {
|
|||||||
|
|
||||||
Array arr = _mesh->get_array();
|
Array arr = _mesh->get_array();
|
||||||
|
|
||||||
if (arr.size() == Mesh::ARRAY_MAX) {
|
if (arr.size() != Mesh::ARRAY_MAX) {
|
||||||
Variant varr = arr[Mesh::ARRAY_VERTEX];
|
return;
|
||||||
PoolVector<Vector3> vertices = varr;
|
}
|
||||||
|
|
||||||
if (vertices.size() == 0) {
|
PoolVector<Vector3> vertices = arr[Mesh::ARRAY_VERTEX];
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, arr);
|
if (vertices.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_material.is_valid() && mesh->get_surface_count() > 0) {
|
mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, arr);
|
||||||
mesh->surface_set_material(0, _material);
|
|
||||||
}
|
if (_material.is_valid() && mesh->get_surface_count() > 0) {
|
||||||
|
mesh->surface_set_material(0, _material);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user