1
0
mirror of https://github.com/DarklightGames/io_scene_psk_psa.git synced 2024-11-15 02:37:39 +01:00

Formatting fixes.

This commit is contained in:
Colin Basnett 2019-12-13 11:29:12 -08:00
parent 3001501006
commit 22cdde2348
8 changed files with 6 additions and 36 deletions

View File

@ -52,9 +52,8 @@ def psa_menu_func(self, context):
def register(): def register():
from bpy.utils import register_class
for cls in classes: 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(psk_menu_func)
bpy.types.TOPBAR_MT_file_export.append(psa_menu_func) bpy.types.TOPBAR_MT_file_export.append(psa_menu_func)
bpy.types.Scene.psa_action_list = CollectionProperty(type=psa_operator.ActionListItem) bpy.types.Scene.psa_action_list = CollectionProperty(type=psa_operator.ActionListItem)
@ -66,9 +65,8 @@ def unregister():
del bpy.types.Scene.psa_action_list del bpy.types.Scene.psa_action_list
bpy.types.TOPBAR_MT_file_export.remove(psa_menu_func) bpy.types.TOPBAR_MT_file_export.remove(psa_menu_func)
bpy.types.TOPBAR_MT_file_export.remove(psk_menu_func) bpy.types.TOPBAR_MT_file_export.remove(psk_menu_func)
from bpy.utils import unregister_class
for cls in reversed(classes): for cls in reversed(classes):
unregister_class(cls) bpy.utils.unregister_class(cls)
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -1,5 +1,6 @@
from ctypes import * from ctypes import *
class Vector3(Structure): class Vector3(Structure):
_fields_ = [ _fields_ = [
('x', c_float), ('x', c_float),

View File

@ -1,5 +1,3 @@
import bpy
import mathutils
from .data import * from .data import *
@ -72,7 +70,6 @@ class PsaBuilder(object):
psa.bones.append(psa_bone) psa.bones.append(psa_bone)
print('---- ACTIONS ----')
frame_start_index = 0 frame_start_index = 0
for action in options.actions: for action in options.actions:
@ -88,11 +85,8 @@ class PsaBuilder(object):
sequence.name = bytes(action.name, encoding='utf-8') sequence.name = bytes(action.name, encoding='utf-8')
sequence.frame_count = frame_max - frame_min + 1 sequence.frame_count = frame_max - frame_min + 1
sequence.frame_start_index = frame_start_index sequence.frame_start_index = frame_start_index
print(frame_start_index)
sequence.fps = 30 # TODO: fill in later with r sequence.fps = 30 # TODO: fill in later with r
print(action.name, frame_min, frame_max)
frame_count = frame_max - frame_min + 1 frame_count = frame_max - frame_min + 1
for frame in range(frame_count): for frame in range(frame_count):
@ -110,9 +104,6 @@ class PsaBuilder(object):
location = pose_bone_matrix.to_translation() location = pose_bone_matrix.to_translation()
rotation = pose_bone_matrix.to_quaternion().normalized() rotation = pose_bone_matrix.to_quaternion().normalized()
if action.name == 'shoot_open' and bone.name == 'barrel':
print(location)
if bone.parent is not None: if bone.parent is not None:
rotation.x = -rotation.x rotation.x = -rotation.x
rotation.y = -rotation.y rotation.y = -rotation.y

View File

@ -1,6 +1,7 @@
from typing import List from typing import List
from ..data import * from ..data import *
class Psa(object): class Psa(object):
class Bone(Structure): class Bone(Structure):

View File

@ -1,6 +1,6 @@
from bpy.types import Operator, Action, UIList, PropertyGroup from bpy.types import Operator, Action, UIList, PropertyGroup
from bpy_extras.io_utils import ExportHelper 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 .builder import PsaBuilder, PsaBuilderOptions
from .exporter import PsaExporter from .exporter import PsaExporter
import bpy import bpy

View File

@ -3,26 +3,6 @@ import bmesh
from .data import * 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): class PskBuilder(object):
def __init__(self): def __init__(self):
# TODO: add options in here # TODO: add options in here

View File

@ -63,7 +63,6 @@ class Psk(object):
('bone_index', c_int32), ('bone_index', c_int32),
] ]
def __init__(self): def __init__(self):
self.points: List[Vector3] = [] self.points: List[Vector3] = []
self.wedges: List[Psk.Wedge16] = [] self.wedges: List[Psk.Wedge16] = []

View File

@ -10,7 +10,7 @@ class PskExportOperator(Operator, ExportHelper):
bl_label = 'Export' bl_label = 'Export'
__doc__ = 'PSK Exporter (.psk)' __doc__ = 'PSK Exporter (.psk)'
filename_ext = '.psk' filename_ext = '.psk'
filter_glob : StringProperty(default='*.psk', options={'HIDDEN'}) filter_glob: StringProperty(default='*.psk', options={'HIDDEN'})
filepath : StringProperty( filepath : StringProperty(
name='File Path', name='File Path',