Advertisement
yhoyo

extra object

Feb 9th, 2015
814
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 11.30 KB | None | 0 0
  1. bl_info = {
  2.     "name": "Origami Symbols",
  3.     "author": "Diego Quevedo",
  4.     "version": (1, 0),
  5.     "blender": (2, 7, 0),
  6.     "location": "View3D > Add > Mesh > New Object",
  7.     "description": "Adds a new Mesh Object used like origami simbols",
  8.     "warning": "",
  9.     "wiki_url": "",
  10.     "category": "Add Mesh"}
  11.  
  12.  
  13. import bpy
  14. from bpy.types import Operator
  15. from bpy.props import FloatVectorProperty
  16. from bpy_extras.object_utils import AddObjectHelper, object_data_add
  17. from mathutils import Vector
  18.  
  19.  
  20.  
  21. class addArrowMesh_forward_1(bpy.types.Operator):
  22.     bl_idname = "mesh.primitive_arrow_forward_1"
  23.     bl_label = "Arrow Mesh forward 1"
  24.     bl_options = {'REGISTER', 'UNDO'}
  25.    
  26.     def execute(self, context):
  27.         try:
  28.             bpy.ops.object.mode_set(mode = 'OBJECT')
  29.            
  30.         except:
  31.             print("ya en modo objeto")
  32.         try:
  33.             ao = bpy.context.active_object
  34.             ao.select = False
  35.         except:
  36.             print("ningun objeto seleccionado""Arrow_forward_1")
  37.         object = bpy.data.objects.new("Arrow_forward_1", mesh)
  38.        
  39.         mat = bpy.data.materials['MaterialFlecha1']
  40.         object.data.materials.append(mat)
  41.        
  42.         object.location = bpy.context.scene.cursor_location
  43.         bpy.context.scene.objects.link(object)
  44.        
  45.         mesh.from_pydata(verts, [], faces)
  46.         mesh.update(calc_edges=True)    
  47.        
  48.        
  49.         bpy.ops.object.mode_set(mode = 'EDIT')  
  50.        
  51.         return{'FINISHED'}
  52.    
  53.  
  54.  
  55.  
  56. class INFO_MT_mes_custom_menu_add(bpy.types.Menu):
  57.     bl_idname = "INFO_MT_mes_custom_menu_add"
  58.     bl_label = "Custom Menu"
  59.    
  60.    
  61.     def draw(self, context):
  62.         layout = self.layout
  63.         layout.operator("mesh.primitive_arrow_forward_1", text="Fold paper forward 1 ");
  64.  
  65.        
  66.        
  67.    
  68.  
  69. # Registration
  70.  
  71. def menu_func(self, context):
  72.     self.layout.menu("INFO_MT_mes_custom_menu_add",icon='PLUGIN')
  73.  
  74. class Objet_Panel(bpy.types.Panel):
  75.     bl_space_type = "VIEW_3D"
  76.     bl_region_type = "TOOLS"
  77.     #bl_context = "editmode"
  78.     bl_label = "SIMBOLOS"
  79.     bl_category = "ORIGAMI SYMBOLS"
  80.    
  81.    
  82.     def draw(self, context):
  83.         layout = self.layout
  84.         layout.operator("mesh.primitive_arrow_forward_1", text="Fold paper forward 1 ");
  85.  
  86.        
  87.        
  88.  
  89. def register():
  90.     bpy.utils.register_module(__name__)
  91.  
  92. def unregister():
  93.     bpy.utils.unregister_module(__name__)
  94.  
  95.  
  96. if __name__ == "__main__":
  97.     register()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement