Advertisement
Guest User

Untitled

a guest
Jan 21st, 2021
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.32 KB | None | 0 0
  1. import bpy
  2. from bpy.types import Panel, Operator, PropertyGroup
  3. from bpy.props import IntProperty, PointerProperty
  4. from random import randint
  5.  
  6.  
  7.  
  8.  
  9.  
  10. class MyProperties(PropertyGroup):
  11.    
  12.     list_a = [""r, "", ""]
  13.    
  14.    
  15.  
  16.  
  17.  
  18.  
  19.  
  20. class ADDONNAME_PT_main_panel(Panel):
  21.     bl_label = "Main Panel"
  22.     bl_idname = "ADDONNAME_PT_main_panel"
  23.     bl_space_type = 'VIEW_3D'
  24.     bl_region_type = 'UI'
  25.     bl_category = "New Tab"
  26.  
  27.     def draw(self, context):
  28.         layout = self.layout
  29.         scene = context.scene
  30.         mytool = scene.my_tool
  31.        
  32.  
  33.        
  34.         layout.operator("addonname.myop_operator")
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. class ADDONNAME_OT_my_op(Operator):
  42.     bl_label = "Add Object"
  43.     bl_idname = "addonname.myop_operator"
  44.    
  45.    
  46.    
  47.     def execute(self, context):
  48.         scene = context.scene
  49.         mytool = scene.my_tool
  50.        
  51.         return {'FINISHED'}
  52.    
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62. classes = [MyProperties, ADDONNAME_PT_main_panel, ADDONNAME_OT_my_op]
  63.  
  64.  
  65.  
  66. def register():
  67.     for cls in classes:
  68.         bpy.utils.register_class(cls)
  69.        
  70.     bpy.types.Scene.my_tool = PointerProperty(type= MyProperties)
  71.  
  72. def unregister():
  73.     for cls in classes:
  74.         bpy.utils.unregister_class(cls)
  75.     del bpy.types.Scene.my_tool
  76.  
  77.  
  78.  
  79. if __name__ == "__main__":
  80.     register()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement