Merge branch 'master' into blender2.8
[blender.git] / intern / cycles / blender / addon / properties.py
index c97d942af9df8870dcf50b42afa011f469b0db90..7f0cb7e875f60bc15f3e2ebde6799343e74129ef 100644 (file)
 # <pep8 compliant>
 
 import bpy
-from bpy.props import (BoolProperty,
-                       EnumProperty,
-                       FloatProperty,
-                       IntProperty,
-                       PointerProperty,
-                       StringProperty)
+from bpy.props import (
+    BoolProperty,
+    EnumProperty,
+    FloatProperty,
+    IntProperty,
+    PointerProperty,
+    StringProperty,
+)
 
 # enums
 
@@ -207,12 +209,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
             description="Pause all viewport preview renders",
             default=False,
         )
-        cls.preview_active_layer = BoolProperty(
-            name="Preview Active Layer",
-            description="Preview active render layer in viewport",
-            default=False,
-        )
-
         cls.aa_samples = IntProperty(
             name="AA Samples",
             description="Number of antialiasing samples to render for each pixel",
@@ -894,17 +890,17 @@ class CyclesMaterialSettings(bpy.types.PropertyGroup):
         del bpy.types.Material.cycles
 
 
-class CyclesLampSettings(bpy.types.PropertyGroup):
+class CyclesLightSettings(bpy.types.PropertyGroup):
     @classmethod
     def register(cls):
-        bpy.types.Lamp.cycles = PointerProperty(
-            name="Cycles Lamp Settings",
-            description="Cycles lamp settings",
+        bpy.types.Light.cycles = PointerProperty(
+            name="Cycles Light Settings",
+            description="Cycles light settings",
             type=cls,
         )
         cls.cast_shadow = BoolProperty(
             name="Cast Shadow",
-            description="Lamp casts shadows",
+            description="Light casts shadows",
             default=True,
         )
         cls.samples = IntProperty(
@@ -921,20 +917,20 @@ class CyclesLampSettings(bpy.types.PropertyGroup):
         )
         cls.use_multiple_importance_sampling = BoolProperty(
             name="Multiple Importance Sample",
-            description="Use multiple importance sampling for the lamp, "
-            "reduces noise for area lamps and sharp glossy materials",
+            description="Use multiple importance sampling for the light, "
+            "reduces noise for area lights and sharp glossy materials",
             default=True,
         )
         cls.is_portal = BoolProperty(
             name="Is Portal",
-            description="Use this area lamp to guide sampling of the background, "
-            "note that this will make the lamp invisible",
+            description="Use this area light to guide sampling of the background, "
+            "note that this will make the light invisible",
             default=False,
         )
 
     @classmethod
     def unregister(cls):
-        del bpy.types.Lamp.cycles
+        del bpy.types.Light.cycles
 
 
 class CyclesWorldSettings(bpy.types.PropertyGroup):
@@ -1166,7 +1162,7 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
             default='THICK',
         )
         cls.cull_backfacing = BoolProperty(
-            name="Cull back-faces",
+            name="Cull Back-faces",
             description="Do not test the back-face of each strand",
             default=True,
         )
@@ -1208,16 +1204,16 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
 def update_render_passes(self, context):
     scene = context.scene
     rd = scene.render
-    rl = rd.layers.active
-    rl.update_render_passes()
+    view_layer = context.view_layer
+    view_layer.update_render_passes()
 
 
 class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
     @classmethod
     def register(cls):
-        bpy.types.SceneRenderLayer.cycles = PointerProperty(
-            name="Cycles SceneRenderLayer Settings",
-            description="Cycles SceneRenderLayer Settings",
+        bpy.types.ViewLayer.cycles = PointerProperty(
+            name="Cycles ViewLayer Settings",
+            description="Cycles ViewLayer Settings",
             type=cls,
         )
         cls.pass_debug_bvh_traversed_nodes = BoolProperty(
@@ -1341,50 +1337,7 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
 
     @classmethod
     def unregister(cls):
-        del bpy.types.SceneRenderLayer.cycles
-
-
-class CyclesCurveSettings(bpy.types.PropertyGroup):
-    @classmethod
-    def register(cls):
-        bpy.types.ParticleSettings.cycles = PointerProperty(
-            name="Cycles Hair Settings",
-            description="Cycles hair settings",
-            type=cls,
-        )
-        cls.radius_scale = FloatProperty(
-            name="Radius Scaling",
-            description="Multiplier of width properties",
-            min=0.0, max=1000.0,
-            default=0.01,
-        )
-        cls.root_width = FloatProperty(
-            name="Root Size",
-            description="Strand's width at root",
-            min=0.0, max=1000.0,
-            default=1.0,
-        )
-        cls.tip_width = FloatProperty(
-            name="Tip Multiplier",
-            description="Strand's width at tip",
-            min=0.0, max=1000.0,
-            default=0.0,
-        )
-        cls.shape = FloatProperty(
-            name="Strand Shape",
-            description="Strand shape parameter",
-            min=-1.0, max=1.0,
-            default=0.0,
-        )
-        cls.use_closetip = BoolProperty(
-            name="Close tip",
-            description="Set tip radius to zero",
-            default=True,
-        )
-
-    @classmethod
-    def unregister(cls):
-        del bpy.types.ParticleSettings.cycles
+        del bpy.types.ViewLayer.cycles
 
 
 class CyclesDeviceSettings(bpy.types.PropertyGroup):
@@ -1409,13 +1362,13 @@ class CyclesPreferences(bpy.types.AddonPreferences):
             list.append(('OPENCL', "OpenCL", "Use OpenCL for GPU acceleration", 2))
         return list
 
-    compute_device_type = EnumProperty(
+    compute_device_type: EnumProperty(
         name="Compute Device Type",
         description="Device to use for computation (rendering with Cycles)",
         items=get_device_types,
     )
 
-    devices = bpy.props.CollectionProperty(type=CyclesDeviceSettings)
+    devices: bpy.props.CollectionProperty(type=CyclesDeviceSettings)
 
     def find_existing_device_entry(self, device):
         for device_entry in self.devices:
@@ -1505,13 +1458,12 @@ def register():
     bpy.utils.register_class(CyclesRenderSettings)
     bpy.utils.register_class(CyclesCameraSettings)
     bpy.utils.register_class(CyclesMaterialSettings)
-    bpy.utils.register_class(CyclesLampSettings)
+    bpy.utils.register_class(CyclesLightSettings)
     bpy.utils.register_class(CyclesWorldSettings)
     bpy.utils.register_class(CyclesVisibilitySettings)
     bpy.utils.register_class(CyclesMeshSettings)
     bpy.utils.register_class(CyclesObjectSettings)
     bpy.utils.register_class(CyclesCurveRenderSettings)
-    bpy.utils.register_class(CyclesCurveSettings)
     bpy.utils.register_class(CyclesDeviceSettings)
     bpy.utils.register_class(CyclesPreferences)
     bpy.utils.register_class(CyclesRenderLayerSettings)
@@ -1521,13 +1473,12 @@ def unregister():
     bpy.utils.unregister_class(CyclesRenderSettings)
     bpy.utils.unregister_class(CyclesCameraSettings)
     bpy.utils.unregister_class(CyclesMaterialSettings)
-    bpy.utils.unregister_class(CyclesLampSettings)
+    bpy.utils.unregister_class(CyclesLightSettings)
     bpy.utils.unregister_class(CyclesWorldSettings)
     bpy.utils.unregister_class(CyclesMeshSettings)
     bpy.utils.unregister_class(CyclesObjectSettings)
     bpy.utils.unregister_class(CyclesVisibilitySettings)
     bpy.utils.unregister_class(CyclesCurveRenderSettings)
-    bpy.utils.unregister_class(CyclesCurveSettings)
     bpy.utils.unregister_class(CyclesDeviceSettings)
     bpy.utils.unregister_class(CyclesPreferences)
     bpy.utils.unregister_class(CyclesRenderLayerSettings)