# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
bl_info = {
"name": "Close Faces",
"author": "MKB, Cedric Lepiller",
"version": (1, 0),
"blender": (2, 75, 0),
"location": "View3D > Editmode > Extrude Menu > ALT+E",
"description": "Close Faces into the Extrude Menu",
"warning": "",
"wiki_url": "",
"tracker_url": "",
"category": "Mesh"}
import bpy
class CloseFaces(bpy.types.Operator):
"""Close Faces"""
bl_idname = "mesh.close_faces"
bl_label = "Close Faces"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
bpy.ops.mesh.edge_face_add()
bpy.ops.mesh.inset(thickness=0.07)
bpy.ops.mesh.poke()
return {'FINISHED'}
def operator_draw(self,context):
layout = self.layout
col = layout.column(align=True)
col.operator("mesh.close_faces", text="Close Faces")
def register():
bpy.utils.register_class(CloseFaces)
bpy.types.VIEW3D_MT_edit_mesh_extrude.append(operator_draw)
def unregister():
bpy.utils.unregister_class(CloseFaces)
bpy.types.VIEW3D_MT_edit_mesh_extrude.remove(operator_draw)
if __name__ == "__main__":
register()
Je n’ai pas le temps en ce moment mais analyse-le…
Il y a aussi une erreur car ton execute a pour option self et context, c’est bien mais c’est avec eux que tu dois lancer les actions cad que tu utilises context cad l’objet sélectionné pour appliquer une fonction.
Je sais bien que tu as utilisé son script basique mais il faudrait corriger ce point aussi.
Car quand tu utilises l’addon tu est déjà sur un objet sélectionné en mode edit, bien sûr, c’est ça le context.