mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 12:12:28 +00:00
Store ArrayMesh path in RenderingServer for use in error messages
This commit is contained in:
parent
59457685c1
commit
ead36fdcc4
@ -262,7 +262,9 @@ void RasterizerSceneGLES3::_geometry_instance_add_surface_with_material(Geometry
|
||||
|
||||
GLES3::Mesh::Surface *s = reinterpret_cast<GLES3::Mesh::Surface *>(sdcache->surface);
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -650,6 +650,20 @@ AABB MeshStorage::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
|
||||
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) {
|
||||
Mesh *mesh = mesh_owner.get_or_null(p_mesh);
|
||||
ERR_FAIL_NULL(mesh);
|
||||
|
@ -130,6 +130,8 @@ struct Mesh {
|
||||
RID shadow_mesh;
|
||||
HashSet<Mesh *> shadow_owners;
|
||||
|
||||
String path;
|
||||
|
||||
Dependency dependency;
|
||||
};
|
||||
|
||||
@ -292,8 +294,11 @@ public:
|
||||
|
||||
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_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_clear(RID p_mesh) override;
|
||||
|
||||
|
@ -1558,6 +1558,7 @@ void ArrayMesh::_create_if_empty() const {
|
||||
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_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
|
||||
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_path(mesh, get_path());
|
||||
}
|
||||
|
||||
surfaces.clear();
|
||||
|
@ -113,8 +113,11 @@ public:
|
||||
|
||||
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_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_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);
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2521,7 +2521,9 @@ void RenderForwardMobile::_geometry_instance_add_surface_with_material(GeometryI
|
||||
|
||||
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)) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -753,6 +753,20 @@ AABB MeshStorage::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
|
||||
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) {
|
||||
Mesh *mesh = mesh_owner.get_or_null(p_mesh);
|
||||
ERR_FAIL_NULL(mesh);
|
||||
|
@ -157,6 +157,8 @@ private:
|
||||
RID shadow_mesh;
|
||||
HashSet<Mesh *> shadow_owners;
|
||||
|
||||
String path;
|
||||
|
||||
Dependency dependency;
|
||||
};
|
||||
|
||||
@ -373,6 +375,9 @@ public:
|
||||
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_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 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 &)
|
||||
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)
|
||||
|
||||
FUNC1(mesh_clear, RID)
|
||||
|
@ -67,9 +67,11 @@ public:
|
||||
|
||||
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_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_clear(RID p_mesh) = 0;
|
||||
|
@ -381,6 +381,9 @@ public:
|
||||
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 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_clear(RID p_mesh) = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user