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

mesh_help.py « mesh_extra_tools - git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7d06c40cd4fb46e4cd745c94e77547f91efe5268 (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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# gpl authors: lijenstina, meta-androcto

# Note:  this script contains the Help Operator used by the various functions
# Usage: add a key string the dictionary with the list of strings to pass to labels in this file
#        and call the operator from the add-on UI draw function by passing the help_ids parameter
#        If the size of the pop-up if needed, define popup_size in the call by using varibles
#        Example (variable prop):
#        prop = layout.row("mesh.extra_tools_help")
#        prop.help_ids = "default"
#        prop.popup_size = 400


import bpy
from bpy.types import Operator
from bpy.props import (
        StringProperty,
        IntProperty,
        )


class MESH_OT_extra_tools_help(Operator):
    bl_idname = "mesh.extra_tools_help"
    bl_label = ""
    bl_options = {'REGISTER'}

    help_ids = StringProperty(
                    name="ID of the Operator to display",
                    options={'HIDDEN'},
                    default="default"
                    )
    popup_size = IntProperty(
                    name="Size of the Help Pop-up Menu",
                    default=350,
                    min=100,
                    max=600,
                    )

    def draw(self, context):
        layout = self.layout
        pick_help = help_custom_draw(self.help_ids)

        for line_text in pick_help:
            layout.label(line_text)

    def execute(self, context):
        return {'FINISHED'}

    def invoke(self, context, event):
        return context.window_manager.invoke_popup(self, width=self.popup_size)


def help_custom_draw(identifier="default"):
    # A table of lists containing the help text under an index key that is the script name
    # If several returns are needed per file, add some suffix after the script name
    # and call them separately
    # In case nothing is passed from the UI call, the returned list is default
    # If undefined one is passed, it will return a warning message
    help_text = {"default": [
                        "This is a placeholder text",
                        "Please fill up the entries in the " + __name__ + " script",
                        ],
                "random_vertices": [
                        "To use:",
                        "Make a selection or selection of Vertices",
                        "Randomize displaced positions",
                        "Note:",
                        "There is an option to use Vertex Weights for displacement",
                        "Before use, don't forget to assign after updating the Group Weight",
                        ],
                "mesh_vertex_chamfer": [
                        "To use:",
                        "Make a selection or selection of vertices",
                        "Result is a triangle Chamfer, works on a single vertex",
                        "Note:",
                        "The difference to the vertex Bevel is that original geometry",
                        "(selected vertices) can be kept as an option",
                        "Limitation:",
                        "In some cases, may need to press F to fill the result",
                        ],
                "mesh_filletplus": [
                        "To use:",
                        "Select two adjacent edges and press Fillet button",
                        "Limitation:",
                        "Works on a mesh whose all faces share the same normal",
                        "(Flat Surface - faces have the same direction)",
                        "Planes with already round corners can produce unsatisfactory results",
                        "Only boundary edges will be evaluated",
                        ],
                "mesh_offset_edges": [
                        "To use:",
                        "Make a selection or selection of Edges",
                        "Extrude, rotate extrusions and more",
                        "Limitation:",
                        "Operates only on separate Edge loops selections",
                        "(i.e. Edge loops that are not connected by a selected edge)",
                        ],
                "mesh_edge_roundifier": [
                        "To use:",
                        "Select a single or multiple Edges",
                        "Make Arcs with various parameters",
                        "Reference, Rotation, Scaling, Connection and Offset",
                        "Note:",
                        "The Mode - Reset button restores the default values",
                        ],
                "mesh_edges_length": [
                        "To use:",
                        "Select a single or multiple Edges",
                        "Change length with various parameters",
                        "Limitation:",
                        "Does not operate on edges that share a vertex",
                        "If the selection wasn't done in Edge Selection mode,",
                        "the option Active will not work (due to Blender's limitation)",
                        ],
                "mesh_to_wall": [
                        "To use:",
                        "Extrudes flat along edges",
                        "Adds depth on both sides of an edge wire",
                        "Limitation:",
                        "Works best on Flat surfaces i.e. Ground Plan like geometry",
                        ],
                "mesh_mextrude_plus": [
                        "To use:",
                        "Make a selection of Faces",
                        "Extrude with Rotation, Scaling, Variation,",
                        "Randomization and Offset parameters",
                        "Limitation:",
                        "Works only with selections that enclose Faces",
                        "(i.e. all Edges or Vertices of a Face selected)",
                        ],
                "mesh_extrude_and_reshape": [
                        "To use:",
                        "Extrude Face and merge Edge intersections,",
                        "between the mesh and the new Edges",
                        "Note:",
                        "If selected Vertices don't form Face they will be",
                        "still extruded in the same direction",
                        "Limitation:",
                        "Works only with the last selected face",
                        "(or all Edges or Vertices of a Face selected)",
                        ],
                "face_inset_fillet": [
                        "To use:",
                        "Select one or multiple faces and inset",
                        "Inset square, circle or outside",
                        "Note:",
                        "Radius: use remove doubles to tidy joins",
                        "Out: select and use normals flip before extruding",
                        "Limitation:",
                        "Using the Out option, sometimes can lead to unsatisfactory results",
                        ],
                "mesh_cut_faces": [
                        "To use:",
                        "Make a selection or selection of Faces",
                        "Some Functions work on a plane only",
                        "Limitation:",
                        "The selection must include at least two Faces with adjacent edges",
                        "(Selections not sharing edges will not work)",
                        ],
                "split_solidify": [
                        "To use:",
                        "Make a selection or selection of Faces",
                        "Split Faces and Extrude results",
                        "Similar to a shatter/explode effect",
                        ],
                "mesh_fastloop": [
                        "To use:",
                        "Activate the tool and hover over the mesh in the general area",
                        "for the loop and left click once to confirm the loop placement",
                        "Slide using the mouse to fine tune its position, left click to confirm",
                        "Repeat the operations if needed for new loops",
                        "Press Esc. twice to exit the tool",
                        "Limitation:",
                        "The tool has the same limitations as Loop Cut and Slide",
                        "In the Operator Panel, only the last loop can be tweaked",
                        ],
                "mesh_pen_tool": [
                        "To use:",
                        "Press Ctrl + D key or click Draw button",
                        "To draw along x use SHIFT + MOUSEMOVE",
                        "To draw along y use ALT + MOUSEMOVE",
                        "Press Ctrl to toggle Extrude at Cursor tool",
                        "Right click to finish drawing or",
                        "Press Esc to cancel",
                        ],
                "pkhg_faces": [
                        "To use:",
                        "Needs a Face Selection in Edit Mode",
                        "Select an option from Face Types drop down list",
                        "Extrude, rotate extrusions and more",
                        "Toggle Edit Mode after use",
                        "Note:",
                        "After using the operator, normals could need repair,",
                        "or Removing Doubles",
                        ],
                }

    if identifier in help_text:
        return help_text[identifier]

    return ["ERROR:", "Help Operator", "Undefined call to the Dictionary"]


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


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


if __name__ == "__main__":
    register()