Cycles: rename displacement methods, default to displace, tweak panel layout.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Thu, 25 Jan 2018 13:08:56 +0000 (14:08 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Thu, 25 Jan 2018 13:25:21 +0000 (14:25 +0100)
Differential Revision: https://developer.blender.org/D3019

intern/cycles/blender/addon/properties.py
intern/cycles/blender/addon/ui.py
intern/cycles/blender/addon/version_update.py

index a63d84f2da68ba57723939d5c12235d77ea152a5..62aea8790af7d8665c49835940db3a844354d41e 100644 (file)
@@ -42,9 +42,9 @@ enum_feature_set = (
     )
 
 enum_displacement_methods = (
-    ('BUMP', "Bump", "Bump mapping to simulate the appearance of displacement"),
-    ('TRUE', "True", "Use true displacement only, requires fine subdivision"),
-    ('BOTH', "Both", "Combination of displacement and bump mapping"),
+    ('BUMP', "Bump Only", "Bump mapping to simulate the appearance of displacement"),
+    ('DISPLACEMENT', "Displacement Only", "Use true displacement of surface only, requires fine subdivision"),
+    ('BOTH', "Displacement and Bump", "Combination of true displacement and bump mapping for finer detail"),
     )
 
 enum_bvh_layouts = (
@@ -878,7 +878,7 @@ class CyclesMaterialSettings(bpy.types.PropertyGroup):
                 name="Displacement Method",
                 description="Method to use for the displacement",
                 items=enum_displacement_methods,
-                default='BUMP',
+                default='DISPLACEMENT',
                 )
 
     @classmethod
index 543ba7c6d4dc753e5983fc0da3e90b0b45aa6ddf..66a37687963cb5c0017ee1678a5a1ec13cea546d 100644 (file)
@@ -1298,7 +1298,6 @@ class CYCLES_MATERIAL_PT_displacement(CyclesButtonsPanel, Panel):
 class CYCLES_MATERIAL_PT_settings(CyclesButtonsPanel, Panel):
     bl_label = "Settings"
     bl_context = "material"
-    bl_options = {'DEFAULT_CLOSED'}
 
     @classmethod
     def poll(cls, context):
@@ -1318,8 +1317,11 @@ class CYCLES_MATERIAL_PT_settings(CyclesButtonsPanel, Panel):
 
         if context.scene.cycles.feature_set == 'EXPERIMENTAL':
             col.separator()
-            col.label(text="Displacement:")
+            col.label(text="Geometry:")
             col.prop(cmat, "displacement_method", text="")
+        else:
+            col.separator()
+            col.prop(mat, "pass_index")
 
         col = split.column()
         col.label(text="Volume:")
@@ -1329,26 +1331,40 @@ class CYCLES_MATERIAL_PT_settings(CyclesButtonsPanel, Panel):
         col.prop(cmat, "volume_interpolation", text="")
         col.prop(cmat, "homogeneous_volume", text="Homogeneous")
 
-        layout.separator()
+        if context.scene.cycles.feature_set == 'EXPERIMENTAL':
+            col.separator()
+            col.prop(mat, "pass_index")
+
+
+class CYCLES_MATERIAL_PT_viewport(CyclesButtonsPanel, Panel):
+    bl_label = "Viewport"
+    bl_context = "material"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    @classmethod
+    def poll(cls, context):
+        return context.material and CyclesButtonsPanel.poll(context)
+
+    def draw(self, context):
+        mat = context.material
+
+        layout = self.layout
         split = layout.split()
 
         col = split.column(align=True)
-        col.label("Viewport Color:")
+        col.label("Color:")
         col.prop(mat, "diffuse_color", text="")
         col.prop(mat, "alpha")
 
         col.separator()
-        col.label("Viewport Alpha:")
+        col.label("Alpha:")
         col.prop(mat.game_settings, "alpha_blend", text="")
 
         col = split.column(align=True)
-        col.label("Viewport Specular:")
+        col.label("Specular:")
         col.prop(mat, "specular_color", text="")
         col.prop(mat, "specular_hardness", text="Hardness")
 
-        col.separator()
-        col.prop(mat, "pass_index")
-
 
 class CYCLES_TEXTURE_PT_context(CyclesButtonsPanel, Panel):
     bl_label = ""
@@ -1853,6 +1869,7 @@ classes = (
     CYCLES_MATERIAL_PT_volume,
     CYCLES_MATERIAL_PT_displacement,
     CYCLES_MATERIAL_PT_settings,
+    CYCLES_MATERIAL_PT_viewport,
     CYCLES_TEXTURE_PT_context,
     CYCLES_TEXTURE_PT_node,
     CYCLES_TEXTURE_PT_mapping,
index 26cdecd2d522519820f828ef6d46b51d09ab13a0..73d84e24794341b7007de9047136191a9b29fe58 100644 (file)
@@ -359,3 +359,9 @@ def do_versions(self):
 
     if bpy.data.version <= (2, 79, 1):
         displacement_nodes_insert()
+
+    if bpy.data.version <= (2, 79, 2):
+        for mat in bpy.data.materials:
+            cmat = mat.cycles
+            if not cmat.is_property_set("displacement_method"):
+                cmat.displacement_method = 'BUMP'