Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在blender python中操纵对象中随机选择的顶点?_Python_Blender_Vertices - Fatal编程技术网

如何在blender python中操纵对象中随机选择的顶点?

如何在blender python中操纵对象中随机选择的顶点?,python,blender,vertices,Python,Blender,Vertices,我正在使用Blender2.79,在编写代码时遇到了一些困难。以下是我打算做的事情。 在这个例子中,我使用了一个简单的平面。我选择了它的两个顶点。我要做的是激活2个选定顶点,并使用for循环打印它。这就是我使用的代码 import bpy import bmesh p = [i.index for i in bmesh.from_edit_mesh(bpy.context.active.data).verts if i.select] ob = bpy.context.object me =

我正在使用Blender2.79,在编写代码时遇到了一些困难。以下是我打算做的事情。 在这个例子中,我使用了一个简单的平面。我选择了它的两个顶点。我要做的是激活2个选定顶点,并使用for循环打印它。这就是我使用的代码

import bpy
import bmesh

p = [i.index for i in bmesh.from_edit_mesh(bpy.context.active.data).verts if i.select]
ob = bpy.context.object
me = ob.data
bm = bmesh.from_edit_mesh(me)

for g in p:
    bm.select_history.add(bm.verts[g])
    print(bm.select_history.active)
正如你所看到的,这是我在这个网站上发现的一个组合代码,它失败了。我能找到的要么是激活一个顶点,要么是找到一个完整的顶点。我不想这样,我只需要编辑2个选定的顶点。我找不到可用于多个选定顶点的代码。请帮我解决这个问题