Skip to content

Fixed compatibility with Blender version 4.3#8

Open
hentila wants to merge 1 commit into
EatTheFuture:masterfrom
hentila:master
Open

Fixed compatibility with Blender version 4.3#8
hentila wants to merge 1 commit into
EatTheFuture:masterfrom
hentila:master

Conversation

@hentila

@hentila hentila commented Jan 2, 2025

Copy link
Copy Markdown

mat.shadow_method is removed from Blender 4.3

mat.shadow_method is removed from Blender 4.3
@hentila

hentila commented Jan 2, 2025

Copy link
Copy Markdown
Author

Fixes #7

Comment thread __init__.py
mat = bpy.data.materials.new(name)
mat.use_nodes = True
mat.blend_method = 'HASHED'
mat.shadow_method = 'HASHED'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of removing this, you could create a function that will work in both environments:

def _set_hashed_shadow(mat):
    """
    Make a material cast alpha‑hashed (dithered) shadows on
    every Blender version that still supports the add‑on.
    """
    if hasattr(mat, "shadow_method"):                       # Blender 2.8 – 3.6
        mat.shadow_method = 'HASHED'
    elif hasattr(mat, "surface_render_method"):             # Blender 4.0 +
        # ‘DITHERED’ == hashed transparency in Eevee‑Next
        mat.surface_render_method = 'DITHERED'

Than call that in place of the removed line. This seems to work as far as 5.0.

@marklio

marklio commented Jul 21, 2025

Copy link
Copy Markdown

@hentila I have a comment with a backwards-compatible replacement that seems to work (although I'm unfamiliar with common approaches for this kind of breaking change in blender add-ons. There may be a better pattern I'm unaware of.

@cessen For the record, this change gets things working (seemingly) as far as the current 5.0 alphas. I'd love to see this concrete issue fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants