just to update everyone:
older:
it's still unfinished though, the script used is still using the PT functions where the data is expected to be world-location specified like an OBJ or DAE file
as for the new UT functions well...
I still need to finish up the data verification...
[color=lime]^ what does this do?
after everything has been imported, the data is still likely unstable, especially for bones.
what this does is gather the current bone's LRS, Bind, and Inverse coords (for each bone) and tests to make sure everything matches accordingly and even attempts to fix what doesn't match.
what this means is you only need to specify 1 of any:
- Loc,Rot,Sca
- Bind Matrix
- Inverse Matrix
and the verifier will calculate the rest.
if everything is defaulted and nothing is supplied, the verifier maps the Inverse to an inverted world-bind matrix at the parent's location.
(LRS and Bind don't need to be touched as they're locally defaulted)
I still have yet to test the various occurrences if the LRS and Bind don't match
I'm actually thinking about redoing the logic to test the Inverse first before testing the LRS and bind...
in fact, I think that's a really good idea
older:
it's still unfinished though, the script used is still using the PT functions where the data is expected to be world-location specified like an OBJ or DAE file
as for the new UT functions well...
I still need to finish up the data verification...
Code:
def __VerifyBoneTree(BID,Data,children,wpbind,wptransform):
BoneName, BDL, (l,r,s), Res, Bind, Inv_Bind, PBID, PrBID, CBID, NBID = Data
default = __rr.Matrix44(DM) # default (same as identity)
transform = __rr.Matrix44.from_scale(s) * __rr.Matrix44.from_eulers(r) * __rr.Matrix44.from_translation(l) # Local Transform
bind = __rr.Matrix44(Bind) # Local Bind
inverse = __rr.Matrix44(Inv_Bind) # World Inverse Bind
wtransform = __rr.matrix44.multiply(transform,wptransform) # World Transform
wbind = __rr.matrix44.multiply(bind,wpbind) # World Bind
cinverse = __rr.matrix33.inverse(wbind)
if (transform == bind).all():
if (default == bind).all(): # possible problem (this may be the proper local location)
if (default == inverse).all(): # this may not be the proper locations
if (default != wpbind).all(): # assume identity to parent and recalculate the inverse bind.
inverse = __rr.matrix33.inverse(wpbind)
else: # recalculate defaulted bind and LRS
wbind = __rr.matrix33.inverse(inverse)
pinverse = __rr.matrix33.inverse(wpbind)
bind = wbind * pinverse
transform = bind
else: # make sure the bind matches the inverse
if (default == inverse).all(): # this is obviousely wrong
inverse = __rr.matrix33.inverse(wbind)
elif (cinverse != inverse).all():
inverse = cinverse
elif (default == bind).all(): pass
elif (default == transform).all(): pass
else: # neither are default, but don't match
pass
# recalculate
#wtmtx = __rr.matrix44.multiply(ltmtx,wptmtx)
#wbmtx = __rr.matrix44.multiply(lbmtx,wpbmtx)
if BID in children: # if this bone has any children
for CID in children[BID]:
__VerifyBoneTree(CID,Data,children,wbind,wtransform)
after everything has been imported, the data is still likely unstable, especially for bones.
what this does is gather the current bone's LRS, Bind, and Inverse coords (for each bone) and tests to make sure everything matches accordingly and even attempts to fix what doesn't match.
what this means is you only need to specify 1 of any:
- Loc,Rot,Sca
- Bind Matrix
- Inverse Matrix
and the verifier will calculate the rest.
if everything is defaulted and nothing is supplied, the verifier maps the Inverse to an inverted world-bind matrix at the parent's location.
(LRS and Bind don't need to be touched as they're locally defaulted)
I still have yet to test the various occurrences if the LRS and Bind don't match
I'm actually thinking about redoing the logic to test the Inverse first before testing the LRS and bind...
in fact, I think that's a really good idea