| I made this a while ago. I don't know if it will serve your needs and can't recall if it works fully. Pretty sure it did and it was my keyframe adding / removing code that didn't yet. I should work on that again sometime... 
 
 
'Moves a bone the specified distance from where it is now.
'USAGE: moveBone(entity, bone number, key frame number,delta x,delta y, delta z)
Function moveBone(ent:TEntity,bone:Int,frame:Int,dx:Float,dy:Float,dz:Float)
	Local boneCount:Int = 0
	Local frameCount:Int = 0
	For Local currBone:TBone=EachIn ent.entity_list
		frameCount = currBone.keys.frames
		
		If frame > frameCount Then Return
		If frame < 1 Then Return
		
		If boneCount = bone
			'Set bone position.
			Local lastFrame = frame - 1
			Local nextFrame = frame + 1
			
			If lastFrame < 0 Then lastFrame = 0
			If nextFrame > frameCount Then nextFrame = frameCount
			
			'Anim time starts at index 1 in the keyframe arrays
			currBone.keys.px[frame]:+dx
			currBone.keys.py[frame]:+dy
			currBone.keys.pz[frame]:+dz
			currBone.keys.flags[frame]=5
			
		EndIf
		
		boneCount:+1
	Next
End Function
Function rotateBone(ent:TEntity,bone:Int,frame:Int,rx:Float,ry:Float,rz:Float)
	Local boneCount:Int = 0
	Local frameCount:Int = 0
	For Local currBone:TBone=EachIn ent.entity_list
		frameCount = currBone.keys.frames
		
		If frame > frameCount Then Return
		If frame < 1 Then Return
		
		If boneCount = bone
			'Set bone rotation.
			Local lastFrame = frame - 1
			Local nextFrame = frame + 1
			
			If lastFrame < 0 Then lastFrame = 0
			If nextFrame > frameCount Then nextFrame = frameCount
			
			
			Local w:Float,x:Float,y:Float,z:Float
			
			EulerToQuart(ry,rx,rz,w,x,y,z)
			
			currBone.keys.qw[frame] = w
			currBone.keys.qx[frame] = x
			currBone.keys.qy[frame] = y
			currBone.keys.qz[frame] = z
			currBone.keys.flags[frame] = 5
			
			'Set the bones position to the initial position... otherwise if this
			'bone has not been rotated before, it will move to 0,0,0
			
			currBone.keys.px[frame] = currBone.n_px#
			currBone.keys.py[frame] = currBone.n_py#
			currBone.keys.pz[frame] = currBone.n_pz#
			
		EndIf
		
		boneCount:+1
	Next
End Function
Function EulerToQuart(yaw:Float,pitch:Float,roll:Float,w:Float Var,x:Float Var,y:Float Var,z:Float Var)
	'Ported on 08/17/2008 from
	'http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm
	Local c1:Float = Cos(yaw/2),c2:Float=Cos(pitch/2),c3:Float = Cos(roll/2)
	Local s1:Float = Sin(yaw/2),s2:Float=Sin(pitch/2),s3:Float = Sin(roll/2)
	
	Local c1c2:Float = c1*c2 
	Local s1s2:Float = s1*s2
	
	w = (c1c2 * c3) - (s1s2 * s3)
	x = (c1c2 * s3) + (s1s2 * c3)
	y = (s1 * c2 * c3) + (c1* s2 * s3)
	z = (c1 * s2 * c3) - (s1 * c2 * s3)
EndFunction
 
 
 |