Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Max Nif Plugin
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
Max Nif Plugin
Commits
366bb8e9
Commit
366bb8e9
authored
16 years ago
by
Tazpn
Browse files
Options
Downloads
Patches
Plain Diff
max: Try to append animation when clear animation is not set when importing.
parent
f6940e69
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.TXT
+6
-0
6 additions, 0 deletions
CHANGELOG.TXT
NifImport/ImportAnimation.cpp
+145
-2
145 additions, 2 deletions
NifImport/ImportAnimation.cpp
README.TXT
+2
-2
2 additions, 2 deletions
README.TXT
with
153 additions
and
4 deletions
CHANGELOG.TXT
+
6
−
0
View file @
366bb8e9
...
...
@@ -3,6 +3,12 @@ NifTools MaxPlugin
Change log
----------
3.4
o Exporter
- Fix issues with importing Freedom Force vs 3rd Reich animation
o Importer
- Fix issues with importing Freedom Force vs 3rd Reich models and animation
3.3
o Exporter
- Fix multi-UVW implementation to compact UV channels on export
...
...
This diff is collapsed.
Click to expand it.
NifImport/ImportAnimation.cpp
+
145
−
2
View file @
366bb8e9
...
...
@@ -216,6 +216,137 @@ void NifImporter::ClearAnimation()
ClearAnimation
(
gi
->
GetRootNode
());
}
}
static
void
GetTimeRange
(
Control
*
c
,
Interval
&
range
)
{
if
(
c
->
IsKeyable
())
{
int
iNumKeys
=
c
->
NumKeys
();
for
(
int
i
=
0
;
i
<
iNumKeys
;
i
++
)
{
TimeValue
t
=
c
->
GetKeyTime
(
i
);
if
(
range
.
Empty
())
{
range
.
SetInstant
(
t
);
}
else
{
if
(
t
<
range
.
Start
())
range
.
SetStart
(
t
);
if
(
t
>
range
.
End
())
range
.
SetEnd
(
t
);
}
}
if
(
range
.
Empty
())
{
if
(
IKeyControl
*
ikeys
=
GetKeyControlInterface
(
c
)){
int
n
=
ikeys
->
GetNumKeys
();
for
(
int
i
=
0
;
i
<
n
;
++
i
){
AnyKey
buf
;
IKey
*
key
=
(
IKey
*
)
buf
;
ikeys
->
GetKey
(
i
,
key
);
if
(
range
.
Empty
())
{
range
.
SetInstant
(
key
->
time
);
}
else
{
if
(
key
->
time
<
range
.
Start
())
range
.
SetStart
(
key
->
time
);
if
(
key
->
time
>
range
.
End
())
range
.
SetEnd
(
key
->
time
);
}
}
}
}
}
if
(
range
.
Empty
())
{
if
(
c
->
IsAnimated
())
{
//Tab<TimeValue> times;
//if ( c->GetKeyTimes( times,FOREVER, KEYAT_POSITION ) ) {
// for (int i=0; i<times.Count(); ++i){
// TimeValue time = times[i];
// if (range.Empty()) {
// range.SetInstant(time);
// } else {
// if (time < range.Start())
// range.SetStart(time);
// if (time > range.End())
// range.SetEnd(time);
// }
// }
//}
//if ( c->GetKeyTimes( times,FOREVER, KEYAT_ROTATION ) ) {
// for (int i=0; i<times.Count(); ++i){
// TimeValue time = times[i];
// if (range.Empty()) {
// range.SetInstant(time);
// } else {
// if (time < range.Start())
// range.SetStart(time);
// if (time > range.End())
// range.SetEnd(time);
// }
// }
//}
}
}
}
static
void
GetTimeRange
(
INode
*
node
,
Interval
&
range
,
bool
recursive
=
true
)
{
int
nTracks
=
node
->
NumNoteTracks
();
// Populate Text keys and Sequence information from note tracks
for
(
int
i
=
0
;
i
<
nTracks
;
++
i
)
{
if
(
NoteTrack
*
nt
=
node
->
GetNoteTrack
(
i
)
)
{
if
(
nt
->
ClassID
()
==
Class_ID
(
NOTETRACK_CLASS_ID
,
0
)
)
{
DefNoteTrack
*
defNT
=
(
DefNoteTrack
*
)
nt
;
if
(
defNT
->
NumKeys
()
>
0
)
{
for
(
int
j
=
0
,
m
=
defNT
->
keys
.
Count
();
j
<
m
;
++
j
)
{
NoteKey
*
key
=
defNT
->
keys
[
j
];
if
(
range
.
Empty
())
{
range
.
SetInstant
(
key
->
time
);
}
else
{
if
(
key
->
time
<
range
.
Start
())
range
.
SetStart
(
key
->
time
);
if
(
key
->
time
>
range
.
End
())
range
.
SetEnd
(
key
->
time
);
}
}
}
}
}
}
if
(
Control
*
c
=
node
->
GetTMController
())
{
GetTimeRange
(
c
,
range
);
#if VERSION_3DSMAX > ((5000<<16)+(15<<8)+0) // Version 5
if
(
Control
*
sc
=
c
->
GetWController
())
{
GetTimeRange
(
sc
,
range
);
if
(
sc
!=
c
)
GetTimeRange
(
sc
,
range
);
}
#endif
if
(
Control
*
sc
=
c
->
GetXController
())
{
if
(
sc
!=
c
)
GetTimeRange
(
sc
,
range
);
}
if
(
Control
*
sc
=
c
->
GetYController
())
{
if
(
sc
!=
c
)
GetTimeRange
(
sc
,
range
);
}
if
(
Control
*
sc
=
c
->
GetZController
())
{
if
(
sc
!=
c
)
GetTimeRange
(
sc
,
range
);
}
if
(
Control
*
sc
=
c
->
GetRotationController
())
{
if
(
sc
!=
c
)
GetTimeRange
(
sc
,
range
);
}
if
(
Control
*
sc
=
c
->
GetPositionController
())
{
if
(
sc
!=
c
)
GetTimeRange
(
sc
,
range
);
}
if
(
Control
*
sc
=
c
->
GetScaleController
())
{
if
(
sc
!=
c
)
GetTimeRange
(
sc
,
range
);
}
}
if
(
recursive
)
{
for
(
int
i
=
0
;
i
<
node
->
NumberOfChildren
();
i
++
)
GetTimeRange
(
node
->
GetChildNode
(
i
),
range
,
true
);
}
}
#if 0
FPValue GetScriptedProperty( FPValue& thing, TCHAR* propName ) {
init_thread_locals();
...
...
@@ -494,6 +625,18 @@ bool KFMImporter::ImportAnimation()
AnimationImport
ai
(
*
this
);
float
time
=
0.0
f
;
// Locate the end of the previous animation and start importing there
if
(
!
clearAnimation
)
{
float
curTime
=
FrameToTime
(
gi
->
GetTime
()
+
TicksPerFrame
);
Interval
globalRange
;
globalRange
.
SetInstant
(
0
);
GetTimeRange
(
gi
->
GetRootNode
(),
globalRange
,
true
);
if
(
globalRange
.
Duration
()
!=
0
)
globalRange
.
SetEnd
(
globalRange
.
End
()
+
TicksPerFrame
);
float
endTime
=
FrameToTime
(
globalRange
.
End
()
);
time
=
max
(
curTime
,
endTime
);
gi
->
SetTime
(
TimeToFrame
(
time
)
);
}
for
(
vector
<
NiControllerSequenceRef
>::
iterator
itr
=
kf
.
begin
();
itr
!=
kf
.
end
();
++
itr
){
float
minTime
=
1e+35
f
;
...
...
@@ -562,7 +705,7 @@ bool KFMImporter::ImportAnimation()
NiKeyframeDataRef
data
;
Point3
p
;
Quat
q
;
float
s
;
if
(
ai
.
GetTransformData
(
*
lnk
,
name
,
data
,
p
,
q
,
s
))
{
PosRotScaleNode
(
n
,
p
,
q
,
s
,
prsDefault
,
0
);
PosRotScaleNode
(
n
,
p
,
q
,
s
,
prsDefault
,
TimeToFrame
(
time
)
);
if
(
ai
.
AddValues
(
c
,
data
,
time
))
{
minTime
=
min
(
minTime
,
start
);
maxTime
=
max
(
maxTime
,
stop
);
...
...
@@ -623,7 +766,7 @@ bool KFMImporter::ImportAnimation()
NiKeyframeDataRef
data
;
Point3
p
;
Quat
q
;
float
s
;
if
(
ai
.
GetTransformData
(
*
lnk
,
name
,
data
,
p
,
q
,
s
))
{
PosRotScaleNode
(
n
,
p
,
q
,
s
,
prsDefault
,
0
);
PosRotScaleNode
(
n
,
p
,
q
,
s
,
prsDefault
,
TimeToFrame
(
time
)
);
if
(
ai
.
AddValues
(
c
,
data
,
time
))
{
minTime
=
min
(
minTime
,
start
);
maxTime
=
max
(
maxTime
,
stop
);
...
...
This diff is collapsed.
Click to expand it.
README.TXT
+
2
−
2
View file @
366bb8e9
MaxPlugins 3.
3
==============
===
MaxPlugins 3.
4
==============
This plugin currently consists of an exporter, importer and a utility
...
...
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