Input dialog blender

How to make a simple input dialog box (for example, on an image) in a blender and process the text entered through python. I can not find a good tutorial on this.

simple entry box

+7
source share
1 answer

In the dialog box, the answer is from how to display a message from a blender script? may be the starting point.

But I think the best approach is to integrate input into the panel, for example,
String example

To do this, you must add StringProperty to your add-in and place it inside your panel (see Addon Tutorial for more information). The main steps:

 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 

...

You can access the string using context.scene.my_string_prop

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

Add text object

Changing the location moves the newly created text object to another location. I have not worked with this, but it should look like the code above.

+9
source

All Articles