[Bf-blender-cvs] [2609ca2b8e0] master: Cleanup: tweaks to cycles/metal preferences

Campbell Barton noreply at git.blender.org
Tue Feb 7 07:31:19 CET 2023


Commit: 2609ca2b8e0a7c364c9b08c07320def46890055f
Author: Campbell Barton
Date:   Tue Feb 7 17:24:13 2023 +1100
Branches: master
https://developer.blender.org/rB2609ca2b8e0a7c364c9b08c07320def46890055f

Cleanup: tweaks to cycles/metal  preferences

- Auto-format.
- Use raw string for regex.
- Remove redundant assignment.
- Remove duplicate arm64 check.
- Break early out of loop.

===================================================================

M	intern/cycles/blender/addon/properties.py

===================================================================

diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 0c5d8a7cd55..bce39bb89e5 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -1722,19 +1722,21 @@ class CyclesPreferences(bpy.types.AddonPreferences):
             row.prop(self, "peer_memory")
 
         if compute_device_type == 'METAL':
-            import platform, re
-            isNavi2 = False
+            import platform
+            import re
+            is_navi_2 = False
             for device in devices:
-                obj = re.search("((RX)|(Pro)|(PRO))\s+W?6\d00X",device.name)
-                if obj:
-                    isNavi2 = True
+                if re.search(r"((RX)|(Pro)|(PRO))\s+W?6\d00X", device.name):
+                    is_navi_2 = True
+                    break
 
-            # MetalRT only works on Apple Silicon and Navi2
-            if platform.machine() == 'arm64' or isNavi2:
+            # MetalRT only works on Apple Silicon and Navi2.
+            is_arm64 = platform.machine() == 'arm64'
+            if is_arm64 or is_navi_2:
                 col = layout.column()
                 col.use_property_split = True
                 # Kernel specialization is only supported on Apple Silicon
-                if platform.machine() == 'arm64':
+                if is_arm64:
                     col.prop(self, "kernel_optimization_level")
                 col.prop(self, "use_metalrt")



More information about the Bf-blender-cvs mailing list