summaryrefslogtreecommitdiff
path: root/scene/resources/mesh.cpp
diff options
context:
space:
mode:
authorDaniel Rakos <daniel.rakos@rastergrid.com>2019-01-31 18:04:36 +0100
committerDaniel Rakos <daniel.rakos@rastergrid.com>2019-02-03 22:48:35 +0100
commit6df53e0401fd7c2f8e81cd7d8189584706d3d7d8 (patch)
tree8f2e5bcd00871fad3fd8a108e7dae51d9390f6c9 /scene/resources/mesh.cpp
parent463123a661151f119132f2ee9af78925a58a068a (diff)
MeshLibrary export improvements
- From now materials assigned to the MeshInstance (not the Mesh) get exported into the MeshLibrary when such materials exist. This enables workflows where the MeshLibrary is exported from an imported scene (e.g. GLTF) where the materials assigned to the Mesh (not the MeshInstance) get overwritten on re-import, thus can't use editor set materials in the exported MeshLibrary unless they are assigned to the MeshInstance whose materials get saved with the inherited scene thus persist across re-imports. - When appending to an existing MeshLibrary only generate previews for newly added or modified meshes. - During preview generation transform camera and lights instead of the mesh and use the source MeshInstance's transform for the mesh to avoid weird previews being generated for meshes with a position dependent material (e.g. when using triplanar mapping). - Adjust the camera angle and light directions used in mesh preview generation for better results.
Diffstat (limited to 'scene/resources/mesh.cpp')
-rw-r--r--scene/resources/mesh.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 805d30245a..e8ac79bdff 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -487,6 +487,7 @@ void Mesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_surface_count"), &Mesh::get_surface_count);
ClassDB::bind_method(D_METHOD("surface_get_arrays", "surf_idx"), &Mesh::surface_get_arrays);
ClassDB::bind_method(D_METHOD("surface_get_blend_shape_arrays", "surf_idx"), &Mesh::surface_get_blend_shape_arrays);
+ ClassDB::bind_method(D_METHOD("surface_set_material", "surf_idx", "material"), &Mesh::surface_set_material);
ClassDB::bind_method(D_METHOD("surface_get_material", "surf_idx"), &Mesh::surface_get_material);
BIND_ENUM_CONSTANT(PRIMITIVE_POINTS);
@@ -1288,7 +1289,6 @@ void ArrayMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("surface_get_array_index_len", "surf_idx"), &ArrayMesh::surface_get_array_index_len);
ClassDB::bind_method(D_METHOD("surface_get_format", "surf_idx"), &ArrayMesh::surface_get_format);
ClassDB::bind_method(D_METHOD("surface_get_primitive_type", "surf_idx"), &ArrayMesh::surface_get_primitive_type);
- ClassDB::bind_method(D_METHOD("surface_set_material", "surf_idx", "material"), &ArrayMesh::surface_set_material);
ClassDB::bind_method(D_METHOD("surface_find_by_name", "name"), &ArrayMesh::surface_find_by_name);
ClassDB::bind_method(D_METHOD("surface_set_name", "surf_idx", "name"), &ArrayMesh::surface_set_name);
ClassDB::bind_method(D_METHOD("surface_get_name", "surf_idx"), &ArrayMesh::surface_get_name);