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
34a49abd
Commit
34a49abd
authored
18 years ago
by
Shon Ferguson
Browse files
Options
Downloads
Patches
Plain Diff
Removed lingering cout statements except those within debug defines.
parent
b241458b
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
kfm.cpp
+1
-1
1 addition, 1 deletion
kfm.cpp
niflib.cpp
+18
-18
18 additions, 18 deletions
niflib.cpp
obj/NiTriBasedGeom.cpp
+0
-11
0 additions, 11 deletions
obj/NiTriBasedGeom.cpp
with
19 additions
and
30 deletions
kfm.cpp
+
1
−
1
View file @
34a49abd
...
@@ -121,7 +121,7 @@ void Kfm::Write( ostream & out, uint version ) {
...
@@ -121,7 +121,7 @@ void Kfm::Write( ostream & out, uint version ) {
Ref
<
NiObject
>
Kfm
::
MergeActions
(
string
const
&
path
)
{
Ref
<
NiObject
>
Kfm
::
MergeActions
(
string
const
&
path
)
{
// Read NIF file
// Read NIF file
cout
<<
path
+
'\\'
+
nif_filename
<<
endl
;
//
cout << path + '\\' + nif_filename << endl;
NiObjectRef
nif
=
ReadNifTree
(
path
+
'\\'
+
nif_filename
);
NiObjectRef
nif
=
ReadNifTree
(
path
+
'\\'
+
nif_filename
);
// Read Kf files
// Read Kf files
...
...
This diff is collapsed.
Click to expand it.
niflib.cpp
+
18
−
18
View file @
34a49abd
...
@@ -71,7 +71,7 @@ NiObjectRef CreateBlock( string block_type ) {
...
@@ -71,7 +71,7 @@ NiObjectRef CreateBlock( string block_type ) {
//Reads the given file by file name and returns a reference to the root block
//Reads the given file by file name and returns a reference to the root block
NiObjectRef
ReadNifTree
(
string
const
&
file_name
)
{
NiObjectRef
ReadNifTree
(
string
const
&
file_name
)
{
//Read block list
//Read block list
cout
<<
"File name: "
<<
file_name
<<
endl
;
//
cout << "File name: " << file_name << endl;
vector
<
NiObjectRef
>
blocks
=
ReadNifList
(
file_name
);
vector
<
NiObjectRef
>
blocks
=
ReadNifList
(
file_name
);
return
FindRoot
(
blocks
);
return
FindRoot
(
blocks
);
}
}
...
@@ -169,6 +169,7 @@ vector<NiObjectRef> ReadNifList( istream & in ) {
...
@@ -169,6 +169,7 @@ vector<NiObjectRef> ReadNifList( istream & in ) {
vector
<
NiObjectRef
>
blocks
(
numBlocks
);
//List to hold the blocks
vector
<
NiObjectRef
>
blocks
(
numBlocks
);
//List to hold the blocks
list
<
uint
>
link_stack
;
//List to add link values to as they're read in from the file
list
<
uint
>
link_stack
;
//List to add link values to as they're read in from the file
string
objectType
;
string
objectType
;
stringstream
errStream
;
for
(
uint
i
=
0
;
i
<
numBlocks
;
i
++
)
{
for
(
uint
i
=
0
;
i
<
numBlocks
;
i
++
)
{
//Check for EOF
//Check for EOF
...
@@ -184,10 +185,10 @@ vector<NiObjectRef> ReadNifList( istream & in ) {
...
@@ -184,10 +185,10 @@ vector<NiObjectRef> ReadNifList( istream & in ) {
uint
checkValue
=
ReadUInt
(
in
);
uint
checkValue
=
ReadUInt
(
in
);
if
(
checkValue
!=
0
)
{
if
(
checkValue
!=
0
)
{
//Throw an exception if it's not zero
//Throw an exception if it's not zero
cout
<<
"ERROR!
Bad object position. Invalid check value
\a
"
<<
endl
;
errStream
<<
"Read failue -
Bad object position. Invalid check value"
<<
endl
;
cout
<<
"====[ "
<<
"Object "
<<
i
<<
" | "
<<
blocks
[
i
-
1
]
->
GetType
().
GetTypeName
()
<<
" ]===="
<<
endl
;
errStream
<<
"====[ "
<<
"Object "
<<
i
<<
" | "
<<
blocks
[
i
-
1
]
->
GetType
().
GetTypeName
()
<<
" ]===="
<<
endl
;
cout
<<
blocks
[
i
-
1
]
->
asString
();
errStream
<<
blocks
[
i
-
1
]
->
asString
();
throw
runtime_error
(
"Read failue - Bad object position"
);
throw
runtime_error
(
errStream
.
str
()
);
}
}
}
}
...
@@ -197,10 +198,10 @@ vector<NiObjectRef> ReadNifList( istream & in ) {
...
@@ -197,10 +198,10 @@ vector<NiObjectRef> ReadNifList( istream & in ) {
// Find which block type this is by reading the string at this location
// Find which block type this is by reading the string at this location
uint
objectTypeLength
=
ReadUInt
(
in
);
uint
objectTypeLength
=
ReadUInt
(
in
);
if
(
objectTypeLength
>
30
||
objectTypeLength
<
6
)
{
if
(
objectTypeLength
>
30
||
objectTypeLength
<
6
)
{
cout
<<
"ERROR!
Bad object position. Invalid Type Name Length: "
<<
objectTypeLength
<<
"
\a
"
<<
endl
;
errStream
<<
"Read failue -
Bad object position. Invalid Type Name Length: "
<<
objectTypeLength
<<
endl
;
cout
<<
"====[ "
<<
"Object "
<<
i
-
1
<<
" | "
<<
blocks
[
i
-
1
]
->
GetType
().
GetTypeName
()
<<
" ]===="
<<
endl
;
errStream
<<
"====[ "
<<
"Object "
<<
i
-
1
<<
" | "
<<
blocks
[
i
-
1
]
->
GetType
().
GetTypeName
()
<<
" ]===="
<<
endl
;
cout
<<
blocks
[
i
-
1
]
->
asString
();
errStream
<<
blocks
[
i
-
1
]
->
asString
();
throw
runtime_error
(
"Read failue - Bad object position"
);
throw
runtime_error
(
errStream
.
str
()
);
}
}
char
*
charobjectType
=
new
char
[
objectTypeLength
+
1
];
char
*
charobjectType
=
new
char
[
objectTypeLength
+
1
];
in
.
read
(
charobjectType
,
objectTypeLength
);
in
.
read
(
charobjectType
,
objectTypeLength
);
...
@@ -208,10 +209,10 @@ vector<NiObjectRef> ReadNifList( istream & in ) {
...
@@ -208,10 +209,10 @@ vector<NiObjectRef> ReadNifList( istream & in ) {
objectType
=
string
(
charobjectType
);
objectType
=
string
(
charobjectType
);
delete
[]
charobjectType
;
delete
[]
charobjectType
;
if
(
(
objectType
[
0
]
!=
'N'
||
objectType
[
1
]
!=
'i'
)
&&
(
objectType
[
0
]
!=
'R'
||
objectType
[
1
]
!=
'o'
)
&&
(
objectType
[
0
]
!=
'A'
||
objectType
[
1
]
!=
'v'
))
{
if
(
(
objectType
[
0
]
!=
'N'
||
objectType
[
1
]
!=
'i'
)
&&
(
objectType
[
0
]
!=
'R'
||
objectType
[
1
]
!=
'o'
)
&&
(
objectType
[
0
]
!=
'A'
||
objectType
[
1
]
!=
'v'
))
{
cout
<<
"ERROR!
Bad object position. Invalid Type Name: "
<<
objectType
<<
"
\a
"
<<
endl
;
errStream
<<
"Read failue -
Bad object position. Invalid Type Name: "
<<
objectType
<<
endl
;
cout
<<
"====[ "
<<
"Object "
<<
i
-
1
<<
" | "
<<
blocks
[
i
-
1
]
->
GetType
().
GetTypeName
()
<<
" ]===="
<<
endl
;
errStream
<<
"====[ "
<<
"Object "
<<
i
-
1
<<
" | "
<<
blocks
[
i
-
1
]
->
GetType
().
GetTypeName
()
<<
" ]===="
<<
endl
;
cout
<<
blocks
[
i
-
1
]
->
asString
();
errStream
<<
blocks
[
i
-
1
]
->
asString
();
throw
runtime_error
(
"Read failue - Bad object position"
);
throw
runtime_error
(
errStream
.
str
()
);
}
}
}
}
...
@@ -226,9 +227,8 @@ vector<NiObjectRef> ReadNifList( istream & in ) {
...
@@ -226,9 +227,8 @@ vector<NiObjectRef> ReadNifList( istream & in ) {
if
(
blocks
[
i
]
==
NULL
)
{
if
(
blocks
[
i
]
==
NULL
)
{
//For version 5.0.0.1 and up, throw an exception - there's nothing we can do
//For version 5.0.0.1 and up, throw an exception - there's nothing we can do
//if ( version >= 0x05000001 ) {
//if ( version >= 0x05000001 ) {
stringstream
str
;
errStream
<<
"Unknown object type encountered during file read: "
<<
objectType
;
str
<<
"Unknown object type encountered during file read: "
<<
objectType
;
throw
runtime_error
(
errStream
.
str
()
);
throw
runtime_error
(
str
.
str
()
);
//} else {
//} else {
//We can skip over this block in older versions
//We can skip over this block in older versions
//blocks[i] = new UnknownBlock(objectType);
//blocks[i] = new UnknownBlock(objectType);
...
@@ -803,7 +803,7 @@ void MergeNifTrees( const Ref<NiNode> & target, const Ref<NiControllerSequence>
...
@@ -803,7 +803,7 @@ void MergeNifTrees( const Ref<NiNode> & target, const Ref<NiControllerSequence>
//attach it to the specific type of controller that's
//attach it to the specific type of controller that's
//connected to the named node
//connected to the named node
NiNodeRef
node
=
name_map
[
node_name
];
NiNodeRef
node
=
name_map
[
node_name
];
cout
<<
"Attaching interpolator to "
<<
node
<<
endl
;
//
cout << "Attaching interpolator to " << node << endl;
list
<
NiTimeControllerRef
>
ctlrs
=
node
->
GetControllers
();
list
<
NiTimeControllerRef
>
ctlrs
=
node
->
GetControllers
();
NiSingleInterpolatorControllerRef
ctlr
;
NiSingleInterpolatorControllerRef
ctlr
;
for
(
list
<
NiTimeControllerRef
>::
iterator
it
=
ctlrs
.
begin
();
it
!=
ctlrs
.
end
();
++
it
)
{
for
(
list
<
NiTimeControllerRef
>::
iterator
it
=
ctlrs
.
begin
();
it
!=
ctlrs
.
end
();
++
it
)
{
...
@@ -825,7 +825,7 @@ void MergeNifTrees( const Ref<NiNode> & target, const Ref<NiControllerSequence>
...
@@ -825,7 +825,7 @@ void MergeNifTrees( const Ref<NiNode> & target, const Ref<NiControllerSequence>
node
->
AddController
(
StaticCast
<
NiTimeController
>
(
ctlr
)
);
node
->
AddController
(
StaticCast
<
NiTimeController
>
(
ctlr
)
);
}
}
cout
<<
"Controller is "
<<
ctlr
<<
endl
;
//
cout << "Controller is " << ctlr << endl;
//Clone the interpolator and attached data and
//Clone the interpolator and attached data and
//add it to controller of matching type that was
//add it to controller of matching type that was
...
...
This diff is collapsed.
Click to expand it.
obj/NiTriBasedGeom.cpp
+
0
−
11
View file @
34a49abd
...
@@ -129,7 +129,6 @@ void NiTriBasedGeom::BindSkin( vector< Ref<NiNode> > bone_nodes ) {
...
@@ -129,7 +129,6 @@ void NiTriBasedGeom::BindSkin( vector< Ref<NiNode> > bone_nodes ) {
while
(
true
)
{
while
(
true
)
{
bool
all_same
=
true
;
bool
all_same
=
true
;
cout
<<
"Ancestors[0].size(): "
<<
int
(
ancestors
[
0
].
size
())
<<
endl
;
if
(
ancestors
[
0
].
size
()
==
0
)
{
if
(
ancestors
[
0
].
size
()
==
0
)
{
//This list is over, so the last top is the common ancestor
//This list is over, so the last top is the common ancestor
//break out of the loop
//break out of the loop
...
@@ -137,7 +136,6 @@ void NiTriBasedGeom::BindSkin( vector< Ref<NiNode> > bone_nodes ) {
...
@@ -137,7 +136,6 @@ void NiTriBasedGeom::BindSkin( vector< Ref<NiNode> > bone_nodes ) {
}
}
NiNodeRef
first_ancestor
=
ancestors
[
0
].
front
();
NiNodeRef
first_ancestor
=
ancestors
[
0
].
front
();
for
(
int
i
=
1
;
i
<
num_lists
;
++
i
)
{
for
(
int
i
=
1
;
i
<
num_lists
;
++
i
)
{
cout
<<
"Ancestors["
<<
i
<<
"].size(): "
<<
int
(
ancestors
[
i
].
size
())
<<
endl
;
if
(
ancestors
[
i
].
size
()
==
0
)
{
if
(
ancestors
[
i
].
size
()
==
0
)
{
//This list is over, so the last top is the common ancestor
//This list is over, so the last top is the common ancestor
//break out of the loop
//break out of the loop
...
@@ -154,7 +152,6 @@ void NiTriBasedGeom::BindSkin( vector< Ref<NiNode> > bone_nodes ) {
...
@@ -154,7 +152,6 @@ void NiTriBasedGeom::BindSkin( vector< Ref<NiNode> > bone_nodes ) {
//and look again
//and look again
skeleton_root
=
ancestors
[
0
].
front
();
skeleton_root
=
ancestors
[
0
].
front
();
cout
<<
"New common stack top: "
<<
skeleton_root
<<
endl
;
for
(
int
i
=
0
;
i
<
num_lists
;
++
i
)
{
for
(
int
i
=
0
;
i
<
num_lists
;
++
i
)
{
ancestors
[
i
].
pop_front
();
ancestors
[
i
].
pop_front
();
}
}
...
@@ -169,8 +166,6 @@ void NiTriBasedGeom::BindSkin( vector< Ref<NiNode> > bone_nodes ) {
...
@@ -169,8 +166,6 @@ void NiTriBasedGeom::BindSkin( vector< Ref<NiNode> > bone_nodes ) {
throw
runtime_error
(
"Failed to find suitable skeleton root."
);
throw
runtime_error
(
"Failed to find suitable skeleton root."
);
}
}
cout
<<
"Skeleton Root Selected: "
<<
skeleton_root
<<
endl
;
//Create a skin instance using the bone and root data
//Create a skin instance using the bone and root data
skinInstance
=
new
NiSkinInstance
(
skeleton_root
,
bone_nodes
);
skinInstance
=
new
NiSkinInstance
(
skeleton_root
,
bone_nodes
);
...
@@ -179,8 +174,6 @@ void NiTriBasedGeom::BindSkin( vector< Ref<NiNode> > bone_nodes ) {
...
@@ -179,8 +174,6 @@ void NiTriBasedGeom::BindSkin( vector< Ref<NiNode> > bone_nodes ) {
};
};
list
<
Ref
<
NiNode
>
>
NiTriBasedGeom
::
ListAncestors
(
const
Ref
<
NiNode
>
&
leaf
)
const
{
list
<
Ref
<
NiNode
>
>
NiTriBasedGeom
::
ListAncestors
(
const
Ref
<
NiNode
>
&
leaf
)
const
{
cout
<<
"Listing ancestors for "
<<
leaf
<<
endl
;
if
(
leaf
==
NULL
)
{
if
(
leaf
==
NULL
)
{
throw
runtime_error
(
"ListAncestors called with a NULL leaf NiNode Ref"
);
throw
runtime_error
(
"ListAncestors called with a NULL leaf NiNode Ref"
);
}
}
...
@@ -197,10 +190,6 @@ list< Ref<NiNode> > NiTriBasedGeom::ListAncestors( const Ref<NiNode> & leaf ) co
...
@@ -197,10 +190,6 @@ list< Ref<NiNode> > NiTriBasedGeom::ListAncestors( const Ref<NiNode> & leaf ) co
}
}
}
}
for
(
list
<
NiNodeRef
>::
iterator
it
=
ancestors
.
begin
();
it
!=
ancestors
.
end
();
++
it
)
{
cout
<<
" "
<<
*
it
<<
endl
;
}
return
ancestors
;
return
ancestors
;
}
}
...
...
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