diff options
Diffstat (limited to 'intern/cycles/blender/addon/ui.py')
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 171 |
1 files changed, 142 insertions, 29 deletions
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 1097b79ffa5..f6ff86ac30e 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -18,7 +18,11 @@ import bpy -from bpy.types import Panel, Menu, Operator +from bpy.types import ( + Panel, + Menu, + Operator, + ) class CYCLES_MT_sampling_presets(Menu): @@ -56,7 +60,15 @@ def use_cpu(context): return (device_type == 'NONE' or cscene.device == 'CPU') -def draw_samples_info(layout, cscene): +def use_branched_path(context): + cscene = context.scene.cycles + device_type = context.user_preferences.system.compute_device_type + + return (cscene.progressive == 'BRANCHED_PATH' and device_type != 'OPENCL') + + +def draw_samples_info(layout, context): + cscene = context.scene.cycles integrator = cscene.progressive # Calculate sample values @@ -86,7 +98,7 @@ def draw_samples_info(layout, cscene): # Draw interface # Do not draw for progressive, when Square Samples are disabled - if (integrator == 'BRANCHED_PATH') or (cscene.use_square_samples and integrator == 'PATH'): + if use_branched_path(context) or (cscene.use_square_samples and integrator == 'PATH'): col = layout.column(align=True) col.scale_y = 0.6 col.label("Total Samples:") @@ -110,6 +122,7 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel): scene = context.scene cscene = scene.cycles + device_type = context.user_preferences.system.compute_device_type row = layout.row(align=True) row.menu("CYCLES_MT_sampling_presets", text=bpy.types.CYCLES_MT_sampling_presets.bl_label) @@ -117,7 +130,9 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel): row.operator("render.cycles_sampling_preset_add", text="", icon="ZOOMOUT").remove_active = True row = layout.row() - row.prop(cscene, "progressive", text="") + sub = row.row() + sub.active = device_type != 'OPENCL' + sub.prop(cscene, "progressive", text="") row.prop(cscene, "use_square_samples") split = layout.split() @@ -125,11 +140,15 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel): col = split.column() sub = col.column(align=True) sub.label("Settings:") - sub.prop(cscene, "seed") + + seed_sub = sub.row(align=True) + seed_sub.prop(cscene, "seed") + seed_sub.prop(cscene, "use_animated_seed", text="", icon="TIME") + sub.prop(cscene, "sample_clamp_direct") sub.prop(cscene, "sample_clamp_indirect") - if cscene.progressive == 'PATH': + if cscene.progressive == 'PATH' or use_branched_path(context) == False: col = split.column() sub = col.column(align=True) sub.label(text="Samples:") @@ -163,7 +182,7 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel): layout.row().prop(cscene, "use_layer_samples") break - draw_samples_info(layout, cscene) + draw_samples_info(layout, context) class CyclesRender_PT_volume_sampling(CyclesButtonsPanel, Panel): @@ -412,6 +431,51 @@ class CyclesRender_PT_layer_passes(CyclesButtonsPanel, Panel): col.prop(rl, "use_pass_emit", text="Emission") col.prop(rl, "use_pass_environment") + if hasattr(rd, "debug_pass_type"): + layout.prop(rd, "debug_pass_type") + + +class CyclesRender_PT_views(CyclesButtonsPanel, Panel): + bl_label = "Views" + bl_context = "render_layer" + + def draw_header(self, context): + rd = context.scene.render + self.layout.prop(rd, "use_multiview", text="") + + def draw(self, context): + layout = self.layout + + scene = context.scene + rd = scene.render + rv = rd.views.active + + layout.active = rd.use_multiview + basic_stereo = (rd.views_format == 'STEREO_3D') + + row = layout.row() + row.prop(rd, "views_format", expand=True) + + if basic_stereo: + row = layout.row() + row.template_list("RENDERLAYER_UL_renderviews", "name", rd, "stereo_views", rd.views, "active_index", rows=2) + + row = layout.row() + row.label(text="File Suffix:") + row.prop(rv, "file_suffix", text="") + + else: + row = layout.row() + row.template_list("RENDERLAYER_UL_renderviews", "name", rd, "views", rd.views, "active_index", rows=2) + + col = row.column(align=True) + col.operator("scene.render_view_add", icon='ZOOMIN', text="") + col.operator("scene.render_view_remove", icon='ZOOMOUT', text="") + + row = layout.row() + row.label(text="Camera Suffix:") + row.prop(rv, "camera_suffix", text="") + class Cycles_PT_post_processing(CyclesButtonsPanel, Panel): bl_label = "Post Processing" @@ -456,11 +520,17 @@ class CyclesCamera_PT_dof(CyclesButtonsPanel, Panel): sub = col.row() sub.active = cam.dof_object is None sub.prop(cam, "dof_distance", text="Distance") - col.prop(dof_options, "fstop") - col.prop(dof_options, "use_high_quality") - if dof_options.use_high_quality: - col.prop(dof_options, "blades") - + + hq_support = dof_options.is_hq_supported + sub = col.column(align=True) + sub.label("Viewport:") + subhq = sub.column() + subhq.active = hq_support + subhq.prop(dof_options, "use_high_quality") + sub.prop(dof_options, "fstop") + if dof_options.use_high_quality and hq_support: + sub.prop(dof_options, "blades") + col = split.column() col.label("Aperture:") @@ -493,11 +563,16 @@ class Cycles_PT_context_material(CyclesButtonsPanel, Panel): ob = context.object slot = context.material_slot space = context.space_data + is_sortable = len(ob.material_slots) > 1 if ob: + rows = 1 + if (is_sortable): + rows = 4 + row = layout.row() - row.template_list("MATERIAL_UL_matslots", "", ob, "material_slots", ob, "active_material_index", rows=1) + row.template_list("MATERIAL_UL_matslots", "", ob, "material_slots", ob, "active_material_index", rows=rows) col = row.column(align=True) col.operator("object.material_slot_add", icon='ZOOMIN', text="") @@ -505,6 +580,12 @@ class Cycles_PT_context_material(CyclesButtonsPanel, Panel): col.menu("MATERIAL_MT_specials", icon='DOWNARROW_HLT', text="") + if is_sortable: + col.separator() + + col.operator("object.material_slot_move", icon='TRIA_UP', text="").direction = 'UP' + col.operator("object.material_slot_move", icon='TRIA_DOWN', text="").direction = 'DOWN' + if ob.mode == 'EDIT': row = layout.row(align=True) row.operator("object.material_slot_assign", text="Assign") @@ -566,7 +647,13 @@ class CyclesObject_PT_motion_blur(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): ob = context.object - return CyclesButtonsPanel.poll(context) and ob and ob.type in {'MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META'} + if CyclesButtonsPanel.poll(context) and ob: + if ob.type in {'MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META'}: + return True + if ob.dupli_type == 'GROUP' and ob.dupli_group: + return True + # TODO(sergey): More duplicator types here? + return False def draw_header(self, context): layout = self.layout @@ -609,8 +696,8 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel): def poll(cls, context): ob = context.object return (CyclesButtonsPanel.poll(context) and - ob and ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LAMP'} or - ob and ob.dupli_type == 'GROUP' and ob.dupli_group) + ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LAMP'}) or + (ob.dupli_type == 'GROUP' and ob.dupli_group))) def draw(self, context): layout = self.layout @@ -655,9 +742,14 @@ def find_node(material, nodetype): if material and material.node_tree: ntree = material.node_tree + active_output_node = None for node in ntree.nodes: if getattr(node, "type", None) == nodetype: - return node + if getattr(node, "is_active_output", True): + return node + if not active_output_node: + active_output_node = node + return active_output_node return None @@ -694,7 +786,10 @@ class CyclesLamp_PT_preview(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): - return context.lamp and CyclesButtonsPanel.poll(context) + return context.lamp and \ + not (context.lamp.type == 'AREA' and + context.lamp.cycles.is_portal) \ + and CyclesButtonsPanel.poll(context) def draw(self, context): self.layout.template_preview(context.lamp) @@ -732,13 +827,21 @@ class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel): sub.prop(lamp, "size", text="Size X") sub.prop(lamp, "size_y", text="Size Y") - if cscene.progressive == 'BRANCHED_PATH': - col.prop(clamp, "samples") - col.prop(clamp, "max_bounces") + if not (lamp.type == 'AREA' and clamp.is_portal): + sub = col.column(align=True) + if use_branched_path(context): + sub.prop(clamp, "samples") + sub.prop(clamp, "max_bounces") col = split.column() - col.prop(clamp, "cast_shadow") - col.prop(clamp, "use_multiple_importance_sampling", text="Multiple Importance") + + sub = col.column(align=True) + sub.active = not (lamp.type == 'AREA' and clamp.is_portal) + sub.prop(clamp, "cast_shadow") + sub.prop(clamp, "use_multiple_importance_sampling", text="Multiple Importance") + + if lamp.type == 'AREA': + col.prop(clamp, "is_portal", text="Portal") if lamp.type == 'HEMI': layout.label(text="Not supported, interpreted as sun lamp") @@ -750,7 +853,9 @@ class CyclesLamp_PT_nodes(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): - return context.lamp and CyclesButtonsPanel.poll(context) + return context.lamp and not (context.lamp.type == 'AREA' and + context.lamp.cycles.is_portal) and \ + CyclesButtonsPanel.poll(context) def draw(self, context): layout = self.layout @@ -933,7 +1038,7 @@ class CyclesWorld_PT_settings(CyclesButtonsPanel, Panel): sub = col.column(align=True) sub.active = cworld.sample_as_light sub.prop(cworld, "sample_map_resolution") - if cscene.progressive == 'BRANCHED_PATH': + if use_branched_path(context): sub.prop(cworld, "samples") col = split.column() @@ -1035,7 +1140,7 @@ class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel): sub = col.column() sub.active = use_cpu(context) sub.prop(cmat, "volume_sampling", text="") - col.prop(cmat, "volume_interpolation", text="") + sub.prop(cmat, "volume_interpolation", text="") col.prop(cmat, "homogeneous_volume", text="Homogeneous") layout.separator() @@ -1347,10 +1452,17 @@ class CyclesScene_PT_simplify(CyclesButtonsPanel, Panel): rd = context.scene.render layout.active = rd.use_simplify + split = layout.split() - row = layout.row() - row.prop(rd, "simplify_subdivision", text="Subdivision") - row.prop(rd, "simplify_child_particles", text="Child Particles") + col = split.column() + col.label(text="Viewport:") + col.prop(rd, "simplify_subdivision", text="Subdivision") + col.prop(rd, "simplify_child_particles", text="Child Particles") + + col = split.column() + col.label(text="Render:") + col.prop(rd, "simplify_subdivision_render", text="Subdivision") + col.prop(rd, "simplify_child_particles_render", text="Child Particles") def draw_device(self, context): @@ -1422,6 +1534,7 @@ def get_panels(): "DATA_PT_vertex_colors", "DATA_PT_camera", "DATA_PT_camera_display", + "DATA_PT_camera_stereoscopy", "DATA_PT_camera_safe_areas", "DATA_PT_lens", "DATA_PT_speaker", |