输入对话框搅拌器 [英] input dialog box blender

查看:76
本文介绍了输入对话框搅拌器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Blender中制作一个简单的输入对话框(如图所示)并处理通过python输入的文本.我找不到关于此的任何好教程.

How to make a simple entry dialog box (like in the image) in blender and processing the text entered through python.I am unable to find any good tutorial on this.

推荐答案

对于对话框,来自

For the dialog box the answer from how to show a message from a blender script? might be a starting point.

但是我认为更好的方法是将输入集成到面板中,例如

But I think a better approach is integrating input into the panel like e.g.

为此,您必须在附件中添加StringProperty并将其放置在面板中(请参见附加教程以获取更多信息).基本步骤是:

To do this you have to add a StringProperty to your add-on and place it inside your panel (see Addon Tutorial for more information). The basic steps are:

def draw(self, context) :
    col = self.layout.column(align = True)
    col.prop(context.scene, "my_string_prop")

...

def register() :
    bpy.types.Scene.my_string_prop = bpy.props.StringProperty \
      (
        name = "My String",
        description = "My description",
        default = "default"
      )

...

def unregister() :
    del bpy.types.Scene.my_string_prop

...

您可以通过context.scene.my_string_prop

还有另一种集成输入的模式.例如,当您在场景中添加文本时,您可以在调用操作员之后更改参数,并立即查看更改:

There is another mode to integrate input. When you add for example a text to your scene you can change the parameters after the operator has been called and see the changes immediately:

更改位置会将新创建的文本对象移动到另一个位置.我尚未对此进行处理,但它应该与上面的代码相似.

Changing Location will move the newly created text object at another place. I haven't worked with this but it should be similar to the code above.

这篇关于输入对话框搅拌器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆