diff --git a/src/bonsai/bonsai/bim/module/drawing/operator.py b/src/bonsai/bonsai/bim/module/drawing/operator.py index 1ca45f155a..d1f0bb872e 100644 --- a/src/bonsai/bonsai/bim/module/drawing/operator.py +++ b/src/bonsai/bonsai/bim/module/drawing/operator.py @@ -2706,14 +2706,15 @@ class ActivateDrawingStyle(bpy.types.Operator, tool.Ifc.Operator): def preprocess(path: str, value: Any) -> tuple[str, Any, bool, bool]: warning = False skip = False - # @25.05.12 - if path == "scene.render.engine" and value == "BLENDER_EEVEE": - value = "BLENDER_EEVEE_NEXT" - print( - f"Warning: Value 'BLENDER_EEVEE' is outdated for property '{path}' " - "since Blender 4.2 and should be replaced with 'BLENDER_EEVEE_NEXT' in shading_styles.json." - ) - warning = True + # 25.11.07, Blender 5+ + if path == "scene.render.engine" and value in ("BLENDER_EEVEE", "BLENDER_EEVEE_NEXT"): + if value == "BLENDER_EEVEE_NEXT": + print( + f"Warning: Value 'BLENDER_EEVEE_NEXT' is outdated for property '{path}' " + "since Blender 5.0 and should be replaced with 'BLENDER_EEVEE' in shading_styles.json." + ) + warning = True + value = tool.Blender.get_eevee_name() # @25.05.12 if path == "scene.display.shading.wireframe_color_type" and value == "MATERIAL": value = "THEME" diff --git a/src/bonsai/bonsai/bim/module/drawing/ui.py b/src/bonsai/bonsai/bim/module/drawing/ui.py index 82ddfef55a..252a3c9148 100644 --- a/src/bonsai/bonsai/bim/module/drawing/ui.py +++ b/src/bonsai/bonsai/bim/module/drawing/ui.py @@ -116,7 +116,7 @@ class BIM_PT_camera(Panel): # See #6686. if ( props.has_underlay - and str(render.engine) == "BLENDER_EEVEE_NEXT" + and str(render.engine) == tool.Blender.get_eevee_name() and ((megapixels := (render.resolution_x * render.resolution_y / 10**6)) > MEGAPIXELS_WARNING_THRESHOLD) ): box = self.layout.box() diff --git a/src/bonsai/bonsai/bim/module/light/prop.py b/src/bonsai/bonsai/bim/module/light/prop.py index 344f524858..e538ca1bf2 100644 --- a/src/bonsai/bonsai/bim/module/light/prop.py +++ b/src/bonsai/bonsai/bim/module/light/prop.py @@ -101,7 +101,7 @@ def update_shadow_mode(self: "BIMSolarProperties", context: bpy.types.Context) - context.scene.collection.objects.link(sun) sun_props.sun_object = sun update_sun_path(self) - context.scene.render.engine = "BLENDER_EEVEE_NEXT" + context.scene.render.engine = tool.Blender.get_eevee_name() assert context.scene.display assert context.scene.display.shading context.scene.display.shading.light = "FLAT" diff --git a/src/bonsai/bonsai/tool/blender.py b/src/bonsai/bonsai/tool/blender.py index beb5d9e025..1747ae0b0f 100644 --- a/src/bonsai/bonsai/tool/blender.py +++ b/src/bonsai/bonsai/tool/blender.py @@ -2084,3 +2084,14 @@ class Blender(bonsai.core.tool.Blender): assert bpy.context.preferences if props_updated and bpy.context.preferences.use_preferences_save: bpy.ops.wm.save_userpref() + + @classmethod + def get_eevee_name(cls) -> Literal["BLENDER_EEVEE"] | Literal["BLENDER_EEVEE_NEXT"]: + """Convenience method to get correct eevee render engine name in multiple Blender versions. + + In Blender 4.2 eevee was renamed to "eevee next". + In Blender 5 eevee next is now just "eevee" again. + """ + if cls.BLENDER_5: + return "BLENDER_EEVEE" + return "BLENDER_EEVEE_NEXT"