Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.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
Python 我想通过脚本使网格变形_Python_Scripting_Blender_Mesh - Fatal编程技术网

Python 我想通过脚本使网格变形

Python 我想通过脚本使网格变形,python,scripting,blender,mesh,Python,Scripting,Blender,Mesh,在雕刻模式下无法看到原木变形。 因此,比例编辑的“球体”使其部分变形 bpy.ops.transform.translate(value=(4.95114, 0, 0), constraint_axis=(True, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='ENABLED', proportional_edit_falloff='SPHERE', proportional_size=1

在雕刻模式下无法看到原木变形。 因此,比例编辑的“球体”使其部分变形

bpy.ops.transform.translate(value=(4.95114, 0, 0), constraint_axis=(True, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='ENABLED', proportional_edit_falloff='SPHERE', proportional_size=15.8631, release_confirm=True, use_accurate=False)
运行此脚本时,选定的部分不会膨胀到球体,但整个原始模型会移动。 我认为这是因为脚本中没有指定中心点的部分。 但我无法指定中心或其他解决方案

通过脚本进行比例编辑的方法是什么?请告诉我是否还有其他方法可以在脚本中进行比例编辑。

在对象和编辑模式中使用,对象需要处于编辑模式才能移动选定顶点

在雕刻模式下,使用的运算符为。在脚本中使用它需要设置一个包含鼠标位置的

如果要通过脚本使网格变形,应考虑使用。

在对象和编辑模式中使用,对象需要处于编辑模式才能移动选定顶点

在雕刻模式下,使用的运算符为。在脚本中使用它需要设置一个包含鼠标位置的

如果要通过脚本使网格变形,应研究使用。

可以在雕刻模式下使用“绘制”或“布料”笔刷,如下所示:

def sculpt(coordinates, strength=0.5):
    bpy.ops.paint.brush_select(sculpt_tool="DRAW", toggle=False)
    bpy.data.brushes["SculptDraw"].strength = strength
    strokes = []
    for i, coordinate in enumerate(coordinates):
        stroke = {
            "name": "stroke",
            "mouse": (0,0),
            "pen_flip" : False,
            "is_start": True if i==0 else False,
            "location": coordinate,
            "size": 50,
            "pressure": 1,
            "time": float(i)
        }
        strokes.append(stroke)
    bpy.ops.sculpt.brush_stroke(context_override(), stroke=strokes)
    print("Finished sculpting")
雕刻([(0,0,1),(0,0,0.5),(0,0,1)])

摘自。

您可以在雕刻模式下使用“DRAW”或“CLOTH”笔刷,如下所示:

def sculpt(coordinates, strength=0.5):
    bpy.ops.paint.brush_select(sculpt_tool="DRAW", toggle=False)
    bpy.data.brushes["SculptDraw"].strength = strength
    strokes = []
    for i, coordinate in enumerate(coordinates):
        stroke = {
            "name": "stroke",
            "mouse": (0,0),
            "pen_flip" : False,
            "is_start": True if i==0 else False,
            "location": coordinate,
            "size": 50,
            "pressure": 1,
            "time": float(i)
        }
        strokes.append(stroke)
    bpy.ops.sculpt.brush_stroke(context_override(), stroke=strokes)
    print("Finished sculpting")
雕刻([(0,0,1),(0,0,0.5),(0,0,1)])


摘自。

如果您需要帮助编写blender脚本,您将在找到更好的支持。好的,我将在那里提问。谢谢。如果您需要帮助编写blender脚本,您将在找到更好的支持。好的,我会在这里提问。谢谢。谢谢你的回答。是否可以通过在脚本中指定中值来执行比例编辑?谢谢你的回答。是否可以通过在脚本中指定中值来执行比例编辑?