Skip to content

Commit

Permalink
Alpha Blend Fix for 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspirata committed Jul 2, 2024
1 parent 5d6bc26 commit 0688817
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Mcblend Source/Materials/Materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def fix_world():
scene = bpy.context.scene
WProperties = scene.world_properties

if MaterialIn(Alpha_Blend_Materials, material):
if MaterialIn(Alpha_Blend_Materials, material) and WProperties.use_alpha_blend:
material.blend_method = 'BLEND'
else:
material.blend_method = 'HASHED'
Expand All @@ -159,7 +159,7 @@ def fix_world():
if "Lazy Biome Color Fix" == node.node_tree.name:
lbcf_node = node

if (image_texture_node and PBSDF) != None:
if image_texture_node and PBSDF:
if GetConnectedSocketTo("Alpha", "BSDF_PRINCIPLED", material) == None:
material.node_tree.links.new(image_texture_node.outputs["Alpha"], PBSDF.inputs["Alpha"])

Expand Down
11 changes: 11 additions & 0 deletions Mcblend Source/Properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ class WorldProperties(PropertyGroup):
default=True,
)

def alpha_blend_fix(): # Fix for Eevee Next
if blender_version(">= 4.2.0"):
return False
else:
return True

use_alpha_blend: BoolProperty(
name="Use Alpha Blend",
default=alpha_blend_fix(),
)




Expand Down
3 changes: 3 additions & 0 deletions Mcblend Source/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ def draw(self, context):
row = box.row()
row.prop(WProperties, "lazy_biome_fix")

row = box.row()
row.prop(WProperties, "use_alpha_blend")

row = box.row()
row.scale_y = Big_Button_Scale
row.operator("world.fix_world", text="Fix World")
Expand Down
Binary file modified Mcblend.blend
Binary file not shown.

0 comments on commit 0688817

Please sign in to comment.