style cleanup

This commit is contained in:
Campbell Barton 2013-01-15 23:15:32 +00:00
parent 87f8925a76
commit 97d62f0183
32 changed files with 130 additions and 107 deletions

View File

@ -37,7 +37,7 @@ dict_uimsgs = {
"aren", # aren't
"betweens", # yuck! in-betweens!
"boolean", "booleans",
"couldn", #couldn't
"couldn", # couldn't
"decrement",
"derivate",
"doesn", # doesn't

View File

@ -47,6 +47,7 @@ from _bpy_path import (extensions_audio,
extensions_image,
)
def abspath(path, start=None, library=None):
"""
Returns the absolute path relative to the current blend file

View File

@ -237,7 +237,8 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
_addon_utils.reset_all(reload_scripts)
# run the active integration preset
filepath = preset_find(_user_preferences.inputs.active_keyconfig, "keyconfig")
filepath = preset_find(_user_preferences.inputs.active_keyconfig,
"keyconfig")
if filepath:
keyconfig_set(filepath)

View File

@ -341,7 +341,7 @@ path_reference_mode = EnumProperty(
('COPY', "Copy", "Copy the file to the destination path "
"(or subdirectory)"),
),
default='AUTO'
default='AUTO',
)

View File

@ -28,14 +28,17 @@ __all__ = (
import bpy as _bpy
class _RestrictContext():
__slots__ = ()
_real_data = _bpy.data
# safe, the pointer never changes
_real_pref = _bpy.context.user_preferences
@property
def window_manager(self):
return self._real_data.window_managers[0]
@property
def user_preferences(self):
return self._real_pref
@ -51,6 +54,7 @@ _data_restrict = _RestrictData()
class RestrictBlend():
__slots__ = ("context", "data")
def __enter__(self):
self.data = _bpy.data
self.context = _bpy.context

View File

@ -484,13 +484,16 @@ class Text(bpy_types.ID):
if cont.type == 'PYTHON']
)
class NodeSocket(StructRNA): # , metaclass=RNAMeta
__slots__ = ()
@property
def links(self):
"""List of node links from or to this socket"""
return tuple(link for link in self.id_data.links if link.from_socket == self or link.to_socket == self)
return tuple(link for link in self.id_data.links
if (link.from_socket == self or
link.to_socket == self))
# values are module: [(cls, path, line), ...]

View File

@ -22,6 +22,7 @@ import bpy
from bpy.types import Operator
from bpy.props import BoolProperty, EnumProperty, StringProperty
# Base class for node 'Add' operators
class NodeAddOperator():
@staticmethod
@ -78,8 +79,9 @@ class NODE_OT_add_node(NodeAddOperator, Operator):
use_transform = BoolProperty(
name="Use Transform",
description="Start transform operator after inserting the node",
default = False,
default=False,
)
def execute(self, context):
node = self.create_node(context, self.type)

View File

@ -716,7 +716,8 @@ class TransformsToDeltasAnim(Operator):
if fcu.array_index in existingFCurves[dpath]:
# conflict
self.report({'ERROR'},
"Object '%r' already has '%r' F-Curve(s). Remove these before trying again" %
"Object '%r' already has '%r' F-Curve(s). "
"Remove these before trying again" %
(obj.name, dpath))
return {'CANCELLED'}
else:
@ -726,7 +727,6 @@ class TransformsToDeltasAnim(Operator):
# no conflict yet
existingFCurves[dpath] = [fcu.array_index]
# if F-Curve uses standard transform path
# just append "delta_" to this path
for fcu in adt.action.fcurves:
@ -766,7 +766,7 @@ class DupliOffsetFromCursor(Operator):
@classmethod
def poll(cls, context):
return context.active_object is not None
return (context.active_object is not None)
def execute(self, context):
scene = context.scene

View File

@ -102,7 +102,6 @@ def extend(obj, operator, EXTEND_MODE):
else:
break
def extrapolate_uv(fac,
l_a_outer, l_a_inner,
l_b_outer, l_b_inner):

View File

@ -133,6 +133,7 @@ def register():
def unregister():
bpy.utils.unregister_module(__name__)
# Define a default UIList, when a list does not need any custom drawing...
class UI_UL_list(bpy.types.UIList):
pass

View File

@ -194,7 +194,6 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel):
row = layout.row()
row.template_list("MESH_UL_vgroups", "", ob, "vertex_groups", ob.vertex_groups, "active_index", rows=rows)
col = row.column(align=True)
col.operator("object.vertex_group_add", icon='ZOOMIN', text="")
col.operator("object.vertex_group_remove", icon='ZOOMOUT', text="").all = False

View File

@ -558,7 +558,6 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col = split.column()
def PARTICLE_INSTANCE(self, layout, ob, md):
layout.prop(md, "object")
layout.prop(md, "particle_system_index", text="Particle System")
@ -1045,12 +1044,12 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
def UV_WARP(self, layout, ob, md):
split = layout.split()
col = split.column()
col.prop(md, "center");
col.prop(md, "center")
col = split.column()
col.label(text="UV Axis:")
col.prop(md, "axis_u", text="");
col.prop(md, "axis_v", text="");
col.prop(md, "axis_u", text="")
col.prop(md, "axis_v", text="")
split = layout.split()
col = split.column()

View File

@ -199,6 +199,7 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, Panel):
col = split.column()
col.prop(game, "collision_mask")
class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, Panel):
bl_label = "Collision Bounds"
COMPAT_ENGINES = {'BLENDER_GAME'}

View File

@ -26,7 +26,8 @@ from bpy.types import Menu, UIList
class MASK_UL_layers(UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
def draw_item(self, context, layout, data, item, icon,
active_data, active_propname, index):
# assert(isinstance(item, bpy.types.MaskLayer)
mask = item
if self.layout_type in {'DEFAULT', 'COMPACT'}:
@ -86,7 +87,8 @@ class MASK_PT_layers:
rows = 5 if active_layer else 2
row = layout.row()
row.template_list("MASK_UL_layers", "", mask, "layers", mask, "active_layer_index", rows=rows)
row.template_list("MASK_UL_layers", "", mask, "layers",
mask, "active_layer_index", rows=rows)
sub = row.column(align=True)

View File

@ -172,7 +172,6 @@ class ConstraintButtonsPanel():
sub.active = con.use_rotation
sub.prop(con, "orient_weight", text="Rotation", slider=True)
def IK_COPY_POSE(self, context, layout, con):
self.target_template(layout, con)
self.ik_template(layout, con)

View File

@ -119,6 +119,7 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel):
col = split.column()
col.prop(coll, "collision_type")
class PHYSICS_PT_smoke_flow_advanced(PhysicButtonsPanel, Panel):
bl_label = "Smoke Flow Advanced"
bl_options = {'DEFAULT_CLOSED'}
@ -152,6 +153,7 @@ class PHYSICS_PT_smoke_flow_advanced(PhysicButtonsPanel, Panel):
col.label(text="Vertex Group:")
col.prop_search(flow, "density_vertex_group", ob, "vertex_groups", text="")
class PHYSICS_PT_smoke_fire(PhysicButtonsPanel, Panel):
bl_label = "Smoke Flames"
bl_options = {'DEFAULT_CLOSED'}
@ -180,6 +182,7 @@ class PHYSICS_PT_smoke_fire(PhysicButtonsPanel, Panel):
col.prop(domain, "flame_max_temp")
col.prop(domain, "flame_smoke_color")
class PHYSICS_PT_smoke_adaptive_domain(PhysicButtonsPanel, Panel):
bl_label = "Smoke Adaptive Domain"
bl_options = {'DEFAULT_CLOSED'}
@ -201,7 +204,7 @@ class PHYSICS_PT_smoke_adaptive_domain(PhysicButtonsPanel, Panel):
layout.active = domain.use_adaptive_domain
split = layout.split()
split.enabled = not domain.point_cache.is_baked
split.enabled = (not domain.point_cache.is_baked)
col = split.column(align=True)
col.label(text="Resolution:")
@ -212,6 +215,7 @@ class PHYSICS_PT_smoke_adaptive_domain(PhysicButtonsPanel, Panel):
col.label(text="Advanced:")
col.prop(domain, "adapt_threshold")
class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, Panel):
bl_label = "Smoke High Resolution"
bl_options = {'DEFAULT_CLOSED'}
@ -249,6 +253,7 @@ class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, Panel):
layout.prop(md, "show_high_resolution")
class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, Panel):
bl_label = "Smoke Groups"
bl_options = {'DEFAULT_CLOSED'}
@ -276,6 +281,7 @@ class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, Panel):
col.label(text="Collision Group:")
col.prop(domain, "collision_group", text="")
class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, Panel):
bl_label = "Smoke Cache"
bl_options = {'DEFAULT_CLOSED'}

View File

@ -60,6 +60,7 @@ class RENDER_UL_renderlayers(UIList):
# uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "use", 0, 0, 0, 0, 0, NULL);
# }
class RenderButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'

View File

@ -23,14 +23,17 @@ from bpy.types import Panel, Header, Menu, UIList
class CLIP_UL_tracking_objects(UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
def draw_item(self, context, layout, data, item, icon,
active_data, active_propname, index):
# assert(isinstance(item, bpy.types.MovieTrackingObject)
tobj = item
if self.layout_type in {'DEFAULT', 'COMPACT'}:
layout.label(tobj.name, icon='CAMERA_DATA' if tobj.is_camera else 'OBJECT_DATA')
layout.label(tobj.name, icon='CAMERA_DATA'
if tobj.is_camera else 'OBJECT_DATA')
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
layout.label("", icon='CAMERA_DATA' if tobj.is_camera else 'OBJECT_DATA')
layout.label("", icon='CAMERA_DATA'
if tobj.is_camera else 'OBJECT_DATA')
class CLIP_HT_header(Header):
@ -333,7 +336,8 @@ class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel):
col = layout.column(align=True)
col.active = not settings.use_tripod_solver
col.prop(settings, "use_fallback_reconstruction", text="Allow Fallback")
col.prop(settings, "use_fallback_reconstruction",
text="Allow Fallback")
sub = col.column()
sub.active = settings.use_fallback_reconstruction
sub.prop(settings, "reconstruction_success_threshold")
@ -482,7 +486,8 @@ class CLIP_PT_objects(CLIP_PT_clip_view_panel, Panel):
tracking = sc.clip.tracking
row = layout.row()
row.template_list("CLIP_UL_tracking_objects", "", tracking, "objects", tracking, "active_object_index", rows=3)
row.template_list("CLIP_UL_tracking_objects", "", tracking, "objects",
tracking, "active_object_index", rows=3)
sub = row.column(align=True)
@ -738,7 +743,8 @@ class CLIP_PT_stabilization(CLIP_PT_reconstruction_panel, Panel):
layout.active = stab.use_2d_stabilization
row = layout.row()
row.template_list("UI_UL_list", "", stab, "tracks", stab, "active_track_index", rows=3)
row.template_list("UI_UL_list", "", stab, "tracks",
stab, "active_track_index", rows=3)
sub = row.column(align=True)

View File

@ -1244,7 +1244,6 @@ class USERPREF_PT_addons(Panel):
box_prefs.label(text="Error (see console)", icon='ERROR')
del addon_preferences_class.layout
# Append missing scripts
# First collect scripts that are used but have no script file.
module_names = {mod.__name__ for mod, info in addons}