I realize similar questions have been asked, but I'm having a lot of trouble and would like to understand.
How can I UV unwrap (smart project) the originally selected object and scale all UVs (scale double) while in Object Mode?
I have a script that adds some array modifiers. It also adds some empties to manipulate the arrays. When I attempt to unwrap it I can't get past the 'failed, context is incorrect'
I read a little about override, but I'm not sure how to use it.
I've included the code for setting up the empties and arrays. I gets input from the user as to how many are needed. I greatly appreciate any help!
#define selected object
obj = bpy.context.active_object
#store current object to select again?
object1 = obj
# code so that I can move the origin of each empty
# store the location of current 3d cursor
#saved_location = bpy.context.scene.cursor_location.copy()
# give 3dcursor new coordinates
#bpy.context.scene.cursor_location = (1.0,0.0,0.0)
# set the origin on the current object to the 3dcursor location
#bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
#CREATE EMPTIES TO MANIPULATE ARRAYS
#for i in range(int(context.scene.arry_amnt)):
# i_amnt = i
# e_mount = ("E" + str(i_amnt))
# bpy.ops.object.text_add()
# obt = bpy.context.object
# obt.name = e_mount
# obt.data.body = e_mount
# obt.data.offset_y = i_amnt
# obt.show_x_ray = True
# obt.show_texture_space = True
# obt.hide_render = True
# if context.scene.rnd_rotation == 1:
# obt.rotation_euler[2] = random.randint(0,2)
# if context.scene.rnd_location == 1:
# obt.location[2] = random.randint(0,2)
#ADD ARRAYS
# p = obj.modifiers.new(name= "BLIX01", type='ARRAY')
# p.use_relative_offset=False
# p.use_object_offset=True
# p.offset_object = bpy.data.objects[e_mount]
# p.count = context.scene.arry_cnt
#how can i select the original object and unwarp / scale uv
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.object.select_all(action='TOGGLE')
object1.select = True
bpy.ops.object.editmode_toggle()
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.mesh.select_mode(type='EDGE')
bpy.ops.mesh.mark_seam(clear=False)
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.object.editmode_toggle()
bpy.ops.uv.smart_project(angle_limit=30, island_margin=0.02, user_area_weight=0.03)