Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nifplg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Grant Kim
nifplg
Commits
14f77735
Commit
14f77735
authored
17 years ago
by
Tazpn
Browse files
Options
Downloads
Patches
Plain Diff
Add support for Freedom Force Animation
parent
85815ab3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
NifImport/ImportAnimation.cpp
+23
-0
23 additions, 0 deletions
NifImport/ImportAnimation.cpp
NifImport/KFImporter.cpp
+47
-2
47 additions, 2 deletions
NifImport/KFImporter.cpp
with
70 additions
and
2 deletions
NifImport/ImportAnimation.cpp
+
23
−
0
View file @
14f77735
...
...
@@ -588,6 +588,29 @@ bool KFMImporter::ImportAnimation()
}
}
}
else
if
(
strmatch
(
type
,
"NiKeyframeController"
))
{
Control
*
c
=
ai
.
GetTMController
(
name
);
if
(
NULL
==
c
)
continue
;
INode
*
n
=
gi
->
GetINodeByName
(
name
.
c_str
());
if
((
*
lnk
).
priority_
!=
0.0
f
)
{
npSetProp
(
n
,
NP_ANM_PRI
,
(
*
lnk
).
priority_
);
}
NiKeyframeDataRef
data
;
Point3
p
;
Quat
q
;
float
s
;
if
(
ai
.
GetTransformData
(
*
lnk
,
name
,
data
,
p
,
q
,
s
))
{
PosRotScaleNode
(
n
,
p
,
q
,
s
,
prsDefault
,
0
);
if
(
ai
.
AddValues
(
c
,
data
,
time
))
{
minTime
=
min
(
minTime
,
start
);
maxTime
=
max
(
maxTime
,
stop
);
ok
=
true
;
}
}
}
}
if
(
maxTime
>
minTime
&&
maxTime
>
0.0
f
)
time
+=
(
maxTime
-
minTime
)
+
FramesIncrement
;
...
...
This diff is collapsed.
Click to expand it.
NifImport/KFImporter.cpp
+
47
−
2
View file @
14f77735
...
...
@@ -2,6 +2,10 @@
#include
"KFImporter.h"
#include
<kfm.h>
#include
"gen/ControllerLink.h"
#include
"obj/NiSequenceStreamHelper.h"
#include
"obj/NiTextKeyExtraData.h"
#include
"obj/NiTimeController.h"
#include
<float.h>
using
namespace
Niflib
;
KFImporter
::
KFImporter
(
const
TCHAR
*
Name
,
ImpInterface
*
I
,
Interface
*
GI
,
BOOL
SuppressPrompts
)
...
...
@@ -18,8 +22,49 @@ void KFImporter::ReadBlocks()
{
try
{
kf
=
DynamicCast
<
NiControllerSequence
>
(
ReadNifList
(
name
.
c_str
()));
BuildNodes
();
// Handle Freedom Force Animation Import
std
::
vector
<
NiObjectRef
>
roots
=
ReadNifList
(
name
.
c_str
());
kf
=
DynamicCast
<
NiControllerSequence
>
(
roots
);
if
(
kf
.
size
()
==
0
)
{
std
::
vector
<
NiSequenceStreamHelperRef
>
helpers
=
DynamicCast
<
NiSequenceStreamHelper
>
(
roots
);
for
(
std
::
vector
<
NiSequenceStreamHelperRef
>::
iterator
itr
=
helpers
.
begin
();
itr
!=
helpers
.
end
();
++
itr
)
{
NiSequenceStreamHelperRef
helper
=
(
*
itr
);
list
<
Ref
<
NiExtraData
>
>
data
=
helper
->
GetExtraData
();
NiTextKeyExtraDataRef
textKey
=
DynamicCast
<
NiTextKeyExtraData
>
(
data
).
front
();
list
<
NiStringExtraDataRef
>
keys
=
DynamicCast
<
NiStringExtraData
>
(
data
);
list
<
Ref
<
NiTimeController
>
>
controllers
=
helper
->
GetControllers
();
if
(
keys
.
size
()
==
controllers
.
size
())
{
int
nk
=
keys
.
size
();
NiControllerSequenceRef
seq
=
new
NiControllerSequence
();
seq
->
SetName
(
helper
->
GetName
()
);
seq
->
SetTextKey
(
textKey
);
float
start
=
FLT_MAX
,
stop
=
FLT_MIN
;
vector
<
Key
<
string
>
>
textKeys
=
textKey
->
GetKeys
();
for
(
vector
<
Key
<
string
>
>::
iterator
tItr
=
textKeys
.
begin
();
tItr
!=
textKeys
.
end
();
++
tItr
)
{
start
=
min
(
start
,
tItr
->
time
);
stop
=
max
(
stop
,
tItr
->
time
);
}
seq
->
SetStartTime
(
start
);
seq
->
SetStopTime
(
stop
);
list
<
NiStringExtraDataRef
>::
iterator
keyItr
=
keys
.
begin
();
list
<
NiTimeControllerRef
>::
iterator
ctrlItr
=
controllers
.
begin
();
for
(
int
i
=
0
;
i
<
nk
;
++
i
,
++
keyItr
,
++
ctrlItr
)
{
seq
->
AddController
(
(
*
keyItr
)
->
GetData
(),
(
*
ctrlItr
)
);
}
kf
.
push_back
(
seq
);
}
}
}
BuildNodes
();
}
catch
(
std
::
exception
&
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment