Page 1 of 1

Gathering NLA from armatures?

Posted: Sat Nov 27, 2004 8:48 am
by dandeloreon1984
After looking around i found out that you get your animation for armatures from nla, and i would like to ask how i go by getting each action for the armature and it's key frames.

so far i have a simple understanding on how to get keys, but i don't know exactly how it is stored and how to access it.

so far the only example that i can see that is extremely lengthy is the ogre exporter.

Posted: Mon Nov 29, 2004 1:48 am
by der_ton
I learned alot by looking at Jiba's Blender2Cal3D exporter:
http://home.gna.org/oomadness/en/blender2cal3d

Posted: Wed Dec 08, 2004 4:00 am
by dandeloreon1984
I understand python about as much as i understand C/C++, and that is very vague and cryptic in what is explained to me, but so far i do know that this is in the bug reports, but this section of code, from Blender2Cal3d is very useful, but it still baffles me and is very very hard for me to understand... oh and do note that this 2nd link right here explains to how i was originally tryin to access animation data.


edit: script was bad... next post is what you want.

Posted: Tue Feb 08, 2005 6:41 pm
by dandeloreon1984
to start things off... i hate dobule posting, but i figure since this is now on the second page, i'll post right after myself.

i have figured out how to get the nla informatoin down... but i have few ponderances about it, since i notice that some values that i thought would be there are not....
the only question i reall have is for the action keys and such, why does it not have the readily defined value startframe, and endframe?
( you haft to evaluate the curves of it every time to get that information, thus leading to having too many frames ) ( posible hint on where to get the api a lot better to use )

now for the code... while it is not much, it uses action ipos to get an ipo list and the action names.

Code: Select all

'''
Blender key exporter.... prints them all in the values.
'''
import Blender
from Blender import Registry, Types

for obj in Blender.Object.GetSelected():
	if obj.getType() == "Armature": # I think
		Therig = obj.getData()
		for bo in Therig.bones:
			print "Bonename:",bo.name,""
			SkeletalAnimations = Blender.Armature.NLA.GetActions()
			for SkelAnimKey in SkeletalAnimations.keys():
				print "Action:[",SkelAnimKey,"]"
				print "Skelanimkey_Raw: ", SkelAnimKey
				Ipolist = SkeletalAnimations[SkelAnimKey].getAllChannelIpos()
				print "\t\tCurve: [", Ipolist[bo.name],"]"
				for Testing in Ipolist[bo.name].getCurves():
					Cname = Testing.name
					if (Cname == "LocX"):
						print "\t\tLocation X keyframelist found...",Cname
					if (Cname == "LocY"):
						print "\t\tLocation Y keyframelist found...",Cname
					if (Cname == "LocZ"):
						print "\t\tLocation Z keyframelist found...",Cname

					if (Cname == "QuatX"):
						print "\t\tQuat X keyframelist found...",Cname
					if (Cname == "QuatY"):
						print "\t\tQuat Y keyframelist found...",Cname
					if (Cname ==  "QuatZ"):
						print "\t\tQuat Z keyframelist found...",Cname
					if (Cname ==  "QuatW"):
						print "\t\tQuat W keyframelist found...",Cname