diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-06-10 19:38:23 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-06-10 19:38:23 +0300 |
commit | 080cf9332bc9d71e0e14326bc8efdf06b738dea1 (patch) | |
tree | e8531a509dca4d8253aa19d89edc68152421f9e5 /intern/cycles/blender/addon/ui.py | |
parent | 6d495cc4ef071171ff0686b2be898a41e05b8051 (diff) | |
parent | 9676642cc94599b3419c9aaa5cf1aae2fbbd235f (diff) |
Merge branch 'gooseberry' into temp_motionpathstemp_motionpaths
Conflicts:
source/blender/blenkernel/intern/object.c
Diffstat (limited to 'intern/cycles/blender/addon/ui.py')
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 172 |
1 files changed, 146 insertions, 26 deletions
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 8e032bafd2e..fb6a3d76dec 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): @@ -303,6 +322,11 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel): subsub.enabled = not rd.use_border subsub.prop(rd, "use_save_buffers") + sub.prop(cscene, "use_camera_cull") + subsub = col.column() + subsub.active = cscene.use_camera_cull + subsub.prop(cscene, "camera_cull_margin") + col = split.column(align=True) col.label(text="Viewport:") @@ -320,6 +344,7 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel): col.label(text="Acceleration structure:") col.prop(cscene, "debug_use_spatial_splits") + col.prop(cscene, "debug_use_triangle_storage") class CyclesRender_PT_layer_options(CyclesButtonsPanel, Panel): @@ -413,6 +438,48 @@ class CyclesRender_PT_layer_passes(CyclesButtonsPanel, Panel): col.prop(rl, "use_pass_environment") +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" bl_options = {'DEFAULT_CLOSED'} @@ -456,7 +523,16 @@ 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") + + 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() @@ -490,11 +566,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="") @@ -502,6 +583,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") @@ -597,8 +684,8 @@ class CyclesObject_PT_motion_blur(CyclesButtonsPanel, Panel): sub.prop(cob, "motion_steps", text="Steps") -class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel): - bl_label = "Ray Visibility" +class CyclesObject_PT_cycles_settings(CyclesButtonsPanel, Panel): + bl_label = "Cycles Settings" bl_context = "object" bl_options = {'DEFAULT_CLOSED'} @@ -613,8 +700,10 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel): layout = self.layout ob = context.object + cob = ob.cycles visibility = ob.cycles_visibility + layout.label(text="Ray Visibility:") flow = layout.column_flow() flow.prop(visibility, "camera") @@ -626,6 +715,9 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel): if ob.type != 'LAMP': flow.prop(visibility, "shadow") + layout.label(text="Performance:") + layout.prop(cob, "use_camera_cull") + class CYCLES_OT_use_shading_nodes(Operator): """Enable nodes on a material, world or lamp""" @@ -652,9 +744,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 @@ -691,7 +788,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) @@ -729,13 +829,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") @@ -747,7 +855,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 @@ -930,7 +1040,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() @@ -1032,7 +1142,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() @@ -1117,7 +1227,8 @@ class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): node = context.texture_node - return node and CyclesButtonsPanel.poll(context) + # TODO(sergey): perform a faster/nicer check? + return node and hasattr(node, 'texture_mapping') and CyclesButtonsPanel.poll(context) def draw(self, context): layout = self.layout @@ -1341,13 +1452,21 @@ class CyclesScene_PT_simplify(CyclesButtonsPanel, Panel): def draw(self, context): layout = self.layout - rd = context.scene.render + scene = context.scene + rd = 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): @@ -1420,6 +1539,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", |