-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathActorAxisConstraint.cs
113 lines (103 loc) · 3.51 KB
/
ActorAxisConstraint.cs
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
using System;
using System.IO;
using System.Collections.Generic;
using Nima.Math2D;
namespace Nima
{
public abstract class ActorAxisConstraint : ActorTargetedConstraint
{
protected bool m_CopyX;
protected bool m_CopyY;
protected float m_ScaleX;
protected float m_ScaleY;
protected bool m_EnableMinX;
protected bool m_EnableMinY;
protected bool m_EnableMaxX;
protected bool m_EnableMaxY;
protected float m_MaxX;
protected float m_MaxY;
protected float m_MinX;
protected float m_MinY;
protected bool m_Offset;
protected TransformSpace m_SourceSpace;
protected TransformSpace m_DestSpace;
protected TransformSpace m_MinMaxSpace;
public ActorAxisConstraint()
{
m_CopyX = false;
m_CopyY = false;
m_ScaleX = 1.0f;
m_ScaleY = 1.0f;
m_EnableMinX = false;
m_EnableMinY = false;
m_EnableMaxX = false;
m_EnableMaxY = false;
m_MinX = 0.0f;
m_MinY = 0.0f;
m_MaxX = 0.0f;
m_MaxY = 0.0f;
m_Offset = false;
m_SourceSpace = TransformSpace.World;
m_DestSpace = TransformSpace.World;
m_MinMaxSpace = TransformSpace.World;
}
public override void OnDirty(byte dirt)
{
MarkDirty();
}
public static ActorAxisConstraint Read(Actor actor, BinaryReader reader, ActorAxisConstraint component)
{
ActorTargetedConstraint.Read(actor, reader, component);
if((component.m_CopyX = reader.ReadByte() == 1))
{
component.m_ScaleX = reader.ReadSingle();
}
if((component.m_EnableMinX = reader.ReadByte() == 1))
{
component.m_MinX = reader.ReadSingle();
}
if((component.m_EnableMaxX = reader.ReadByte() == 1))
{
component.m_MaxX = reader.ReadSingle();
}
// Y Axis
if((component.m_CopyY = reader.ReadByte() == 1))
{
component.m_ScaleY = reader.ReadSingle();
}
if((component.m_EnableMinY = reader.ReadByte() == 1))
{
component.m_MinY = reader.ReadSingle();
}
if((component.m_EnableMaxY = reader.ReadByte() == 1))
{
component.m_MaxY = reader.ReadSingle();
}
component.m_Offset = reader.ReadByte() == 1;
component.m_SourceSpace = (TransformSpace)reader.ReadByte();
component.m_DestSpace = (TransformSpace)reader.ReadByte();
component.m_MinMaxSpace = (TransformSpace)reader.ReadByte();
return component;
}
public void Copy(ActorAxisConstraint node, Actor resetActor)
{
base.Copy(node, resetActor);
m_CopyX = node.m_CopyX;
m_CopyY = node.m_CopyY;
m_ScaleX = node.m_ScaleX;
m_ScaleY = node.m_ScaleY;
m_EnableMinX = node.m_EnableMinX;
m_EnableMinY = node.m_EnableMinY;
m_EnableMaxX = node.m_EnableMaxX;
m_EnableMaxY = node.m_EnableMaxY;
m_MinX = node.m_MinX;
m_MinY = node.m_MinY;
m_MaxX = node.m_MaxX;
m_MaxY = node.m_MaxY;
m_Offset = node.m_Offset;
m_SourceSpace = node.m_SourceSpace;
m_DestSpace = node.m_DestSpace;
m_MinMaxSpace = node.m_MinMaxSpace;
}
}
}