我定义一个函数
def border_select():
bpy.ops.object.mode_set(mode='OBJECT')
bpy.context.scene.objects.active = bpy.data.objects['horse']
bpy.ops.object.mode_set(mode = 'EDIT')
for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
override = bpy.context.copy()
override['area'] = area
override['region'] = area.regions[4]
bpy.ops.view3d.select_border(override, gesture_mode=3, xmin=0, xmax=area.width, ymin=0, ymax=area.height, extend=False)
break
我编写了一个循环以随机更改相机的视图,并每次调用border_select()来选择相机视图中的可见点。我尝试了多种刷新视图的方法,但是发现第一次调用border_select()后,选定的点没有改变。