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
839807bc
Commit
839807bc
authored
19 years ago
by
Amorilia
Browse files
Options
Downloads
Patches
Plain Diff
updated skeleton root calculation once more
parent
1bf10f27
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nif_attrs.h
+36
-1
36 additions, 1 deletion
nif_attrs.h
with
36 additions
and
1 deletion
nif_attrs.h
+
36
−
1
View file @
839807bc
...
...
@@ -1213,7 +1213,41 @@ public:
return
blk_ref
(
-
1
);
}
//Arbitrarily start at the first bone in the list
//Arbitrarily start at the first bone in the list, and get it's ancestors
/*NEW CODE BEGIN*/
// We want to get the closest common ancestor between the _owner and the bones
// So start with a list of ancestors of the first bone (this is just a random choice)
blk_ref
block
=
bones
[
0
];
blk_ref
par
=
block
->
GetParent
();
list
<
blk_ref
>
bone_pars
;
while
(
par
.
is_null
()
==
false
)
{
bone_pars
.
push_front
(
par
);
par
=
par
->
GetParent
();
};
// Now do the same with the owner.
block
=
_owner
;
par
=
block
->
GetParent
();
list
<
blk_ref
>
owner_pars
;
while
(
par
.
is_null
()
==
false
)
{
owner_pars
.
push_front
(
par
);
par
=
par
->
GetParent
();
};
// Now find closest common ancestor.
if
(
owner_pars
.
empty
()
||
bone_pars
.
empty
()
)
throw
runtime_error
(
"Skinning instance has no common parent with the bones it refers to (invalid NIF file?). Cannot set skeleton root."
);
blk_ref
skelroot
;
list
<
blk_ref
>::
const_iterator
bone_par_it
=
bone_pars
.
begin
();
list
<
blk_ref
>::
const_iterator
owner_par_it
=
owner_pars
.
begin
();
while
(
*
bone_par_it
==
*
owner_par_it
)
{
skelroot
=
*
bone_par_it
;
bone_par_it
++
;
owner_par_it
++
;
};
if
(
skelroot
.
is_null
()
)
throw
runtime_error
(
"Skinning instance has no common parent with the bones it refers to (invalid NIF file?). Cannot set skeleton root."
);
return
skelroot
;
/*NEW CODE END*/
/*OLD CODE BEGIN
blk_ref block = bones[0];
blk_ref par;
int flags;
...
...
@@ -1248,6 +1282,7 @@ public:
//We didn't find the root this time, set block to par and try again
block = par;
}
OLD CODE END*/
}
string
asString
()
const
{
stringstream
out
;
...
...
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