Notifications
Clear all

[Closed] CopyPasteBipedKeys

 MZ1

some key functions doesn’t work on biped object, I’m looking for fastest and optimized way to copy-paste biped keys. this is my first try:


fn BipedCopyPasteKey Obj Cnt SourceFrame TargetFrame =
(
	index = getkeyindex Cnt SourceFrame
	if index != 0 do
	(
		k1 = biped.getkey Cnt index
		k2 = biped.addnewkey Cnt TargetFrame
		if k1.type == #Body do
		(
			if k1.ikBlend == 0 then
			(
				at time TargetFrame biped.setfreeKey Obj
			)
			else
			(
				if k1.ikJoinedPivot == true then
				(
					at time TargetFrame biped.setplantedKey Obj
				)
				else
				(
					at time TargetFrame biped.setSlidingKey Obj
				)
			)
		)
		disableRefMsgs()
		k2.selected = k1.selected
		k2.tension = k1.tension
		k2.continuity = k1.continuity
		k2.bias = k1.bias
		k2.easeTo = k1.easeTo
		k2.easeFrom = k1.easeFrom
		case k1.type of
		(
			#vertical:
			(
				k2.z = k1.z
				k2.dynamicsBlend = k1.dynamicsBlend
				k2.ballisticTension = k1.ballisticTension
			)
			#horizontal:
			(
				k2.x = k1.x
				k2.y = k1.y
				k2.balanceFactor = k1.balanceFactor
			)
			#turning:
			(
				k2.rotation = k1.rotation
			)
			#body:
			(
				k2.ikBlend = k1.ikBlend
				k2.ikSpace = k1.ikSpace
				k2.ikAnkleTension = k1.ikAnkleTension
				k2.ikJoinedPivot = k1.ikJoinedPivot
				k2.ikPivotIndex = k1.ikPivotIndex
			)		
			#head:
			(
				k2.headBlend = k1.headBlend
			)
			#prop:
			(
				k2.posSpace = k1.posSpace
				k2.rotSpace = k1.rotSpace
			)
		)
		enableRefMsgs()
	)

)

for o in objects where classof o == Biped_Object do
(
	BipedCopyPasteKey o o.controller slidertime (slidertime+2)
)
4 Replies

Keys must be pasted by hierarchy of biped bones, from root to children to get right values.

1 Reply
 MZ1
(@mz1)
Joined: 11 months ago

Posts: 0

Good point, but meanwhile I’m thinking about performance. Document says all controller functions works on biped except for add or delete keys, But I don’t know why CopyPaste function doesn’t work:

selectkeys Obj SourceFrame 
CopyPasteKeys Obj (fn bumpTime t delta = t + delta) 1 #replaceKeys

First of all It would be better to change the Topic Title, and your question to “Why my Biped Copy/Paste function doesn’t work?”

Second… Can you do this copy-paste without mxs, just using Biped UI?

1 Reply
 MZ1
(@mz1)
Joined: 11 months ago

Posts: 0

Actually this is my first question, I tried to use regular max’s key function, But not working. So I decided to write my own function.I have to use mxs, Do you mean copy posture-pose? No, because this way slider-plant keys will be converted to free keys. What I want to achieve is Copy-Paste biped keys like regular max keys.