diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-10-15 08:51:18 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-10-15 08:53:38 +0300 |
commit | 1001adb500196537050cc60e8d80318a2f1a56c3 (patch) | |
tree | f1612808909d94f849eb93502ed2c6ccb034fcbe /intern/cycles/blender/addon/properties.py | |
parent | 4bea4702d5d5a9feb4f06c4d9f09834dc4a278a1 (diff) |
Fix T81520: Crash setting the Cycles device from Python
Diffstat (limited to 'intern/cycles/blender/addon/properties.py')
-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 3eeaece7c36..054fd900419 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -1608,8 +1608,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 |