I have exported game archive with all objects. I also have CSV file with all their details, such as model name, location, rotation (XYZW). How do I import CSV file, and make blender read it and put all objects on the places? Ps. Z rotation axis must be multiplied to '-1'.

  • $\begingroup$ @batFINGER, Hi. Thanks for the reply. Your code helps me but didn't solve my problem. FBX importing doesn't have a location and rotation, unlike UV spheres in your example. I see axis_forward and axis_up in FBX importing example, but I don't know what it is. $\endgroup$ Oct 7, 2018 at 8:48
  • $\begingroup$ @batFINGER, I practised little more and successfully assigned location to object. But a question about rotation and scale is still teasing me. $\endgroup$ Oct 7, 2018 at 16:06

1 Answer 1


so after @batFINGER `s examples, I wrote my example. The code is 'Ugly' but in the other hand, it's working

import bpy
import csv

csvfile = "yourfiledirectory\file.csv"
suffix = '.fbx'
with open(csvfile) as csvfile:
    csvread = csv.reader(csvfile)
    for i, row in enumerate (csvread):
        if i==0: continue
        filename = row[0]
        loc_x = row[1]
        loc_y = row[2]
        loc_z = row[3]
        scale_x  = row[4]
        scale_y  = row[5]
        scale_z  = row[6]
        rot_x = row[7]
        rot_y = row[8]
        rot_z = row[9]
        rot_z = float(rot_z)*-1
        rot_w = row[10]
        dir = "directory where your files are"
        bpy.ops.import_scene.fbx( filepath = dir )
        bpy.ops.transform.translate(value=(float(loc_x), float(loc_y), float(loc_z)))
        bpy.ops.transform.resize(value=(float(scale_x), float(scale_y), float(scale_z)))
        for obj in bpy.context.selected_objects:
            a = obj.name
            bpy.context.scene.objects.active = bpy.data.objects[a]
            bpy.context.object.rotation_mode = 'QUATERNION'
            bpy.context.object.rotation_mode = 'QUATERNION'
            bpy.context.object.rotation_quaternion[0] = float(rot_w)
            bpy.context.object.rotation_quaternion[1] = float(rot_x)
            bpy.context.object.rotation_quaternion[2] = float(rot_y)
            bpy.context.object.rotation_quaternion[3] = float(rot_z)
  • $\begingroup$ Instead fo loc_x = row[1] and the next two lines, use something like loc = [float(x) for x in row[1:4]]. Then you can replace the bpy.ops.transform.translate line with bpy.context.object.location = loc. Also, in your loop you can just directly assign to obj.rotation_mode and obj.rotation_quaternion, there is no need to set the active object. $\endgroup$
    – dr. Sybren
    Oct 8, 2018 at 13:27

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