SHARE
TWEET

Untitled

a guest Jul 24th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import bpy
  2.  
  3. global boolCheck
  4.  
  5.  
  6. class DialogOperator(bpy.types.Operator):
  7.     bl_idname = "object.dialog_operator"
  8.     bl_label = "Simple Dialog Operator"
  9.  
  10.     def toggleConsole(self, context):
  11.         if self.my_bool:
  12.             bpy.ops.wm.console_toggle()
  13.         return None
  14.  
  15.     my_float = bpy.props.FloatProperty(name="Some Floating Point")
  16.     my_bool = bpy.props.BoolProperty(name="Toggle Option", update=toggleConsole)
  17.     my_string = bpy.props.StringProperty(name="String Value")
  18.  
  19.     def execute(self, context):
  20.         #message = "Popup Values: %f, %d, '%s'" %
  21.         #    (self.my_float, self.my_bool, self.my_string)
  22.         #self.report({'INFO'}, message)
  23.         print("stage 1 (clicked OK in popup box)")
  24.         boolCheck = 1
  25.         #print("popup boolCheck after pressing OK: %s" % (boolCheck))
  26.         return {'FINISHED'}
  27.  
  28.     def check(self, context):
  29.         return True
  30.  
  31.     def draw(self, context):
  32.         layout = self.layout
  33.         layout.prop(self, "my_bool")
  34.  
  35.  
  36.     def invoke(self, context, event):
  37.         wm = context.window_manager
  38.         #print("stage 0.5 (opened popup window)")
  39.         self.boolCheck = 0
  40.         #print("popup boolCheck before pressing OK: %s" % (boolCheck))
  41.         return wm.invoke_props_dialog(self)
  42.  
  43. bpy.utils.register_class(DialogOperator)
  44.  
  45.  
  46. #main
  47. boolCheck = 0
  48. print("nnstage 0 (code that come BEFORE popup box code)")
  49. #print("main boolCheck before popup script: %s" % (boolCheck))
  50. bpy.ops.object.dialog_operator('INVOKE_DEFAULT')
  51. #print("main boolCheck after popup script: %s" % (boolCheck))
  52. if (boolCheck == 1):
  53.     print("stage 2 (code the comes AFTER popup box code)")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top