Fix T81520: Crash setting the Cycles device from Python
This commit is contained in:
parent
d5555115e1
commit
0ff7d21c27
Notes:
blender-bot
2023-02-14 05:16:25 +01:00
Referenced by issue #81520, Crash when choosing cycles device with python Referenced by issue #77348, Blender LTS: Maintenance Task 2.83
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue