Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Niflib
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
Niflib
Commits
f1b53eab
Commit
f1b53eab
authored
13 years ago
by
Amorilia
Browse files
Options
Downloads
Patches
Plain Diff
New WriteNifTree function which can take a missing_link_stack argument.
parent
4c6d9e90
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
include/RefObject.h
+1
-1
1 addition, 1 deletion
include/RefObject.h
src/niflib.cpp
+11
-4
11 additions, 4 deletions
src/niflib.cpp
src/obj/NiObject.cpp
+2
-1
2 additions, 1 deletion
src/obj/NiObject.cpp
with
14 additions
and
6 deletions
include/RefObject.h
+
1
−
1
View file @
f1b53eab
...
...
@@ -110,7 +110,7 @@ public:
/*! NIFLIB_HIDDEN function. For internal use only. */
NIFLIB_HIDDEN
virtual
void
Read
(
istream
&
in
,
list
<
unsigned
int
>
&
link_stack
,
const
NifInfo
&
info
)
=
0
;
/*! NIFLIB_HIDDEN function. For internal use only. */
NIFLIB_HIDDEN
virtual
void
Write
(
ostream
&
out
,
const
map
<
Ref
<
NiObject
>
,
unsigned
int
>
&
link_map
,
const
NifInfo
&
info
)
const
=
0
;
NIFLIB_HIDDEN
virtual
void
Write
(
ostream
&
out
,
const
map
<
Ref
<
NiObject
>
,
unsigned
int
>
&
link_map
,
list
<
NiObject
*>
&
missing_link_stack
,
const
NifInfo
&
info
)
const
=
0
;
/*! NIFLIB_HIDDEN function. For internal use only. */
NIFLIB_HIDDEN
virtual
void
FixLinks
(
const
map
<
unsigned
int
,
Ref
<
NiObject
>
>
&
objects
,
list
<
unsigned
int
>
&
link_stack
,
const
NifInfo
&
info
)
=
0
;
/*! NIFLIB_HIDDEN function. For internal use only. */
...
...
This diff is collapsed.
Click to expand it.
src/niflib.cpp
+
11
−
4
View file @
f1b53eab
...
...
@@ -398,7 +398,9 @@ vector<NiObjectRef> ReadNifList( istream & in, NifInfo * info ) {
}
// Writes a valid Nif File given an ostream, a list to the root objects of a file tree
void
WriteNifTree
(
ostream
&
out
,
list
<
NiObjectRef
>
const
&
roots
,
const
NifInfo
&
info
)
{
// (missing_link_stack stores a stack of links which are referred to but which
// are not inside the tree rooted by roots)
void
WriteNifTree
(
ostream
&
out
,
list
<
NiObjectRef
>
const
&
roots
,
list
<
NiObject
*>
&
missing_link_stack
,
const
NifInfo
&
info
)
{
//Enumerate all objects in tree
map
<
Type
*
,
unsigned
int
>
type_map
;
...
...
@@ -463,7 +465,7 @@ void WriteNifTree( ostream & out, list<NiObjectRef> const & roots, const NifInfo
header
.
blockSize
.
resize
(
objects
.
size
()
);
for
(
unsigned
int
i
=
0
;
i
<
objects
.
size
();
++
i
)
{
ostr
.
reset
();
objects
[
i
]
->
Write
(
ostr
,
link_map
,
info
);
objects
[
i
]
->
Write
(
ostr
,
link_map
,
missing_link_stack
,
info
);
header
.
blockSize
[
i
]
=
ostr
.
tellp
();
}
header
.
numStrings
=
header
.
strings
.
size
();
...
...
@@ -505,7 +507,7 @@ void WriteNifTree( ostream & out, list<NiObjectRef> const & roots, const NifInfo
WriteUInt
(
0
,
out
);
}
objects
[
i
]
->
Write
(
out
,
link_map
,
info
);
objects
[
i
]
->
Write
(
out
,
link_map
,
missing_link_stack
,
info
);
}
//--Write Footer--//
...
...
@@ -534,13 +536,18 @@ void WriteNifTree( ostream & out, list<NiObjectRef> const & roots, const NifInfo
footer
.
numRoots
=
roots
.
size
();
footer
.
roots
.
insert
(
footer
.
roots
.
end
(),
roots
.
begin
(),
roots
.
end
());
}
footer
.
Write
(
out
,
link_map
,
info
);
footer
.
Write
(
out
,
link_map
,
missing_link_stack
,
info
);
}
// clear the header pointer in the stream. Should be in try/catch block
out
<<
hdrInfo
(
NULL
);
}
void
WriteNifTree
(
ostream
&
out
,
list
<
NiObjectRef
>
const
&
roots
,
const
NifInfo
&
info
)
{
list
<
NiObject
*>
missing_link_stack
;
WriteNifTree
(
out
,
roots
,
missing_link_stack
,
info
);
}
// Writes a valid Nif File given a file name, a pointer to the root object of a file tree
void
WriteNifTree
(
string
const
&
file_name
,
NiObject
*
root
,
const
NifInfo
&
info
)
{
//Open output file
...
...
This diff is collapsed.
Click to expand it.
src/obj/NiObject.cpp
+
2
−
1
View file @
f1b53eab
...
...
@@ -108,7 +108,8 @@ NiObjectRef NiObject::Clone( unsigned int version, unsigned int user_version ) {
//Write this object's data to the stream
NifInfo
info
(
version
,
user_version
);
this
->
Write
(
tmp
,
link_map
,
info
);
list
<
NiObject
*>
missing_link_stack
;
this
->
Write
(
tmp
,
link_map
,
missing_link_stack
,
info
);
//Dummy stack
list
<
unsigned
int
>
link_stack
;
...
...
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