Oikeastaan TeemuOK:n onglmaan skeletonien ajamisesta toisella skeleton tein scriptin, joka tekee Bipedista meshSkeletonin ja asettaa mesh skeletonille oikeat parentoinnit ja constraintit automaagisesti. Eli valitaan Bipedin root bone ja ajetaan scripti niin mesh skeleton liikkuu bipedin mukana. Voit tietysti myös samalla periaattella ajaa mesh skeletonilla mistä tahansa tuodusta skeletonilla, kuten esim. MB:stä.
fn myFnBipedToMesh fpBipRoot =
(
format "[DBG] Converting biped...\n"
aObjs = #()
aObjs = myFnCopyChild fpBipRoot aObjs
myFnFixParents fpBipRoot
myFnSetupConstraints fpBipRoot
select aObjs
)
fn myFnCopyChild fpObj fpObjs =
(
for i=1 to fpObj.children.count do
(
obj = fpObj.children[i]
tObj = (snapshot obj)
tObj.name = ("BipToMesh_"+obj.name)
tObj.parent = undefined
append fpObjs tObj
myFnCopyChild (obj) fpObjs
)
return fpObjs
)
fn myFnFixParents fpObj =
(
for i=1 to fpObj.children.count do
(
if (fpObj.children[i]) != undefined do
(
obj = fpObj.children[i]
tObj = getNodeByName ("BipToMesh_"+obj.name)
tObj.parent = (getNodeByName ("BipToMesh_"+obj.parent.name))
myFnFixParents obj
)
)
)
fn myFnSetupConstraints fpObj =
(
for i=1 to fpObj.children.count do
(
obj = fpObj.children[i]
tObj = getNodeByName ("BipToMesh_"+obj.name)
rc = Orientation_Constraint()
tObj.rotation.controller = rc
rc.appendTarget obj 100
pc = Position_Constraint()
tObj.position.controller = pc
pc.appendTarget obj 100
if (fpObj.children[i]) != undefined do
(
myFnSetupConstraints obj
)
)
)
myFnBipedToMesh selection[1]