📄 mfkey.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "MFKey"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
'*************************************************************************
'FUNCTION: holds an array of animation keys
'AUTHOR: edx - edx@hk.super.net, Oct 98 - all rights reserved
'HISTORY: -
'NOTES: - this class is used to hold key data.
'This field is a child of a node of one of the following types:
'POS_TRACK_TAG
'ROT_TRACK_TAG:
'SCL_TRACK_TAG:
'MORPH_TRACK_TAG:
'HIDE_TRACK_TAG:
'*************************************************************************
'this struct is used to hold the animation key's data
Private Type Key3DS
'key header
FrameNumber As Long
Spline As Integer
'these values may or may not be present
Tension As Single
Continuity As Single
Bias As Single
EaseTo As Single
EaseFrom As Single
'data
'one or more of the following, depending on type of key
'pos - x,y,z
x As Single 'hide - z
y As Single
z As Single
Angle As Single 'rot - x,y,z,angle
Name As String 'morph???
End Type
Public ID&
Public ChunkID%
Public Parent As CNode
Dim m_Count&
Dim m_Values() As Key3DS
Public TreeNode As Node
Private Sub Class_Initialize()
'
End Sub
Private Sub Class_Terminate()
'
End Sub
'----------------------------------------------------------------------------
'you must set the count before adding values to this class.
'----------------------------------------------------------------------------
Public Property Get Count&()
Count = m_Count
End Property
Public Property Let Count(ByVal NewValue&)
If NewValue > 0 Then
ReDim m_Values(0 To NewValue - 1)
m_Count = NewValue
Else
ReDim m_Values(0 To 0)
m_Count = 0
End If
End Property
'----------------------------------------------------------------------------
'key header properties
'----------------------------------------------------------------------------
Public Property Let FrameNum(Index&, NewValue&)
If Index > m_Count Then
Debug.Assert 0
ReDim Preserve m_Values(0 To Index)
m_Count = Index + 1
End If
m_Values(Index).FrameNumber = NewValue
End Property
Public Property Get FrameNum&(Index&)
FrameNum = m_Values(Index).FrameNumber
End Property
'----------------------------------------------------------------------------
Public Property Let Spline(Index&, NewValue%)
If Index > m_Count Then
Debug.Assert 0
ReDim Preserve m_Values(0 To Index)
m_Count = Index + 1
End If
m_Values(Index).Spline = NewValue
End Property
Public Property Get Spline%(Index&)
Spline = m_Values(Index).Spline
End Property
'----------------------------------------------------------------------------
Public Property Let Tension(Index&, NewValue!)
If Index > m_Count Then
Debug.Assert 0
ReDim Preserve m_Values(0 To Index)
m_Count = Index + 1
End If
m_Values(Index).Tension = NewValue
End Property
Public Property Get Tension!(Index&)
Tension = m_Values(Index).Tension
End Property
'----------------------------------------------------------------------------
Public Property Let Continuity(Index&, NewValue!)
If Index > m_Count Then
Debug.Assert 0
ReDim Preserve m_Values(0 To Index)
m_Count = Index + 1
End If
m_Values(Index).Continuity = NewValue
End Property
Public Property Get Continuity!(Index&)
Continuity = m_Values(Index).Continuity
End Property
'----------------------------------------------------------------------------
Public Property Let Bias(Index&, NewValue!)
If Index > m_Count Then
Debug.Assert 0
ReDim Preserve m_Values(0 To Index)
m_Count = Index + 1
End If
m_Values(Index).Bias = NewValue
End Property
Public Property Get Bias!(Index&)
Bias = m_Values(Index).Bias
End Property
'----------------------------------------------------------------------------
Public Property Let EaseTo(Index&, NewValue!)
If Index > m_Count Then
Debug.Assert 0
ReDim Preserve m_Values(0 To Index)
m_Count = Index + 1
End If
m_Values(Index).EaseTo = NewValue
End Property
Public Property Get EaseTo!(Index&)
EaseTo = m_Values(Index).EaseTo
End Property
'----------------------------------------------------------------------------
Public Property Let EaseFrom(Index&, NewValue!)
If Index > m_Count Then
Debug.Assert 0
ReDim Preserve m_Values(0 To Index)
m_Count = Index + 1
End If
m_Values(Index).EaseFrom = NewValue
End Property
Public Property Get EaseFrom!(Index&)
EaseFrom = m_Values(Index).EaseFrom
End Property
'----------------------------------------------------------------------------
'data properties
'----------------------------------------------------------------------------
Public Property Let x(Index&, NewValue!)
If Index > m_Count Then
Debug.Assert 0
ReDim Preserve m_Values(0 To Index)
m_Count = Index + 1
End If
m_Values(Index).x = NewValue
End Property
Public Property Get x!(Index&)
x = m_Values(Index).x
End Property
'----------------------------------------------------------------------------
Public Property Let y(Index&, NewValue!)
If Index > m_Count Then
Debug.Assert 0
ReDim Preserve m_Values(0 To Index)
m_Count = Index + 1
End If
m_Values(Index).y = NewValue
End Property
Public Property Get y!(Index&)
y = m_Values(Index).y
End Property
'----------------------------------------------------------------------------
Public Property Let z(Index&, NewValue!)
If Index > m_Count Then
Debug.Assert 0
ReDim Preserve m_Values(0 To Index)
m_Count = Index + 1
End If
m_Values(Index).z = NewValue
End Property
Public Property Get z!(Index&)
z = m_Values(Index).z
End Property
'----------------------------------------------------------------------------
Public Property Let Angle(Index&, NewValue!)
If Index > m_Count Then
Debug.Assert 0
ReDim Preserve m_Values(0 To Index)
m_Count = Index + 1
End If
m_Values(Index).Angle = NewValue
End Property
Public Property Get Angle!(Index&)
Angle = m_Values(Index).Angle
End Property
'----------------------------------------------------------------------------
Public Sub SetXYZ(Index&, v!(), Optional Angle! = 0)
m_Values(Index).x = v(0)
m_Values(Index).y = v(1)
m_Values(Index).z = v(2)
m_Values(Index).Angle = Angle
End Sub
Public Property Let Name(Index&, NewValue$)
If Index > m_Count Then
Debug.Assert 0
ReDim Preserve m_Values(0 To Index)
m_Count = Index + 1
End If
m_Values(Index).Name = NewValue
End Property
'----------------------------------------------------------------------------
Public Property Get Name$(Index&)
Name = m_Values(Index).Name
End Property
'----------------------------------------------------------------------------
'add this object and all the keys to the treeview
'----------------------------------------------------------------------------
Public Sub FillTree()
Dim ParentNode As Node, i&, s$
Dim MyNode As Node
s = ChunkName(ChunkID)
Set ParentNode = Parent.TreeNode
With frmMain.TV1.Nodes
Set MyNode = .Add(ParentNode, tvwChild, , s, IMG_FILM)
If m_Count Then
Select Case Parent.ChunkID
Case POS_TRACK_TAG, SCL_TRACK_TAG, COL_TRACK_TAG
For i = 0 To m_Count - 1
s = m_Values(i).x & ", " & m_Values(i).y & ", " & m_Values(i).z
.Add MyNode, tvwChild, , s, IMG_FIELD
Next
Case ROT_TRACK_TAG:
For i = 0 To m_Count - 1
s = m_Values(i).x & ", " & m_Values(i).y & ", " & m_Values(i).z & ", " & m_Values(i).Angle
.Add MyNode, tvwChild, , s, IMG_FIELD
Next
Case MORPH_TRACK_TAG:
For i = 0 To m_Count - 1
s = m_Values(i).Name
.Add MyNode, tvwChild, , s, IMG_FIELD
Next
Case HIDE_TRACK_TAG, FOV_TRACK_TAG, ROLL_TRACK_TAG, HOT_TRACK_TAG, FALL_TRACK_TAG
For i = 0 To m_Count - 1
s = m_Values(i).x
.Add MyNode, tvwChild, , s, IMG_FIELD
Next
Case Else:
Debug.Assert 0
Debug.Print ChunkName(ChunkID)
End Select
End If
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -