Cleanup: pep8 (indentation, spacing, long lines)
This commit is contained in:
@@ -592,7 +592,10 @@ class CustomPropertiesExportTest(AbstractAlembicTest):
|
||||
|
||||
def _run_export(self, tempdir: pathlib.Path) -> pathlib.Path:
|
||||
abc = tempdir / 'custom-properties.abc'
|
||||
script = "import bpy; bpy.context.scene.frame_set(1); bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1)" % abc.as_posix()
|
||||
script = (
|
||||
"import bpy; bpy.context.scene.frame_set(1); "
|
||||
"bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1)" % abc.as_posix()
|
||||
)
|
||||
self.run_blender('custom-properties.blend', script)
|
||||
return abc
|
||||
|
||||
|
@@ -150,10 +150,20 @@ def main():
|
||||
|
||||
# Example background utility, add some text and renders or saves it (with options)
|
||||
# Possible types are: string, int, long, choice, float and complex.
|
||||
parser.add_option("-o", "--operator", dest="operator", help="This text will be used to render an image", type="string")
|
||||
parser.add_option(
|
||||
"-o",
|
||||
"--operator",
|
||||
dest="operator",
|
||||
help="This text will be used to render an image",
|
||||
type="string")
|
||||
parser.add_option("-p", "--path", dest="path", help="Path to use for searching for files", type='string')
|
||||
parser.add_option("-m", "--match", dest="match", help="Wildcard to match filename", type="string")
|
||||
parser.add_option("-s", "--save_path", dest="save_path", help="Save the input file to a blend file in a new location", metavar='string')
|
||||
parser.add_option(
|
||||
"-s",
|
||||
"--save_path",
|
||||
dest="save_path",
|
||||
help="Save the input file to a blend file in a new location",
|
||||
metavar='string')
|
||||
parser.add_option("-S", "--start", dest="start", help="From collected files, start with this index", metavar='int')
|
||||
parser.add_option("-E", "--end", dest="end", help="From collected files, end with this index", metavar='int')
|
||||
|
||||
|
@@ -313,13 +313,13 @@ class CameraExportImportTest(unittest.TestCase):
|
||||
self.loc_rot_scale('CAM_Unit_Transform', (0, 0, 0), (0, 0, 0))
|
||||
|
||||
self.loc_rot_scale('CAM_Look_+Y', (2, 0, 0), (90, 0, 0))
|
||||
self.loc_rot_scale('CAM_Static_Child_Left', (2-0.15, 0, 0), (90, 0, 0))
|
||||
self.loc_rot_scale('CAM_Static_Child_Right', (2+0.15, 0, 0), (90, 0, 0))
|
||||
self.loc_rot_scale('CAM_Static_Child_Left', (2 - 0.15, 0, 0), (90, 0, 0))
|
||||
self.loc_rot_scale('CAM_Static_Child_Right', (2 + 0.15, 0, 0), (90, 0, 0))
|
||||
self.loc_rot_scale('Static_Child', (2, 0, 1), (90, 0, 0))
|
||||
|
||||
self.loc_rot_scale('CAM_Animated', (4, 0, 0), (90, 0, 0))
|
||||
self.loc_rot_scale('CAM_Animated_Child_Left', (4-0.15, 0, 0), (90, 0, 0))
|
||||
self.loc_rot_scale('CAM_Animated_Child_Right', (4+0.15, 0, 0), (90, 0, 0))
|
||||
self.loc_rot_scale('CAM_Animated_Child_Left', (4 - 0.15, 0, 0), (90, 0, 0))
|
||||
self.loc_rot_scale('CAM_Animated_Child_Right', (4 + 0.15, 0, 0), (90, 0, 0))
|
||||
self.loc_rot_scale('Animated_Child', (4, 0, 1), (90, 0, 0))
|
||||
|
||||
bpy.context.scene.frame_set(10)
|
||||
|
@@ -39,38 +39,38 @@ class FCurveEvaluationTest(unittest.TestCase):
|
||||
'Test dir %s should exist' % self.testdir)
|
||||
|
||||
def test_fcurve_versioning_291(self):
|
||||
# See D8752.
|
||||
bpy.ops.wm.open_mainfile(filepath=str(self.testdir / "fcurve-versioning-291.blend"))
|
||||
cube = bpy.data.objects['Cube']
|
||||
fcurve = cube.animation_data.action.fcurves.find('location', index=0)
|
||||
# See D8752.
|
||||
bpy.ops.wm.open_mainfile(filepath=str(self.testdir / "fcurve-versioning-291.blend"))
|
||||
cube = bpy.data.objects['Cube']
|
||||
fcurve = cube.animation_data.action.fcurves.find('location', index=0)
|
||||
|
||||
self.assertAlmostEqual(0.0, fcurve.evaluate(1))
|
||||
self.assertAlmostEqual(0.019638698548078537, fcurve.evaluate(2))
|
||||
self.assertAlmostEqual(0.0878235399723053, fcurve.evaluate(3))
|
||||
self.assertAlmostEqual(0.21927043795585632, fcurve.evaluate(4))
|
||||
self.assertAlmostEqual(0.41515052318573, fcurve.evaluate(5))
|
||||
self.assertAlmostEqual(0.6332430243492126, fcurve.evaluate(6))
|
||||
self.assertAlmostEqual(0.8106040954589844, fcurve.evaluate(7))
|
||||
self.assertAlmostEqual(0.924369215965271, fcurve.evaluate(8))
|
||||
self.assertAlmostEqual(0.9830065965652466, fcurve.evaluate(9))
|
||||
self.assertAlmostEqual(1.0, fcurve.evaluate(10))
|
||||
self.assertAlmostEqual(0.0, fcurve.evaluate(1))
|
||||
self.assertAlmostEqual(0.019638698548078537, fcurve.evaluate(2))
|
||||
self.assertAlmostEqual(0.0878235399723053, fcurve.evaluate(3))
|
||||
self.assertAlmostEqual(0.21927043795585632, fcurve.evaluate(4))
|
||||
self.assertAlmostEqual(0.41515052318573, fcurve.evaluate(5))
|
||||
self.assertAlmostEqual(0.6332430243492126, fcurve.evaluate(6))
|
||||
self.assertAlmostEqual(0.8106040954589844, fcurve.evaluate(7))
|
||||
self.assertAlmostEqual(0.924369215965271, fcurve.evaluate(8))
|
||||
self.assertAlmostEqual(0.9830065965652466, fcurve.evaluate(9))
|
||||
self.assertAlmostEqual(1.0, fcurve.evaluate(10))
|
||||
|
||||
def test_fcurve_extreme_handles(self):
|
||||
# See D8752.
|
||||
bpy.ops.wm.open_mainfile(filepath=str(self.testdir / "fcurve-extreme-handles.blend"))
|
||||
cube = bpy.data.objects['Cube']
|
||||
fcurve = cube.animation_data.action.fcurves.find('location', index=0)
|
||||
# See D8752.
|
||||
bpy.ops.wm.open_mainfile(filepath=str(self.testdir / "fcurve-extreme-handles.blend"))
|
||||
cube = bpy.data.objects['Cube']
|
||||
fcurve = cube.animation_data.action.fcurves.find('location', index=0)
|
||||
|
||||
self.assertAlmostEqual(0.0, fcurve.evaluate(1))
|
||||
self.assertAlmostEqual(0.004713400732725859, fcurve.evaluate(2))
|
||||
self.assertAlmostEqual(0.022335870191454887, fcurve.evaluate(3))
|
||||
self.assertAlmostEqual(0.06331237405538559, fcurve.evaluate(4))
|
||||
self.assertAlmostEqual(0.16721539199352264, fcurve.evaluate(5))
|
||||
self.assertAlmostEqual(0.8327845335006714, fcurve.evaluate(6))
|
||||
self.assertAlmostEqual(0.9366875886917114, fcurve.evaluate(7))
|
||||
self.assertAlmostEqual(0.9776642322540283, fcurve.evaluate(8))
|
||||
self.assertAlmostEqual(0.9952865839004517, fcurve.evaluate(9))
|
||||
self.assertAlmostEqual(1.0, fcurve.evaluate(10))
|
||||
self.assertAlmostEqual(0.0, fcurve.evaluate(1))
|
||||
self.assertAlmostEqual(0.004713400732725859, fcurve.evaluate(2))
|
||||
self.assertAlmostEqual(0.022335870191454887, fcurve.evaluate(3))
|
||||
self.assertAlmostEqual(0.06331237405538559, fcurve.evaluate(4))
|
||||
self.assertAlmostEqual(0.16721539199352264, fcurve.evaluate(5))
|
||||
self.assertAlmostEqual(0.8327845335006714, fcurve.evaluate(6))
|
||||
self.assertAlmostEqual(0.9366875886917114, fcurve.evaluate(7))
|
||||
self.assertAlmostEqual(0.9776642322540283, fcurve.evaluate(8))
|
||||
self.assertAlmostEqual(0.9952865839004517, fcurve.evaluate(9))
|
||||
self.assertAlmostEqual(1.0, fcurve.evaluate(10))
|
||||
|
||||
|
||||
def main():
|
||||
|
@@ -46,7 +46,7 @@ class TestBlendFileSaveLoadBasic(TestHelper):
|
||||
|
||||
TESTS = (
|
||||
TestBlendFileSaveLoadBasic,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def argparse_create():
|
||||
|
@@ -44,7 +44,7 @@ class TestBlendLibLinkSaveLoadBasic(TestHelper):
|
||||
|
||||
TESTS = (
|
||||
TestBlendLibLinkSaveLoadBasic,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def argparse_create():
|
||||
|
@@ -15,7 +15,7 @@ class TestHelper:
|
||||
@classmethod
|
||||
def blender_data_to_tuple(cls, bdata, pprint_name=None):
|
||||
ret = sorted(tuple((cls.id_to_uid(k), sorted(tuple(cls.id_to_uid(vv) for vv in v)))
|
||||
for k, v in bdata.user_map().items()))
|
||||
for k, v in bdata.user_map().items()))
|
||||
if pprint_name is not None:
|
||||
print("\n%s:" % pprint_name)
|
||||
pprint.pprint(ret)
|
||||
|
@@ -85,7 +85,7 @@ class AbstractConstraintTests(unittest.TestCase):
|
||||
actual = self.bone_matrix(object_name, bone_name)
|
||||
self.assert_matrix(actual, expect, object_name)
|
||||
|
||||
def constraint_context(self, constraint_name: str, owner_name: str='') -> dict:
|
||||
def constraint_context(self, constraint_name: str, owner_name: str = '') -> dict:
|
||||
"""Return a context suitable for calling object constraint operators.
|
||||
|
||||
Assumes the owner is called "{constraint_name}.owner" if owner_name=''.
|
||||
@@ -100,7 +100,7 @@ class AbstractConstraintTests(unittest.TestCase):
|
||||
}
|
||||
return context
|
||||
|
||||
def bone_constraint_context(self, constraint_name: str, owner_name: str='', bone_name: str='') -> dict:
|
||||
def bone_constraint_context(self, constraint_name: str, owner_name: str = '', bone_name: str = '') -> dict:
|
||||
"""Return a context suitable for calling bone constraint operators.
|
||||
|
||||
Assumes the owner's object is called "{constraint_name}.owner" if owner_name=''.
|
||||
|
@@ -503,7 +503,7 @@ def main():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# ~ for i in range(200):
|
||||
# ~ RANDOM_SEED[0] += 1
|
||||
#~ main()
|
||||
# for i in range(200):
|
||||
# RANDOM_SEED[0] += 1
|
||||
# main()
|
||||
main()
|
||||
|
@@ -43,13 +43,13 @@ def setup():
|
||||
# Simple probe setup
|
||||
bpy.ops.object.lightprobe_add(type='CUBEMAP', location=(0.5, 0, 1.5))
|
||||
cubemap = bpy.context.selected_objects[0]
|
||||
cubemap.scale = (2.5,2.5,1.0)
|
||||
cubemap.scale = (2.5, 2.5, 1.0)
|
||||
cubemap.data.falloff = 0
|
||||
cubemap.data.clip_start = 2.4
|
||||
|
||||
bpy.ops.object.lightprobe_add(type='GRID', location=(0, 0, 0.25))
|
||||
grid = bpy.context.selected_objects[0]
|
||||
grid.scale = (1.735,1.735,1.735)
|
||||
grid.scale = (1.735, 1.735, 1.735)
|
||||
grid.data.grid_resolution_x = 3
|
||||
grid.data.grid_resolution_y = 3
|
||||
grid.data.grid_resolution_z = 2
|
||||
|
@@ -22,7 +22,7 @@ def _write_html(output_dir):
|
||||
filepath = os.path.join(output_dir, filename)
|
||||
combined_reports += pathlib.Path(filepath).read_text()
|
||||
|
||||
combined_reports += "<br/>\n";
|
||||
combined_reports += "<br/>\n"
|
||||
|
||||
html = """
|
||||
<html>
|
||||
@@ -67,7 +67,7 @@ def add(output_dir, category, name, filepath, failed=None):
|
||||
name=name,
|
||||
filepath=filepath)
|
||||
|
||||
dirpath = os.path.join(output_dir, "report", category);
|
||||
dirpath = os.path.join(output_dir, "report", category)
|
||||
os.makedirs(dirpath, exist_ok=True)
|
||||
filepath = os.path.join(dirpath, name + ".data")
|
||||
pathlib.Path(filepath).write_text(html)
|
||||
|
@@ -128,7 +128,14 @@ class MeshTest:
|
||||
the public method run_test().
|
||||
"""
|
||||
|
||||
def __init__(self, test_object_name: str, expected_object_name: str, operations_stack=None, apply_modifiers=False, threshold=None):
|
||||
def __init__(
|
||||
self,
|
||||
test_object_name: str,
|
||||
expected_object_name: str,
|
||||
operations_stack=None,
|
||||
apply_modifiers=False,
|
||||
threshold=None,
|
||||
):
|
||||
"""
|
||||
Constructs a MeshTest object. Raises a KeyError if objects with names expected_object_name
|
||||
or test_object_name don't exist.
|
||||
@@ -259,7 +266,6 @@ class MeshTest:
|
||||
if self.apply_modifier:
|
||||
bpy.ops.object.modifier_apply(modifier=modifier_spec.modifier_name)
|
||||
|
||||
|
||||
def _bake_current_simulation(self, obj, test_mod_type, test_mod_name, frame_end):
|
||||
for scene in bpy.data.scenes:
|
||||
for modifier in obj.modifiers:
|
||||
@@ -296,11 +302,15 @@ class MeshTest:
|
||||
|
||||
scene.frame_set(physics_spec.frame_end + 1)
|
||||
|
||||
self._bake_current_simulation(test_object, physics_spec.modifier_type, physics_spec.modifier_name, physics_spec.frame_end)
|
||||
self._bake_current_simulation(
|
||||
test_object,
|
||||
physics_spec.modifier_type,
|
||||
physics_spec.modifier_name,
|
||||
physics_spec.frame_end,
|
||||
)
|
||||
if self.apply_modifier:
|
||||
bpy.ops.object.modifier_apply(modifier=physics_spec.modifier_name)
|
||||
|
||||
|
||||
def _apply_operator(self, test_object, operator: OperatorSpec):
|
||||
"""
|
||||
Apply operator on test object.
|
||||
|
@@ -31,7 +31,7 @@ COLORS = COLORS_DUMMY
|
||||
|
||||
# NOTE: Keep everything lowercase.
|
||||
BLACKLIST = (
|
||||
# 'file_to_blacklist.blend',
|
||||
# 'file_to_blacklist.blend',
|
||||
)
|
||||
|
||||
|
||||
|
@@ -146,7 +146,7 @@ def main():
|
||||
"expectedCubeInsetDepth", "inset", {"thickness": 0.2, "depth": 0.2}],
|
||||
["FACE", {35, 36, 37, 45, 46, 47, 55, 56, 57}, "testGridInsetRelativeOffset", "expectedGridInsetRelativeOffset",
|
||||
"inset", {"thickness": 0.4, "use_relative_offset": True}],
|
||||
]
|
||||
]
|
||||
|
||||
operators_test = OperatorTest(tests)
|
||||
|
||||
|
@@ -164,7 +164,8 @@ class TestMArray(unittest.TestCase):
|
||||
|
||||
def test_assign_item(self):
|
||||
# arr[i] = x
|
||||
for arr, func in zip(("fmarr", "imarr", "bmarr", "fdmarr", "idmarr", "bdmarr"), (rand_float, rand_int, rand_bool) * 2):
|
||||
for arr, func in zip(("fmarr", "imarr", "bmarr", "fdmarr", "idmarr", "bdmarr"),
|
||||
(rand_float, rand_int, rand_bool) * 2):
|
||||
rval = make_random_2d_array((4, 5), func)
|
||||
|
||||
for i in range(3):
|
||||
@@ -172,7 +173,8 @@ class TestMArray(unittest.TestCase):
|
||||
self.assertEqual(prop_to_list(getattr(test, arr)[i]), rval)
|
||||
|
||||
# arr[i][j] = x
|
||||
for arr, func in zip(("fmarr", "imarr", "bmarr", "fdmarr", "idmarr", "bdmarr"), (rand_float, rand_int, rand_bool) * 2):
|
||||
for arr, func in zip(("fmarr", "imarr", "bmarr", "fdmarr", "idmarr", "bdmarr"),
|
||||
(rand_float, rand_int, rand_bool) * 2):
|
||||
|
||||
arr = getattr(test, arr)
|
||||
rval = make_random_array(5, func)
|
||||
@@ -283,7 +285,10 @@ def prop_to_list(prop):
|
||||
|
||||
|
||||
def suite():
|
||||
return unittest.TestSuite([unittest.TestLoader().loadTestsFromTestCase(TestArray), unittest.TestLoader().loadTestsFromTestCase(TestMArray)])
|
||||
return unittest.TestSuite([
|
||||
unittest.TestLoader().loadTestsFromTestCase(TestArray),
|
||||
unittest.TestLoader().loadTestsFromTestCase(TestMArray),
|
||||
])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@@ -81,7 +81,10 @@ def api_dump(use_properties=True, use_functions=True):
|
||||
|
||||
for prop in v.properties:
|
||||
if prop.collection_type:
|
||||
funcs = [(prop.identifier + "." + func.identifier, func) for func in prop.collection_type.functions]
|
||||
funcs = [
|
||||
(prop.identifier + "." + func.identifier, func)
|
||||
for func in prop.collection_type.functions
|
||||
]
|
||||
for func_id, func in funcs:
|
||||
data.append(func_to_str(struct_id_str, func_id, func))
|
||||
data.sort()
|
||||
@@ -100,7 +103,10 @@ def api_dump(use_properties=True, use_functions=True):
|
||||
|
||||
for prop in v.properties:
|
||||
if prop.collection_type:
|
||||
props = [(prop.identifier + "." + prop_sub.identifier, prop_sub) for prop_sub in prop.collection_type.properties]
|
||||
props = [
|
||||
(prop.identifier + "." + prop_sub.identifier, prop_sub)
|
||||
for prop_sub in prop.collection_type.properties
|
||||
]
|
||||
for prop_sub_id, prop_sub in props:
|
||||
data.append(prop_to_str(struct_id_str, prop_sub_id, prop_sub))
|
||||
data.sort()
|
||||
|
Reference in New Issue
Block a user