3
$\begingroup$

I have a value node driving the vertical position of an object. I want to animate this over 800 frames using a pre-existing list of unique values currently stored in an Excel spreadsheet column.

The solutions I can find online seem to require getting heavily into the Animation nodes addon which isn't stable in the current build. Is there any simpler way to do this without entering every value and keyframing by hand?

example values

$\endgroup$
3
  • $\begingroup$ Hello, which blender version do you use ? $\endgroup$
    – Gorgious
    Jun 18, 2020 at 6:29
  • $\begingroup$ Just the latest stable version 2.83 $\endgroup$ Jun 18, 2020 at 7:01
  • $\begingroup$ I know that the value node accepts non-float/int variables such as #frame, but I'm finding it hard to find a list of what else it DOES accept. Maybe you could write a small python script that checks the frame number and enters a value into a variable based on that. You could then, conceivably, use this variable in your value node. However, as I said, it is hard to find info on what is acceptable in that field. Maybe you'll have more luck searching than me. $\endgroup$ Jun 18, 2020 at 19:59

1 Answer 1

2
$\begingroup$

You can actually achieve this using an inline driver by entering the following directly into the property field (eg, the Z-location) :

#[1.054,0.752,0.557,0.297,0.155,-0.00725,-0.064,-0.079,-0.12,-0.101][int(max(0,min(9,frame)))]

Here the '#' is a shortcut to define a driver, [....] is your list of values - and the rest picks up the current 'frame', limits it to fit in the range of the list (0 through 9 in this case) and converts to an 'integer' to use as an index.

Once pasted into the property it should turn purple (to indicate a driver is present) and changing the current frame should automatically pick out the relevant value from the list.

This obviously gets more cumbersome the more values you have in you list but works fine for relatively short lists. For longer lists it would be better to register a driver function instead of defining inline (see https://blender.stackexchange.com/a/66257/29586 for an example of that).

The key is then to simply reformat your data from Excel into a python list.

example result


The above method will only work with a relatively small list of values - due to the limitation of how much you can actually fit into a single property. For a larger list you can use a text block to define a driver function as follows :

import bpy

mylist = [0.0,0.00333332716049726,0.00666661728406036,0.00999983333416666,0.0133329382751166,0.0166658950724451,0.0199986666933331,0.0233312161070191,0.0266635062852107,0.0299955002024957,0.0333271608367536,0.0366584511695674,0.0399893341866342,0.043319772878177,0.0466497302393557,0.0499791692706783,0.0533080529784122,0.0566363443749947,0.0599640064794446,0.0632910023177728,0.066617294923393,0.0699428473375328,0.0732676226096439,0.0765915837978132,0.0799146939691727,0.0832369162003102,0.0865582135776797,0.089878549198011,0.0931978861687204,0.0965161876083201,0.0998334166468282,0.103149536426178,0.106464510100629,0.109778300837175,0.113090871815951,0.116402186230649,0.119712207288919,0.123020898212785,0.126328222239047,0.129634142619695,0.132938622622314,0.136241625530494,0.139543114644236,0.142843053280363,0.146141404772923,0.149438132473599,0.152733199752119,0.156026569996658,0.159318206614246,0.162608073031178,0.165896132693415,0.169182349066996,0.172466685638439,0.175749105915149,0.179029573425824,0.182308051720858,0.185584504372749,0.188858894976501,0.192131187150029,0.195401344534565,0.198669330795061,0.201935109620593,0.205198644724761,0.2084598998461,0.211718838748473,0.214975425221483,0.218229623080869,0.221481396168911,0.224730708354829,0.227977523535188,0.231221805634299,0.234463518604614,0.237702626427135,0.240939093111807,0.244172882697924,0.247403959254523,0.250632286880787,0.253857829706441,0.257080551892155,0.260300417629937,0.263517391143535,0.266731436688831,0.269942518554241,0.273150601061112,0.276355648564114,0.279557625451642,0.282756496146207,0.285952225104836,0.28914477681946,0.292334115817317,0.29552020666134,0.29870301395055,0.301882502320457,0.305058636443443,0.308231381029164,0.311400700824932,0.314566560616118,0.317728925226533,0.320887759518825,0.324043028394868,0.327194696796152,0.330342729704171,0.333487092140814,0.336627749168754,0.339764665891832,0.342897807455451,0.34602713904696,0.34915262589604,0.35227423327509,0.355391926499617,0.358505670928617,0.361615431964962,0.364721175055783,0.367822865692856,0.370920469412983,0.374013951798377,0.377103278477043,0.380188415123161,0.383269327457468,0.386345981247634,0.389418342308651,0.392486376503203,0.395550049742055,0.398609327984423,0.401664177238359,0.404714563561125,0.40776045305957,0.41080181189051,0.4138386062611,0.416870802429211,0.419898366703806,0.422921265445313,0.425939465066,0.428952932030345,0.431961632855415,0.43496553411123,0.437964602421141,0.440958804462198,0.44394810696552,0.446932476716665,0.449911880556,0.452886285379068,0.455855658136959,0.458819965836671,0.461779175541483,0.464733254371318,0.467682169503107,0.470625888171158,0.473564377667516,0.476497605342327,0.479425538604203,0.482348144920583,0.485265391818092,0.488177246882907,0.491083677761113,0.493984652159063,0.496880137843737,0.499770102643102,0.502654514446469,0.505533341204847,0.508406550931301,0.511274111701309,0.514135991653113,0.516992158988077,0.519842581971038,0.522687228930659,0.52552606825978,0.528359068415772,0.531186197920883,0.534007425362594,0.536822719393961,0.539632048733969,0.542435382167876,0.545232688547562,0.548023936791874,0.55080909588697,0.553588134886667,0.556361022912784,0.559127729155481,0.561888222873606,0.564642473395035,0.567390450117014,0.570132122506495,0.572867460100481,0.57559643250636,0.578319009402243,0.581035160537305,0.583744855732117,0.586448064878981,0.58914475794227,0.591834904958753,0.594518476037937,0.597195441362392,0.599865771188087,0.602529435844719,0.60518640573604,0.607836651340189,0.610480143210022,0.613116851973434,0.615746748333686,0.618369803069737,0.62098598703656,0.623595271165471,0.626197626464451,0.628793024018469,0.631381434989799,0.633962830618348,0.636537182221968,0.639104461196778,0.641664639017484,0.644217687237691,0.646763577490223,0.649302281487437,0.651833771021537,0.654358017964887,0.656874994270325,0.659384671971473,0.66188702318305,0.664382020101179,0.666869635003698,0.669349840250466,0.671822608283674,0.674287911628145,0.676745722891647,0.67919601476519,0.681638760023334,0.684073931524491,0.686501502211224,0.688921445110551,0.691333733334243,0.69373834007912,0.696135238627357,0.69852440234677,0.700905804691122,0.70327941920041,0.705645219501165,0.708003179306741,0.710353272417608,0.712695472721645,0.715029754194429,0.717356090899523,0.719674456988764,0.721984826702554,0.724287174370143,0.726581474409911,0.728867701329662,0.731145829726896,0.7334158342891,0.735677689794023,0.737931371109963,0.740176853196037,0.742414111102469,0.744643119970859,0.746863855034467,0.74907629161848,0.751280405140293,0.753476171109778,0.755663565129558,0.757842562895277,0.760013140195872,0.76217527291384,0.764328937025505,0.766474108601289,0.768610763805974,0.770738878898969,0.772858430234572,0.774969394262235,0.777071747526824,0.779165466668879,0.781250528424876,0.783326909627483,0.785394587205821,0.787453538185714,0.78950373968995,0.791545168938535,0.793577803248942,0.795601620036366,0.797616596813975,0.799622711193158,0.801619940883777,0.803608263694411,0.805587657532605,0.807558100405114,0.809519570418149,0.811472045777619,0.813415504789374,0.815349925859443,0.817275287494281,0.819191568300998,0.821098746987607,0.822996802363253,0.82488571333845,0.826765458925319,0.828636018237817,0.83049737049197,0.832349495006107,0.834192371201085,0.836025978600521,0.837850296831017,0.839665305622391,0.841470984807897,0.84326731432445,0.845054274212854,0.846831844618015,0.848600005789171,0.850358738080104,0.852108021949363,0.853847837960478,0.855578166782177,0.857298989188603,0.859010286059525,0.860712038380551,0.862404227243338,0.864086833845807,0.865759839492344,0.867423225594017,0.869076973668773,0.870721065341653,0.872355482344986,0.873980206518602,0.875595219810026,0.877200504274682,0.878796042076093,0.880381815486077,0.881957806884948,0.883523998761704,0.88508037371423,0.886626914449487,0.888163603783706,0.889690424642575,0.891207360061435,0.892714393185463,0.894211507269863,0.895698685680048,0.897175911891829,0.898643169491597,0.900100442176505,0.901547713754649,0.902984968145249,0.904412189378826,0.905829361597381,0.907236469054571,0.908633496115883,0.910020427258809,0.911397247073016,0.912763940260521,0.914120491635858,0.915466886126249,0.916803108771767,0.918129144725509,0.919444979253755,0.920750597736136,0.922045985665792,0.923331128649538,0.92460601240802,0.925870622775877,0.927124945701896,0.928368967249167,0.929602673595242,0.930826051032285,0.932039085967226,0.933241764921913,0.934434074533257,0.935616001553386,0.93678753284979,0.937948655405467,0.939099356319068,0.940239622805037,0.941369442193759,0.942488801931697,0.943597689581533,0.944696092822303,0.945783999449539,0.9468613973754,0.947928274628809,0.948984619355586,0.950030419818578,0.95106566439779,0.952090341590516,0.953104440011463,0.954107948392883,0.955100855584692,0.956083150554599,0.957054822388224,0.958015860289225,0.958966253579412,0.959905991698869,0.960835064206073,0.961753460778003,0.962661171210264,0.963558185417193,0.964444493431975,0.965320085406752,0.966184951612734,0.967039082440305,0.967882468399131,0.968715100118265,0.969536968346254,0.970348063951235,0.971148377921045,0.971937901363313,0.972716625505565,0.973484541695319,0.974241641400181,0.974987916207939,0.975723357826659,0.976447958084775,0.97716170893118,0.977864602435316,0.978556630787264,0.979237786297826,0.979908061398614,0.980567448642135,0.981215940701871,0.98185353037236,0.982480210569279,0.983095974329523,0.983700814811277,0.984294725294097,0.984877699178986,0.98544972998846,0.986010811366629,0.98656093707926,0.98710010101385,0.987628297179696,0.988145519707957,0.98865176285172,0.989147020986067,0.989631288608135,0.990104560337178,0.990566830914625,0.991018095204143,0.991458348191686,0.991887584985562,0.992305800816475,0.992712991037588,0.99310915112457,0.993494276675645,0.993868363411645,0.994231407176054,0.994583403935056,0.994924349777581,0.995254240915344,0.995573073682891,0.99588084453764,0.996177550059918,0.996463186952999,0.996737752043143,0.997001242279631,0.997253654734795,0.997494986604054,0.997725235205948,0.997944397982159,0.998152472497548,0.998349456440179,0.998535347621342,0.998710143975583,0.998873843560721,0.999026444557874,0.999167945271476,0.999298344129299,0.999417639682469,0.999525830605479,0.99962291569621,0.99970889387594,0.999783764189357,0.999847525804568,0.999900178013113,0.999941720229966,0.999972151993549,0.999991472965731,0.999999682931835,0.999996781800638,0.999982769604376,0.99995764649874,0.999921412762875,0.999874068799377,0.999815615134291,0.9997460524171,0.999665381420724,0.999573603041505,0.999470718299203,0.99935672833698,0.999231634421391,0.999095437942365,0.998948140413197,0.998789743470524,0.99862024887431,0.998439658507827,0.998247974377632,0.998045198613548,0.997831333468636,0.997606381319174,0.997370344664627,0.997123226127622,0.996865028453919,0.996595754512378,0.996315407294928,0.996023989916537,0.995721505615171,0.995407957751765,0.99508334981018,0.994747685397168,0.99440096824233,0.994043202198076,0.993674391239579,0.993294539464736,0.992903651094118,0.992501730470926,0.992088782060939,0.991664810452469,0.991229820356307,0.990783816605673,0.990326804156158,0.989858788085675,0.989379773594396,0.988889766004701,0.988388770761114,0.987876793430241,0.987353839700716,0.986819915383131,0.986275026409971,0.985719178835553,0.985152378835957,0.984574632708953,0.983985946873937,0.983386327871857,0.98277578236514,0.982154317137618,0.981521939094456,0.980878655262067,0.980224472788045,0.979559398941077,0.978883441110865,0.978196606808045,0.977498903664101,0.976790339431285,0.976070921982524,0.975340659311339,0.974599559531751,0.973847630878195,0.973084881705426,0.972311320488427,0.971526955822315,0.970731796422245,0.969925851123312,0.969109128880456,0.968281638768361,0.967443389981353,0.966594391833298,0.9657346537575,0.964864185306596,0.963982996152448,0.963091096086039,0.962188495017359,0.9612752029753,0.960351230107542,0.959416586680441,0.958471283078914,0.957515329806325,0.956548737484367,0.955571516852944,0.954583678770054,0.953585234211665,0.952576194271595,0.95155657016139,0.950526373210194,0.94948561486463,0.94843430668867,0.947372460363504,0.946300087687414,0.945217200575641,0.944123811060253,0.943019931290011,0.941905573530233,0.940780750162663,0.939645473685325,0.938499756712391,0.937343611974038,0.936177052316306,0.935000090700958,0.933812740205332,0.9326150140222,0.931406925459619,0.930188487940781,0.928959715003869,0.927720620301904,0.92647121760259,0.925211520788168,0.923941543855256,0.922661300914696,0.921370806191395,0.920070074024172,0.918759118865592,0.91743795528181,0.916106597952408,0.914765061670231,0.913413361341225,0.912051511984268,0.910679528731006,0.909297426825682,0.90790522162497,0.906502928597804,0.905090563325201,0.903668141500095,0.902235678927159,0.900793191522627,0.899340695314124,0.897878206440481,0.89640574115156,0.89492331580807,0.893430946881389,0.89192865095338,0.890416444716202,0.888894344972133,0.887362368633375,0.885820532721874,0.884268854369122,0.882707350815974,0.881136039412454,0.879554937617562,0.877964062999078,0.876363433233371,0.8747530661052,0.873132979507516,0.871503191441265,0.869863720015187,0.868214583445613,0.866555800056266,0.864887388278056,0.863209366648874,0.861521753813388,0.859824568522834,0.858117829634809,0.856401556113061,0.854675767027278,0.852940481552876,0.851195718970788,0.849441498667246,0.84767784013357,0.845904762965946,0.844122286865214,0.842330431636646,0.840529217189725,0.838718663537928,0.836898790798498,0.835069619192224,0.833231169043218,0.831383460778683,0.829526514928693,0.827660352125961,0.825784993105608,0.823900458704939,0.822006769863205,0.820103947621374,0.818192013121896,0.816270987608467,0.814340892425796,0.812401749019365,0.810453578935191,0.80849640381959,0.806530245418931,0.804555125579398,0.802571066246747,0.800578089466062,0.798576217381507,0.796565472236087,0.794545876371392,0.792517452227356,0.790480222342005,0.788434209351204,0.786379435988411,0.78431592508442,0.782243699567108,0.780162782461182,0.778073196887921,0.775974966064922,0.773868113305839,0.771752662020126,0.769628635712774,0.767496057984055,0.765354952529254,0.763205343138409,0.761047253696049,0.758880708180922,0.756705730665734,0.754522345316878,0.752330576394171,0.750130448250577,0.747921985331942,0.74570521217672,0.743480153415702,0.741246833771739,0.739005278059471,0.73675551118505,0.734497558145862,0.732231444030251,0.72995719401724,0.72767483337625,0.72538438746682,0.723085881738325,0.720779341729694,0.718464793069126,0.716142261473805,0.713811772749612,0.711473352790844,0.709127027579921,0.706772823187097,0.704410765770176,0.702040881574216,0.699663196931238,0.697277738259938,0.694884532065386,0.692483604938738,0.690074983556936,0.687658694682418,0.68523476516281,0.68280322193064,0.680364092003028,0.677917402481394,0.675463180551151,0.673001453481407,0.670532248624659,0.668055593416491,0.665571515375269,0.663080042101836,0.660581201279201,0.658075020672236,0.655561528127368,0.653040751572265,0.65051271901553,0.647977458546387,0.645434998334371,0.642885366629014,0.64032859175953,0.637764702134504,0.635193726241571,0.632615692647103,0.630030629995892,0.62743856701083,0.624839532492589,0.622233555319305,0.619620664446252,0.617000888905524,0.614374257805712,0.611740800331578,0.609100545743734,0.606453523378315,0.603799762646653,0.601139293034952,0.598472144103957,0.595798345488628,0.593117926897813,0.590430918113913,0.587737348992552,0.585037249462249,0.582330649524082,0.579617579251356,0.576898068789267,0.574172148354573,0.571439848235247,0.568701198790154,0.565956230448703,0.563204973710514,0.560447459145077,0.557683717391417,0.554913779157745,0.552137675221125,0.549355436427127,0.546567093689487,0.543772677989762,0.540972220376989,0.538165751967331,0.535353303943744,0.532534907555621,0.529710594118448,0.526880395013458,0.524044341687276,0.521202465651578,0.518354798482735,0.515501371821464,0.512642217372476,0.509777366904126,0.506906852248053,0.504030705298838,0.501148958013638,0.498261642411839,0.495368790574694,0.492470434644973,0.4895666068266,0.486657339384298,0.483742664643233,0.480822614988648,0.47789722286551,0.474966520778147,0.472030541289883,0.469089317022683,0.466142880656786,0.463191264930345,0.460234502639059,0.457272626635812,0.454305669830306,0.451333665188699,0.448356645733233,0.445374644541871,0.44238769474793,0.43939582953971,0.436399082160126,0.433397485906342,0.430391074129395,0.42737988023383,0.424363937677326,0.421343279970325,0.418317940675659,0.415287953408178,0.412253351834376,0.409214169672017,0.406170440689761,0.403122198706787,0.40006947759242,0.39701231126575,0.393950733695262,0.390884778898452,0.387814480941455,0.384739873938658,0.381660992052332,0.378577869492242,0.375490540515276,0.372399039425056,0.369303400571562,0.36620365835075,0.363099847204168,0.359992001618576,0.356880156125557,0.353764345301143,0.35064460376542,0.347520966182152,0.34439346725839,0.341262141744091,0.338127024431727,0.334988150155905,0.331845553792971,0.328699270260632,0.32554933451756,0.322395781563009,0.319238646436425,0.316077964217054,0.312913770023554,0.309746099013606,0.306574986383523,0.303400467367856,0.300222577239007,0.297041351306832,0.293856824918255,0.290669033456868,0.287478012342544,0.284283797031041,0.281086423013607,0.277885925816587,0.274682341001027,0.271475704162283,0.268266050929618,0.265053416965814,0.261837837966771,0.258619349661111,0.255397987809782,0.25217378820566,0.248946786673153,0.245717019067799,0.242484521275873,0.239249329213982,0.236011478828673,0.232771006096027,0.229527947021264,0.22628233763834,0.223034214009548,0.219783612225117,0.216530568402811,0.213275118687529,0.210017299250899,0.206757146290884,0.203494696031369,0.200229984721771,0.196963048636624,0.193693924075185,0.190422647361027,0.187149254841636,0.183873782888005,0.180596267894233,0.17731674627712,0.174035254475763,0.170751828951145,0.167466506185741,0.164179322683102,0.160890314967456,0.157599519583298,0.154306973094989,0.151012712086344,0.14771677316023,0.144419192938155,0.141120008059867,0.137819255182942,0.134516970982376,0.131213192150184,0.127907955394985,0.124601297441596,0.12129325503063,0.117983864918077,0.114673163874906,0.11136118868665,0.108047976152998,0.10473356308739,0.101417986316602,0.098101282680343,0.0947834890308414,0.0914646422324372,0.088144779161171,0.0848239367043765,0.0815021517602691,0.0781794612375362,0.0748559020549272,0.0715315111408437,0.0682063254329274,0.0648803818776525,0.0615537174299131,0.0582263690526134,0.0548983737162569,0.0515697683985346,0.0482405900839163,0.0449108757632377,0.0415806624332905,0.0382499870964107,0.0349188867600682,0.0315873984364539,0.0282555591420708,0.0249234058973213,0.021590975726096,0.0182583056553625,0.0149254327147545,0.0115923939361583,0.00825922635330428,0.00492596700135356,0.00159265291648683,-0.00174067886450703,-0.00507399130464208,-0.00840724736714862,-0.011740410015882,-0.015073442215736,-0.0184063069330538,-0.0217389671360395,-0.0250713857951691,-0.0284035258836038,-0.0317353503775987,-0.0350668222569158,-0.0383979045052354,-0.0417285601105661,-0.0450587520656587,-0.0483884433684141,-0.0517175970222966,-0.0550461760367443,-0.0583741434275801,-0.0617014622174223,-0.0650280954360974,-0.0683540061210478,-0.0716791573177445,-0.0750035120800973,-0.0783270334708653,-0.0816496845620668,-0.0849714284353914,-0.0882922281826076,-0.0916120469059745,-0.0949308477186517,-0.0982485937451087,-0.101565248121534,-0.104880773996249,-0.108195134530108,-0.11150829289692,-0.114820212283846,-0.118130855891817,-0.121440186935939,-0.124748168645899,-0.12805476426638,-0.131359937057464,-0.134663650295043,-0.137965867271227,-0.141266551294749,-0.144565665691377,-0.147863173804319,-0.151159038994627,-0.154453224641614,-0.157745694143248,-0.161036410916571,-0.164325338398096,-0.167612440044218,-0.17089767933162,-0.174181019757676,-0.17746242484086,-0.18074185812115,-0.184019283160431,-0.187294663542903]


def drv_getvalue(frame):

    if (frame>=0) and (frame<=999):
        return mylist[frame]
    else:
        return 0;

if 'drv_getvalue' in bpy.app.driver_namespace:
    del bpy.app.driver_namespace['drv_getvalue']
bpy.app.driver_namespace['drv_getvalue'] = drv_getvalue

Name the text block something like 'drv_getvalue.py' and execute it. You can then set a driver to use the new 'drv_getvalue' function by pasting the following into a property field :

#drv_getvalue(int(frame))

This will now call the function and lookup the relevant value from your list on change of frame.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .