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
f3dac454
Commit
f3dac454
authored
13 years ago
by
Amorilia
Browse files
Options
Downloads
Patches
Plain Diff
Updated public interface in preparation for missing_link_stack support during read.
parent
ddd52bf1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/niflib.h
+16
-0
16 additions, 0 deletions
include/niflib.h
src/niflib.cpp
+31
-0
31 additions, 0 deletions
src/niflib.cpp
with
47 additions
and
0 deletions
include/niflib.h
+
16
−
0
View file @
f3dac454
...
...
@@ -107,6 +107,22 @@ enum ExportOptions {
*/
NIFLIB_API
unsigned
int
GetNifVersion
(
string
const
&
file_name
);
/*!
* Return the missing link stack with objects replaced from nif trees at specified roots.
*/
NIFLIB_API
list
<
Ref
<
NiObject
>
>
ProcessMissingLinkStack
(
list
<
Ref
<
NiObject
>
>
const
&
roots
,
const
list
<
NiObject
*>
&
missing_link_stack
);
/*!
* Reads the given input stream and returns a vector of object references
* \param in The input stream to read NIF data from.
* \param missing_link_stack A stack where to copy NULL refs from (in case of reading a nif from an incomplete nif tree)
* \param info Optionally, a NifInfo structure pointer can be passed in, and it will be filled with information from the header of the NIF file.
* \return All the NIF objects read from the stream.
*/
NIFLIB_API
vector
<
Ref
<
NiObject
>
>
ReadNifList
(
istream
&
in
,
const
list
<
Ref
<
NiObject
>
>
&
missing_link_stack
,
NifInfo
*
info
);
/*!
* Reads the given file by file name and returns a vector of object references
* \param file_name The name of the file to load, or the complete path if it is not in the working directory.
...
...
This diff is collapsed.
Click to expand it.
src/niflib.cpp
+
31
−
0
View file @
f3dac454
...
...
@@ -119,6 +119,11 @@ vector<NiObjectRef> ReadNifList( string const & file_name, NifInfo * info ) {
}
vector
<
NiObjectRef
>
ReadNifList
(
istream
&
in
,
NifInfo
*
info
)
{
list
<
NiObjectRef
>
missing_link_stack
;
return
ReadNifList
(
in
,
missing_link_stack
,
info
);
}
vector
<
NiObjectRef
>
ReadNifList
(
istream
&
in
,
const
list
<
NiObjectRef
>
&
missing_link_stack
,
NifInfo
*
info
)
{
//Ensure that objects are registered
if
(
g_objects_registered
==
false
)
{
...
...
@@ -397,6 +402,32 @@ vector<NiObjectRef> ReadNifList( istream & in, NifInfo * info ) {
return
obj_list
;
}
NiObjectRef
_ProcessMissingLinkStackHelper
(
NiObjectRef
root
,
NiObject
*
obj
)
{
// search by name
NiNodeRef
rootnode
=
DynamicCast
<
NiNode
>
(
root
);
NiNodeRef
objnode
=
DynamicCast
<
NiNode
>
(
obj
);
if
(
rootnode
!=
NULL
&&
objnode
!=
NULL
)
{
if
(
!
(
rootnode
->
GetName
().
empty
())
&&
rootnode
->
GetName
()
==
objnode
->
GetName
())
{
return
StaticCast
<
NiObject
>
(
rootnode
);
}
}
// nothing found
return
NiObjectRef
();
}
list
<
NiObjectRef
>
ProcessMissingLinkStack
(
list
<
NiObjectRef
>
const
&
roots
,
const
list
<
NiObject
*>
&
missing_link_stack
)
{
list
<
NiObjectRef
>
result
;
for
(
list
<
NiObject
*>::
const_iterator
obj
=
missing_link_stack
.
begin
();
obj
!=
missing_link_stack
.
end
();
++
obj
)
{
for
(
list
<
NiObjectRef
>::
const_iterator
root
=
roots
.
begin
();
root
!=
roots
.
end
();
++
root
)
{
result
.
push_back
(
_ProcessMissingLinkStackHelper
(
*
root
,
*
obj
));
}
}
return
result
;
}
// Writes a valid Nif File given an ostream, a list to the root objects of a file tree
// (missing_link_stack stores a stack of links which are referred to but which
// are not inside the tree rooted by roots)
...
...
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