From 22cdde23489065ab1d2ed3e3bacb47d441ea8458 Mon Sep 17 00:00:00 2001 From: Colin Basnett Date: Fri, 13 Dec 2019 11:29:12 -0800 Subject: [PATCH] Formatting fixes. --- src/__init__.py | 6 ++---- src/data.py | 1 + src/psa/builder.py | 9 --------- src/psa/data.py | 1 + src/psa/operator.py | 2 +- src/psk/builder.py | 20 -------------------- src/psk/data.py | 1 - src/psk/operator.py | 2 +- 8 files changed, 6 insertions(+), 36 deletions(-) diff --git a/src/__init__.py b/src/__init__.py index b515278..84a3e4f 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -52,9 +52,8 @@ def psa_menu_func(self, context): def register(): - from bpy.utils import register_class for cls in classes: - register_class(cls) + bpy.utils.register_class(cls) bpy.types.TOPBAR_MT_file_export.append(psk_menu_func) bpy.types.TOPBAR_MT_file_export.append(psa_menu_func) bpy.types.Scene.psa_action_list = CollectionProperty(type=psa_operator.ActionListItem) @@ -66,9 +65,8 @@ def unregister(): del bpy.types.Scene.psa_action_list bpy.types.TOPBAR_MT_file_export.remove(psa_menu_func) bpy.types.TOPBAR_MT_file_export.remove(psk_menu_func) - from bpy.utils import unregister_class for cls in reversed(classes): - unregister_class(cls) + bpy.utils.unregister_class(cls) if __name__ == '__main__': diff --git a/src/data.py b/src/data.py index f695da1..91d9386 100644 --- a/src/data.py +++ b/src/data.py @@ -1,5 +1,6 @@ from ctypes import * + class Vector3(Structure): _fields_ = [ ('x', c_float), diff --git a/src/psa/builder.py b/src/psa/builder.py index 5a62a3b..699eeae 100644 --- a/src/psa/builder.py +++ b/src/psa/builder.py @@ -1,5 +1,3 @@ -import bpy -import mathutils from .data import * @@ -72,7 +70,6 @@ class PsaBuilder(object): psa.bones.append(psa_bone) - print('---- ACTIONS ----') frame_start_index = 0 for action in options.actions: @@ -88,11 +85,8 @@ class PsaBuilder(object): sequence.name = bytes(action.name, encoding='utf-8') sequence.frame_count = frame_max - frame_min + 1 sequence.frame_start_index = frame_start_index - print(frame_start_index) sequence.fps = 30 # TODO: fill in later with r - print(action.name, frame_min, frame_max) - frame_count = frame_max - frame_min + 1 for frame in range(frame_count): @@ -110,9 +104,6 @@ class PsaBuilder(object): location = pose_bone_matrix.to_translation() rotation = pose_bone_matrix.to_quaternion().normalized() - if action.name == 'shoot_open' and bone.name == 'barrel': - print(location) - if bone.parent is not None: rotation.x = -rotation.x rotation.y = -rotation.y diff --git a/src/psa/data.py b/src/psa/data.py index e9a4a6d..adf744d 100644 --- a/src/psa/data.py +++ b/src/psa/data.py @@ -1,6 +1,7 @@ from typing import List from ..data import * + class Psa(object): class Bone(Structure): diff --git a/src/psa/operator.py b/src/psa/operator.py index 4dd7a96..227e7a1 100644 --- a/src/psa/operator.py +++ b/src/psa/operator.py @@ -1,6 +1,6 @@ from bpy.types import Operator, Action, UIList, PropertyGroup from bpy_extras.io_utils import ExportHelper -from bpy.props import StringProperty, BoolProperty, FloatProperty, CollectionProperty, PointerProperty +from bpy.props import StringProperty, BoolProperty, CollectionProperty, PointerProperty from .builder import PsaBuilder, PsaBuilderOptions from .exporter import PsaExporter import bpy diff --git a/src/psk/builder.py b/src/psk/builder.py index 4eaecda..10a083a 100644 --- a/src/psk/builder.py +++ b/src/psk/builder.py @@ -3,26 +3,6 @@ import bmesh from .data import * -# TODO: move to another file -def make_fquat(bquat): - quat = Quaternion() - # flip handedness for UT = set x,y,z to negative (rotate in other direction) - quat.x = -bquat.x - quat.y = -bquat.y - quat.z = -bquat.z - quat.w = bquat.w - return quat - - -def make_fquat_default(bquat): - quat = Quaternion() - quat.x = bquat.x - quat.y = bquat.y - quat.z = bquat.z - quat.w = bquat.w - return quat - - class PskBuilder(object): def __init__(self): # TODO: add options in here diff --git a/src/psk/data.py b/src/psk/data.py index 5d4c8d1..cf8d545 100644 --- a/src/psk/data.py +++ b/src/psk/data.py @@ -63,7 +63,6 @@ class Psk(object): ('bone_index', c_int32), ] - def __init__(self): self.points: List[Vector3] = [] self.wedges: List[Psk.Wedge16] = [] diff --git a/src/psk/operator.py b/src/psk/operator.py index 7075ceb..e68c24e 100644 --- a/src/psk/operator.py +++ b/src/psk/operator.py @@ -10,7 +10,7 @@ class PskExportOperator(Operator, ExportHelper): bl_label = 'Export' __doc__ = 'PSK Exporter (.psk)' filename_ext = '.psk' - filter_glob : StringProperty(default='*.psk', options={'HIDDEN'}) + filter_glob: StringProperty(default='*.psk', options={'HIDDEN'}) filepath : StringProperty( name='File Path',