-
Notifications
You must be signed in to change notification settings - Fork 6
/
GLLPoseExporter.m
54 lines (39 loc) · 1.14 KB
/
GLLPoseExporter.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// GLLPoseExporter.m
// GLLara
//
// Created by Torsten Kammer on 31.01.13.
// Copyright (c) 2013 Torsten Kammer. All rights reserved.
//
#import "GLLPoseExporter.h"
#import "GLLItem.h"
#import "GLLItemBone.h"
#import "GLLModelBone.h"
@interface GLLPoseExporter ()
@property (nonatomic) id bonesList;
@end
@implementation GLLPoseExporter
- (instancetype)initWithItem:(GLLItem *)item
{
NSParameterAssert(item);
return [self initWithBones:item.combinedBones];
}
- (instancetype)initWithBones:(id)bones
{
NSParameterAssert(bones);
if (!(self = [super init])) return nil;
self.bonesList = bones;
return self;
}
- (NSString *)poseDescription
{
NSMutableString *string = [[NSMutableString alloc] init];
for (GLLItemBone *bone in self.bonesList)
{
if (self.skipUnused && [bone.bone.name hasPrefix:@"unused"])
continue;
[string appendFormat:@"%@: %f %f %f %f %f %f\r\n", bone.bone.name, bone.rotationX * 180.0 / M_PI, bone.rotationY * 180.0 / M_PI, bone.rotationZ * 180.0 / M_PI, bone.positionX, bone.positionY, bone.positionZ];
}
return [string copy];
}
@end