Store ArrayMesh path in RenderingServer for use in error messages
(cherry picked from commit ead36fdcc4
)
This commit is contained in:
parent
138b3ded67
commit
2ec1d8043c
|
@ -262,7 +262,9 @@ void RasterizerSceneGLES3::_geometry_instance_add_surface_with_material(Geometry
|
||||||
|
|
||||||
GLES3::Mesh::Surface *s = reinterpret_cast<GLES3::Mesh::Surface *>(sdcache->surface);
|
GLES3::Mesh::Surface *s = reinterpret_cast<GLES3::Mesh::Surface *>(sdcache->surface);
|
||||||
if (p_material->shader_data->uses_tangent && !(s->format & RS::ARRAY_FORMAT_TANGENT)) {
|
if (p_material->shader_data->uses_tangent && !(s->format & RS::ARRAY_FORMAT_TANGENT)) {
|
||||||
WARN_PRINT_ED("Attempting to use a shader that requires tangents with a mesh that doesn't contain tangents. Ensure that meshes are imported with the 'ensure_tangents' option. If creating your own meshes, add an `ARRAY_TANGENT` array (when using ArrayMesh) or call `generate_tangents()` (when using SurfaceTool).");
|
String shader_path = p_material->shader_data->path.is_empty() ? "" : "(" + p_material->shader_data->path + ")";
|
||||||
|
String mesh_path = mesh_storage->mesh_get_path(p_mesh).is_empty() ? "" : "(" + mesh_storage->mesh_get_path(p_mesh) + ")";
|
||||||
|
WARN_PRINT_ED(vformat("Attempting to use a shader %s that requires tangents with a mesh %s that doesn't contain tangents. Ensure that meshes are imported with the 'ensure_tangents' option. If creating your own meshes, add an `ARRAY_TANGENT` array (when using ArrayMesh) or call `generate_tangents()` (when using SurfaceTool).", shader_path, mesh_path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -727,6 +727,20 @@ AABB MeshStorage::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
|
||||||
return aabb;
|
return aabb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MeshStorage::mesh_set_path(RID p_mesh, const String &p_path) {
|
||||||
|
Mesh *mesh = mesh_owner.get_or_null(p_mesh);
|
||||||
|
ERR_FAIL_NULL(mesh);
|
||||||
|
|
||||||
|
mesh->path = p_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
String MeshStorage::mesh_get_path(RID p_mesh) const {
|
||||||
|
Mesh *mesh = mesh_owner.get_or_null(p_mesh);
|
||||||
|
ERR_FAIL_NULL_V(mesh, String());
|
||||||
|
|
||||||
|
return mesh->path;
|
||||||
|
}
|
||||||
|
|
||||||
void MeshStorage::mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh) {
|
void MeshStorage::mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh) {
|
||||||
Mesh *mesh = mesh_owner.get_or_null(p_mesh);
|
Mesh *mesh = mesh_owner.get_or_null(p_mesh);
|
||||||
ERR_FAIL_NULL(mesh);
|
ERR_FAIL_NULL(mesh);
|
||||||
|
|
|
@ -142,6 +142,8 @@ struct Mesh {
|
||||||
RID shadow_mesh;
|
RID shadow_mesh;
|
||||||
HashSet<Mesh *> shadow_owners;
|
HashSet<Mesh *> shadow_owners;
|
||||||
|
|
||||||
|
String path;
|
||||||
|
|
||||||
Dependency dependency;
|
Dependency dependency;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -304,8 +306,11 @@ public:
|
||||||
|
|
||||||
virtual void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) override;
|
virtual void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) override;
|
||||||
virtual AABB mesh_get_custom_aabb(RID p_mesh) const override;
|
virtual AABB mesh_get_custom_aabb(RID p_mesh) const override;
|
||||||
|
|
||||||
virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton = RID()) override;
|
virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton = RID()) override;
|
||||||
|
|
||||||
|
virtual void mesh_set_path(RID p_mesh, const String &p_path) override;
|
||||||
|
virtual String mesh_get_path(RID p_mesh) const override;
|
||||||
|
|
||||||
virtual void mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh) override;
|
virtual void mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh) override;
|
||||||
virtual void mesh_clear(RID p_mesh) override;
|
virtual void mesh_clear(RID p_mesh) override;
|
||||||
|
|
||||||
|
|
|
@ -1558,6 +1558,7 @@ void ArrayMesh::_create_if_empty() const {
|
||||||
mesh = RS::get_singleton()->mesh_create();
|
mesh = RS::get_singleton()->mesh_create();
|
||||||
RS::get_singleton()->mesh_set_blend_shape_mode(mesh, (RS::BlendShapeMode)blend_shape_mode);
|
RS::get_singleton()->mesh_set_blend_shape_mode(mesh, (RS::BlendShapeMode)blend_shape_mode);
|
||||||
RS::get_singleton()->mesh_set_blend_shape_count(mesh, blend_shapes.size());
|
RS::get_singleton()->mesh_set_blend_shape_count(mesh, blend_shapes.size());
|
||||||
|
RS::get_singleton()->mesh_set_path(mesh, get_path());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1666,6 +1667,7 @@ void ArrayMesh::_set_surfaces(const Array &p_surfaces) {
|
||||||
// we can create it with a single call, which is a lot more efficient and thread friendly
|
// we can create it with a single call, which is a lot more efficient and thread friendly
|
||||||
mesh = RS::get_singleton()->mesh_create_from_surfaces(surface_data, blend_shapes.size());
|
mesh = RS::get_singleton()->mesh_create_from_surfaces(surface_data, blend_shapes.size());
|
||||||
RS::get_singleton()->mesh_set_blend_shape_mode(mesh, (RS::BlendShapeMode)blend_shape_mode);
|
RS::get_singleton()->mesh_set_blend_shape_mode(mesh, (RS::BlendShapeMode)blend_shape_mode);
|
||||||
|
RS::get_singleton()->mesh_set_path(mesh, get_path());
|
||||||
}
|
}
|
||||||
|
|
||||||
surfaces.clear();
|
surfaces.clear();
|
||||||
|
|
|
@ -113,8 +113,11 @@ public:
|
||||||
|
|
||||||
virtual void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) override {}
|
virtual void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) override {}
|
||||||
virtual AABB mesh_get_custom_aabb(RID p_mesh) const override { return AABB(); }
|
virtual AABB mesh_get_custom_aabb(RID p_mesh) const override { return AABB(); }
|
||||||
|
|
||||||
virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton = RID()) override { return AABB(); }
|
virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton = RID()) override { return AABB(); }
|
||||||
|
|
||||||
|
virtual void mesh_set_path(RID p_mesh, const String &p_path) override {}
|
||||||
|
virtual String mesh_get_path(RID p_mesh) const override { return String(); }
|
||||||
|
|
||||||
virtual void mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh) override {}
|
virtual void mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh) override {}
|
||||||
virtual void mesh_clear(RID p_mesh) override;
|
virtual void mesh_clear(RID p_mesh) override;
|
||||||
|
|
||||||
|
|
|
@ -3722,7 +3722,9 @@ void RenderForwardClustered::_geometry_instance_add_surface_with_material(Geomet
|
||||||
|
|
||||||
uint64_t format = RendererRD::MeshStorage::get_singleton()->mesh_surface_get_format(sdcache->surface);
|
uint64_t format = RendererRD::MeshStorage::get_singleton()->mesh_surface_get_format(sdcache->surface);
|
||||||
if (p_material->shader_data->uses_tangent && !(format & RS::ARRAY_FORMAT_TANGENT)) {
|
if (p_material->shader_data->uses_tangent && !(format & RS::ARRAY_FORMAT_TANGENT)) {
|
||||||
WARN_PRINT_ED("Attempting to use a shader that requires tangents with a mesh that doesn't contain tangents. Ensure that meshes are imported with the 'ensure_tangents' option. If creating your own meshes, add an `ARRAY_TANGENT` array (when using ArrayMesh) or call `generate_tangents()` (when using SurfaceTool).");
|
String shader_path = p_material->shader_data->path.is_empty() ? "" : "(" + p_material->shader_data->path + ")";
|
||||||
|
String mesh_path = mesh_storage->mesh_get_path(p_mesh).is_empty() ? "" : "(" + mesh_storage->mesh_get_path(p_mesh) + ")";
|
||||||
|
WARN_PRINT_ED(vformat("Attempting to use a shader %s that requires tangents with a mesh %s that doesn't contain tangents. Ensure that meshes are imported with the 'ensure_tangents' option. If creating your own meshes, add an `ARRAY_TANGENT` array (when using ArrayMesh) or call `generate_tangents()` (when using SurfaceTool).", shader_path, mesh_path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2522,7 +2522,9 @@ void RenderForwardMobile::_geometry_instance_add_surface_with_material(GeometryI
|
||||||
|
|
||||||
uint64_t format = RendererRD::MeshStorage::get_singleton()->mesh_surface_get_format(sdcache->surface);
|
uint64_t format = RendererRD::MeshStorage::get_singleton()->mesh_surface_get_format(sdcache->surface);
|
||||||
if (p_material->shader_data->uses_tangent && !(format & RS::ARRAY_FORMAT_TANGENT)) {
|
if (p_material->shader_data->uses_tangent && !(format & RS::ARRAY_FORMAT_TANGENT)) {
|
||||||
WARN_PRINT_ED("Attempting to use a shader that requires tangents with a mesh that doesn't contain tangents. Ensure that meshes are imported with the 'ensure_tangents' option. If creating your own meshes, add an `ARRAY_TANGENT` array (when using ArrayMesh) or call `generate_tangents()` (when using SurfaceTool).");
|
String shader_path = p_material->shader_data->path.is_empty() ? "" : "(" + p_material->shader_data->path + ")";
|
||||||
|
String mesh_path = mesh_storage->mesh_get_path(p_mesh).is_empty() ? "" : "(" + mesh_storage->mesh_get_path(p_mesh) + ")";
|
||||||
|
WARN_PRINT_ED(vformat("Attempting to use a shader %s that requires tangents with a mesh %s that doesn't contain tangents. Ensure that meshes are imported with the 'ensure_tangents' option. If creating your own meshes, add an `ARRAY_TANGENT` array (when using ArrayMesh) or call `generate_tangents()` (when using SurfaceTool).", shader_path, mesh_path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -766,6 +766,20 @@ AABB MeshStorage::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
|
||||||
return aabb;
|
return aabb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MeshStorage::mesh_set_path(RID p_mesh, const String &p_path) {
|
||||||
|
Mesh *mesh = mesh_owner.get_or_null(p_mesh);
|
||||||
|
ERR_FAIL_NULL(mesh);
|
||||||
|
|
||||||
|
mesh->path = p_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
String MeshStorage::mesh_get_path(RID p_mesh) const {
|
||||||
|
Mesh *mesh = mesh_owner.get_or_null(p_mesh);
|
||||||
|
ERR_FAIL_NULL_V(mesh, String());
|
||||||
|
|
||||||
|
return mesh->path;
|
||||||
|
}
|
||||||
|
|
||||||
void MeshStorage::mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh) {
|
void MeshStorage::mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh) {
|
||||||
Mesh *mesh = mesh_owner.get_or_null(p_mesh);
|
Mesh *mesh = mesh_owner.get_or_null(p_mesh);
|
||||||
ERR_FAIL_NULL(mesh);
|
ERR_FAIL_NULL(mesh);
|
||||||
|
|
|
@ -161,6 +161,8 @@ private:
|
||||||
RID shadow_mesh;
|
RID shadow_mesh;
|
||||||
HashSet<Mesh *> shadow_owners;
|
HashSet<Mesh *> shadow_owners;
|
||||||
|
|
||||||
|
String path;
|
||||||
|
|
||||||
Dependency dependency;
|
Dependency dependency;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -377,6 +379,9 @@ public:
|
||||||
virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton = RID()) override;
|
virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton = RID()) override;
|
||||||
virtual void mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh) override;
|
virtual void mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh) override;
|
||||||
|
|
||||||
|
virtual void mesh_set_path(RID p_mesh, const String &p_path) override;
|
||||||
|
virtual String mesh_get_path(RID p_mesh) const override;
|
||||||
|
|
||||||
virtual void mesh_clear(RID p_mesh) override;
|
virtual void mesh_clear(RID p_mesh) override;
|
||||||
|
|
||||||
virtual bool mesh_needs_instance(RID p_mesh, bool p_has_skeleton) override;
|
virtual bool mesh_needs_instance(RID p_mesh, bool p_has_skeleton) override;
|
||||||
|
|
|
@ -315,6 +315,9 @@ public:
|
||||||
FUNC2(mesh_set_custom_aabb, RID, const AABB &)
|
FUNC2(mesh_set_custom_aabb, RID, const AABB &)
|
||||||
FUNC1RC(AABB, mesh_get_custom_aabb, RID)
|
FUNC1RC(AABB, mesh_get_custom_aabb, RID)
|
||||||
|
|
||||||
|
FUNC2(mesh_set_path, RID, const String &)
|
||||||
|
FUNC1RC(String, mesh_get_path, RID)
|
||||||
|
|
||||||
FUNC2(mesh_set_shadow_mesh, RID, RID)
|
FUNC2(mesh_set_shadow_mesh, RID, RID)
|
||||||
|
|
||||||
FUNC1(mesh_clear, RID)
|
FUNC1(mesh_clear, RID)
|
||||||
|
|
|
@ -67,9 +67,11 @@ public:
|
||||||
|
|
||||||
virtual void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) = 0;
|
virtual void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) = 0;
|
||||||
virtual AABB mesh_get_custom_aabb(RID p_mesh) const = 0;
|
virtual AABB mesh_get_custom_aabb(RID p_mesh) const = 0;
|
||||||
|
|
||||||
virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton = RID()) = 0;
|
virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton = RID()) = 0;
|
||||||
|
|
||||||
|
virtual void mesh_set_path(RID p_mesh, const String &p_path) = 0;
|
||||||
|
virtual String mesh_get_path(RID p_mesh) const = 0;
|
||||||
|
|
||||||
virtual void mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh) = 0;
|
virtual void mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh) = 0;
|
||||||
|
|
||||||
virtual void mesh_clear(RID p_mesh) = 0;
|
virtual void mesh_clear(RID p_mesh) = 0;
|
||||||
|
|
|
@ -385,6 +385,9 @@ public:
|
||||||
virtual void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) = 0;
|
virtual void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) = 0;
|
||||||
virtual AABB mesh_get_custom_aabb(RID p_mesh) const = 0;
|
virtual AABB mesh_get_custom_aabb(RID p_mesh) const = 0;
|
||||||
|
|
||||||
|
virtual void mesh_set_path(RID p_mesh, const String &p_path) = 0;
|
||||||
|
virtual String mesh_get_path(RID p_mesh) const = 0;
|
||||||
|
|
||||||
virtual void mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh) = 0;
|
virtual void mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh) = 0;
|
||||||
|
|
||||||
virtual void mesh_clear(RID p_mesh) = 0;
|
virtual void mesh_clear(RID p_mesh) = 0;
|
||||||
|
|
Loading…
Reference in New Issue