Welcome to mirror list, hosted at ThFree Co, Russian Federation.

mesh_fastloop.py « mesh_extra_tools - git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8e56f7d6efd0997fa0f919394c166f4ef18a6b4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# ##### 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": "Fast Loop",
    "description": "Add loops fast",
    "author": "Andy Davies (metalliandy)",
    "version": (0, 1, 7),
    "blender": (2, 5, 6),
    "location": "Tool Shelf",
    "warning": "",
    "wiki_url": "",
    "category": "Mesh"
    }

"""
About this script:-
This script enables the fast creation of multiple loops on a mesh

Usage:-
1)Click the FastLoop button on the Tool Shelf to activate the tool
2)Hover over the mesh in the general area where you would like a loop to be added
  (shown by a highlight on the mesh)
3)Click once to confirm the loop placement
4)place the loop and then slide to fine tune its position
5)Repeat 1-4 if needed
6)Press Esc. twice to exit the tool

Related Links:-
http://blenderartists.org/forum/showthread.php?t=206989
http://www.metalliandy.com

Thanks to:-
Bartius Crouch (Crouch) - http://sites.google.com/site/bartiuscrouch/
Dealga McArdle (zeffii) - http://www.digitalaphasia.com

Version history:-
v0.16 - Ammended script for compatibility with recent API changes
v0.15 - Ammended script meta information and button rendering code for
        compatibility with recent API changes
v0.14 - Modal operator
v0.13 - Initial revision
"""

import bpy
from bpy.types import Operator
from bpy.props import BoolProperty


class OBJECT_OT_FastLoop(Operator):
    bl_idname = "object_ot.fastloop"
    bl_label = "FastLoop"
    bl_description = ("Create multiple edge loops in succession\n"
                      "Runs modal until ESC is pressed twice")

    active = BoolProperty(
                name="active",
                default=False
                )

    @classmethod
    def poll(cls, context):
        return bpy.ops.mesh.loopcut_slide.poll()

    def modal(self, context, event):
        if event.type == 'ESC':
            context.area.header_text_set("")
            return {'CANCELLED'}

        elif event.type == 'LEFTMOUSE' and event.value == 'RELEASE':
            self.active = False

        if not self.active:
            self.active = True
            bpy.ops.mesh.loopcut_slide('INVOKE_DEFAULT')
            context.area.header_text_set("Press ESC twice to stop FastLoop")

        return {'RUNNING_MODAL'}

    def invoke(self, context, event):
        context.window_manager.modal_handler_add(self)

        return {'RUNNING_MODAL'}


def register():
    bpy.utils.register_module(__name__)
    pass


def unregister():
    bpy.utils.unregister_module(__name__)
    pass


if __name__ == "__main__":
    register()