diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-11-19 03:15:08 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-11-20 17:45:22 +0300 |
commit | f68ef05a56b7b3dca4825513b257441739c373b9 (patch) | |
tree | a89fb2c66a3f5bf779787d13d9ceed97492f5274 /intern/cycles | |
parent | aea4ed00d5a7fe661f12fbe1a16ad6574d9be8ea (diff) |
Cycles: add basic backwards compatibility for device selection, move to System tab.
For the multi-GPU case users still have to reconfigure the devices they want to use.
Based on patch from Lukas Stockner.
Differential Revision: https://developer.blender.org/D2347
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/blender/addon/properties.py | 12 | ||||
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 8 | ||||
-rw-r--r-- | intern/cycles/blender/addon/version_update.py | 12 |
3 files changed, 20 insertions, 12 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 575a3f9b6c5..b53f85c3266 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -30,7 +30,7 @@ import _cycles enum_devices = ( ('CPU', "CPU", "Use CPU for rendering"), - ('GPU', "GPU Compute", "Use GPU compute device for rendering, configured in user preferences"), + ('GPU', "GPU Compute", "Use GPU compute device for rendering, configured in the system tab in the user preferences"), ) if _cycles.with_network: @@ -1188,7 +1188,7 @@ class CyclesPreferences(bpy.types.AddonPreferences): def get_devices(self): import _cycles - # Layout of the device tuples: (Name, Type, Internal ID, Persistent ID) + # Layout of the device tuples: (Name, Type, Persistent ID) device_list = _cycles.available_devices() cuda_devices = [] @@ -1236,21 +1236,19 @@ class CyclesPreferences(bpy.types.AddonPreferences): def draw_impl(self, layout, context): - layout.label(text="Compute Device:") + layout.label(text="Cycles Compute Device:") layout.row().prop(self, "compute_device_type", expand=True) cuda_devices, opencl_devices = self.get_devices() row = layout.row() - if cuda_devices: + if self.compute_device_type == 'CUDA' and cuda_devices: col = row.column(align=True) - col.label(text="CUDA devices:") for device in cuda_devices: col.prop(device, "use", text=device.name, toggle=True) - if opencl_devices: + if self.compute_device_type == 'OPENCL' and opencl_devices: col = row.column(align=True) - col.label(text="OpenCL devices:") for device in opencl_devices: col.prop(device, "use", text=device.name, toggle=True) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 6296d6787e5..1856b278c89 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -1623,11 +1623,9 @@ def draw_device(self, context): split = layout.split(percentage=1/3) split.label("Device:") - row = split.row(align=True) - sub = row.split(align=True) - sub.active = show_device_selection(context) - sub.prop(cscene, "device", text="") - row.operator("wm.addon_userpref_show", text="", icon='PREFERENCES').module = __package__ + row = split.row() + row.active = show_device_selection(context) + row.prop(cscene, "device", text="") if engine.with_osl() and use_cpu(context): layout.prop(cscene, "shading_system") diff --git a/intern/cycles/blender/addon/version_update.py b/intern/cycles/blender/addon/version_update.py index 951afd37a92..136080efadc 100644 --- a/intern/cycles/blender/addon/version_update.py +++ b/intern/cycles/blender/addon/version_update.py @@ -172,6 +172,18 @@ def custom_bake_remap(scene): @persistent def do_versions(self): + if bpy.context.user_preferences.version <= (2, 78, 1): + prop = bpy.context.user_preferences.addons[__package__].preferences + system = bpy.context.user_preferences.system + if not prop.is_property_set("compute_device_type"): + if system.legacy_compute_device_type == 1: + prop.compute_device_type = 'OPENCL' + elif system.legacy_compute_device_type == 2: + prop.compute_device_type = 'CUDA' + else: + prop.compute_device_type = 'NONE' + prop.get_devices() + # We don't modify startup file because it assumes to # have all the default values only. if not bpy.data.is_saved: |