1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-05 17:15:09 +00:00

add ORMSpatialMaterial

This commit is contained in:
Ansraer
2024-02-08 20:10:26 +01:00
parent cc4492f9b9
commit b9cbffd957
59 changed files with 1568 additions and 1444 deletions

View File

@@ -518,7 +518,7 @@ void EditorResourcePicker::_get_allowed_types(bool p_with_convert, Set<String> *
}
if (p_with_convert) {
if (base == "SpatialMaterial") {
if (base == "SpatialMaterial" || base == "ORMSpatialMaterial") {
p_vector->insert("Texture");
} else if (base == "ShaderMaterial") {
p_vector->insert("Shader");
@@ -643,11 +643,22 @@ void EditorResourcePicker::drop_data_fw(const Point2 &p_point, const Variant &p_
if (at == "SpatialMaterial" && ClassDB::is_parent_class(dropped_resource->get_class(), "Texture")) {
// Use existing resource if possible and only replace its data.
Ref<SpatialMaterial> mat = edited_resource;
Ref<Material3D> mat = edited_resource;
if (mat.is_null()) {
mat.instance();
}
mat->set_texture(SpatialMaterial::TextureParam::TEXTURE_ALBEDO, dropped_resource);
mat->set_texture(Material3D::TextureParam::TEXTURE_ALBEDO, dropped_resource);
dropped_resource = mat;
break;
}
if (at == "ORMSpatialMaterial" && ClassDB::is_parent_class(dropped_resource->get_class(), "Texture")) {
// Use existing resource if possible and only replace its data.
Ref<ORMSpatialMaterial> mat = edited_resource;
if (mat.is_null()) {
mat.instance();
}
mat->set_texture(Material3D::TextureParam::TEXTURE_ALBEDO, dropped_resource);
dropped_resource = mat;
break;
}