Fill doublesidedness and transparency (TODO: figure out additive mapping/emulation) from material settings

This commit is contained in:
William Herald Snyder 2022-10-03 23:06:33 -04:00
parent f44c7bfdf3
commit 56f6ce6940
1 changed files with 8 additions and 1 deletions

View File

@ -39,11 +39,18 @@ class FillSWBFMaterialProperties(bpy.types.Operator):
for mat in mats: for mat in mats:
if mat.name in mats_visited: if mat.name in mats_visited or not mat.swbf_msh_mat:
continue continue
else: else:
mats_visited.add(mat.name) mats_visited.add(mat.name)
mat.swbf_msh_mat.doublesided = not mat.use_backface_culling
mat.swbf_msh_mat.hardedged_transparency = (mat.blend_method == "CLIP")
mat.swbf_msh_mat.blended_transparency = (mat.blend_method == "BLEND")
# Below is all for filling the diffuse map/texture_0 fields
try: try:
for BSDF_node in [n for n in mat.node_tree.nodes if n.type == 'BSDF_PRINCIPLED']: for BSDF_node in [n for n in mat.node_tree.nodes if n.type == 'BSDF_PRINCIPLED']:
base_col = BSDF_node.inputs['Base Color'] base_col = BSDF_node.inputs['Base Color']