Blender:如何在python中调整uv图像的选定部分?

时间:2014-11-06 20:11:07

标签: python blender editing

我试图选择我的uv图像的一部分。在搅拌机,一切看起来都很好,小费" s" +"鼠标调整大小"。

但是我需要在.py档案中执行此操作。

然而,使用脚本bpy.ops.transform.resize(...),会发生另一件事!与图像调整大小关联的对象,而不是uv图像:(

我怎么能在python上调整uv图像部分的大小?

我的剧本现在直到:

def create_score():
#adding empty object
bpy.ops.object.empty_add()
empty_obj = bpy.context.object
empty_obj.name = "score"

#adding score plane
bpy.ops.mesh.primitive_plane_add(radius=1, location=(0.5,6.7,0))
bpy.ops.transform.resize(value=(-8, -8, -8), constraint_axis=(True, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)

#adding score object1
bpy.ops.mesh.primitive_plane_add(radius=0.5, location=(-6, 7.2, 0.1))
obtext1 = bpy.context.object
obtext1.name = "Score1"
obtext1.select = True
bpy.ops.object.editmode_toggle()
for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        area.spaces[0].viewport_shade = 'TEXTURED'
        area.type = 'IMAGE_EDITOR'
#adding image I want resize
bpy.ops.image.open(filepath="//../../textures/arialbd.tga", directory="/home/camila/Documents/cinemaxd/PlayerXD/textures/", files=[{"name":"arialbd.tga", "name":"arialbd.tga"}], relative_path=True)
bpy.data.screens['UV Editing'].areas[1].spaces[0].image = bpy.data.images['arialbd.tga']
bpy.ops.uv.unwrap()
#selecting all image
bpy.ops.uv.select_all(action='TOGGLE')

- 此

# store original area type
originalArea = bpy.context.area.type
# change current area to image editor
bpy.context.area.type = 'IMAGE_EDITOR'

#insert UV specific transforms here

#return to previouswindow for good measure ( and cleanliness )
bpy.context.area.type = originalArea

也没帮助:/

0 个答案:

没有答案