used py error checking tools to fix some bugs & make pep8 corrections

This commit is contained in:
2009-11-14 13:35:44 +00:00
parent aac16ce4ec
commit d33291fcc4
28 changed files with 228 additions and 249 deletions

View File

@@ -21,6 +21,7 @@ import bpy
narrowui = 180
class DataButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@@ -60,9 +61,7 @@ class DATA_PT_skeleton(DataButtonsPanel):
def draw(self, context):
layout = self.layout
ob = context.object
arm = context.armature
space = context.space_data
col2 = context.region.width > narrowui
layout.itemR(arm, "pose_position", expand=True)

View File

@@ -21,6 +21,7 @@ import bpy
narrowui = 180
class BoneButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@@ -201,7 +202,6 @@ class BONE_PT_display(BoneButtonsPanel):
ob = context.object
bone = context.bone
arm = context.armature
col2 = context.region.width > narrowui
if not bone:

View File

@@ -21,6 +21,7 @@ import bpy
narrowui = 180
class DataButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@@ -82,7 +83,7 @@ class DATA_PT_camera(DataButtonsPanel):
col.itemR(cam, "lens_unit", text="")
elif cam.type == 'ORTHO':
row.itemR(cam, "ortho_scale")
col.itemR(cam, "ortho_scale")
layout.itemR(cam, "panorama")

View File

@@ -21,6 +21,7 @@ import bpy
narrowui = 180
class DataButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@@ -70,6 +71,7 @@ class DATA_PT_context_curve(DataButtonsPanel):
else:
layout.template_ID(ob, "data")
class DATA_PT_shape_curve(DataButtonsPanel):
bl_label = "Shape"
@@ -78,7 +80,6 @@ class DATA_PT_shape_curve(DataButtonsPanel):
ob = context.object
curve = context.curve
space = context.space_data
col2 = context.region.width > narrowui
is_surf = (ob.type == 'SURFACE')

View File

@@ -21,6 +21,7 @@ import bpy
narrowui = 180
class DataButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'

View File

@@ -21,6 +21,7 @@ import bpy
narrowui = 180
class DataButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'

View File

@@ -21,6 +21,7 @@ import bpy
narrowui = 180
class DataButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'

View File

@@ -56,9 +56,7 @@ class DATA_PT_shape_text(DataButtonsPanel):
def draw(self, context):
layout = self.layout
ob = context.object
curve = context.curve
space = context.space_data
split = layout.split()

View File

@@ -21,6 +21,7 @@ import bpy
narrowui = 180
def active_node_mat(mat):
# TODO, 2.4x has a pipeline section, for 2.5 we need to communicate
# which settings from node-materials are used

View File

@@ -21,6 +21,7 @@ import bpy
narrowui = 180
class ObjectButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@@ -89,7 +90,7 @@ class OBJECT_PT_transform_locks(ObjectButtonsPanel):
layout = self.layout
ob = context.object
col2 = context.region.width > narrowui
# col2 = context.region.width > narrowui
row = layout.row()

View File

@@ -208,7 +208,7 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel):
layout = self.layout
psys = context.particle_system
part = psys.settings
#part = psys.settings
cloth = psys.cloth.settings
layout.enabled = psys.hair_dynamics
@@ -250,7 +250,6 @@ class PARTICLE_PT_cache(ParticleButtonsPanel):
return psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.hair_dynamics)
def draw(self, context):
layout = self.layout
psys = context.particle_system
@@ -932,7 +931,7 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel):
ob = context.object
psys = context.particle_system
part = psys.settings
# part = psys.settings
# layout.itemL(text="Nothing here yet.")

View File

@@ -17,7 +17,6 @@
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import bpy
def point_cache_ui(self, cache, enabled, particles, smoke):

View File

@@ -38,7 +38,6 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
layout = self.layout
md = context.fluid
ob = context.object
split = layout.split()
split.operator_context = 'EXEC_DEFAULT'

View File

@@ -143,8 +143,6 @@ class PHYSICS_PT_smoke_cache(PhysicButtonsPanel):
return md and (md.smoke_type == 'TYPE_DOMAIN')
def draw(self, context):
layout = self.layout
md = context.smoke.domain_settings
cache = md.point_cache_low
@@ -191,8 +189,6 @@ class PHYSICS_PT_smoke_cache_highres(PhysicButtonsPanel):
return md and (md.smoke_type == 'TYPE_DOMAIN') and md.domain_settings.highres
def draw(self, context):
layout = self.layout
md = context.smoke.domain_settings
cache = md.point_cache_high

View File

@@ -204,7 +204,6 @@ class PHYSICS_PT_softbody_collision(PhysicButtonsPanel):
md = context.soft_body
softbody = md.settings
ob = context.object
layout.active = softbody.self_collision and softbody_panel_enabled(md)
@@ -230,7 +229,6 @@ class PHYSICS_PT_softbody_solver(PhysicButtonsPanel):
md = context.soft_body
softbody = md.settings
ob = context.object
layout.active = softbody_panel_enabled(md)

View File

@@ -21,20 +21,18 @@ import bpy
narrowui = 180
class RenderButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "render"
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
def poll(self, context):
rd = context.scene.render_data
return (context.scene and rd.use_game_engine == False) and (rd.engine in self.COMPAT_ENGINES)
class RENDER_PT_render(RenderButtonsPanel):
bl_label = "Render"
COMPAT_ENGINES = set(['BLENDER_RENDER'])

View File

@@ -21,6 +21,7 @@ import bpy
narrowui = 180
class SceneButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'

View File

@@ -21,6 +21,7 @@ import bpy
narrowui = 180
def active_node_mat(mat):
if mat:
mat_node = mat.active_node_material
@@ -33,7 +34,6 @@ def active_node_mat(mat):
def context_tex_datablock(context):
idblock = active_node_mat(context.material)
if idblock:
return idblock
@@ -103,8 +103,6 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
col.item_enumO("texture.slot_move", "type", 'DOWN', text="", icon='ICON_TRIA_DOWN')
if col2:
split = layout.split(percentage=0.65)
if idblock:
@@ -190,7 +188,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel):
idblock = context_tex_datablock(context)
tex = context.texture_slot
textype = context.texture
# textype = context.texture
col2 = context.region.width > narrowui
if type(idblock) != bpy.types.Brush:
@@ -278,7 +276,7 @@ class TEXTURE_PT_influence(TextureSlotPanel):
idblock = context_tex_datablock(context)
textype = context.texture
# textype = context.texture
tex = context.texture_slot
col2 = context.region.width > narrowui
@@ -574,7 +572,7 @@ class TEXTURE_PT_image_sampling(TextureTypePanel):
layout = self.layout
tex = context.texture
slot = context.texture_slot
# slot = context.texture_slot
col2 = context.region.width > narrowui
split = layout.split()
@@ -679,7 +677,7 @@ class TEXTURE_PT_plugin(TextureTypePanel):
def draw(self, context):
layout = self.layout
tex = context.texture
# tex = context.texture
layout.itemL(text="Nothing yet")
@@ -691,7 +689,7 @@ class TEXTURE_PT_envmap(TextureTypePanel):
def draw(self, context):
layout = self.layout
tex = context.texture
# tex = context.texture
layout.itemL(text="Nothing yet")

View File

@@ -21,6 +21,7 @@ import bpy
narrowui = 180
class WorldButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@@ -67,6 +68,7 @@ class WORLD_PT_context_world(WorldButtonsPanel):
else:
layout.template_ID(scene, "world", new="world.new")
class WORLD_PT_world(WorldButtonsPanel):
bl_label = "World"
COMPAT_ENGINES = set(['BLENDER_RENDER'])

View File

@@ -17,7 +17,6 @@
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import sys
import bpy
from bpy.props import *
@@ -83,6 +82,7 @@ class CONSOLE_MT_report(bpy.types.Menu):
layout.itemO("console.report_delete")
layout.itemO("console.report_copy")
class CONSOLE_MT_language(bpy.types.Menu):
bl_label = "Languages..."
@@ -102,6 +102,7 @@ class CONSOLE_MT_language(bpy.types.Menu):
for language in languages:
layout.item_stringO("console.language", "language", language, text=language[0].upper() + language[1:])
def add_scrollback(text, text_type):
for l in text.split('\n'):
bpy.ops.console.scrollback_append(text=l.replace('\t', ' '),
@@ -170,11 +171,10 @@ class ConsoleBanner(bpy.types.Operator):
return ('FINISHED',)
class ConsoleLanguage(bpy.types.Operator):
'''Set the current language for this console'''
bl_idname = "console.language"
language = StringProperty(name="Language", maxlen= 32, default= "")
language = StringProperty(name="Language", maxlen=32, default="")
def execute(self, context):
sc = context.space_data

View File

@@ -27,7 +27,7 @@ class IMAGE_MT_view(bpy.types.Menu):
layout = self.layout
sima = context.space_data
uv = sima.uv_editor
# uv = sima.uv_editor
settings = context.tool_settings
show_uvedit = sima.show_uvedit
@@ -227,8 +227,8 @@ class IMAGE_HT_header(bpy.types.Header):
iuser = sima.image_user
settings = context.tool_settings
show_render = sima.show_render
show_paint = sima.show_paint
# show_render = sima.show_render
# show_paint = sima.show_paint
show_uvedit = sima.show_uvedit
row = layout.row(align=True)
@@ -264,17 +264,14 @@ class IMAGE_HT_header(bpy.types.Header):
else:
layout.itemR(settings, "uv_selection_mode", text="", expand=True)
layout.itemR(uvedit, "sticky_selection_mode", text="", icon_only=True)
pass
row = layout.row(align=True)
row.itemR(settings, "snap", text="")
if settings.snap:
row.itemR(settings, "snap_mode", text="")
"""
mesh = context.edit_object.data
row.item_pointerR(mesh, "active_uv_layer", mesh, "uv_textures")
"""
# mesh = context.edit_object.data
# row.item_pointerR(mesh, "active_uv_layer", mesh, "uv_textures")
if ima:
# layers
@@ -310,7 +307,7 @@ class IMAGE_PT_image_properties(bpy.types.Panel):
layout = self.layout
sima = context.space_data
ima = sima.image
# ima = sima.image
iuser = sima.image_user
layout.template_image(sima, "image", iuser, compact=True)

View File

@@ -29,7 +29,6 @@ class INFO_HT_header(bpy.types.Header):
def draw(self, context):
layout = self.layout
st = context.space_data
scene = context.scene
rd = scene.render_data
@@ -237,7 +236,7 @@ class INFO_MT_render(bpy.types.Menu):
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
# rd = context.scene.render_data
layout.itemO("screen.render", text="Render Image", icon='ICON_RENDER_STILL')
layout.item_booleanO("screen.render", "animation", True, text="Render Animation", icon='ICON_RENDER_ANIMATION')
@@ -377,3 +376,4 @@ bpy.ops.add(HELP_OT_developer_community)
bpy.ops.add(HELP_OT_user_community)
bpy.ops.add(HELP_OT_report_bug)
bpy.ops.add(HELP_OT_operator_cheat_sheet)

View File

@@ -43,27 +43,27 @@ class NODE_HT_header(bpy.types.Header):
if snode.tree_type == 'MATERIAL':
ob = snode.id_from
id = snode.id
snode_id = snode.id
if ob:
layout.template_ID(ob, "active_material", new="material.new")
if id:
layout.itemR(id, "use_nodes")
if snode_id:
layout.itemR(snode_id, "use_nodes")
elif snode.tree_type == 'TEXTURE':
row.itemR(snode, "texture_type", text="", expand=True)
id = snode.id
snode_id = snode.id
id_from = snode.id_from
if id_from:
layout.template_ID(id_from, "active_texture", new="texture.new")
if id:
layout.itemR(id, "use_nodes")
if snode_id:
layout.itemR(snode_id, "use_nodes")
elif snode.tree_type == 'COMPOSITING':
id = snode.id
snode_id = snode.id
layout.itemR(id, "use_nodes")
layout.itemR(id.render_data, "free_unused_nodes", text="Free Unused")
layout.itemR(snode_id, "use_nodes")
layout.itemR(snode_id.render_data, "free_unused_nodes", text="Free Unused")
layout.itemR(snode, "backdrop")

View File

@@ -133,8 +133,6 @@ class SEQUENCER_MT_select(bpy.types.Menu):
def draw(self, context):
layout = self.layout
st = context.space_data
layout.column()
layout.item_enumO("sequencer.select_active_side", "side", 'LEFT', text="Strips to the Left")
layout.item_enumO("sequencer.select_active_side", "side", 'RIGHT', text="Strips to the Right")
@@ -154,8 +152,6 @@ class SEQUENCER_MT_marker(bpy.types.Menu):
def draw(self, context):
layout = self.layout
st = context.space_data
layout.column()
layout.itemO("marker.add", text="Add Marker")
layout.itemO("marker.duplicate", text="Duplicate Marker")
@@ -174,8 +170,6 @@ class SEQUENCER_MT_add(bpy.types.Menu):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
st = context.space_data
layout.column()
layout.itemO("sequencer.scene_strip_add", text="Scene")
layout.itemO("sequencer.movie_strip_add", text="Movie")
@@ -191,7 +185,6 @@ class SEQUENCER_MT_add_effect(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
st = context.space_data
layout.column()
layout.item_enumO("sequencer.effect_strip_add", 'type', 'ADD')
@@ -215,8 +208,6 @@ class SEQUENCER_MT_strip(bpy.types.Menu):
def draw(self, context):
layout = self.layout
st = context.space_data
layout.operator_context = 'INVOKE_REGION_WIN'
layout.column()

View File

@@ -26,7 +26,6 @@ class TIME_HT_header(bpy.types.Header):
def draw(self, context):
layout = self.layout
st = context.space_data
scene = context.scene
tools = context.tool_settings
screen = context.screen
@@ -103,7 +102,7 @@ class TIME_MT_frame(bpy.types.Menu):
def draw(self, context):
layout = self.layout
tools = context.tool_settings
# tools = context.tool_settings
layout.itemO("marker.add", text="Add Marker")
layout.itemO("marker.duplicate", text="Duplicate Marker")

View File

@@ -41,7 +41,7 @@ class USERPREF_MT_view(bpy.types.Menu):
bl_label = "View"
def draw(self, context):
layout = self.layout
pass # layout = self.layout
class USERPREF_PT_tabs(bpy.types.Panel):
@@ -757,24 +757,24 @@ class USERPREF_PT_theme(bpy.types.Panel):
col.itemR(graph, "handle_vertex_size")
elif theme.active_theme == 'FILE_BROWSER':
file = theme.file_browser
file_browse = theme.file_browser
col = split.column()
col.itemR(file, "back")
col.itemR(file, "text")
col.itemR(file, "text_hi")
col.itemR(file_browse, "back")
col.itemR(file_browse, "text")
col.itemR(file_browse, "text_hi")
col = split.column()
col.itemR(file, "header")
col.itemR(file, "list")
col.itemR(file_browse, "header")
col.itemR(file_browse, "list")
col = split.column()
col.itemR(file, "selected_file")
col.itemR(file, "tiles")
col.itemR(file_browse, "selected_file")
col.itemR(file_browse, "tiles")
col = split.column()
col.itemR(file, "active_file")
col.itemR(file, "active_file_text")
col.itemR(file_browse, "active_file")
col.itemR(file_browse, "active_file_text")
elif theme.active_theme == 'NLA_EDITOR':
nla = theme.nla_editor
@@ -1065,7 +1065,7 @@ class USERPREF_PT_file(bpy.types.Panel):
col = split.column()
sub = col.split(percentage=0.2)
sub1 = sub.column()
sub.column() # sub1, unused
sub2 = sub.column()
sub2.itemL(text="Save & Load:")
sub2.itemR(paths, "use_relative_paths")
@@ -1101,7 +1101,7 @@ class USERPREF_PT_input(bpy.types.Panel):
userpref = context.user_preferences
wm = context.manager
#input = userpref.input
input = userpref
#input = userpref
inputs = userpref.inputs
split = layout.split(percentage=0.25)
@@ -1159,7 +1159,7 @@ class USERPREF_PT_input(bpy.types.Panel):
# Keymap Settings
col = split.column()
kc = wm.active_keyconfig
# kc = wm.active_keyconfig
defkc = wm.default_keyconfig
km = wm.active_keymap
@@ -1398,7 +1398,7 @@ class WM_OT_keyitem_add(bpy.types.Operator):
def execute(self, context):
wm = context.manager
km = wm.active_keymap
kmi = km.add_item("", 'A', 'PRESS')
km.add_item("", 'A', 'PRESS') # kmi
return ('FINISHED',)

View File

@@ -27,7 +27,7 @@ class VIEW3D_HT_header(bpy.types.Header):
def draw(self, context):
layout = self.layout
view = context.space_data
# view = context.space_data
mode_string = context.mode
edit_object = context.edit_object
object = context.active_object
@@ -48,8 +48,6 @@ class VIEW3D_HT_header(bpy.types.Header):
if edit_object:
sub.itemM("VIEW3D_MT_edit_%s" % edit_object.type.lower())
elif object:
ob_mode_string = object.mode
if mode_string not in ['PAINT_WEIGHT', 'PAINT_TEXTURE']:
sub.itemM("VIEW3D_MT_%s" % mode_string.lower())
else:
@@ -90,6 +88,7 @@ class VIEW3D_MT_snap(bpy.types.Menu):
layout.itemO("view3d.snap_cursor_to_grid", text="Cursor to Grid")
layout.itemO("view3d.snap_cursor_to_active", text="Cursor to Active")
class VIEW3D_MT_uv_map(dynamic_menu.DynMenu):
bl_label = "UV Mapping"
@@ -665,8 +664,6 @@ class VIEW3D_MT_paint_vertex(bpy.types.Menu):
def draw(self, context):
layout = self.layout
sculpt = context.tool_settings.sculpt
layout.itemO("paint.vertex_color_set")
props = layout.itemO("paint.vertex_color_set", text="Set Selected Vertex Colors", properties=True)
props.selected = True
@@ -694,16 +691,18 @@ class VIEW3D_MT_sculpt(bpy.types.Menu):
layout.item_menu_enumO("brush.curve_preset", property="shape")
layout.itemS()
if brush.sculpt_tool != 'GRAB':
sculpt_tool = brush.sculpt_tool
if sculpt_tool != 'GRAB':
layout.itemR(brush, "use_airbrush")
if brush.sculpt_tool != 'LAYER':
if sculpt_tool != 'LAYER':
layout.itemR(brush, "use_anchor")
if brush.sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'):
if sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'):
layout.itemR(brush, "flip_direction")
if brush.sculpt_tool == 'LAYER':
if sculpt_tool == 'LAYER':
layout.itemR(brush, "use_persistent")
layout.itemO("sculpt.set_persistent_base")
@@ -1375,6 +1374,7 @@ class VIEW3D_PT_3dview_properties(bpy.types.Panel):
layout.column().itemR(scene, "cursor_location", text="3D Cursor:")
class VIEW3D_PT_3dview_item(bpy.types.Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
@@ -1399,6 +1399,7 @@ class VIEW3D_PT_3dview_item(bpy.types.Panel):
row.itemL(text="", icon='ICON_BONE_DATA')
row.itemR(bone, "name", text="")
class VIEW3D_PT_3dview_display(bpy.types.Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
@@ -1508,7 +1509,7 @@ class VIEW3D_PT_background_image(bpy.types.Panel):
def poll(self, context):
view = context.space_data
bg = context.space_data.background_image
# bg = context.space_data.background_image
return (view)
def draw_header(self, context):

View File

@@ -514,11 +514,11 @@ class VIEW3D_PT_tools_brush(PaintPanel):
row.itemR(brush, "strength", slider=True)
row.itemR(brush, "use_strength_pressure", text="")
''' # XXX - TODO
row = col.row(align=True)
row.itemR(brush, "jitter", slider=True)
row.itemR(brush, "use_jitter_pressure", toggle=True, text="")
'''
# XXX - TODO
#row = col.row(align=True)
#row.itemR(brush, "jitter", slider=True)
#row.itemR(brush, "use_jitter_pressure", toggle=True, text="")
col = layout.column()
if brush.sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'):
@@ -587,11 +587,10 @@ class VIEW3D_PT_tools_brush(PaintPanel):
row.itemR(brush, "strength", slider=True)
row.itemR(brush, "use_strength_pressure", toggle=True, text="")
''' # XXX - TODO
row = col.row(align=True)
row.itemR(brush, "jitter", slider=True)
row.itemR(brush, "use_jitter_pressure", toggle=True, text="")
'''
# XXX - TODO
#row = col.row(align=True)
#row.itemR(brush, "jitter", slider=True)
#row.itemR(brush, "use_jitter_pressure", toggle=True, text="")
class VIEW3D_PT_tools_brush_stroke(PaintPanel):
@@ -694,8 +693,6 @@ class VIEW3D_PT_tools_weightpaint(View3DPanel):
def draw(self, context):
layout = self.layout
wpaint = context.tool_settings.weight_paint
col = layout.column()
# col.itemL(text="Blend:")
col.itemO("object.vertex_group_normalize_all", text="Normalize All")