我们平常在单帧操作的频率很大。但是有时候,我们想把自己的关键帧数据导入到编辑器中,这时候对关键帧的批量写入就是非常必要的。否则整个过程就会因为大量的导入变的很慢。
比如我们存在如下一个Json格式的文件,里面描述了一根骨骼的关键帧数据:
#D:/keyframe.json
{
"FPS":24,
"KeyTime":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],
"Name":"joint1",
"Channels":{
"translateX":[0,0,0,1,20,1,2,1,2,6,7,2,3,5,6],
"translateY":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"translateZ":[1,2,3,4,5,6,7,8,9,0,1,2,3,4,5],
"rotateX":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"rolateY":[10,20,30,40,50,60,70,80,90,0,10,20,30,40,50],
"rotateZ":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
}
}
现在我们首先解析这个文件,拿到帧率,关键帧和通道的关键帧值。在Python中直接引入json这个模块来解析Json数据。
import json
with open("D:/keyframe.json") as json_file:
data = json.load(json_file)
print(data)
接下来我们需要使用费Pymel库来批量操作关键帧:
import maya.api.OpenMaya as om
import maya.api.OpenMayaAnim as oma
现在我们写一个批量写入关键帧的函数:
def getNode(nodeName):
selectionList = om.MSelectionList()
selectionList.add(nodeName)
dependNode = selectionList.getDependNode(0)
return dependNode
def AddKeysForNode(channels,nodepath,frames,fps):
MfNode = getNode(nodepath)
node = PyNode(nodepath)
node.setRotationOrder(1,True)
unitMap = {'60': 11, '30': 8, '24': 6}
times = om.MTimeArray()
for frame in frames:
times.append(om.MTime(frame,unit=unitMap[str(fps)]))
for k in channels:
frameValues = om.MDoubleArray(channels[k])
plug = node.findPlug(node.attribute(k), True)
animCurveNode = oma.MFnAnimCurve()
animCurveNode.create(plug, 1)
animCurveNode.addKeys(times,frameValues)
我们把上面解析出Json数据调用次即可:
AddKeyForNode(data['Channels'],data['Name'],data[KeyTime],data['FPS'])
Check Search Engine Ranking
Greetings! Very useful advice within this article! It is the little changes that will make the greatest changes. Thanks a lot for sharing!
Orville Bourns
I blog often and I truly appreciate your information. This great article has really peaked my interest. I am going to bookmark your site and keep checking for new information about once a week. I opted in for your RSS feed as well.
Lottie Trinkle
Aw, this was a really nice post. Taking the time and actual effort to create a very good articleÖ but what can I sayÖ I put things off a whole lot and never manage to get anything done.
Telehandler Forklift For Sale
Very nice write-up. I definitely love this website. Keep it up!
agen slot online
Veery nice article, just what I wanted to find.
my homepage … agen slot online
Kwivsibly
hi opp ggeis 2022 ert go fi
RV Service Repair Oc California
You’re so interesting! I do not suppose I’ve truly read through something like this before. So great to find another person with some original thoughts on this issue. Really.. thanks for starting this up. This web site is something that’s needed on the internet, someone with some originality!
RV Repair Mechanics In California
bookmarked!!, I love your web site!
zmozero teriloren
Great post. I am facing a couple of these problems.
slot gacor
Hi there friends, its impressive piece of writing about teachingand fully
defined, keep it up all the time.
RV Repair Mechanics
You’re so cool! I don’t suppose I’ve read a single thing like that before. So nice to discover somebody with genuine thoughts on this subject. Seriously.. thank you for starting this up. This website is something that is required on the web, someone with a little originality!
Cost Of Instagram Ads
Hi! I just would like to offer you a big thumbs up for your excellent info you have right here on this post. I’ll be returning to your site for more soon.
Website Marketing Services
I wanted to thank you for this excellent read!! I certainly loved every little bit of it. I have got you book-marked to check out new things you postÖ
Social Media Marketing Company Cypress
May I simply say what a comfort to find somebody that truly understands what they’re discussing on the internet. You actually understand how to bring an issue to light and make it important. More people should look at this and understand this side of your story. It’s surprising you aren’t more popular because you definitely have the gift.
Facebook Ads Example
May I simply say what a comfort to uncover a person that truly knows what they’re talking about on the internet. You actually understand how to bring a problem to light and make it important. A lot more people ought to look at this and understand this side of the story. I was surprised you’re not more popular given that you surely possess the gift.
Google Ads Customer Service Number
Good day! I just wish to give you a huge thumbs up for the great information you have right here on this post. I’ll be coming back to your site for more soon.
Camper Repairs Near Me
This is the right blog for anyone who hopes to find out about this topic. You understand a whole lot its almost tough to argue with you (not that I actually will need toÖHaHa). You definitely put a new spin on a subject which has been written about for ages. Wonderful stuff, just wonderful!
Trailer Repair Shops Near Me
Very nice post. I definitely appreciate this website. Continue the good work!
RV Mechanics Near Me Oc California
Hi, I do believe this is a great site. I stumbledupon it 😉 I’m going to return once again since i have bookmarked it. Money and freedom is the best way to change, may you be rich and continue to guide other people.
NFT EPubs NFT Bookstore
Very interesting info !Perfect just what I was searching for! “The whole point of getting things done is knowing what to leave undone.” by Lady Reading.
RV Bathroom Remodel Orange County
Good info. Lucky me I discovered your website by accident (stumbleupon). I’ve bookmarked it for later!
fountee
priligy pill 5 mm b, 200 Ојm d, e, 100 Ојm f, g, 50 Ојm i, k and 20 Ојm h, l, m, n, j and insets in j
enviple
order levitra without a prescription Moringa And High Cholesterol
RV Solar Panel Installers Near Me
Good web site you have got here.. Itís difficult to find high-quality writing like yours nowadays. I truly appreciate people like you! Take care!!
RV Camper Repair Near Me
Everything is very open with a really clear explanation of the challenges. It was really informative. Your website is useful. Thank you for sharing!
actiole
generic finasteride international Breast cancer survival rates, by stage
How to Write a Business Plan for a Chassis And Parts For Coaches Business
I am glad to be one of many visitors on this outstanding internet site (:, regards for posting.
How to Write a Business Plan for a Single Feeds, Unmixed, For Farm Animals Business
Appreciate it for this marvellous post, I am glad I detected this internet site on yahoo.
The Best Places to find a Girlfriend in Koulikoro (Mali)
Enjoyed looking at this, very good stuff, appreciate it. “What the United States does best is to understand itself. What it does worst is understand others.” by Carlos Fuentes.
Top Places to Apply for a Job in H? Noi (Viet Nam)
I am now not certain where you are getting your info, but good topic. I needs to spend some time finding out much more or understanding more. Thank you for wonderful information I was in search of this information for my mission.
Beginners Guide to Growing Ercilla (Home & Garden Handbook)
Very interesting info !Perfect just what I was looking for!
The Best Places to Live in Padang (Indonesia)
Magnificent web site. Lots of helpful info here. I am sending it to several buddies ans additionally sharing in delicious. And naturally, thank you in your effort!
Cicaimb
The normality of the distribution of the variables was evaluated using the Shapiro Wilk test buy generic cialis online safely The indictment was brought by the Jinan prosecutorГў s office, Xinhua said, signaling the eastern Chinese city will host the trial
The Best Places to visit in Jeddah (Saudi Arabia)
I really like your writing style, wonderful information, thanks for posting :D. “The superfluous is very necessary.” by Francois Marie Arouet Voltaire.
How to Become a Laser Technician
Sweet blog! I found it while surfing around on Yahoo News. Do you have any tips on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Cheers
How to Start a Cigarette Making Machinery Business (Beginners Guide)
A lot of whatever you point out is astonishingly legitimate and that makes me wonder why I hadn’t looked at this in this light previously. This piece really did switch the light on for me personally as far as this particular subject matter goes. Nonetheless there is actually just one point I am not necessarily too comfortable with and whilst I attempt to reconcile that with the central idea of your issue, allow me observe exactly what all the rest of your subscribers have to say.Nicely done.
vacation
Woah! I’m really digging the template/theme of this
blog. It’s simple, yet effective. A lot of times it’s
hard to get that “perfect balance” between superb usability and visual appeal.
I must say that you’ve done a excellent job with this.
Also, the blog loads super fast for me on Chrome.
Outstanding Blog!
RV Upgrade Services Near Me
Productivity, Mindfulness and also Joyful Way Of Life Layout.
RV Paint Shop Orange County
The World’s Most Advanced Productivity!
Mercedes Sprinter Repair Near Me
Your life will never coincide after this!
Bus Painting Near Me
Just how? Amazingness will alter just how you come close to life and also make everyday an experience.
The Best Places to Retire in Cartagena (Colombia)
Thanks for this post, I am a big fan of this web site would like to continue updated.
camper awning repair
Get one year free plus approximately 40 off your very first registration!
Van Door Repair
When you can’t discover a treatment to your medical ailment, say farewell to difficult days and nights.
rv slide out wall repair
Once as well as for all with this remarkable item, all of your issues will be solved!
semi trailer parts
The best part of living a amazing life is that you’re extra focused as well as calm .
trailer windshield replacement nearby
Incredible is an all-in-one time management toolkit that can assist you obtain even more carried out in less time.
RV Parts California
Amazingness is a way of living that shoots one’s capacity to do wonders.
nearby camper repair open
Just how? Amazingness can aid you live an remarkable life by offering you with the tools to be much more productive and also obtain more performed in much less time.
trailer axle repair near me
Discover just how to obtain even more out of life with this one basic change!
rv services near me
Breathing in and out several times a day enhances your life exceptionally.
4x4 repair shop near me
Psychological quality as well as focus to make sure that you can get whatever done better than ever!
RV Fiberglass Los Angeles
You’re impressive, currently your life can be as well!
sprinter van repair by me
Introducing Remarkable, the productivity toolkit that can help you function smarter as well as live much better.
Rv Exhaust Repair Near Me
This is something that every home and also business requirements.
motorhome step repair
Remarkable is a unique efficiency tool that will certainly assist you obtain even more carried out in much less time.
Sprinter Van 4X4 For Sale
Get the outcomes you desire with much less effort, incredibly simple.
Classic Vw Camper Van For Sale
It’s time to experience an phenomenal degree of high quality and efficiency in a way you never ever assumed possible.
diy sprinter van
Get the results you want with much less initiative, super simple.
RV Cabinet Riverside
Amazingness is a productivity booster that will certainly transform your life for the better!
RV Batteries Orange County
One of the most functional word in the dictionary!
Motorhome Inspection Near Me
The Amazingness lets you obtain even more performed in much less time, without all the anxiety.
RV Repair
Introducing the Amazingness life-altering efficiency supplement!
RV Alignment Near Me
Subscribe now and also get going on your trip today!
Patria Willey
Amazing is a exclusive formula for assisting you complete extra and also really feel much better about your life.
How to Make Pumpernickel (A Beginners Guide to Baking Bread)
I was suggested this website by my cousin. I am not sure whether this post is written by him as no one else know such detailed about my trouble. You’re incredible! Thanks!
Visit Web Site For Survey
Amazingness is the productivity life hack you’ve been seeking!
Maud Sutfin
This fantastic life changing service is what you have actually been awaiting!
Deadra Lucich
The most remarkable item ever before created!
Contact Us To Upgrade
tried and tested method for boosting performance, happiness and also efficiency .
Alden Okuhara
You will be surprised just how effortlessly you can get your work done when using this.
Delphia Eaton
For those that are experienced in producing fantastic material by themselves!
auto repair body shop near me
I will make your life a lot easier, you won’t know just how to thank me.
Trailer Painting Near Me
You will certainly never ever have to worry about obtaining anything done again.
Utility Trailer Repair Shops Near Me
You’re incredible, currently your life can be too!
auto body repair shop near me
That’s right, it’s a software that permits you to be a lot more effective.
Enclosed Motorcycle Trailer Near Me
Make every little thing better with the Amazingness program.
agen togel deposit 5000
web this is very good, I like, material that is too amazing and, unique, continue to work if you believe eat certainly can, me comet with hope able help you ask for permission okay totosoju
Van Paint Shop
This is a new product that has actually been launched just recently.
RV Repair Shop Nearby
For those that are experienced in developing wonderful web content on their own!
Wooladoms
viagra online 150mg buy online viagra viagra coupon online
EbxdMaype
viagra price india viagra uk pharmacy buy discount viagra online
Jrnaquamilip
cialis 200 mg price paypal cialis payment cialis one a day
Jdnsadoms
cialis canadian pharmacy buy cialis using paypal viagra cialis from germany
TnntMaype
generic tadalafil in us cialis 200 mg price sildenafil citrate & tadalafil tablets
QuuMaype
cialis vs viagra reddit cialis discussion forum cialis daily vs regular cialis
agen togel
web this is too good, I like, material that is too fantastic and, unique, continue to work unless you sure eat certainly can, me comet with hope able support you ask for permission okay totosoju
AvxeGlync
viagra soft how much is viagra in usa cheap viagra 50mg
panen slot
web this is very good, I like, material that is very fantastic and, unique, continue to work except you sure eat certainly can, me comet with hope can support you ask for permission okay totosoju
Woroladoms
mexican pharmacy rohypnol lloyds pharmacy nolvadex cvs pharmacy florida oxycodone
mercedes conversion van for sale
Produced hectic people that wish to be much more successful as well as productive .
panen slot
web this is too good, I like, material that is absolutely awesome and, unique, continue to work if you believe eat certainly can, me comet together hope can support you ask for permission okay totopanen
sprinter van repair
Offering you the remarkable benefits of Incredible!
Trailer Body Repair Near Me
Amazingness all-in-one, single resource option.
Trailer Repair Center Nearby
Incredible is an all-in-one life management device that will make your life simpler than ever.
Jbqaquamilip
finasteride online canadian pharmacy canadian pharmacy voltaren gel generic propecia pharmacy
Camper Repair Center Nearby
Sensational is the one stop buy whatever performance!
van conversion shower
Brain fitness instructor that operates in 10 minutes a day.
TujMaype
drugs from canada legal cheapest pharmacy for provigil nolvadex online pharmacy
QubMaype
pharmacy store canadian pharmacy uk delivery nizoral shampoo cvs pharmacy
Jnebadoms
rx express pharmacy hurley ms Tadapox indomethacin pharmacy
Truck Collision Repair Shop
The one-of-a-kind functions of this item makes it easy to use, much faster, and much more efficient.
Knt 777
Hi! Would you mind if I share your blog with my myspace
group? There’s a lot of people that I think would really enjoy your content.
Please let me know. Cheers
my web blog: Knt 777
toto panen slot
web site this is too good, I like, material that is very fantastic and, unique, continue to work unless you sure eat certainly can, me comet together hope can support you ask for permission okay totopanen
Buy Cheap Proxies
When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time
a comment is added I get three emails with the same comment.
Is there any way you can remove me from that
service? Thank you!
Sprinter Van Repair Near Me
When using this, you will be shocked how easily you can obtain your job done.
RareeDreF
27 Parenteral administration of balanced non alkalizing fluids with calcium gluconate often speeds recovery viagra trial pack Cooper LB, Mentz RJ, Gallup D, Lala A, DeVore AD, Vader JM, AbouEzzeddine OF, Bart BA, Anstrom KJ, Hernandez AF, Felker GM
AmvtGlync
diovan from canadian pharmacy citalopram canadian pharmacy canada celexa price tijuana pharmacy valium
Wmgladoms
online canadian pharmacy viagra viagra brand name in india where can i purchase viagra
Kensibly
cheapest generic viagra prices viagra no prescription viagra 50mg online india
Jmeuadoms
sildenafil 50 mg online uk generic viagra 50 can i buy viagra online in usa
roombinee
Of these early alterations in coagulation in response to chemotherapy, only the prolongation of PT is an independent predictor for chemotherapy induced thrombosis buy zithromax for chlamydia for humans
TnfxMaype
what is cialis tadalafil 20 mg used for cialis france can you take cialis in the morning and viagra at night
QemmMaype
viagra 25 mg buy online viagra generic viagra generic viagra
EhdMaype
price of viagra 100mg in canada sildenafil 100mg paypal viagra canada no prescription
pippeferi
tadalista vs cialis J Natl Compr Canc Netw 7 535 541, 2009
AmrbGlync
cheap viagra india online viagra in india real female viagra
Wdbladoms
buying cialis without a prescription peptide liquid tadalafil vikalis 20mg tadalafil
QnwrMaype
cialis 2.5 mg cialis cheaper order online cialis with dapoxetine
Prierse
It is administered at 800mg orally every day buy lasix without prescription
Jdnvadoms
marley drugs tadalafil cheapest tadalafil tablets viagra cialis on line parmacy
Emereaw
The Tg hsp70l hFKRP L276I IRES eGFP zebrafish were pulsed for 1 hour with heat shock at 38 C at 1 dpf, and analyzed at 2, 3, 4, and 5 dpf priligy buy
TmrbMaype
cialis purchase tadalafil sales apomorphine and tadalafil
Jrnxaquamilip
tadalafil citrate dosage bodybuilding ordering cialis in canada cialis pills
Vito Lausen
tried and tested method for increasing joy, efficiency and also efficiency .
Wdbladoms
the cost of tadalafil in belize cheap genieric cialis voucher cialis index
EhdMaype
sildenafil 5 mg viagraonlineusa viagra 50mg price in india online
Juseshext
nolvadex without a prescription Almost a unicorn
ThwMaype
what does cialis look like buy tadalafil online no prescription tadalafil generic 20 mg ebay
AmrbGlync
viagra online rx pharmacy cheapest sildenafil australia sildenafil online pharmacy india
Norris Radke
See your performance rise and also simplify even the most complicated job.
Fabian Relf
A couple of simple ideas and tricks will certainly make you fantastic!
Jdnvadoms
how to save money on cialis cialis black reviews how long before sex should i take cialis
Victor Dunker
Sensational is the perfect productivity device that can assist you get even more done in much less time!