Cycles Merge
[blender.git] / intern / cycles / blender / addon / ui.py
index 33e0b8bcb5048d95582860934e4862df9d585e8b..dfbfb769170736463d66d61db2930a12dfe350fd 100644 (file)
@@ -62,12 +62,13 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
         sub.label(text="Samples:")
         sub.prop(cscene, "samples", text="Render")
         sub.prop(cscene, "preview_samples", text="Preview")
+        sub.prop(cscene, "seed")
 
         sub = col.column(align=True)
         sub.label("Transparency:")
         sub.prop(cscene, "transparent_max_bounces", text="Max")
         sub.prop(cscene, "transparent_min_bounces", text="Min")
-        sub.prop(cscene, "no_caustics")
+        sub.prop(cscene, "use_transparent_shadows", text="Shadows")
 
         col = split.column()
 
@@ -81,6 +82,7 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
         sub.prop(cscene, "diffuse_bounces", text="Diffuse")
         sub.prop(cscene, "glossy_bounces", text="Glossy")
         sub.prop(cscene, "transmission_bounces", text="Transmission")
+        sub.prop(cscene, "no_caustics")
 
         #row = col.row()
         #row.prop(cscene, "blur_caustics")
@@ -228,7 +230,7 @@ class CyclesCamera_PT_dof(CyclesButtonsPanel, Panel):
         sub.prop(ccam, "aperture_rotation", text="Rotation")
 
 class Cycles_PT_context_material(CyclesButtonsPanel, Panel):
-    bl_label = ""
+    bl_label = "Surface"
     bl_context = "material"
     bl_options = {'HIDE_HEADER'}
 
@@ -309,7 +311,7 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
     @classmethod
     def poll(cls, context):
         ob = context.object
-        return ob and ob.type in ('MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META') # todo: 'LAMP'
+        return CyclesButtonsPanel.poll(context) and ob and ob.type in ('MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META') # todo: 'LAMP'
 
     def draw(self, context):
         layout = self.layout
@@ -347,7 +349,7 @@ def find_node_input(node, name):
 
 def panel_node_draw(layout, id, output_type, input_name):
     if not id.node_tree:
-        layout.prop(id, "use_nodes")
+        layout.prop(id, "use_nodes", icon='NODETREE')
         return
 
     ntree = id.node_tree
@@ -362,12 +364,10 @@ def panel_node_draw(layout, id, output_type, input_name):
 class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel):
     bl_label = "Lamp"
     bl_context = "data"
-    bl_options = {'DEFAULT_CLOSED'}
 
     @classmethod
     def poll(cls, context):
-        return False
-        #return context.lamp and CyclesButtonsPanel.poll(context)
+        return context.lamp and CyclesButtonsPanel.poll(context)
 
     def draw(self, context):
         layout = self.layout
@@ -400,8 +400,8 @@ class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel):
         elif lamp.type == 'HEMI':
             layout.label(text="Not supported, interpreted as sun lamp.")
    
-class CyclesLamp_PT_shader(CyclesButtonsPanel, Panel):
-    bl_label = "Shader"
+class CyclesLamp_PT_nodes(CyclesButtonsPanel, Panel):
+    bl_label = "Nodes"
     bl_context = "data"
 
     @classmethod
@@ -412,10 +412,10 @@ class CyclesLamp_PT_shader(CyclesButtonsPanel, Panel):
         layout = self.layout
 
         mat = context.lamp
-        panel_node_draw(layout, mat, 'OUTPUT_LAMP', 'Shader')
+        panel_node_draw(layout, mat, 'OUTPUT_LAMP', 'Surface')
 
-class CyclesWorld_PT_shader(CyclesButtonsPanel, Panel):
-    bl_label = "Shader"
+class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel):
+    bl_label = "Surface"
     bl_context = "world"
 
     @classmethod
@@ -426,10 +426,27 @@ class CyclesWorld_PT_shader(CyclesButtonsPanel, Panel):
         layout = self.layout
 
         mat = context.world
-        panel_node_draw(layout, mat, 'OUTPUT_WORLD', 'Shader')
+        panel_node_draw(layout, mat, 'OUTPUT_WORLD', 'Surface')
+
+class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel):
+    bl_label = "Volume"
+    bl_context = "world"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    @classmethod
+    def poll(cls, context):
+        world = context.world
+        return False # world and world.node_tree and CyclesButtonsPanel.poll(context)
+
+    def draw(self, context):
+        layout = self.layout
+        layout.active = False
+
+        world = context.world
+        panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Volume')
 
-class CyclesMaterial_PT_shader(CyclesButtonsPanel, Panel):
-    bl_label = "Shader"
+class CyclesMaterial_PT_surface(CyclesButtonsPanel, Panel):
+    bl_label = "Surface"
     bl_context = "material"
 
     @classmethod
@@ -440,7 +457,28 @@ class CyclesMaterial_PT_shader(CyclesButtonsPanel, Panel):
         layout = self.layout
 
         mat = context.material
-        panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Shader')
+        panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Surface')
+
+class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel):
+    bl_label = "Volume"
+    bl_context = "material"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    @classmethod
+    def poll(cls, context):
+        mat = context.material
+        return False #mat and mat.node_tree and CyclesButtonsPanel.poll(context)
+
+    def draw(self, context):
+        layout = self.layout
+        layout.active = False
+
+        mat = context.material
+        cmat = mat.cycles
+
+        panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Volume')
+
+        layout.prop(cmat, "homogeneous_volume")
 
 class CyclesMaterial_PT_displacement(CyclesButtonsPanel, Panel):
     bl_label = "Displacement"
@@ -448,7 +486,8 @@ class CyclesMaterial_PT_displacement(CyclesButtonsPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        return context.material and CyclesButtonsPanel.poll(context)
+        mat = context.material
+        return mat and mat.node_tree and CyclesButtonsPanel.poll(context)
 
     def draw(self, context):
         layout = self.layout
@@ -471,17 +510,13 @@ class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel):
         mat = context.material
         cmat = mat.cycles
 
-        layout.prop(mat, "diffuse_color", text="Viewport Color")
-
-        """
         split = layout.split()
-    
+
         col = split.column()
-        col.prop(cmat, "sample_as_light")
+        col.prop(mat, "diffuse_color", text="Viewport Color")
 
         col = split.column()
-        col.prop(cmat, "homogeneous_volume")
-        """
+        col.prop(cmat, "sample_as_light")
 
 class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
     bl_label = ""
@@ -569,23 +604,64 @@ class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel):
 
     def draw(self, context):
         layout = self.layout
-        layout.label("Texture coordinate mapping goes here.");
-        layout.label("Translate, rotate, scale, projection, XYZ.")
 
-class CyclesTexture_PT_color(CyclesButtonsPanel, Panel):
+        tex = context.texture
+        node = context.texture_node
+
+        mapping = node.texture_mapping
+
+        row = layout.row()
+
+        row.column().prop(mapping, "location")
+        row.column().prop(mapping, "rotation")
+        row.column().prop(mapping, "scale")
+
+        layout.label(text="Projection:")
+
+        row = layout.row()
+        row.prop(mapping, "mapping_x", text="")
+        row.prop(mapping, "mapping_y", text="")
+        row.prop(mapping, "mapping_z", text="")
+
+class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel):
     bl_label = "Color"
     bl_context = "texture"
+    bl_options = {'DEFAULT_CLOSED'}
 
     @classmethod
     def poll(cls, context):
         tex = context.texture
         node = context.texture_node
-        return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context)
+        return False
+        #return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context)
 
     def draw(self, context):
         layout = self.layout
-        layout.label("Color modification options go here.");
-        layout.label("Ramp, brightness, contrast, saturation.")
+
+        tex = context.texture
+        node = context.texture_node
+
+        mapping = node.color_mapping
+
+        split = layout.split()
+
+        col = split.column()
+        col.label(text="Blend:")
+        col.prop(mapping, "blend_type", text="")
+        col.prop(mapping, "blend_factor", text="Factor")
+        col.prop(mapping, "blend_color", text="")
+
+        col = split.column()
+        col.label(text="Adjust:")
+        col.prop(mapping, "brightness")
+        col.prop(mapping, "contrast")
+        col.prop(mapping, "saturation")
+
+        layout.separator()
+
+        layout.prop(mapping, "use_color_ramp", text="Ramp")
+        if mapping.use_color_ramp:
+            layout.template_color_ramp(mapping, "color_ramp", expand=True)
 
 def draw_device(self, context):
     scene = context.scene
@@ -636,6 +712,7 @@ def get_panels():
         bpy.types.DATA_PT_vertex_colors,
         bpy.types.DATA_PT_camera,
         bpy.types.DATA_PT_camera_display,
+        bpy.types.DATA_PT_lens,
         bpy.types.DATA_PT_custom_props_mesh,
         bpy.types.DATA_PT_custom_props_camera,
         bpy.types.DATA_PT_custom_props_lamp,