Advertisement
Guest User

PopupTemplate

a guest
Jul 13th, 2020
2,983
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.13 KB | None | 0 0
  1. import bpy
  2.  
  3.  
  4.  
  5. class ADDONNAME_PT_TemplatePanel(bpy.types.Panel):
  6.     bl_label = "Name of the Panel"
  7.     bl_idname = "ADDONNAME_PT_TemplatePanel"
  8.     bl_space_type = "VIEW_3D"
  9.     bl_region_type = 'UI'
  10.     bl_category = "Template Tab"
  11.    
  12.     def draw(self, context):
  13.         layout = self.layout
  14.        
  15.         layout.operator("wm.template_operator")
  16.        
  17.  
  18.  
  19.  
  20.  
  21.  
  22. class ADDONAME_OT_TemplateOperator(bpy.types.Operator):
  23.     bl_label = "Template Operator"
  24.     bl_idname = "wm.template_operator"
  25.    
  26.    
  27.    
  28.    
  29.    
  30.     def invoke(self, context, event):
  31.         wm = context.window_manager
  32.         return wm.invoke_props_dialog(self)
  33.    
  34.    
  35.     def draw(self, context):
  36.         layout = self.layout
  37.        
  38.    
  39.     def execute(self, context):
  40.        
  41.         return {'FINISHED'}    
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50. classes = [ADDONNAME_PT_TemplatePanel, ADDONAME_OT_TemplateOperator]
  51.  
  52.  
  53.  
  54. def register():
  55.     for cls in classes:
  56.         bpy.utils.register_class(cls)
  57.  
  58. def unregister():
  59.     for cls in classes:
  60.         bpy.utils.unregister_class(cls)
  61.  
  62.  
  63.  
  64. if __name__ == "__main__":
  65.     register()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement