Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
761
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.50 KB | None | 0 0
  1. bl_info = {
  2.     "name": "Object Adder",
  3.     "author": "Enter Your Name Here",
  4.     "version": (1, 0),
  5.     "blender": (2, 80, 0),
  6.     "location": "View3D > Toolbar > Object Adder",
  7.     "description": "Adds objects and other functions",
  8.     "warning": "",
  9.     "wiki_url": "",
  10.     "category": "Add Mesh",
  11. }
  12.  
  13. import bpy
  14.  
  15.     #This is the Main Panel (Parent of Panel A and B)
  16. class MainPanel(bpy.types.Panel):
  17.     bl_label = "Object Adder"
  18.     bl_idname = "PT_MainPanel"
  19.     bl_space_type = 'VIEW_3D'
  20.     bl_region_type = 'UI'
  21.     bl_category = 'Object Adder'
  22.    
  23.     def draw(self, context):
  24.         layout = self.layout
  25.         layout.scale_y = 1.2
  26.        
  27.         row = layout.row()
  28.         row.label(text= "Add an object", icon= 'OBJECT_ORIGIN')
  29.         row = layout.row()
  30.         row.operator("mesh.primitive_cube_add", icon= 'CUBE', text= "Cube")
  31.         row.operator("mesh.primitive_uv_sphere_add", icon= 'SPHERE', text= "Sphere")
  32.         row.operator("mesh.primitive_monkey_add", icon= 'MESH_MONKEY', text= "Suzanne")
  33.         row = layout.row()
  34.         row.operator("curve.primitive_bezier_curve_add", icon= 'CURVE_BEZCURVE', text= "Bezier Curve")
  35.         row.operator("curve.primitive_bezier_circle_add", icon= 'CURVE_BEZCIRCLE', text= "Bezier Circle")
  36.        
  37.        
  38.         row = layout.row()
  39.         row.operator("object.text_add", icon= 'FILE_FONT', text= "Add Font")
  40.         row = layout.row()
  41.  
  42.  
  43.     #This is Panel A - The Scale Sub Panel (Child of MainPanel)
  44. class PanelA(bpy.types.Panel):
  45.     bl_label = "Scale"
  46.     bl_idname = "PT_PanelA"
  47.     bl_space_type = 'VIEW_3D'
  48.     bl_region_type = 'UI'
  49.     bl_category = 'Object Adder'
  50.     bl_parent_id = 'PT_MainPanel'
  51.     bl_options = {'DEFAULT_CLOSED'}
  52.    
  53.     def draw(self, context):
  54.         layout = self.layout
  55.         obj = context.object
  56.        
  57.         row = layout.row()
  58.         row.label(text= "Select an option to scale your", icon= 'FONT_DATA')
  59.         row = layout.row()
  60.         row.label(text= "      object.")
  61.         row = layout.row()
  62.         row.operator("transform.resize")
  63.         row = layout.row()
  64.         layout.scale_y = 1.2
  65.        
  66.         col = layout.column()
  67.         col.prop(obj, "scale")
  68.              
  69.  
  70.     #This is Panel B - The Specials Sub Panel (Child of MainPanel)
  71. class PanelB(bpy.types.Panel):
  72.     bl_label = "Specials"
  73.     bl_idname = "PT_PanelB"
  74.     bl_space_type = 'VIEW_3D'
  75.     bl_region_type = 'UI'
  76.     bl_category = 'Object Adder'
  77.     bl_parent_id = 'PT_MainPanel'
  78.     bl_options = {'DEFAULT_CLOSED'}
  79.    
  80.     def draw(self, context):
  81.         layout = self.layout
  82.        
  83.         row = layout.row()
  84.         row.label(text= "Select a Special Option", icon= 'COLOR_BLUE')
  85.         row = layout.row()
  86.         row.operator("object.shade_smooth", icon= 'MOD_SMOOTH', text= "Set Smooth Shading")
  87.         row.operator("object.subdivision_set", icon= 'MOD_SUBSURF', text= "Add Subsurf")
  88.         row = layout.row()
  89.         row.operator("object.modifier_add", icon= 'MODIFIER')
  90.        
  91.        
  92.     #Here we are Registering the Classes        
  93. def register():
  94.     bpy.utils.register_class(MainPanel)
  95.     bpy.utils.register_class(PanelA)
  96.     bpy.utils.register_class(PanelB)
  97.  
  98.     #Here we are UnRegistering the Classes    
  99. def unregister():
  100.     bpy.utils.unregister_class(MainPanel)
  101.     bpy.utils.unregister_class(PanelA)
  102.     bpy.utils.unregister_class(PanelB)
  103.  
  104.     #This is required in order for the script to run in the text editor    
  105. if __name__ == "__main__":
  106.     register()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement