fix crash on mat creation after orm refactor

This commit is contained in:
Ansraer
2024-02-13 15:44:23 +01:00
parent 354404db60
commit 1e7c60174e
11 changed files with 17 additions and 17 deletions

View File

@ -822,7 +822,7 @@ void MeshInstance::create_debug_tangents() {
}
if (lines.size()) {
Ref<Material3D> sm;
Ref<SpatialMaterial> sm;
sm.instance();
sm->set_flag(Material3D::FLAG_UNSHADED, true);

View File

@ -421,7 +421,7 @@ void RayCast::_create_debug_shape() {
void RayCast::_update_debug_shape_material(bool p_check_collision) {
if (!debug_material.is_valid()) {
Ref<Material3D> material = memnew(Material3D);
Ref<SpatialMaterial> material = memnew(SpatialMaterial);
debug_material = material;
material->set_flag(Material3D::FLAG_UNSHADED, true);

View File

@ -539,7 +539,7 @@ void ShapeCast::_create_debug_shape() {
void ShapeCast::_update_debug_shape_material(bool p_check_collision) {
if (!debug_material.is_valid()) {
Ref<Material3D> material = memnew(Material3D);
Ref<SpatialMaterial> material = memnew(SpatialMaterial);
debug_material = material;
material->set_flag(Material3D::FLAG_UNSHADED, true);

View File

@ -1507,7 +1507,7 @@ Ref<MultiMesh> VoxelLightBaker::create_debug_multimesh(DebugMode p_mode) {
}
{
Ref<Material3D> fsm;
Ref<SpatialMaterial> fsm;
fsm.instance();
fsm->set_flag(Material3D::FLAG_SRGB_VERTEX_COLOR, true);
fsm->set_flag(Material3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);

View File

@ -1826,7 +1826,7 @@ RID Material3D::get_material_rid_for_2d(bool p_shaded, bool p_transparent, bool
return materials_for_2d[hash]->get_rid();
}
Ref<Material3D> material;
Ref<SpatialMaterial> material;
material.instance();
material->set_flag(FLAG_UNSHADED, !p_shaded);

View File

@ -458,6 +458,8 @@ protected:
void _validate_property(PropertyInfo &property) const;
virtual bool _can_do_next_pass() const { return true; }
Material3D(bool p_orm = false);
public:
void set_albedo(const Color &p_albedo);
Color get_albedo() const;
@ -643,7 +645,6 @@ public:
virtual Shader::Mode get_shader_mode() const;
Material3D(bool p_orm = false);
virtual ~Material3D();
};