Fix T97644: new 3.2 obj importer does not set blend mode for eevee

The old python importer had a "if do_transparency, set blend_method to
BLEND" type of logic. This bit was missing in the new importer; it was
only setting the eevee blend method when a transparency texture was
present, but not in other cases of transparency (as driven by MTL
"illum" mode).

Reviewd By: Howard Trickey
Differential Revision: https://developer.blender.org/D14783
This commit is contained in:
Aras Pranckevicius 2022-04-27 22:09:27 +03:00
parent 33518f9da1
commit c87f6242b9
Notes: blender-bot 2023-06-21 19:23:24 +02:00
Referenced by issue #97644, Regression: OBJ/MTL import: new 3.2 importer does not set EEVEE blend mode for illum values
2 changed files with 6 additions and 3 deletions

View File

@ -122,7 +122,7 @@ ShaderNodetreeWrap::ShaderNodetreeWrap(Main *bmain, const MTLMaterial &mtl_mat,
bsdf_ = add_node_to_tree(SH_NODE_BSDF_PRINCIPLED);
shader_output_ = add_node_to_tree(SH_NODE_OUTPUT_MATERIAL);
set_bsdf_socket_values();
set_bsdf_socket_values(mat);
add_image_textures(bmain, mat);
link_sockets(bsdf_, "BSDF", shader_output_, "Surface", 4);
@ -188,7 +188,7 @@ void ShaderNodetreeWrap::link_sockets(bNode *from_node,
nodeAddLink(nodetree_.get(), from_node, from_sock, to_node, to_sock);
}
void ShaderNodetreeWrap::set_bsdf_socket_values()
void ShaderNodetreeWrap::set_bsdf_socket_values(Material *mat)
{
const int illum = mtl_mat_.illum;
bool do_highlight = false;
@ -309,6 +309,9 @@ void ShaderNodetreeWrap::set_bsdf_socket_values()
set_property_of_socket(SOCK_FLOAT, "Metallic", {metallic}, bsdf_);
set_property_of_socket(SOCK_FLOAT, "IOR", {ior}, bsdf_);
set_property_of_socket(SOCK_FLOAT, "Alpha", {alpha}, bsdf_);
if (do_tranparency) {
mat->blend_method = MA_BM_BLEND;
}
}
void ShaderNodetreeWrap::add_image_textures(Main *bmain, Material *mat)

View File

@ -82,7 +82,7 @@ class ShaderNodetreeWrap {
/**
* Set values of sockets in p-BSDF node of the nodetree.
*/
void set_bsdf_socket_values();
void set_bsdf_socket_values(Material *mat);
/**
* Create image texture, vector and normal mapping nodes from MTL materials and link the
* nodes to p-BSDF node.