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:
authorCampbell Barton <ideasman42@gmail.com>2009-12-13 16:59:16 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-12-13 16:59:16 +0300
commita1656300ba14f9a220961814ab0366ece6900441 (patch)
tree9bac019a4acecdbc81240a7b4d06284eeae4391d /release/scripts
parentc1bfd014bd8fb4af1ee51ed0e2aaecb707c46ff2 (diff)
script for automating pep8 checks.
On ubuntu/debian install these tools... sudo apt-get install pylint pyflakes python-setuptools python-pip sudo pip install pep8 then run from blenders source dir... python release/test/pep8.py This searches for the comments "# <pep8 compliant>" and "# <pep8-80 compliant>", running the checking tools on these scripts only. * some minor pep8 corrections too.
Diffstat (limited to 'release/scripts')
-rw-r--r--release/scripts/modules/bpy/__init__.py6
-rw-r--r--release/scripts/modules/bpy/ops.py1
-rw-r--r--release/scripts/modules/bpy/utils.py7
-rw-r--r--release/scripts/modules/rigify/__init__.py59
-rw-r--r--release/scripts/modules/rigify/arm_biped_generic.py38
-rw-r--r--release/scripts/modules/rigify/copy.py9
-rw-r--r--release/scripts/modules/rigify/delta.py1
-rw-r--r--release/scripts/modules/rigify/leg_biped_generic.py2
-rw-r--r--release/scripts/modules/rigify/neck_flex.py18
-rw-r--r--release/scripts/modules/rigify/palm_curl.py1
-rw-r--r--release/scripts/modules/rigify/spine_pivot_flex.py4
-rw-r--r--release/scripts/modules/rigify_utils.py19
-rw-r--r--release/scripts/modules/rna_prop_ui.py1
-rw-r--r--release/scripts/op/object.py1
-rw-r--r--release/scripts/op/wm.py47
-rw-r--r--release/scripts/ui/properties_scene.py2
-rw-r--r--release/scripts/ui/space_info.py3
-rw-r--r--release/scripts/ui/space_sequencer.py8
-rw-r--r--release/scripts/ui/space_userpref.py26
19 files changed, 137 insertions, 116 deletions
diff --git a/release/scripts/modules/bpy/__init__.py b/release/scripts/modules/bpy/__init__.py
index 7dfa403a54f..8e7e74e2743 100644
--- a/release/scripts/modules/bpy/__init__.py
+++ b/release/scripts/modules/bpy/__init__.py
@@ -36,6 +36,7 @@ ops = _ops_module.ops_fake_module
import sys
DEBUG = ("-d" in sys.argv)
+
def load_scripts(reload_scripts=False):
import os
import traceback
@@ -47,7 +48,7 @@ def load_scripts(reload_scripts=False):
def test_import(module_name):
try:
t = time.time()
- ret= __import__(module_name)
+ ret = __import__(module_name)
if DEBUG:
print("time %s %.4f" % (module_name, time.time() - t))
return ret
@@ -78,6 +79,7 @@ def load_scripts(reload_scripts=False):
if DEBUG:
print("Time %.4f" % (time.time() - t_main))
+
def _main():
# a bit nasty but this prevents help() and input() from locking blender
@@ -99,5 +101,3 @@ def _main():
load_scripts()
_main()
-
-
diff --git a/release/scripts/modules/bpy/ops.py b/release/scripts/modules/bpy/ops.py
index c8ca9bc77fc..93c0d719580 100644
--- a/release/scripts/modules/bpy/ops.py
+++ b/release/scripts/modules/bpy/ops.py
@@ -134,7 +134,6 @@ class bpy_ops_submodule_op(object):
__keys__ = ('module', 'func')
-
def _get_doc(self):
return op_as_string(self.idname())
diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py
index ad0fa4e8ba5..1948a28a726 100644
--- a/release/scripts/modules/bpy/utils.py
+++ b/release/scripts/modules/bpy/utils.py
@@ -21,6 +21,7 @@
import bpy
import os
+
def expandpath(path):
if path.startswith("//"):
return os.path.join(os.path.dirname(bpy.data.filename), path[2:])
@@ -44,15 +45,17 @@ _unclean_chars = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, \
_unclean_chars = ''.join([chr(i) for i in _unclean_chars])
+
def clean_name(name, replace="_"):
'''
All characters besides A-Z/a-z, 0-9 are replaced with "_"
or the replace argumet if defined.
'''
for ch in _unclean_chars:
- name = name.replace(ch, replace)
+ name = name.replace(ch, replace)
return name
+
def display_name(name):
'''
Only capitalize all lowercase names, mixed case use them as is.
@@ -75,6 +78,7 @@ def display_name(name):
_scripts = os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir)
_scripts = (os.path.normpath(_scripts), )
+
def script_paths(*args):
scripts = list(_scripts)
@@ -105,6 +109,7 @@ def script_paths(*args):
_presets = os.path.join(_scripts[0], "presets") # FIXME - multiple paths
+
def preset_paths(subdir):
'''
Returns a list of paths for a spesific preset.
diff --git a/release/scripts/modules/rigify/__init__.py b/release/scripts/modules/rigify/__init__.py
index 3cef288f79e..519784e8507 100644
--- a/release/scripts/modules/rigify/__init__.py
+++ b/release/scripts/modules/rigify/__init__.py
@@ -25,14 +25,18 @@ from Mathutils import Vector
from rna_prop_ui import rna_idprop_ui_prop_get
SPECIAL_TYPES = "root",
+
class RigifyError(Exception):
"""Exception raised for errors in the metarig.
"""
+
def __init__(self, message):
self.message = message
+
def __str__(self):
return repr(self.message)
+
def submodule_func_from_type(bone_type):
type_pair = bone_type.split(".")
@@ -48,7 +52,7 @@ def submodule_func_from_type(bone_type):
submod = __import__(name="%s.%s" % (__package__, type_name), fromlist=[type_name])
except ImportError:
raise RigifyError("python module for type '%s' not found" % type_name)
-
+
reload(submod)
return type_name, submod, getattr(submod, func_name)
@@ -60,9 +64,10 @@ def get_submodule_types():
for f in files:
if not f.startswith("_") and f.endswith(".py"):
submodules.append(f[:-3])
-
+
return sorted(submodules)
+
def get_bone_type_options(pbone, type_name):
options = {}
bone_name = pbone.name
@@ -75,13 +80,14 @@ def get_bone_type_options(pbone, type_name):
return options
+
def validate_rig(context, obj):
'''
Makes no changes
only runs the metarig definitions and reports errors
'''
type_found = False
-
+
for pbone in obj.pose.bones:
bone_name = pbone.name
bone_type = pbone.get("type", "")
@@ -103,19 +109,19 @@ def validate_rig(context, obj):
get_bone_type_options(pbone, bone_type)
# missing, - check for duplicate root bone.
-
+
if not type_found:
raise RigifyError("This rig has no 'type' properties defined on any pose bones, nothing to do")
def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
'''
- Main function for generating
+ Main function for generating
'''
from collections import OrderedDict
import rigify_utils
reload(rigify_utils)
-
+
# Not needed but catches any errors before duplicating
validate_rig(context, obj_orig)
@@ -124,8 +130,8 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
mode_orig = context.mode
rest_backup = obj_orig.data.pose_position
obj_orig.data.pose_position = 'REST'
-
-
+
+
bpy.ops.object.mode_set(mode='OBJECT')
scene = context.scene
@@ -147,7 +153,7 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
# original name mapping
base_names = {}
-
+
# add all new parentless children to this bone
root_bone = None
@@ -168,7 +174,7 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
# value: [functions, ...]
# each function is from the module. eg leg.ik, arm.main
bone_typeinfos = {}
-
+
# key: bone name
# value: [new_bone_name, ...]
# where each bone with a 'type' stores a list of bones that it created
@@ -182,12 +188,12 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
bone_type = pbone.get("type", "")
if bone_type:
bone_type_list = [bt for bt in bone_type.replace(",", " ").split()]
-
+
# not essential but means running autorig again wont do anything
del pbone["type"]
else:
bone_type_list = []
-
+
if bone_type_list == ["root"]: # special case!
if root_bone:
raise Exception("cant have more then 1 root bone, found '%s' and '%s' to have type==root" % (root_bone, bone_name))
@@ -197,7 +203,7 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
for bone_type in bone_type_list:
type_name, submod, type_func = submodule_func_from_type(bone_type)
reload(submod)
-
+
bone_def_dict = bone_definitions.setdefault(bone_name, {})
# Only calculate bone definitions once
@@ -226,7 +232,7 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
# Only blend results from the same submodule, eg.
# leg.ik and arm.fk could not be blended.
results = OrderedDict()
-
+
bone_names_pre = set([bone.name for bone in arm.bones])
for type_name, type_func in bone_typeinfos[bone_name]:
@@ -255,21 +261,21 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
bone_names_post = set([bone.name for bone in arm.bones])
-
+
# Store which bones were created from this one
bone_genesis[bone_name] = list(bone_names_post - bone_names_pre)
-
+
# need a reverse lookup on bone_genesis so as to know immediately
# where a bone comes from
bone_genesis_reverse = {}
for bone_name, bone_children in bone_genesis.items():
for bone_child_name in bone_children:
bone_genesis_reverse[bone_child_name] = bone_name
-
+
if root_bone:
# assign all new parentless bones to this
-
+
bpy.ops.object.mode_set(mode='EDIT')
root_ebone = arm.edit_bones[root_bone]
for ebone in arm.edit_bones:
@@ -284,19 +290,19 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
root_ebone_tmp = arm.edit_bones[root_bone_override]
else:
root_ebone_tmp = root_ebone
-
+
ebone.connected = False
ebone.parent = root_ebone_tmp
bpy.ops.object.mode_set(mode='OBJECT')
-
+
if META_DEF:
# for pbone in obj_def.pose.bones:
for bone_name, bone_name_new in base_names.items():
#pbone_from = bone_name
pbone = obj_def.pose.bones[bone_name_new]
-
+
con = pbone.constraints.new('COPY_ROTATION')
con.target = obj
con.subtarget = bone_name
@@ -318,8 +324,7 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
obj_orig.data.pose_position = rest_backup
obj.data.pose_position = 'POSE'
context.user_preferences.edit.global_undo = global_undo
-
-
+
return obj
@@ -344,9 +349,9 @@ def generate_test(context, metarig_type="", GENERATE_FINAL=True):
continue
# XXX workaround!, problem with updating the pose matrix.
- if module_name=="delta":
+ if module_name == "delta":
continue
-
+
type_name, submodule, func = submodule_func_from_type(module_name)
metarig_template = getattr(submodule, "metarig_template", None)
@@ -356,7 +361,7 @@ def generate_test(context, metarig_type="", GENERATE_FINAL=True):
metarig_template()
obj = context.active_object
obj.location = scene.cursor_location
-
+
if GENERATE_FINAL:
obj_new = generate_rig(context, obj)
new_objects.append((obj, obj_new))
@@ -378,7 +383,7 @@ def generate_test_all(context, GRAPH=False):
reload(graphviz_export)
new_objects = rigify.generate_test(context)
-
+
if GRAPH:
base_name = os.path.splitext(bpy.data.filename)[0]
for obj, obj_new in new_objects:
diff --git a/release/scripts/modules/rigify/arm_biped_generic.py b/release/scripts/modules/rigify/arm_biped_generic.py
index 33fbb8577cf..22de14ade54 100644
--- a/release/scripts/modules/rigify/arm_biped_generic.py
+++ b/release/scripts/modules/rigify/arm_biped_generic.py
@@ -96,14 +96,14 @@ def metarig_definition(obj, orig_bone_name):
def ik(obj, definitions, base_names, options):
arm = obj.data
-
+
mt = bone_class_instance(obj, METARIG_NAMES)
mt.shoulder, mt.arm, mt.forearm, mt.hand = definitions
mt.update()
-
+
ik = bone_class_instance(obj, ["pole", "pole_vis", "hand_vis"])
ik_chain = mt.copy(to_fmt="MCH-%s_ik", base_names=base_names, exclude_attrs=["shoulder"])
-
+
# IK needs no parent_index
ik_chain.hand_e.connected = False
ik_chain.hand_e.parent = None
@@ -112,14 +112,14 @@ def ik(obj, definitions, base_names, options):
ik_chain.arm_e.connected = False
ik_chain.arm_e.parent = mt.shoulder_e
-
+
# Add the bone used for the arms poll target
#ik.pole = add_pole_target_bone(obj, mt.forearm, get_base_name(base_names[mt.forearm]) + "_target" + get_side_name(mt.forearm), mode='ZAVERAGE')
ik.pole = add_pole_target_bone(obj, mt.forearm, "elbow_target" + get_side_name(mt.forearm), mode='ZAVERAGE')
-
+
ik.update()
ik.pole_e.local_location = False
-
+
# option: elbow_parent
elbow_parent_name = options.get("elbow_parent", "")
@@ -130,17 +130,17 @@ def ik(obj, definitions, base_names, options):
# TODO, old/new parent mapping
raise RigifyError("parent bone from property 'arm_biped_generic.elbow_parent' not found '%s'" % elbow_parent_name)
ik.pole_e.parent = elbow_parent_e
-
+
# update bones after this!
ik.hand_vis = add_stretch_to(obj, mt.hand, ik_chain.hand, "VIS-%s_ik" % base_names[mt.hand])
ik.pole_vis = add_stretch_to(obj, mt.forearm, ik.pole, "VIS-%s_ik" % base_names[mt.forearm])
-
+
ik.update()
ik.hand_vis_e.restrict_select = True
ik.pole_vis_e.restrict_select = True
-
+
bpy.ops.object.mode_set(mode='OBJECT')
-
+
mt.update()
ik.update()
ik_chain.update()
@@ -171,15 +171,15 @@ def ik(obj, definitions, base_names, options):
prop["soft_max"] = 1.0
bpy.ops.object.mode_set(mode='EDIT')
-
+
# don't blend the shoulder
return [None] + ik_chain.names()
def fk(obj, definitions, base_names, options):
-
+
arm = obj.data
-
+
mt = bone_class_instance(obj, METARIG_NAMES)
mt.shoulder, mt.arm, mt.forearm, mt.hand = definitions
mt.update()
@@ -197,19 +197,19 @@ def fk(obj, definitions, base_names, options):
ex.socket_e.connected = False
ex.socket_e.parent = mt.shoulder_e
ex.socket_e.length *= 0.5
-
+
# insert the 'DLT-hand', between the forearm and the hand
# copies forarm rotation
ex.hand_delta_e = copy_bone_simple(arm, fk_chain.hand, "DLT-%s" % base_names[mt.hand], parent=True)
ex.hand_delta = ex.hand_delta_e.name
ex.hand_delta_e.length *= 0.5
ex.hand_delta_e.connected = False
-
+
fk_chain.hand_e.connected = False
fk_chain.hand_e.parent = ex.hand_delta_e
bpy.ops.object.mode_set(mode='OBJECT')
-
+
mt.update()
ex.update()
fk_chain.update()
@@ -222,7 +222,7 @@ def fk(obj, definitions, base_names, options):
con = fk_chain.arm_p.constraints.new('COPY_LOCATION')
con.target = obj
con.subtarget = ex.socket
-
+
fk_chain.hand_p.lock_location = True, True, True
con = ex.hand_delta_p.constraints.new('COPY_ROTATION')
con.target = obj
@@ -262,13 +262,13 @@ def fk(obj, definitions, base_names, options):
mod.coefficients[1] = -1.0
hinge_setup()
-
+
bpy.ops.object.mode_set(mode='EDIT')
return None, fk_chain.arm, fk_chain.forearm, fk_chain.hand
-def main(obj, bone_definition, base_names, options):
+def main(obj, bone_definition, base_names, options):
bones_ik = ik(obj, bone_definition, base_names, options)
bones_fk = fk(obj, bone_definition, base_names, options)
diff --git a/release/scripts/modules/rigify/copy.py b/release/scripts/modules/rigify/copy.py
index 70086b70907..6a3ecb7f639 100644
--- a/release/scripts/modules/rigify/copy.py
+++ b/release/scripts/modules/rigify/copy.py
@@ -24,7 +24,7 @@ from rna_prop_ui import rna_idprop_ui_prop_get
METARIG_NAMES = ("cpy",)
-# note, this example is just a bone with copy property.
+
def metarig_template():
# generated by rigify.write_meta_rig
bpy.ops.object.mode_set(mode='EDIT')
@@ -40,6 +40,7 @@ def metarig_template():
pbone = obj.pose.bones['Bone']
pbone['type'] = 'copy'
+
def metarig_definition(obj, orig_bone_name):
return [orig_bone_name]
@@ -51,14 +52,14 @@ def main(obj, bone_definition, base_names, options):
mt.update()
cp = mt.copy(to_fmt="%s_cpy")
bpy.ops.object.mode_set(mode='OBJECT')
-
+
cp.update()
mt.update()
-
+
con = cp.cpy_p.constraints.new('COPY_ROTATION')
con.target = obj
con.subtarget = mt.cpy
-
+
con = cp.cpy_p.constraints.new('COPY_LOCATION')
con.target = obj
con.subtarget = mt.cpy
diff --git a/release/scripts/modules/rigify/delta.py b/release/scripts/modules/rigify/delta.py
index 4e1d8ce4571..475c64ab317 100644
--- a/release/scripts/modules/rigify/delta.py
+++ b/release/scripts/modules/rigify/delta.py
@@ -118,7 +118,6 @@ def main(obj, bone_definition, base_names, options):
bpy.ops.object.mode_set(mode='OBJECT')
-
# Move the child bone to the deltas location
obj.animation_data_create()
delta_pbone = obj.pose.bones[delta_name]
diff --git a/release/scripts/modules/rigify/leg_biped_generic.py b/release/scripts/modules/rigify/leg_biped_generic.py
index 4ce7352539a..c48ff093a2f 100644
--- a/release/scripts/modules/rigify/leg_biped_generic.py
+++ b/release/scripts/modules/rigify/leg_biped_generic.py
@@ -106,7 +106,7 @@ def metarig_definition(obj, orig_bone_name):
children = bone.children
# Now there must be 2 children, only one connected
if len(children) != 2:
- raise RigifyError("expected the foot bone:'%s' to have 2 children" % bone.name )
+ raise RigifyError("expected the foot bone:'%s' to have 2 children" % bone.name)
if children[0].connected == children[1].connected:
raise RigifyError("expected one bone to be connected")
diff --git a/release/scripts/modules/rigify/neck_flex.py b/release/scripts/modules/rigify/neck_flex.py
index 15efc2a6985..377fd9c9bc8 100644
--- a/release/scripts/modules/rigify/neck_flex.py
+++ b/release/scripts/modules/rigify/neck_flex.py
@@ -154,8 +154,8 @@ def main(obj, bone_definition, base_names, options):
ex.neck_socket_e.head = mt.head_e.head
ex.neck_socket_e.tail = mt.head_e.head - Vector(0.0, neck_chain_segment_length / 2.0, 0.0)
ex.neck_socket_e.roll = 0.0
-
-
+
+
# copy of the head for controling
ex.head_ctrl_e = copy_bone_simple(arm, mt.head, base_names[mt.head])
ex.head_ctrl = ex.head_ctrl_e.name
@@ -229,7 +229,7 @@ def main(obj, bone_definition, base_names, options):
head_driver_path = ex.head_ctrl_p.path_to_id()
target_names = [("b%.2d" % (i + 1)) for i in range(len(neck_chain))]
-
+
ex.head_ctrl_p["bend_tot"] = 0.0
fcurve = ex.head_ctrl_p.driver_add('["bend_tot"]', 0)
driver = fcurve.driver
@@ -242,7 +242,7 @@ def main(obj, bone_definition, base_names, options):
tar.id_type = 'OBJECT'
tar.id = obj
tar.data_path = head_driver_path + ('["bend_%.2d"]' % (i + 1))
-
+
for i, attr in enumerate(ex_chain.attr_names):
neck_p = getattr(ex_chain, attr + "_p")
@@ -272,9 +272,9 @@ def main(obj, bone_definition, base_names, options):
driver = fcurve.driver
driver.type = 'SCRIPTED'
driver.expression = "bend/bend_tot"
-
+
fcurve.modifiers.remove(0) # grr dont need a modifier
-
+
# add target
tar = driver.targets.new()
@@ -282,14 +282,14 @@ def main(obj, bone_definition, base_names, options):
tar.id_type = 'OBJECT'
tar.id = obj
tar.data_path = head_driver_path + ('["bend_tot"]')
-
+
tar = driver.targets.new()
tar.name = "bend"
tar.id_type = 'OBJECT'
tar.id = obj
tar.data_path = head_driver_path + ('["%s"]' % prop_name)
-
-
+
+
# finally constrain the original bone to this one
orig_neck_p = getattr(mt_chain, attr + "_p")
con = orig_neck_p.constraints.new('COPY_ROTATION')
diff --git a/release/scripts/modules/rigify/palm_curl.py b/release/scripts/modules/rigify/palm_curl.py
index 5a06d2451ee..ee99ef6e82a 100644
--- a/release/scripts/modules/rigify/palm_curl.py
+++ b/release/scripts/modules/rigify/palm_curl.py
@@ -25,6 +25,7 @@ from rna_prop_ui import rna_idprop_ui_prop_get
# not used, defined for completeness
METARIG_NAMES = tuple()
+
def metarig_template():
# generated by rigify.write_meta_rig
bpy.ops.object.mode_set(mode='EDIT')
diff --git a/release/scripts/modules/rigify/spine_pivot_flex.py b/release/scripts/modules/rigify/spine_pivot_flex.py
index f2608732c37..4765f0591f7 100644
--- a/release/scripts/modules/rigify/spine_pivot_flex.py
+++ b/release/scripts/modules/rigify/spine_pivot_flex.py
@@ -177,7 +177,7 @@ def main(obj, bone_definition, base_names, options):
df.ribcage_e = copy_bone_simple(arm, child.name, "DEF-wgt_%s" % base_names[mt.ribcage])
df.ribcage = df.ribcage_e.name
df.ribcage_e.translate(Vector(spine_chain_segment_length * 2.0, - df.ribcage_e.length / 2.0, 0.0))
-
+
ex.ribcage_copy_e = copy_bone_simple(arm, mt.ribcage, base_names[mt.ribcage])
ex.ribcage_copy = ex.ribcage_copy_e.name
ex.ribcage_copy_e.connected = False
@@ -294,7 +294,7 @@ def main(obj, bone_definition, base_names, options):
# df.ribcage_p / DEF-wgt_rib_cage
df.ribcage_p.lock_location = True, True, True
-
+
con = df.ribcage_p.constraints.new('COPY_ROTATION')
con.target = obj
con.subtarget = ex.ribcage
diff --git a/release/scripts/modules/rigify_utils.py b/release/scripts/modules/rigify_utils.py
index 6b15329c992..f4694023f12 100644
--- a/release/scripts/modules/rigify_utils.py
+++ b/release/scripts/modules/rigify_utils.py
@@ -32,6 +32,7 @@ from rna_prop_ui import rna_idprop_ui_prop_get
DELIMITER = '-._'
EMPTY_LAYER = [False] * 32
+
def add_stretch_to(obj, from_name, to_name, name):
'''
Adds a bone that stretches from one to another
@@ -71,7 +72,7 @@ def add_stretch_to(obj, from_name, to_name, name):
con.volume = 'NO_VOLUME'
bpy.ops.object.mode_set(mode=mode_orig)
-
+
return stretch_name
@@ -216,7 +217,7 @@ def add_pole_target_bone(obj, base_bone_name, name, mode='CROSS'):
parent_dir = parent_head - parent_tail
distance = (base_dir.length + parent_dir.length)
-
+
if mode == 'CROSS':
# direction from the angle of the joint
offset = base_dir.copy().normalize() - parent_dir.copy().normalize()
@@ -244,7 +245,6 @@ def add_pole_target_bone(obj, base_bone_name, name, mode='CROSS'):
return poll_name
-
def get_side_name(name):
'''
Returns the last part of a string (typically a bone's name) indicating
@@ -256,6 +256,7 @@ def get_side_name(name):
else:
return ""
+
def get_base_name(name):
'''
Returns the part of a string (typically a bone's name) corresponding to it's
@@ -327,16 +328,17 @@ def write_meta_rig(obj, func_name="metarig_template"):
return "\n".join(code)
-
# *** bone class collection ***
+
+
def bone_class_instance(obj, slots, name="BoneContainer"):
'''
bone collection utility class to help manage cases with
edit/pose/bone bones where switching modes can invalidate some of the members.
-
+
there are also utility functions for manipulating all members.
'''
-
+
if len(slots) != len(set(slots)):
raise Exception("duplicate entries found %s" % attr_names)
@@ -361,6 +363,7 @@ def bone_class_instance(obj, slots, name="BoneContainer"):
instance = auto_class_instance(slots, name, class_dict)
return instance
+
def auto_class(slots, name="ContainerClass", class_dict=None):
if class_dict:
@@ -413,10 +416,10 @@ def _bone_class_instance_copy(self, from_fmt="%s", to_fmt="%s", exclude_attrs=()
new_slot_ls = []
for attr in self.attr_names:
-
+
if attr in exclude_attrs:
continue
-
+
bone_name_orig = getattr(self, attr)
ebone = getattr(self, attr + "_e")
# orig_names[attr] = bone_name_orig
diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py
index 07b3a7c1c42..0aa62bb5960 100644
--- a/release/scripts/modules/rna_prop_ui.py
+++ b/release/scripts/modules/rna_prop_ui.py
@@ -219,7 +219,6 @@ class WM_OT_properties_edit(bpy.types.Operator):
return ('RUNNING_MODAL',)
-
class WM_OT_properties_add(bpy.types.Operator):
'''Internal use (edit a property path)'''
bl_idname = "wm.properties_add"
diff --git a/release/scripts/op/object.py b/release/scripts/op/object.py
index e29259cacfb..64406fd0d5c 100644
--- a/release/scripts/op/object.py
+++ b/release/scripts/op/object.py
@@ -126,4 +126,3 @@ class Retopo(bpy.types.Operator):
bpy.ops.add(SelectPattern)
bpy.ops.add(SubdivisionSet)
bpy.ops.add(Retopo)
-
diff --git a/release/scripts/op/wm.py b/release/scripts/op/wm.py
index a61c6d2f301..ae49cf4907a 100644
--- a/release/scripts/op/wm.py
+++ b/release/scripts/op/wm.py
@@ -23,6 +23,7 @@ import os
from bpy.props import *
+
class MESH_OT_delete_edgeloop(bpy.types.Operator):
'''Export a single object as a stanford PLY with normals,
colours and texture coordinates.'''
@@ -42,7 +43,8 @@ rna_path_prop = StringProperty(name="Context Attributes",
rna_reverse_prop = BoolProperty(name="Reverse",
description="Cycle backwards", default=False)
-class NullPathMember:
+
+class NullPath:
pass
@@ -53,7 +55,7 @@ def context_path_validate(context, path):
except AttributeError:
if "'NoneType'" in str(sys.exc_info()[1]):
# One of the items in the rna path is None, just ignore this
- value = NullPathMember
+ value = NullPath
else:
# We have a real error in the rna path, dont ignore that
raise
@@ -62,7 +64,7 @@ def context_path_validate(context, path):
def execute_context_assign(self, context):
- if context_path_validate(context, self.properties.path) == NullPathMember:
+ if context_path_validate(context, self.properties.path) == NullPath:
return ('PASS_THROUGH',)
exec("context.%s=self.properties.value" % self.properties.path)
return ('FINISHED',)
@@ -136,10 +138,12 @@ class WM_OT_context_toggle(bpy.types.Operator):
def execute(self, context):
- if context_path_validate(context, self.properties.path) == NullPathMember:
+ if context_path_validate(context, self.properties.path) == NullPath:
return ('PASS_THROUGH',)
- exec("context.%s=not (context.%s)" % (self.properties.path, self.properties.path))
+ exec("context.%s=not (context.%s)" %
+ (self.properties.path, self.properties.path))
+
return ('FINISHED',)
@@ -157,11 +161,13 @@ class WM_OT_context_toggle_enum(bpy.types.Operator):
def execute(self, context):
- if context_path_validate(context, self.properties.path) == NullPathMember:
+ if context_path_validate(context, self.properties.path) == NullPath:
return ('PASS_THROUGH',)
exec("context.%s = ['%s', '%s'][context.%s!='%s']" % \
- (self.properties.path, self.properties.value_1, self.properties.value_2, self.properties.path, self.properties.value_2))
+ (self.properties.path, self.properties.value_1,\
+ self.properties.value_2, self.properties.path,
+ self.properties.value_2))
return ('FINISHED',)
@@ -177,7 +183,7 @@ class WM_OT_context_cycle_int(bpy.types.Operator):
def execute(self, context):
value = context_path_validate(context, self.properties.path)
- if value == NullPathMember:
+ if value == NullPath:
return ('PASS_THROUGH',)
self.properties.value = value
@@ -209,7 +215,7 @@ class WM_OT_context_cycle_enum(bpy.types.Operator):
def execute(self, context):
value = context_path_validate(context, self.properties.path)
- if value == NullPathMember:
+ if value == NullPath:
return ('PASS_THROUGH',)
orig_value = value
@@ -318,9 +324,12 @@ class WM_OT_doc_edit(bpy.types.Operator):
def execute(self, context):
- class_name, class_prop = self.properties.doc_id.split('.')
+ doc_id = self.properties.doc_id
+ doc_new = self.properties.doc_new
+
+ class_name, class_prop = doc_id.split('.')
- if not self.properties.doc_new:
+ if not doc_new:
return ('RUNNING_MODAL',)
# check if this is an operator
@@ -333,25 +342,25 @@ class WM_OT_doc_edit(bpy.types.Operator):
if op_class:
rna = op_class.bl_rna
doc_orig = rna.description
- if doc_orig == self.properties.doc_new:
+ if doc_orig == doc_new:
return ('RUNNING_MODAL',)
- print("op - old:'%s' -> new:'%s'" % (doc_orig, self.properties.doc_new))
- upload["title"] = 'OPERATOR %s:%s' % (self.properties.doc_id, doc_orig)
- upload["description"] = self.properties.doc_new
+ print("op - old:'%s' -> new:'%s'" % (doc_orig, doc_new))
+ upload["title"] = 'OPERATOR %s:%s' % (doc_id, doc_orig)
+ upload["description"] = doc_new
self._send_xmlrpc(upload)
else:
rna = getattr(bpy.types, class_name).bl_rna
doc_orig = rna.properties[class_prop].description
- if doc_orig == self.properties.doc_new:
+ if doc_orig == doc_new:
return ('RUNNING_MODAL',)
- print("rna - old:'%s' -> new:'%s'" % (doc_orig, self.properties.doc_new))
- upload["title"] = 'RNA %s:%s' % (self.properties.doc_id, doc_orig)
+ print("rna - old:'%s' -> new:'%s'" % (doc_orig, doc_new))
+ upload["title"] = 'RNA %s:%s' % (doc_id, doc_orig)
- upload["description"] = self.properties.doc_new
+ upload["description"] = doc_new
self._send_xmlrpc(upload)
diff --git a/release/scripts/ui/properties_scene.py b/release/scripts/ui/properties_scene.py
index 622ce06c567..cce49172428 100644
--- a/release/scripts/ui/properties_scene.py
+++ b/release/scripts/ui/properties_scene.py
@@ -100,7 +100,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel):
col = row.column()
col.label(text="Keyframing Settings:")
col.prop(ks, "insertkey_needed", text="Needed")
- col.prop(ks, "insertkey_visual", text="Visual")
+ col.prop(ks, "insertkey_visual", text="Visual")
col.prop(ks, "insertkey_xyz_to_rgb", text="XYZ to RGB")
diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py
index 57410daf2b5..56509a6e099 100644
--- a/release/scripts/ui/space_info.py
+++ b/release/scripts/ui/space_info.py
@@ -51,7 +51,7 @@ class INFO_HT_header(bpy.types.Header):
layout.separator()
else:
layout.template_ID(context.window, "screen", new="screen.new", unlink="screen.delete")
-
+
layout.template_ID(context.screen, "scene", new="scene.new", unlink="scene.delete")
layout.separator()
@@ -182,6 +182,7 @@ class INFO_MT_mesh_add(dynamic_menu.DynMenu):
layout.operator("mesh.primitive_grid_add", icon='MESH_GRID', text="Grid")
layout.operator("mesh.primitive_monkey_add", icon='MESH_MONKEY', text="Monkey")
+
class INFO_MT_armature_add(dynamic_menu.DynMenu):
bl_idname = "INFO_MT_armature_add"
bl_label = "Armature"
diff --git a/release/scripts/ui/space_sequencer.py b/release/scripts/ui/space_sequencer.py
index 86f9c3168fc..2beb2ff22d9 100644
--- a/release/scripts/ui/space_sequencer.py
+++ b/release/scripts/ui/space_sequencer.py
@@ -134,7 +134,7 @@ class SEQUENCER_MT_select(bpy.types.Menu):
class SEQUENCER_MT_marker(bpy.types.Menu):
- bl_label = "Marker (TODO)"
+ bl_label = "Marker"
def draw(self, context):
layout = self.layout
@@ -384,7 +384,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel):
elif strip.type == 'TRANSFORM':
self.draw_panel_transform(strip)
-
+
col = layout.column(align=True)
if strip.type == 'SPEED':
@@ -393,11 +393,11 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel):
col.prop(strip, "use_effect_default_fade", "Default fade")
if not strip.use_effect_default_fade:
col.prop(strip, "effect_fader", text="Effect fader")
-
+
def draw_panel_transform(self, strip):
layout = self.layout
col = layout.column()
-
+
col.prop(strip, "interpolation")
col.prop(strip, "translation_unit")
col = layout.column(align=True)
diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py
index 383e7ce4e9c..6d1a358408f 100644
--- a/release/scripts/ui/space_userpref.py
+++ b/release/scripts/ui/space_userpref.py
@@ -111,9 +111,9 @@ class USERPREF_PT_interface(bpy.types.Panel):
column = split.column()
colsplit = column.split(percentage=0.85)
-
+
col = colsplit.column()
-
+
#Toolbox doesn't exist yet
#col.label(text="Toolbox:")
#col.prop(view, "use_column_layout")
@@ -173,7 +173,7 @@ class USERPREF_PT_edit(bpy.types.Panel):
col.prop(edit, "enter_edit_mode")
col.label(text="Align To:")
col.row().prop(edit, "object_align", expand=True)
-
+
col.separator()
col.separator()
col.separator()
@@ -299,11 +299,11 @@ class USERPREF_PT_system(bpy.types.Panel):
sub.prop(system, "audio_mixing_buffer", text="Mixing Buffer")
sub.prop(system, "audio_sample_rate", text="Sample Rate")
sub.prop(system, "audio_sample_format", text="Sample Format")
-
+
col.separator()
col.separator()
col.separator()
-
+
col.label(text="Weight Colors:")
col.prop(system, "use_weight_color_range", text="Use Custom Range")
sub = col.column()
@@ -329,7 +329,7 @@ class USERPREF_PT_system(bpy.types.Panel):
col1 = colsplit.column()
col1.label(text="Solid OpenGL lights:")
-
+
col = col1.split()
sub = col.column()
@@ -355,7 +355,7 @@ class USERPREF_PT_system(bpy.types.Panel):
subsub.prop(lamp2, "diffuse_color")
subsub.prop(lamp2, "specular_color")
subsub.prop(lamp2, "direction")
-
+
column = split.column()
colsplit = column.split(percentage=0.85)
@@ -453,7 +453,7 @@ class USERPREF_PT_theme(bpy.types.Panel):
subsub.active = ui.shaded
subsub.prop(ui, "shadetop")
subsub.prop(ui, "shadedown")
-
+
layout.separator()
ui = theme.user_interface.wcol_tool
@@ -1070,10 +1070,10 @@ class USERPREF_PT_file(bpy.types.Panel):
col = split.column()
col.label(text="File Paths:")
-
+
colsplit = col.split(percentage=0.95)
col1 = colsplit.split(percentage=0.3)
-
+
sub = col1.column()
sub.label(text="Fonts:")
sub.label(text="Textures:")
@@ -1084,7 +1084,7 @@ class USERPREF_PT_file(bpy.types.Panel):
sub.label(text="Sounds:")
sub.label(text="Temp:")
sub.label(text="Animation Player:")
-
+
sub = col1.column()
sub.prop(paths, "fonts_directory", text="")
sub.prop(paths, "textures_directory", text="")
@@ -1105,7 +1105,7 @@ class USERPREF_PT_file(bpy.types.Panel):
col.prop(paths, "load_ui")
col.prop(paths, "filter_file_extensions")
col.prop(paths, "hide_dot_files_datablocks")
-
+
col.separator()
col.separator()
@@ -1474,4 +1474,4 @@ bpy.ops.add(WM_OT_keyconfig_export)
bpy.ops.add(WM_OT_keymap_edit)
bpy.ops.add(WM_OT_keymap_restore)
bpy.ops.add(WM_OT_keyitem_add)
-bpy.ops.add(WM_OT_keyitem_remove) \ No newline at end of file
+bpy.ops.add(WM_OT_keyitem_remove)