@@ -32,6 +32,7 @@ def OnResetMaterialType(self:Material, context):
3232
3333 self .name = self .name .replace (self .material_type_old , self .material_type )
3434 self .material_type_old = self .material_type
35+ OnRenderingChanged (self ,context )
3536
3637Material .material_type = EnumProperty (
3738 name = 'Material Type' ,
@@ -204,6 +205,9 @@ def OnRenderingChanged(self:Material, context):
204205 elif self .material_type in ["MuzzleFlash" ,"FXLightning" , "Lightning" , "FXProtonCollider" ]:
205206 self .blend_method = "BLEND"
206207 self .show_transparent_back = True
208+ elif "Buildings" in self .material_type .__str__ ():
209+ self .blend_method = "CLIP"
210+ self .show_transparent_back = False
207211 else :
208212 if self .alpha_test == False :
209213 self .blend_method = "OPAQUE"
@@ -505,13 +509,13 @@ def OnDiffuseTextureChanged(self, context):
505509 self .node_tree .links .new (tex_spec .outputs ["Color" ], spec_sepa_node .inputs ["Color" ])
506510
507511 #self.node_tree.links.new(tex_node.outputs["Color"], principled.node_principled_bsdf.inputs["Base Color"])
508- if "Allied" in self .material_type or "Soviet" in self .material_type or "Japan" in self .material_type :
512+ if "Buildings" in self .material_type .__str__ ():
513+ self .node_tree .links .new (tex_diffuse .outputs ["Alpha" ], principled .node_principled_bsdf .inputs ["Alpha" ])
514+ else :
509515 inputs = principled .node_principled_bsdf .inputs ["Alpha" ]
510516 if inputs .is_linked :
511517 link = inputs .links [0 ]
512518 self .node_tree .links .remove (link )
513- else :
514- self .node_tree .links .new (tex_diffuse .outputs ["Alpha" ], principled .node_principled_bsdf .inputs ["Alpha" ])
515519
516520 faction_color_node = create_node_no_repeative (nodes , 'ShaderNodeRGB' , "faction_color_node" )
517521 faction_color_node .outputs ["Color" ].default_value = (* self .faction_color , 1.0 ) # Convert to 4D vector
@@ -617,7 +621,9 @@ def OnDamagedViewChanged(self:Material, context):
617621 if inputs .is_linked :
618622 link = inputs .links [0 ]
619623 self .node_tree .links .remove (link )
620- self .blend_method = "OPAQUE"
624+ tex_diffuse = create_texture_node (self , context .preferences .addons ["io_mesh_w3d" ].preferences .texture_paths , self .diffuse_texture , "tex_diffuse" )
625+ self .node_tree .links .new (tex_diffuse .outputs ["Alpha" ], principled .node_principled_bsdf .inputs ["Alpha" ])
626+ self .blend_method = "CLIP"
621627
622628Material .preview_holes = BoolProperty (
623629 name = 'Preview Damaged Model 2' ,
0 commit comments