Skip to content

Commit f1fa3fe

Browse files
committed
Upgrade according to Blender Material.blend_method,
`Material.show_transparent_back` deprecation.
1 parent 5596909 commit f1fa3fe

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

io_ogre/ogre/material.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,19 @@ def generate_pass( self, mat, pass_name="" ):
191191

192192
color = mat_wrapper.base_color
193193
alpha = 1.0
194-
if mat.blend_method == "CLIP":
195-
alpha = mat_wrapper.alpha
196-
self.w.iword('alpha_rejection greater_equal').round(255*mat.alpha_threshold).nl()
197-
elif mat.blend_method == "BLEND":
194+
if mat.surface_render_method == "DITHERED":
195+
# https://developer.blender.org/docs/release_notes/4.2/eevee_migration/#materials
196+
if mat.use_nodes and mat.node_tree:
197+
for node in mat.node_tree.nodes:
198+
if type(node) == bpy.types.ShaderNodeMath and node.operation == 'GREATER_THAN':
199+
alpha = mat_wrapper.alpha
200+
self.w.iword('alpha_rejection greater_equal').round(255*mat.alpha_threshold).nl()
201+
break
202+
elif mat.surface_render_method == "BLENDED":
198203
alpha = mat_wrapper.alpha
199204
self.w.iword('scene_blend alpha_blend').nl()
200-
if mat.show_transparent_back:
205+
# https://developer.blender.org/docs/release_notes/4.2/python_api/
206+
if mat.use_transparency_overlap:
201207
self.w.iword('cull_hardware none').nl()
202208
self.w.iword('depth_write off').nl()
203209

0 commit comments

Comments
 (0)