0

this is taken from an example and it seems to be about as simple as one could get. I have tried on blender 3.4 and blender 3.5 and cannot get any of the properties to render. I've stared at this thinking I must have done something different than the example but it's exactly the same. When I run this I get the dialog but it only has the title and an OK button, there is no input for the "text" property.

import bpy

class WM_OT_TestUI(bpy.types.Operator): bl_label = "Testing UI" bl_idname = "wm.testui"

text = bpy.props.StringProperty(name="Enter Text: ",default="")
testint = bpy.props.IntProperty(name="Enter a Number")

def execute(self,context):
    bpy.ops.mesh.primitive_cube_add()
    return {'FINISHED'}

def invoke(self, context, event):
    return context.window_manager.invoke_props_dialog(self)

def register(): bpy.utils.register_class(WM_OT_TestUI)

def unregister(): bpy.utils.unregister_class(WM_OT_TestUI)

if name == "main": register()

bpy.ops.wm.testui('INVOKE_DEFAULT')

JohnKP
  • 1
  • 1

1 Answers1

0

Don't use = use : to define properties.

e.g. text : bpy.props.StringProperty(name="Enter Text: ",default="") etc.

enter image description here

import bpy

class WM_OT_TestUI(bpy.types.Operator): bl_label = "Testing UI" bl_idname = "wm.testui" bl_options = {'REGISTER', 'UNDO'}

text : bpy.props.StringProperty(name="Enter Text: ",default="")
testint : bpy.props.IntProperty(name="Enter a Number")

def execute(self,context):
    bpy.ops.mesh.primitive_cube_add()
    return {'FINISHED'}

def invoke(self, context, event):
    return context.window_manager.invoke_props_dialog(self)


def register(): bpy.utils.register_class(WM_OT_TestUI)

def unregister(): bpy.utils.unregister_class(WM_OT_TestUI)

if name == "main": register() bpy.ops.wm.testui("INVOKE_DEFAULT")

Karan
  • 1,984
  • 5
  • 21