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]