0
$\begingroup$

i worked in a dialog box in blender 2.92 and it worked fine, but in this release the dialog box doesn´t show me the input, here an example:

enter image description here

Here is the code:

bl_info = {
     "blender" : (2, 93, 0),
     "location" : "View3D",
     "warning" : "",
     "category" : "Modifiers",
     }


import bpy
from bpy.props import *


class TestPanel(bpy.types.Panel):
  bl_label = "Set object"
  bl_idname = "PT_TestPanel"
  bl_space_type = 'VIEW_3D'
  bl_region_type = 'UI'
  bl_category = 'Set'      
  
  def draw(self, context):
        layout = self.layout
        row = layout.row()
        split = layout.split()

        layout.operator('create.line_operator')
        
        # Create an row where the buttons are aligned to each other.
        #layout.label(text=" Set the object:")

        row = layout.row(align=True)
        row.operator("object1.simple_operator")
        
class PanelA(bpy.types.Operator):
  bl_label = "Create spline"
  bl_idname = 'create.line_operator'
  
  spline = bpy.props.BoolProperty(name = "spline",default= False)
  
  def execute(self, context):
      s = self.spline
      bpy.ops.curve.primitive_bezier_curve_add(radius=1, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
      bpy.ops.object.editmode_toggle()
      bpy.ops.curve.delete(type='VERT')
      bpy.ops.wm.tool_set_by_id(name = "builtin.draw")
      
      if s == True:
          bpy.context.scene.tool_settings.curve_paint_settings.depth_mode = 'SURFACE'              
      if s == False:                  
          bpy.context.scene.tool_settings.curve_paint_settings.depth_mode = 'CURSOR'
      return {'FINISHED'}
  
  def invoke(self, context,event):
      return context.window_manager.invoke_props_dialog(self)

def register():
    bpy.utils.register_class(TestPanel)
    bpy.utils.register_class(PanelA)


def unregister():
    bpy.utils.unregister_class(TestPanel)   
    bpy.utils.unregister_class(PanelA)
    

if __name__ == "__main__":
    register()
    
   


#(i apreciated any help)
$\endgroup$
1
$\begingroup$

Starting with 2.93, non-annotation properties are no longer supported. In previous version it would output a (cryptic) warning in the console :

enter image description here

See the related commit

The solution is to replace = by : in the property definition.

L.58 :

spline : bpy.props.BoolProperty(name="spline", default=False)
$\endgroup$
1
  • $\begingroup$ Thanks man, you´ve helped me a lot. $\endgroup$ – Daniel Cardona Jun 3 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.