A Script to Import a CSV File and Create F-Curves (for Blender 2.5x or later)

What is CSV F-Curve Importer?
This is a Python script for Blender 2.5x or later and it imports a CSV file into Blender and creates f-curves. The image below shows the UI of CSV F-Curve Importer and imported sine curves in the rotation euler X and Y as shown in F-Curve Editor window. Please watch the video to get the idea of what the script can do for your artwork.
http://4.bp.blogspot.com/-6f1Kte4nMSY/TWBSS7e6JMI/AAAAAAAAAx0/fTpONhtxm8o/s600/00079.JPG

Name:
CSV F-Curve Importer v0.7 alpha5

Download:
csv_fcurve_importer v0_7_alpha5.zip
(It is being developed in SourceForge.net)

Requirements:
CSV F-Curve Importer works as a plugin on Blender 2.5x or later. I confirmed it works well on Blender 2.74.

Features:

  • Be able to import a CSV file and create f-curves.
  • Be able to import and create multi f-curves in any Data Pathes (loc X, Y, …) in any Action data at once.
  • Not Yet : Be able to import with more detailed settings of f-curves, gains, bias, …etc.
  • Not Yet : Be able to import automatically without setting in the UI.

How to Start to Use Most Easily:
If you want to know how to use quickly, it would be the fastest way to see this video tutorial. Also you can read the instruction below.

— Installing Plugin —

    1. Download a file csv_fcurve_importer v0_7_alpha5.zip from “Download:” link above. Then unzip it and make sure a file csv_fcurve_importer v0_7_alpha4.py is created.
    1. Close Blender if it’s running.
    1. Put the file csv_fcurve_importer.py to “%BlenderInstalledAddress%\Blender%Version%\scripts\addons”. (%BlenderInstalledAddress% means the address in which Blender is installed. %Version% means Blender’s version number like 2.74.)
    1. Start Blender.
    1. From the top menu, select “File -> User Preferences…” to see Blender User Preferences window.
    1. In the left list, select “Import-Export” item and you’ll find “Import-Export: CSV F-Curve Importer” in the right list.
    1. Click the check box of “Import-Export: CSV F-Curve Importer” and make sure a check mark is placed.
    1. Click “Save As Default” button to keep this setting.

— Importing a CSV File —

    1. Find the UI of CSV F-Curve Importer in Scene panel.
    1. Select a CSV file in “.csv File Path:” file selection box. For example, use “Sample\1_Data_MostEasily.csv” in the .zip file.
    1. Click “Add” button and you’ll see a configuration box below.
    1. Specify “Time column:” number, for example 0.
    1. Specify “Data column:” number, for example 1.
    1. Specify “Action Name:” text box, for example “Sample”.
    1. Specify “Data Path:” text box, for example “location”.
    1. Specify “Index:” number, for example 0.
    1. Click “Import” button.
    1. You’ll see an imported f-curve in Graph window.

http://2.bp.blogspot.com/-d1r4WQw_z_o/TzYGUUtC-iI/AAAAAAAAABE/4a9sbgoBk0k/s600/00178.jpg

http://1.bp.blogspot.com/-hkYw9amntFE/TWBSSwi7i4I/AAAAAAAAAx8/PAX3zT76FOM/s400/00087.png http://2.bp.blogspot.com/-1kO8k2FQi80/TWBSTC5vGGI/AAAAAAAAAyE/eCYTXMuXXoM/s400/00088.png

— Parameters Explanations —

  • “Time Column:” number means what number of the columns in a CSV file you import as a time data.
  • “Data Column:” number means what number of the columns in a CSV file you import as a value data.
  • “Action Name:” text means the name of Action object in which f-curves are created.
  • “Data Path:” text means the type of path, for example location, rotation, scale, etc.
  • “Index:” number means the type of axis where 0 is x-axis, 1 is y-axis, and 2 is z-axis.
  • “Data Path:” = location and “Index:” = 0 means LocX IPO in Blender 2.49 or older. “Data Path:” = location and “Index:” = 1 is LocY, “Data Path:” = rotation_euler and “Index:” = 0 is RotZ, etc.

Video Tutrials:

Recent Change Logs:


2015/05/10: v0.7 alpha5
  + added the checkboxes to select delimiter letters.
2015/05/01: v0.7 alpha4
  + updated for Blender 2.74.
  + special thanks to chebhou and vklidu, who made this script work 
    and confirm it in Blender 2.74.
  + removed prop_search and replaced to string box. Now you can specify
    any name for Action and Data Path.
2013/06/23: v0.7 alpha3
  + removed feature to select data path name to avoid addon init error.
2013/02/20: v0.7 alpha2
  + modified to read comments in .csv file.
2011/04/19: v0.7 alpha1
  + updated for Blender 2.57.
  + special thanks to bladecoder, who made this script work in Blender 
    2.57.
2011/02/20: v0.6 alpha3
  + refactoring for the class field names.
  + add unit test_one class for FCurvePointAdder.
  + fix bug related to add-on registration.
    (you MUST access bpy.data.scenes[0] ANY TIMES to get 
    CONFIG_CsvFcurveImporter contents)
2010/10/31: v0.6 alpha2
  + rewrite the logic part of script to read a file and to add points to 
    f-curves.
  + add add-on information data.
  + add a feature to output log data to console after importing.
2010/10/24: v0.6 alpha1
  + rewrite the CSV Importer script for Blender 2.5. (the minimum feature)
  + create a UI for the f-curve import configuration.
2010/06/07: v0.5 beta3
  + fixed the bug in which it doesn't import a .csv file with detailed 
    timeline. (Thank you for reporting, okchoir)
2007/08/03: v0.5 beta2
  + added New=Ipo, Object to detail setup items of AutoMode.
  + fixed lots of bug after final test.
  + can print out setups in HandleMode.
2007/07/24: v0.5 beta1
  + can write setups for both IPO curves and meshes into a CSV file and 
    import it automatically.
  + can write detailed setups for both IPO curves and meshes into a CSV 
    file (AutoMode only).
2007/07/02: v0.4 beta
  + improved GUI for better usability.
  + added buttons, Reset, SaveLogs in GUI.
  + improved the contents of logs.
2006/11/24: v0.3 beta
  + can import data from a CSV file and create meshes 
    (AutoMode unsupported).
2006/10/13: v0.2 beta
  + can print out logs for debug (suggestion of Manda).
2006/10/09: v0.1 beta
  + can write setups into a CSV file and import it automatically 
    (experimental).
2006/10/07: v0.0 beta
  + first edition.
  + can use GUI for setup.
  + can save setups to Registry in Blender.
  + can import data from a CSV file and create IPO curves.

The Differences from v0.5 beta3:
v0.6 series are rewritten for Blender 2.5x based on the previous v0.5 beta3. It is still under development and it only has very limited features yet. The features that v0.5 beta3 has and that v0.6 series haven’t yet would be added one by one in the future updates.

1 Like

Here is a screenshot of Eclipse PyDev Outline window as a reference information for those who want to take a glance at the script class structure.
http://3.bp.blogspot.com/-nsSkGi-SIpk/TWBsadMnuJI/AAAAAAAAAyM/MX8GppFwdM4/s800/00097.png

Hello Hans,

I think your csv-file importer for f-curves is very helpful.

Is it possible to use this importer to create a path animation?
What I want to do is to import a csv-file and add the data to the Evaluation Time of an path. so that an object can follow a path with a calculated velocity.

Maybe I missed something and it is already possible, but if not would it be possible to implement such a function?

Greetings Dennis

Hello Dechgo,

Thank you for taking a look at this script. I think it’s possible. A csv file needs to include time-position data.
I created a videoto show how to use the script and it might help.

I’ve created a video that explains how to use the script. Please watch it and get the idea of this script.

Hello Hans,

thanks for the video tutorial, this is helpful.

Unfortunately this did not helped me to solve my question.
Maybe you miss understood me what I want to do or I still dont understand correctly how the importer works :slight_smile:

I’ve attached a blend file and a screenshot, which shows what I’m trying to realize.
In words:
I have an object (in the attached example the cube) and a curve (in the attached example the bezier curve).
So the cube gets an “follow path” constraint (as target object the bezier curve) and “follow curve” will be activated. So now the cube will move along the curve. To animate this I have to go to the Bezier Curve to the object data to “path animation” there I can change the Evaluation time. With keyframes it is possible to animate this evaluation time. And of course in the f-Curve editor you can change the curve…

This is were your script would be very helpful. Instead of creating by myself these keyframes I’d like to import a calculated curve and “add” it to this evaluation time.
When I understand your program correct this evaluation time should appear at your “Date path” input box.
I would really appreciate your help.

Thanks and greetings
Dennis


path_test.blend (478 KB)

Thank you for your explanation, Dechgo.
I understood what you want to do, that is to import a .csv file to a f-curve as the data path of the Evaluation time.

The suggestion list of data path in the script has only 6 items, such as location, rotation_euler… etc, but you can put any names of path data in the textbox. All you have to do is to get the name of data path that you want to import to. So here is how to get.

When you want to create a f-curve for the Evaluation time, click right button over the floatbox of the Evaluation time and select “Copy Data Path” in the menu like below. The name will be copied in your clipboard.
http://1.bp.blogspot.com/-1c5IofGk7SA/TXLWiv_uBwI/AAAAAAAAAyU/Qx4QLSlyIAA/s1600/00104.jpg

Then put the copied name into the textbox in the script. The color of the box will turn red but it works. Click “Import” button and you will get a f-curve of the Evaluation time.
http://1.bp.blogspot.com/-atoYzO-kc40/TXLWjJMkNvI/AAAAAAAAAyc/igiI7MvNXTw/s1600/00105.jpg

In Blender 2.5, you can create f-curves for any kinds of the variables that Blender has. So I cannot list up all the names in the suggestion list in the script, and it has the main 6 names now.

Hello Hans,

thank you very much for your explanation.
Like I assumed it is already possible, I just did not know how to do it :slight_smile:
That you can import the cvs file to everything is amazing. This makes it possible to animate calculated movements now very easy.
Great work!!

I followed your explanation, but unfortunately it won’t work.
I copied the “data-path” and inserted it. But after this the cube will not move.


I guess I’m still doing something wrong.
I would really appreciate your help again.

Greetings Dennis

Thank you for reporting, Dechgo.
I understood it doesn’t work when importing several variables for Bezier Curves. I didn’t know this behavior actually. I thought all types of Object including Bezier Curves can have each Action and all their variables can be animated by adding key points to the Action. But your report makes me find that there are some other cases in Blender. To solve this, I have to look into Blender Python structure and find the way that make it possible by trial and error, so it takes time. However, I really want to fix this and I’m going to keep working on it.

Here is a workaround for importing the Evaluation time in Bezier Curves.

  1. Import your .csv data to the data path of location using the script.
  2. In the Graph Editor in Blender, select all key points and press Ctrl+C to copy.
  3. Show the Evaluation time in the Graph Editor and press Ctrl+V to paste.

It needs a lot of steps to follow, so it would be inconvenient, but if you need such types of importing immediately, you can give it a try.

Hello Hans,

thanks for all your help.

Too bad, that it’s at the moment not possible to import the csv-file directly to the Evaluation of a Curve…

But your workaround works perfectly.

Like I said before, I realy like your script. GREAT WORK!!!

Hopefully you find a way how to import it directly to the curve, but if not copying the imported F-curve is quite easy to do.
Much better then creating each keyframe manually (thats what I had to do before). So your script saves me a lot of time now.

so thanks very much for sharing your nice script!!!

Greetings Dennis

I will look for how to add key points to the Evaluation time in Bezier Curves for the first step. Thank you again for giving me the bug information.

Hi.

Thanks for an amazing plugin :slight_smile: Unfortunately I have some elementary problems with it: I have done as instructed in this thread, but when I hit the Import button, nothing happens. I’m really just a beginner with Blender, so have I missed something? Should I get the Grapg view automatically?

edit

Just noticed the video :slight_smile: Now I got it. Thank you so much!

Ok, now I now some basics of Blender and this great plugin :slight_smile: However I’d like to have some advice on my problem:

I have csv-file with frame numbers and values. I can import the data fine, no problem. I want to do a 2D graph (I guess its a curve in Blender terms) that changes its Z-value according to the second column of my csv-file. (or if we’re talking about a true 2D graph, X is time and Y is value). I can easily create an animation in which the default cube moves (the location changes) “according to the data”, but how do I create a curve for that purpose? The reason I’m using Blender is that I need a movie file which I can use as an overlay for a captured video from the computer display. I then plan to create a simple illustration video with Sony Vegas combining the curve and what was happening on the screen. I don’t need any other object to travel along the curve (to follow it), I’d only need the curve.

edit
I guess I’m not so good at explaining things… I’d like to have a movie in which there’s a “similar” graph as I now get into my Graph editor. How do I “convert” the Graph editor graph into a real rendered object (graph)?

I hope this makes sense :slight_smile:

Hi, thanks for your help :slight_smile: I got the mesh importeer running, but I can’t quite get the result I’d like. My csv-file has only 2 colums: first column (I suppose it’s column 0 in the mesh i porter settings) has the time in seconds. Second column (called column 1 in mesh importer?) has the data values.

I had to manually add the timecode (in seconds), because the application I get the actual data from does not include time code in the csv-file. Luckily the application allows me to set the data rate (in this example is 32 values/second).

1,0.214
1,0.214
1,0.214
1,0.214
1,0.214
1,0.212
1,0.214
1,0.214
1,0.214
1,0.214
1,0.212
1,0.212
1,0.214
1,0.214
1,0.214
1,0.214
1,0.216
1,0.216
1,0.216
1,0.216
1,0.219
1,0.219
1,0.219
1,0.219
1,0.219
1,0.219
1,0.221
1,0.219
1,0.219
1,0.219
1,0.219
1,0.219
2,0.216
2,0.219
2,0.219
2,0.219
2,0.216
2,0.216
2,0.219
2,0.216
2,0.216
2,0.216
2,0.216
2,0.216
2,0.216
2,0.216
2,0.216
2,0.216
2,0.219
2,0.216
2,0.219
2,0.221
2,0.226
2,0.226
2,0.228
2,0.231
2,0.231
2,0.231
2,0.233
2,0.231
2,0.233
2,0.233

I used the csv file and chose the Point X-Y 2D table (matrix) and Ceate vertices and faces (reactangles). The result looks like this:


Is there something wrong with my csv-file format?

I guess the graph is actually correct, but how can I change the properties? Sorry, I’m just a newbie with Blender here.

Maybe I’m still not sure what you want to do. Is it correct that you want to create a curve for a graph where the horizontal axis is time line in range from 0.0 to 3.0 and the vertical axis is values in range from 0.212 to 0.233?
If you want to get a curve, please use “Point list containing X, Y, Z columns” in the “File Type” menu and “Create vertices and edges (single line)” in the “Mesh Type” menu.

Maybe I’m still not sure what you want to do. Is it correct that you want to create a curve for a graph where the horizontal axis is time line in range from 0.0 to 3.0 and the vertical axis is values in range from 0.212 to 0.233?
If you want to get a curve, please use “Point list containing X, Y, Z columns” in the “File Type” menu and “Create vertices and edges (single line)” in the “Mesh Type” menu.

Yes, the actual csv-file is much much longer. I tried those settings also, but I only got a “straight” black line? Ok, it may be that as my data is gathered for a period of one hour, it just looks like a traight line although there are some very radical changes later on in the data. I’ll make another csv-file with more radical changes in the values straight in the beginning and test with that :slight_smile:

Thank you for your help Hans :slight_smile:

Hi.

Could you please test my csv-file and see what’s gonna happen? There’s something I don’t understand regarding the csv-colums/x,y,x -settings in the plugin maybe :frowning: The link for the (1.4 MB) file is below.

http://koti.mbnet.fi/olliraa/fulldata.csv

The first colums lists (full) seconds and the second column is the data values. What would be the compatible format?

Could you test that? Sorry for the trouble :frowning:

Thank you, ora. I’ve downloaded the .csv file. I will try tomorrow.

Please let me understand correctly. The graph below shows exactly what you want?