I'm trying to create a default mapping mode for an object. I followed through understanding the python API for blender, and things are making more sense at this point, however I'm not able to create the UV map I wish on the object. Code below:
import bpy
from os import getcwd
file = getcwd()+'/data/naturalSat/models/2_Pallas_101.obj'
print("Testing")
imported_object = bpy.ops.import_scene.obj(filepath=file)
obj_object = bpy.context.selected_objects[0]
print("processing: "+obj_object.name)
#Extract the mesh and smooth all polygons
output = obj_object.data
for face in output.polygons:
face.use_smooth = True
bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.uv.unwrap()
bpy.ops.uv.cylinder_project(direction='VIEW_ON_EQUATOR', scale_to_bounds=True)
#export
filePath = getcwd()+'/'+obj_object.name+'.obj'
bpy.ops.export_scene.obj(filepath=filePath)
Am I doing this correctly? one of the concerns I have is that the cylindrical_project arguments is direction = 'VIEW'. I'm loading a python script using the command line, so headless mode.