forked from bartvdbraak/blender
pep8 cleanup
This commit is contained in:
parent
f0eb3b56de
commit
736a7b7a22
@ -21,6 +21,8 @@
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
IGNORE = \
|
||||
"/test/",\
|
||||
"/decimate_glut_test/",\
|
||||
@ -45,6 +47,8 @@ global_c = set()
|
||||
|
||||
import os
|
||||
from os.path import splitext
|
||||
|
||||
|
||||
def source_list(path, filename_check=None):
|
||||
for dirpath, dirnames, filenames in os.walk(path):
|
||||
|
||||
@ -56,26 +60,32 @@ def source_list(path, filename_check=None):
|
||||
if filename_check is None or filename_check(filename):
|
||||
yield os.path.join(dirpath, filename)
|
||||
|
||||
|
||||
# extension checking
|
||||
def is_c_header(filename):
|
||||
ext = splitext(filename)[1]
|
||||
return (ext in (".h", ".hpp", ".hxx"))
|
||||
|
||||
|
||||
def is_cmake(filename):
|
||||
ext = splitext(filename)[1]
|
||||
return (ext == ".cmake") or (filename == "CMakeLists.txt")
|
||||
|
||||
|
||||
def is_c_header(filename):
|
||||
ext = splitext(filename)[1]
|
||||
return (ext in (".h", ".hpp", ".hxx"))
|
||||
|
||||
|
||||
def is_c(filename):
|
||||
ext = splitext(filename)[1]
|
||||
return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc"))
|
||||
|
||||
|
||||
def is_c_any(filename):
|
||||
return is_c(filename) or is_c_header(filename)
|
||||
|
||||
|
||||
def cmake_get_src(f):
|
||||
|
||||
sources_h = []
|
||||
@ -131,7 +141,6 @@ def cmake_get_src(f):
|
||||
# replace dirs
|
||||
l = l.replace("${CMAKE_CURRENT_SOURCE_DIR}", cmake_base)
|
||||
|
||||
|
||||
if not l:
|
||||
pass
|
||||
elif l.startswith("$"):
|
||||
@ -175,6 +184,7 @@ def cmake_get_src(f):
|
||||
for cmake in source_list(base, is_cmake):
|
||||
cmake_get_src(cmake)
|
||||
|
||||
|
||||
def is_ignore(f):
|
||||
for ig in IGNORE:
|
||||
if ig in f:
|
||||
|
@ -21,6 +21,8 @@
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
import os
|
||||
from os.path import join, dirname, normpath, abspath, splitext, relpath, exists
|
||||
|
||||
@ -28,6 +30,7 @@ base = join(os.path.dirname(__file__), "..", "..")
|
||||
base = normpath(base)
|
||||
base = abspath(base)
|
||||
|
||||
|
||||
def source_list(path, filename_check=None):
|
||||
for dirpath, dirnames, filenames in os.walk(path):
|
||||
|
||||
@ -40,31 +43,38 @@ def source_list(path, filename_check=None):
|
||||
if filename_check is None or filename_check(filepath):
|
||||
yield filepath
|
||||
|
||||
|
||||
# extension checking
|
||||
def is_c_header(filename):
|
||||
ext = splitext(filename)[1]
|
||||
return (ext in (".h", ".hpp", ".hxx"))
|
||||
|
||||
|
||||
def is_cmake(filename):
|
||||
ext = splitext(filename)[1]
|
||||
return (ext == ".cmake") or (filename == "CMakeLists.txt")
|
||||
|
||||
|
||||
def is_c_header(filename):
|
||||
ext = splitext(filename)[1]
|
||||
return (ext in (".h", ".hpp", ".hxx"))
|
||||
|
||||
|
||||
def is_c(filename):
|
||||
ext = splitext(filename)[1]
|
||||
return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc"))
|
||||
|
||||
|
||||
def is_c_any(filename):
|
||||
return is_c(filename) or is_c_header(filename)
|
||||
|
||||
|
||||
def is_svn_file(filename):
|
||||
dn, fn = os.path.split(filename)
|
||||
filename_svn = join(dn, ".svn", "text-base", "%s.svn-base" % fn)
|
||||
return exists(filename_svn)
|
||||
|
||||
|
||||
def is_project_file(filename):
|
||||
return (is_c_any(filename) or is_cmake(filename)) and is_svn_file(filename)
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
#
|
||||
# #**** END GPL LICENSE BLOCK #****
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
script_help_msg = '''
|
||||
Usage:
|
||||
|
||||
@ -81,9 +83,11 @@ def range_str(val):
|
||||
Converts values to strings for the range directive.
|
||||
(unused function it seems)
|
||||
'''
|
||||
if val < -10000000: return '-inf'
|
||||
if val > 10000000: return 'inf'
|
||||
if type(val)==float:
|
||||
if val < -10000000:
|
||||
return '-inf'
|
||||
elif val > 10000000:
|
||||
return 'inf'
|
||||
elif type(val) == float:
|
||||
return '%g' % val
|
||||
else:
|
||||
return str(val)
|
||||
@ -310,7 +314,6 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
|
||||
file.close()
|
||||
|
||||
|
||||
|
||||
def rna2sphinx(BASEPATH):
|
||||
|
||||
structs, funcs, ops, props = rna_info.BuildRNAInfo()
|
||||
@ -325,7 +328,6 @@ def rna2sphinx(BASEPATH):
|
||||
file = open(filepath, "w")
|
||||
fw = file.write
|
||||
|
||||
|
||||
version_string = bpy.app.version_string.split("(")[0]
|
||||
if bpy.app.build_revision != "Unknown":
|
||||
version_string = version_string + " r" + bpy.app.build_revision
|
||||
@ -349,7 +351,7 @@ def rna2sphinx(BASEPATH):
|
||||
fw("latex_paper_size = 'a4paper'\n")
|
||||
file.close()
|
||||
|
||||
|
||||
# main page needed for sphinx (index.html)
|
||||
filepath = os.path.join(BASEPATH, "contents.rst")
|
||||
file = open(filepath, "w")
|
||||
fw = file.write
|
||||
@ -407,7 +409,6 @@ def rna2sphinx(BASEPATH):
|
||||
fw(".. toctree::\n")
|
||||
fw(" :maxdepth: 1\n\n")
|
||||
|
||||
|
||||
fw(" mathutils.rst\n\n")
|
||||
fw(" mathutils.geometry.rst\n\n")
|
||||
# XXX TODO
|
||||
@ -429,7 +430,6 @@ def rna2sphinx(BASEPATH):
|
||||
|
||||
file.close()
|
||||
|
||||
|
||||
# internal modules
|
||||
filepath = os.path.join(BASEPATH, "bpy.ops.rst")
|
||||
file = open(filepath, "w")
|
||||
@ -451,7 +451,6 @@ def rna2sphinx(BASEPATH):
|
||||
fw(" bpy.types.*\n\n")
|
||||
file.close()
|
||||
|
||||
|
||||
# not actually a module, only write this file so we
|
||||
# can reference in the TOC
|
||||
filepath = os.path.join(BASEPATH, "bpy.data.rst")
|
||||
@ -474,7 +473,6 @@ def rna2sphinx(BASEPATH):
|
||||
|
||||
EXAMPLE_SET_USED.add("bpy.data")
|
||||
|
||||
|
||||
# python modules
|
||||
from bpy import utils as module
|
||||
pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities (bpy.utils)")
|
||||
@ -518,7 +516,6 @@ def rna2sphinx(BASEPATH):
|
||||
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.render.rst"), BASEPATH)
|
||||
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.events.rst"), BASEPATH)
|
||||
|
||||
|
||||
if 0:
|
||||
filepath = os.path.join(BASEPATH, "bpy.rst")
|
||||
file = open(filepath, "w")
|
||||
@ -651,7 +648,6 @@ def rna2sphinx(BASEPATH):
|
||||
|
||||
fw("\n")
|
||||
|
||||
|
||||
# python methods
|
||||
py_funcs = struct.get_py_functions()
|
||||
py_func = None
|
||||
@ -696,7 +692,6 @@ def rna2sphinx(BASEPATH):
|
||||
fw(line)
|
||||
fw("\n")
|
||||
|
||||
|
||||
# funcs
|
||||
lines[:] = []
|
||||
|
||||
@ -723,7 +718,6 @@ def rna2sphinx(BASEPATH):
|
||||
|
||||
lines[:] = []
|
||||
|
||||
|
||||
if struct.references:
|
||||
# use this otherwise it gets in the index for a normal heading.
|
||||
fw(".. rubric:: References\n\n")
|
||||
@ -738,7 +732,6 @@ def rna2sphinx(BASEPATH):
|
||||
fw(" * :class:`%s`\n" % ref)
|
||||
fw("\n")
|
||||
|
||||
|
||||
for struct in structs.values():
|
||||
# TODO, rna_info should filter these out!
|
||||
if "_OT_" in struct.identifier:
|
||||
@ -776,10 +769,9 @@ def rna2sphinx(BASEPATH):
|
||||
if type(descr) == GetSetDescriptorType:
|
||||
py_descr2sphinx(" ", fw, descr, "bpy.types", _BPY_STRUCT_FAKE, key)
|
||||
|
||||
|
||||
# operators
|
||||
def write_ops():
|
||||
API_BASEURL='https://svn.blender.org/svnroot/bf-blender/trunk/blender/release/scripts'
|
||||
API_BASEURL = "https://svn.blender.org/svnroot/bf-blender/trunk/blender/release/scripts"
|
||||
fw = None
|
||||
last_mod = ''
|
||||
|
||||
@ -821,6 +813,7 @@ def rna2sphinx(BASEPATH):
|
||||
|
||||
file.close()
|
||||
|
||||
|
||||
def main():
|
||||
import bpy
|
||||
if 'bpy' not in dir():
|
||||
@ -830,9 +823,9 @@ def main():
|
||||
import shutil
|
||||
|
||||
script_dir = os.path.dirname(__file__)
|
||||
path_in = os.path.join(script_dir,'sphinx-in')
|
||||
path_out = os.path.join(script_dir,'sphinx-out')
|
||||
path_examples = os.path.join(script_dir,'examples')
|
||||
path_in = os.path.join(script_dir, "sphinx-in")
|
||||
path_out = os.path.join(script_dir, "sphinx-out")
|
||||
path_examples = os.path.join(script_dir, "examples")
|
||||
# only for partial updates
|
||||
path_in_tmp = path_in + "-tmp"
|
||||
|
||||
@ -843,7 +836,6 @@ def main():
|
||||
if f.endswith(".py"):
|
||||
EXAMPLE_SET.add(os.path.splitext(f)[0])
|
||||
|
||||
|
||||
# only for full updates
|
||||
if _BPY_FULL_REBUILD:
|
||||
shutil.rmtree(path_in, True)
|
||||
@ -883,7 +875,6 @@ def main():
|
||||
'''else:
|
||||
print("\tkeeping: %s" % f) # eh, not that useful'''
|
||||
|
||||
|
||||
EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED
|
||||
if EXAMPLE_SET_UNUSED:
|
||||
print("\nUnused examples found in '%s'..." % path_examples)
|
||||
|
@ -18,6 +18,8 @@
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
"""
|
||||
Thumbnailer runs with python 2.6 and 3.x.
|
||||
To run automatically with nautilus:
|
||||
|
@ -1,7 +1,29 @@
|
||||
# Built-In Keying Sets
|
||||
# None of these Keying Sets should be removed, as these
|
||||
# are needed by various parts of Blender in order for them
|
||||
# to work correctly.
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
"""
|
||||
Built-In Keying Sets
|
||||
None of these Keying Sets should be removed, as these
|
||||
are needed by various parts of Blender in order for them
|
||||
to work correctly.
|
||||
"""
|
||||
|
||||
import bpy
|
||||
from keyingsets_utils import *
|
||||
@ -9,6 +31,7 @@ from keyingsets_utils import *
|
||||
###############################
|
||||
# Built-In KeyingSets
|
||||
|
||||
|
||||
# Location
|
||||
class BUILTIN_KSI_Location(bpy.types.KeyingSetInfo):
|
||||
bl_label = "Location"
|
||||
@ -22,6 +45,7 @@ class BUILTIN_KSI_Location(bpy.types.KeyingSetInfo):
|
||||
# generator - use callback for location
|
||||
generate = RKS_GEN_location
|
||||
|
||||
|
||||
# Rotation
|
||||
class BUILTIN_KSI_Rotation(bpy.types.KeyingSetInfo):
|
||||
bl_label = "Rotation"
|
||||
@ -35,6 +59,7 @@ class BUILTIN_KSI_Rotation(bpy.types.KeyingSetInfo):
|
||||
# generator - use callback for location
|
||||
generate = RKS_GEN_rotation
|
||||
|
||||
|
||||
# Scale
|
||||
class BUILTIN_KSI_Scaling(bpy.types.KeyingSetInfo):
|
||||
bl_label = "Scaling"
|
||||
@ -50,6 +75,7 @@ class BUILTIN_KSI_Scaling(bpy.types.KeyingSetInfo):
|
||||
|
||||
# ------------
|
||||
|
||||
|
||||
# LocRot
|
||||
class BUILTIN_KSI_LocRot(bpy.types.KeyingSetInfo):
|
||||
bl_label = "LocRot"
|
||||
@ -67,6 +93,7 @@ class BUILTIN_KSI_LocRot(bpy.types.KeyingSetInfo):
|
||||
# rotation
|
||||
RKS_GEN_rotation(self, context, ks, data)
|
||||
|
||||
|
||||
# LocScale
|
||||
class BUILTIN_KSI_LocScale(bpy.types.KeyingSetInfo):
|
||||
bl_label = "LocScale"
|
||||
@ -84,6 +111,7 @@ class BUILTIN_KSI_LocScale(bpy.types.KeyingSetInfo):
|
||||
# scale
|
||||
RKS_GEN_scaling(self, context, ks, data)
|
||||
|
||||
|
||||
# LocRotScale
|
||||
class BUILTIN_KSI_LocRotScale(bpy.types.KeyingSetInfo):
|
||||
bl_label = "LocRotScale"
|
||||
@ -103,6 +131,7 @@ class BUILTIN_KSI_LocRotScale(bpy.types.KeyingSetInfo):
|
||||
# scale
|
||||
RKS_GEN_scaling(self, context, ks, data)
|
||||
|
||||
|
||||
# RotScale
|
||||
class BUILTIN_KSI_RotScale(bpy.types.KeyingSetInfo):
|
||||
bl_label = "RotScale"
|
||||
@ -122,6 +151,7 @@ class BUILTIN_KSI_RotScale(bpy.types.KeyingSetInfo):
|
||||
|
||||
# ------------
|
||||
|
||||
|
||||
# Location
|
||||
class BUILTIN_KSI_VisualLoc(bpy.types.KeyingSetInfo):
|
||||
bl_label = "Visual Location"
|
||||
@ -137,6 +167,7 @@ class BUILTIN_KSI_VisualLoc(bpy.types.KeyingSetInfo):
|
||||
# generator - use callback for location
|
||||
generate = RKS_GEN_location
|
||||
|
||||
|
||||
# Rotation
|
||||
class BUILTIN_KSI_VisualRot(bpy.types.KeyingSetInfo):
|
||||
bl_label = "Visual Rotation"
|
||||
@ -152,6 +183,7 @@ class BUILTIN_KSI_VisualRot(bpy.types.KeyingSetInfo):
|
||||
# generator - use callback for rotation
|
||||
generate = RKS_GEN_rotation
|
||||
|
||||
|
||||
# VisualLocRot
|
||||
class BUILTIN_KSI_VisualLocRot(bpy.types.KeyingSetInfo):
|
||||
bl_label = "Visual LocRot"
|
||||
@ -173,6 +205,7 @@ class BUILTIN_KSI_VisualLocRot(bpy.types.KeyingSetInfo):
|
||||
|
||||
# ------------
|
||||
|
||||
|
||||
# Available
|
||||
class BUILTIN_KSI_Available(bpy.types.KeyingSetInfo):
|
||||
bl_label = "Available"
|
||||
@ -190,6 +223,7 @@ class BUILTIN_KSI_Available(bpy.types.KeyingSetInfo):
|
||||
|
||||
###############################
|
||||
|
||||
|
||||
# All properties that are likely to get animated in a character rig
|
||||
class BUILTIN_KSI_WholeCharacter(bpy.types.KeyingSetInfo):
|
||||
bl_label = "Whole Character"
|
||||
|
@ -3,43 +3,49 @@
|
||||
# for polling, iterator callbacks, and also generate callbacks.
|
||||
# All of these can be used in conjunction with the others.
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
|
||||
###########################
|
||||
# General Utilities
|
||||
|
||||
|
||||
# Append the specified property name on the the existing path
|
||||
def path_add_property(path, prop):
|
||||
if len(path):
|
||||
return path + "." + prop;
|
||||
return path + "." + prop
|
||||
else:
|
||||
return prop;
|
||||
return prop
|
||||
|
||||
###########################
|
||||
# Poll Callbacks
|
||||
|
||||
|
||||
# selected objects
|
||||
def RKS_POLL_selected_objects(ksi, context):
|
||||
return context.active_object or len(context.selected_objects);
|
||||
return context.active_object or len(context.selected_objects)
|
||||
|
||||
|
||||
# selected bones
|
||||
def RKS_POLL_selected_bones(ksi, context):
|
||||
# we must be in Pose Mode, and there must be some bones selected
|
||||
if (context.active_object) and (context.active_object.mode == 'POSE'):
|
||||
if context.active_pose_bone or len(context.selected_pose_bones):
|
||||
return True;
|
||||
return True
|
||||
|
||||
# nothing selected
|
||||
return False;
|
||||
return False
|
||||
|
||||
|
||||
# selected bones or objects
|
||||
def RKS_POLL_selected_items(ksi, context):
|
||||
return RKS_POLL_selected_bones(ksi, context) or RKS_POLL_selected_objects(ksi, context);
|
||||
return RKS_POLL_selected_bones(ksi, context) or RKS_POLL_selected_objects(ksi, context)
|
||||
|
||||
###########################
|
||||
# Iterator Callbacks
|
||||
|
||||
|
||||
# all selected objects or pose bones, depending on which we've got
|
||||
def RKS_ITER_selected_item(ksi, context, ks):
|
||||
if (context.active_object) and (context.active_object.mode == 'POSE'):
|
||||
@ -52,6 +58,7 @@ def RKS_ITER_selected_item(ksi, context, ks):
|
||||
###########################
|
||||
# Generate Callbacks
|
||||
|
||||
|
||||
# 'Available' F-Curves
|
||||
def RKS_GEN_available(ksi, context, ks, data):
|
||||
# try to get the animation data associated with the closest
|
||||
@ -61,7 +68,7 @@ def RKS_GEN_available(ksi, context, ks, data):
|
||||
|
||||
# there must also be an active action...
|
||||
if adt is None or adt.action is None:
|
||||
return;
|
||||
return
|
||||
|
||||
# if we haven't got an ID-block as 'data', try to restrict
|
||||
# paths added to only those which branch off from here
|
||||
@ -69,7 +76,7 @@ def RKS_GEN_available(ksi, context, ks, data):
|
||||
if id_block != data:
|
||||
basePath = data.path_from_id()
|
||||
else:
|
||||
basePath = None; # this is not needed...
|
||||
basePath = None # this is not needed...
|
||||
|
||||
# for each F-Curve, include a path to key it
|
||||
# NOTE: we don't need to set the group settings here
|
||||
@ -82,6 +89,7 @@ def RKS_GEN_available(ksi, context, ks, data):
|
||||
|
||||
# ------
|
||||
|
||||
|
||||
# get ID block and based ID path for transform generators
|
||||
def get_transform_generators_base_info(data):
|
||||
# ID-block for the data
|
||||
@ -105,6 +113,7 @@ def get_transform_generators_base_info(data):
|
||||
# return the ID-block and the path
|
||||
return id_block, path, grouping
|
||||
|
||||
|
||||
# Location
|
||||
def RKS_GEN_location(ksi, context, ks, data):
|
||||
# get id-block and path info
|
||||
@ -119,6 +128,7 @@ def RKS_GEN_location(ksi, context, ks, data):
|
||||
else:
|
||||
ks.paths.add(id_block, path)
|
||||
|
||||
|
||||
# Rotation
|
||||
def RKS_GEN_rotation(ksi, context, ks, data):
|
||||
# get id-block and path info
|
||||
@ -139,6 +149,7 @@ def RKS_GEN_rotation(ksi, context, ks, data):
|
||||
else:
|
||||
ks.paths.add(id_block, path)
|
||||
|
||||
|
||||
# Scaling
|
||||
def RKS_GEN_scaling(ksi, context, ks, data):
|
||||
# get id-block and path info
|
||||
@ -158,6 +169,7 @@ def RKS_GEN_scaling(ksi, context, ks, data):
|
||||
|
||||
classes = []
|
||||
|
||||
|
||||
def register():
|
||||
pass
|
||||
|
||||
|
@ -1,7 +1,28 @@
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
from math import *
|
||||
import bpy
|
||||
from mathutils import *
|
||||
|
||||
|
||||
def main(context):
|
||||
def cleanupEulCurve(fcv):
|
||||
keys = []
|
||||
@ -20,7 +41,7 @@ def main(context):
|
||||
|
||||
th = pi
|
||||
if abs(prev[1][1] - cur[1][1]) >= th: # more than 180 degree jump
|
||||
fac = pi*2
|
||||
fac = pi * 2.0
|
||||
if prev[1][1] > cur[1][1]:
|
||||
while abs(cur[1][1] - prev[1][1]) >= th: # < prev[1][1]:
|
||||
cur[0][1] += fac
|
||||
@ -43,6 +64,7 @@ def main(context):
|
||||
if f.select and f.data_path.endswith("rotation_euler"):
|
||||
cleanupEulCurve(f)
|
||||
|
||||
|
||||
class DiscontFilterOp(bpy.types.Operator):
|
||||
"""Fixes the most common causes of gimbal lock in the fcurves of the active bone"""
|
||||
bl_idname = "graph.euler_filter"
|
||||
@ -56,9 +78,11 @@ class DiscontFilterOp(bpy.types.Operator):
|
||||
main(context)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def register():
|
||||
pass
|
||||
|
||||
|
||||
def unregister():
|
||||
pass
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
class PhysicButtonsPanel():
|
||||
bl_space_type = 'PROPERTIES'
|
||||
bl_region_type = 'WINDOW'
|
||||
@ -30,6 +31,7 @@ class PhysicButtonsPanel():
|
||||
rd = context.scene.render
|
||||
return (context.object) and (not rd.use_game_engine)
|
||||
|
||||
|
||||
def physics_add(self, layout, md, name, type, typeicon, toggles):
|
||||
sub = layout.row(align=True)
|
||||
if md:
|
||||
@ -41,6 +43,7 @@ def physics_add(self, layout, md, name, type, typeicon, toggles):
|
||||
else:
|
||||
sub.operator("object.modifier_add", text=name, icon=typeicon).type = type
|
||||
|
||||
|
||||
class PHYSICS_PT_add(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = ""
|
||||
bl_options = {'HIDE_HEADER'}
|
||||
@ -59,17 +62,17 @@ class PHYSICS_PT_add(PhysicButtonsPanel, bpy.types.Panel):
|
||||
col.operator("object.forcefield_toggle", text="Force Field", icon='X')
|
||||
|
||||
if(ob.type == 'MESH'):
|
||||
physics_add(self, col, context.collision, "Collision", 'COLLISION', 'MOD_PHYSICS', False);
|
||||
physics_add(self, col, context.cloth, "Cloth", 'CLOTH', 'MOD_CLOTH', True);
|
||||
physics_add(self, col, context.collision, "Collision", 'COLLISION', 'MOD_PHYSICS', False)
|
||||
physics_add(self, col, context.cloth, "Cloth", 'CLOTH', 'MOD_CLOTH', True)
|
||||
|
||||
col = split.column()
|
||||
|
||||
if(ob.type == 'MESH' or ob.type == 'LATTICE'or ob.type == 'CURVE'):
|
||||
physics_add(self, col, context.soft_body, "Soft Body", 'SOFT_BODY', 'MOD_SOFT', True);
|
||||
physics_add(self, col, context.soft_body, "Soft Body", 'SOFT_BODY', 'MOD_SOFT', True)
|
||||
|
||||
if(ob.type == 'MESH'):
|
||||
physics_add(self, col, context.fluid, "Fluid", 'FLUID_SIMULATION', 'MOD_FLUIDSIM', True);
|
||||
physics_add(self, col, context.smoke, "Smoke", 'SMOKE', 'MOD_SMOKE', True);
|
||||
physics_add(self, col, context.fluid, "Fluid", 'FLUID_SIMULATION', 'MOD_FLUIDSIM', True)
|
||||
physics_add(self, col, context.smoke, "Smoke", 'SMOKE', 'MOD_SMOKE', True)
|
||||
|
||||
|
||||
#cachetype can be 'PSYS' 'HAIR' 'SMOKE' etc
|
||||
|
@ -34,6 +34,7 @@ def draw_repeat_tools(context, layout):
|
||||
col.operator("screen.repeat_last")
|
||||
col.operator("screen.repeat_history", text="History...")
|
||||
|
||||
|
||||
# Keyframing tools
|
||||
def draw_keyframing_tools(context, layout):
|
||||
col = layout.column(align=True)
|
||||
@ -42,6 +43,7 @@ def draw_keyframing_tools(context, layout):
|
||||
row.operator("anim.keyframe_insert_menu", text="Insert")
|
||||
row.operator("anim.keyframe_delete_v3d", text="Remove")
|
||||
|
||||
|
||||
# Grease Pencil tools
|
||||
def draw_gpencil_tools(context, layout):
|
||||
col = layout.column(align=True)
|
||||
|
@ -50,6 +50,12 @@ def is_pep8(path):
|
||||
print(path)
|
||||
if open(path, 'rb').read(3) == b'\xef\xbb\xbf':
|
||||
print("\nfile contains BOM, remove first 3 bytes: %r\n" % path)
|
||||
|
||||
# templates dont have a header but should be pep8
|
||||
for d in ("presets", "templates", "examples"):
|
||||
if ("%s%s%s" % (os.sep, d, os.sep)) in path:
|
||||
return 1
|
||||
|
||||
f = open(path, 'r', encoding="utf8")
|
||||
for i in range(PEP8_SEEK_COMMENT):
|
||||
line = f.readline()
|
||||
|
Loading…
Reference in New Issue
Block a user