Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# -*- coding: utf-8 -*-
# ##### 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": "Addon Courbes libres",
"author": "Laurent Laget",
"version": (0, 4, 2),
"blender": (2, 78, 0),
"location": "Add",
"description": "Dessine en courbes libres 3D",
"warning": "",
"wiki_url": "",
"category": "Add",
}
import bpy
#classe dessin de courbes
class dessin(bpy.types.Operator):
"""Dessiner sans avoir à créer de curve"""
bl_idname = "object.dessin"
bl_label = "dessin"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
bpy.ops.curve.primitive_bezier_curve_add()
bpy.ops.object.editmode_toggle()
bpy.ops.curve.delete(type='VERT')
bpy.context.object.data.fill_mode = 'FULL'
bpy.context.object.data.bevel_resolution = 3
bpy.context.object.data.bevel_depth = 0.3
return {'FINISHED'}
addon_keymaps = []
def menu_item(self, context):
self.layout.operator(dessin.bl_idname, text="Courbe libre", icon="PLUGIN")
def register():
bpy.utils.register_module(__name__)
#bpy.utils.register_class(dessin)
bpy.types.INFO_MT_curve_add.append(menu_item)
global addon_keymaps
wm = bpy.context.window_manager
km = wm.keyconfigs.addon.keymaps.new(name = "3D View", space_type = "VIEW_3D")
kmi = km.keymap_items.new(dessin.bl_idname, 'SELECTMOUSE', 'CLICK', shift=True,alt=True)
addon_keymaps.append(km)
def unregister():
bpy.utils.unregister_class(dessin)
bpy.utils.unregister_module(__name__)
bpy.types.INFO_MT_curve_add.remove(menu_item)
global addon_keymaps
wm = bpy.context.window_manager
for km in addon_keymaps:
for kmi in km.keymap_items:
km.keymap_items.remove(kmi)
wm.keyconfigs.addon.keymaps.remove(km)
addon_keymaps.clear()
if __name__ == "__main__":
register()
@ethanaeris

This comment has been minimized.

Copy link
Owner Author

commented Sep 2, 2017

Courbelibre est un addon gratuit pour Blender.
Il permet de directement dessiner des courbes extrudées en mode objet avec Shift+clic droit ou add->curve, tout en conservant la possibilité de dessiner des courbes classiques en mode edit.

Courbelibre is a free Blender addon.
It enables to draw free extruded curvesin object mode whith Shift+right click or add->curve, while maintening the possibility to draw curves as usually in edit mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.