Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/blender/addon/ui.py')
-rw-r--r--intern/cycles/blender/addon/ui.py71
1 files changed, 52 insertions, 19 deletions
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index 7c7d4c81b89..d96efe93cf8 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -16,6 +16,8 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
+# <pep8 compliant>
+
import bpy
from bpy.types import Panel, Menu
@@ -23,6 +25,7 @@ from bpy.types import Panel, Menu
from cycles import enums
from cycles import engine
+
class CYCLES_MT_integrator_presets(Menu):
bl_label = "Integrator Presets"
preset_subdir = "cycles/integrator"
@@ -30,16 +33,18 @@ class CYCLES_MT_integrator_presets(Menu):
COMPAT_ENGINES = {'CYCLES'}
draw = Menu.draw_preset
+
class CyclesButtonsPanel():
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "render"
-
+
@classmethod
def poll(cls, context):
rd = context.scene.render
return rd.engine == 'CYCLES'
+
class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
bl_label = "Integrator"
bl_options = {'DEFAULT_CLOSED'}
@@ -49,7 +54,7 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
scene = context.scene
cscene = scene.cycles
-
+
row = layout.row(align=True)
row.menu("CYCLES_MT_integrator_presets", text=bpy.types.CYCLES_MT_integrator_presets.bl_label)
row.operator("render.cycles_integrator_preset_add", text="", icon="ZOOMIN")
@@ -87,7 +92,8 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
#row = col.row()
#row.prop(cscene, "blur_caustics")
#row.active = not cscene.no_caustics
-
+
+
class CyclesRender_PT_film(CyclesButtonsPanel, Panel):
bl_label = "Film"
@@ -99,7 +105,7 @@ class CyclesRender_PT_film(CyclesButtonsPanel, Panel):
split = layout.split()
- col = split.column();
+ col = split.column()
col.prop(cscene, "film_exposure")
col.prop(cscene, "film_transparent")
@@ -109,6 +115,7 @@ class CyclesRender_PT_film(CyclesButtonsPanel, Panel):
if cscene.filter_type != 'BOX':
sub.prop(cscene, "filter_width", text="Width")
+
class CyclesRender_PT_performance(CyclesButtonsPanel, Panel):
bl_label = "Performance"
bl_options = {'DEFAULT_CLOSED'}
@@ -142,6 +149,7 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel):
sub.prop(cscene, "debug_bvh_type", text="")
sub.prop(cscene, "debug_use_spatial_splits")
+
class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
bl_label = "Layers"
bl_options = {'DEFAULT_CLOSED'}
@@ -178,6 +186,7 @@ class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
layout.prop(rl, "material_override", text="Material")
+
class Cycles_PT_post_processing(CyclesButtonsPanel, Panel):
bl_label = "Post Processing"
bl_options = {'DEFAULT_CLOSED'}
@@ -196,6 +205,7 @@ class Cycles_PT_post_processing(CyclesButtonsPanel, Panel):
col = split.column()
col.prop(rd, "dither_intensity", text="Dither", slider=True)
+
class CyclesCamera_PT_dof(CyclesButtonsPanel, Panel):
bl_label = "Depth of Field"
bl_context = "data"
@@ -229,6 +239,7 @@ class CyclesCamera_PT_dof(CyclesButtonsPanel, Panel):
sub.prop(ccam, "aperture_blades", text="Blades")
sub.prop(ccam, "aperture_rotation", text="Rotation")
+
class Cycles_PT_context_material(CyclesButtonsPanel, Panel):
bl_label = "Surface"
bl_context = "material"
@@ -277,13 +288,14 @@ class Cycles_PT_context_material(CyclesButtonsPanel, Panel):
split.template_ID(space, "pin_id")
split.separator()
+
class Cycles_PT_mesh_displacement(CyclesButtonsPanel, Panel):
bl_label = "Displacement"
bl_context = "data"
@classmethod
def poll(cls, context):
- return context.mesh or context.curve or context.meta_ball
+ return CyclesButtonsPanel.poll(context) and context.mesh or context.curve or context.meta_ball
def draw(self, context):
layout = self.layout
@@ -300,8 +312,9 @@ class Cycles_PT_mesh_displacement(CyclesButtonsPanel, Panel):
cdata = mball.cycles
layout.prop(cdata, "displacement_method", text="Method")
- layout.prop(cdata, "use_subdivision");
- layout.prop(cdata, "dicing_rate");
+ layout.prop(cdata, "use_subdivision")
+ layout.prop(cdata, "dicing_rate")
+
class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
bl_label = "Ray Visibility"
@@ -311,7 +324,7 @@ class CyclesObject_PT_ray_visibility(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') # 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
@@ -330,6 +343,7 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
col.prop(visibility, "transmission")
col.prop(visibility, "shadow")
+
def find_node(material, nodetype):
if material and material.node_tree:
ntree = material.node_tree
@@ -337,16 +351,18 @@ def find_node(material, nodetype):
for node in ntree.nodes:
if hasattr(node, 'type') and node.type == nodetype:
return node
-
+
return None
+
def find_node_input(node, name):
for input in node.inputs:
if input.name == name:
return input
-
+
return None
+
def panel_node_draw(layout, id, output_type, input_name):
if not id.node_tree:
layout.prop(id, "use_nodes", icon='NODETREE')
@@ -359,10 +375,11 @@ def panel_node_draw(layout, id, output_type, input_name):
layout.label(text="No output node.")
else:
input = find_node_input(node, input_name)
- layout.template_node_view(ntree, node, input);
-
+ layout.template_node_view(ntree, node, input)
+
return True
+
class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel):
bl_label = "Lamp"
bl_context = "data"
@@ -401,7 +418,8 @@ class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel):
layout.label(text="Not supported, interpreted as point lamp.")
elif lamp.type == 'HEMI':
layout.label(text="Not supported, interpreted as sun lamp.")
-
+
+
class CyclesLamp_PT_nodes(CyclesButtonsPanel, Panel):
bl_label = "Nodes"
bl_context = "data"
@@ -417,6 +435,7 @@ class CyclesLamp_PT_nodes(CyclesButtonsPanel, Panel):
if not panel_node_draw(layout, lamp, 'OUTPUT_LAMP', 'Surface'):
layout.prop(lamp, "color")
+
class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel):
bl_label = "Surface"
bl_context = "world"
@@ -432,6 +451,7 @@ class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel):
if not panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Surface'):
layout.prop(world, "horizon_color", text="Color")
+
class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel):
bl_label = "Volume"
bl_context = "world"
@@ -440,7 +460,7 @@ class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
world = context.world
- return False # world and world.node_tree and CyclesButtonsPanel.poll(context)
+ return False # world and world.node_tree and CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
@@ -449,6 +469,7 @@ class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel):
world = context.world
panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Volume')
+
class CyclesMaterial_PT_surface(CyclesButtonsPanel, Panel):
bl_label = "Surface"
bl_context = "material"
@@ -464,6 +485,7 @@ class CyclesMaterial_PT_surface(CyclesButtonsPanel, Panel):
if not panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Surface'):
layout.prop(mat, "diffuse_color")
+
class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel):
bl_label = "Volume"
bl_context = "material"
@@ -472,7 +494,7 @@ class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
mat = context.material
- return False #mat and mat.node_tree and CyclesButtonsPanel.poll(context)
+ return False # mat and mat.node_tree and CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
@@ -485,6 +507,7 @@ class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel):
layout.prop(cmat, "homogeneous_volume")
+
class CyclesMaterial_PT_displacement(CyclesButtonsPanel, Panel):
bl_label = "Displacement"
bl_context = "material"
@@ -500,6 +523,7 @@ class CyclesMaterial_PT_displacement(CyclesButtonsPanel, Panel):
mat = context.material
panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Displacement')
+
class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel):
bl_label = "Settings"
bl_context = "material"
@@ -523,6 +547,7 @@ class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel):
col = split.column()
col.prop(cmat, "sample_as_light")
+
class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
bl_label = ""
bl_context = "texture"
@@ -535,7 +560,7 @@ class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
tex = context.texture
space = context.space_data
pin_id = space.pin_id
- use_pin_id = space.use_pin_id;
+ use_pin_id = space.use_pin_id
user = context.texture_user
node = context.texture_node
@@ -555,7 +580,7 @@ class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
col.template_ID(space, "pin_id")
elif user:
col.template_ID(user, "texture", new="texture.new")
-
+
if tex:
row = split.row()
row.prop(tex, "use_nodes", icon="NODETREE", text="")
@@ -566,6 +591,7 @@ class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
split.label(text="Type:")
split.prop(tex, "type", text="")
+
class CyclesTexture_PT_nodes(CyclesButtonsPanel, Panel):
bl_label = "Nodes"
bl_context = "texture"
@@ -581,6 +607,7 @@ class CyclesTexture_PT_nodes(CyclesButtonsPanel, Panel):
tex = context.texture
panel_node_draw(layout, tex, 'OUTPUT_TEXTURE', 'Color')
+
class CyclesTexture_PT_node(CyclesButtonsPanel, Panel):
bl_label = "Node"
bl_context = "texture"
@@ -597,6 +624,7 @@ class CyclesTexture_PT_node(CyclesButtonsPanel, Panel):
ntree = node.id_data
layout.template_node_view(ntree, node, None)
+
class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel):
bl_label = "Mapping"
bl_context = "texture"
@@ -628,6 +656,7 @@ class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel):
row.prop(mapping, "mapping_y", text="")
row.prop(mapping, "mapping_z", text="")
+
class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel):
bl_label = "Color"
bl_context = "texture"
@@ -668,6 +697,7 @@ class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel):
if mapping.use_color_ramp:
layout.template_color_ramp(mapping, "color_ramp", expand=True)
+
def draw_device(self, context):
scene = context.scene
layout = self.layout
@@ -686,6 +716,7 @@ def draw_device(self, context):
if cscene.device == 'CPU' and engine.with_osl():
layout.prop(cscene, "shading_system")
+
def draw_pause(self, context):
layout = self.layout
scene = context.scene
@@ -697,6 +728,7 @@ def draw_pause(self, context):
cscene = scene.cycles
layout.prop(cscene, "preview_pause", icon="PAUSE", text="")
+
def get_panels():
return [
bpy.types.RENDER_PT_render,
@@ -752,17 +784,18 @@ def get_panels():
bpy.types.PARTICLE_PT_vertexgroups,
bpy.types.PARTICLE_PT_custom_props]
+
def register():
bpy.types.RENDER_PT_render.append(draw_device)
bpy.types.VIEW3D_HT_header.append(draw_pause)
for panel in get_panels():
panel.COMPAT_ENGINES.add('CYCLES')
-
+
+
def unregister():
bpy.types.RENDER_PT_render.remove(draw_device)
bpy.types.VIEW3D_HT_header.remove(draw_pause)
for panel in get_panels():
panel.COMPAT_ENGINES.remove('CYCLES')
-