Fix T50001: auto tile size addon broken after Cycles GPU device changes.
Adds a get_num_gpu_devices() utility function for the addon to use.
This commit is contained in:
parent
e400f4a53e
commit
60409841a4
Notes:
blender-bot
2023-02-14 11:42:40 +01:00
Referenced by issue #50001, Time required for rendering in cycle increased in the latest build.
|
@ -1199,15 +1199,21 @@ class CyclesPreferences(bpy.types.AddonPreferences):
|
|||
return cuda_devices, opencl_devices
|
||||
|
||||
|
||||
def has_active_device(self):
|
||||
def get_num_gpu_devices(self):
|
||||
import _cycles
|
||||
device_list = _cycles.available_devices()
|
||||
num = 0
|
||||
for device in device_list:
|
||||
if device[1] != self.compute_device_type:
|
||||
continue
|
||||
if any(dev.use and dev.id == device[2] for dev in self.devices):
|
||||
return True
|
||||
return False
|
||||
for dev in self.devices:
|
||||
if dev.use and dev.id == device[2]:
|
||||
num += 1
|
||||
return num
|
||||
|
||||
|
||||
def has_active_device(self):
|
||||
return self.get_num_gpu_devices() > 0
|
||||
|
||||
|
||||
def draw_impl(self, layout, context):
|
||||
|
|
|
@ -1620,7 +1620,7 @@ def draw_device(self, context):
|
|||
sub = row.split(align=True)
|
||||
sub.active = show_device_selection(context)
|
||||
sub.prop(cscene, "device", text="")
|
||||
row.operator("wm.addon_userpref_show", text="Preferences", icon='PREFERENCES').module = __package__
|
||||
row.operator("wm.addon_userpref_show", text="", icon='PREFERENCES').module = __package__
|
||||
|
||||
if engine.with_osl() and use_cpu(context):
|
||||
layout.prop(cscene, "shading_system")
|
||||
|
|
Loading…
Reference in New Issue