Cleanup: defer importing '_cycles' in properties.py

This was imported already in nearly all usage.

Also use static-set for string comparison.
This commit is contained in:
Campbell Barton 2020-10-15 16:25:26 +11:00
parent aca8640b12
commit c0dde8be84
1 changed files with 5 additions and 3 deletions

View File

@ -31,7 +31,6 @@ from math import pi
# enums
import _cycles
from . import engine
enum_devices = (
@ -39,8 +38,10 @@ enum_devices = (
('GPU', "GPU Compute", "Use GPU compute device for rendering, configured in the system tab in the user preferences"),
)
if _cycles.with_network:
from _cycles import with_network
if with_network:
enum_devices += (('NETWORK', "Networked Device", "Use networked device for rendering"),)
del with_network
enum_feature_set = (
('SUPPORTED', "Supported", "Only use finished and supported features"),
@ -184,6 +185,7 @@ enum_aov_types = (
def enum_openimagedenoise_denoiser(self, context):
import _cycles
if _cycles.with_openimagedenoise:
return [('OPENIMAGEDENOISE', "OpenImageDenoise", "Use Intel OpenImageDenoise AI denoiser running on the CPU", 4)]
return []
@ -1599,7 +1601,7 @@ class CyclesPreferences(bpy.types.AddonPreferences):
elif entry.type == 'CPU':
cpu_devices.append(entry)
# Extend all GPU devices with CPU.
if compute_device_type in ('CUDA', 'OPENCL'):
if compute_device_type in {'CUDA', 'OPENCL'}:
devices.extend(cpu_devices)
return devices