diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-10-15 08:51:18 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2020-10-28 11:37:27 +0300 |
commit | 0ff7d21c27957b4f4a9f02c59b458cdd6beeb06b (patch) | |
tree | 6aecdc9093015d1575788e947e6eb04c0701d70f | |
parent | d5555115e121eac0960f2de981b8dcdd175bcf49 (diff) |
Fix T81520: Crash setting the Cycles device from Python
-rw-r--r-- | intern/cycles/blender/addon/properties.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index c91e210bbd8..39650801584 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -1577,8 +1577,13 @@ class CyclesPreferences(bpy.types.AddonPreferences): # For backwards compatibility, only returns CUDA and OpenCL but still # refreshes all devices. def get_devices(self, compute_device_type=''): + import _cycles + # Ensure `self.devices` is not re-allocated when the second call to + # get_devices_for_type is made, freeing items from the first list. + for device_type in ('CUDA', 'OPTIX', 'OPENCL'): + self.update_device_entries(_cycles.available_devices(device_type)) + cuda_devices = self.get_devices_for_type('CUDA') - self.get_devices_for_type('OPTIX') opencl_devices = self.get_devices_for_type('OPENCL') return cuda_devices, opencl_devices |