Advertisement
Guest User

custom 3d menu to append a scene in blender from a .blend

a guest
Dec 16th, 2014
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.36 KB | None | 0 0
  1. bl_info = {"name": "yellowsubmarine",
  2. "author": "anonb",
  3. "version": (1, 0, 0),
  4. "blender": (2, 72, 0),
  5. "location": "Add > Mesh",
  6. "description": "Create yellowsubmarine primitive.",
  7. "warning": "",
  8. "wiki_url": "",
  9. "tracker_url": "",
  10. "category": "Add Mesh"}
  11.  
  12.  
  13.  
  14.  
  15. if "bpy" in locals():
  16. import imp
  17.  
  18.  
  19.  
  20.  
  21. import bpy
  22. import bmesh
  23. import math
  24. from mathutils import *
  25.  
  26.  
  27.  
  28.  
  29. class OBJECT_OT_addSubmarine(bpy.types.Operator):
  30. '''
  31. Class representing an operator for adding a yellow submarine
  32. '''
  33. bl_idname = "mesh.addsubmarine" #name used to refer to this operator
  34. bl_label = "Add Submarine" #operator's label
  35. bl_options = {'REGISTER', 'UNDO'}
  36. bl_description = "Add a yellow submarine" #tooltip
  37.  
  38. def execute(self, context):
  39. '''
  40. Function to process a click on the "Add Submarine" button
  41. '''
  42. bpy.ops.wm.append(directory="C:/Users/Youruser/Desktop/test_append/yellowsubmarine.blend/Scene/",
  43. filename="submarine", link=False) #append submarine from .blend file
  44. return{'FINISHED'}
  45.  
  46.  
  47.  
  48.  
  49. def menu_item(self, context):
  50. self.layout.operator(OBJECT_OT_addSubmarine.bl_idn ame, text="yellowsubmarine", icon="PLUGIN")
  51.  
  52.  
  53. def register():
  54. bpy.utils.register_module(__name__)
  55. bpy.types.INFO_MT_mesh_add.append(menu_item)
  56.  
  57.  
  58. def unregister():
  59. bpy.utils.unregister_module(__name__)
  60. bpy.types.INFO_MT_mesh_add.remove(menu_item)
  61.  
  62.  
  63. if __name__ == "__main__":
  64. register()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement