Newer
Older
# ##### 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": "Carver MT",
"category": "Object",
"author": "Pixivore, Cedric LEPILLER, Ted Milker",
"version": (1, 1, 6),
"blender": (2, 77, 0),
"wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
"Scripts/Modeling/Carver",
"tracker_url": "https://developer.blender.org/maniphest/task/edit/form/2/",
"description": "Multiple tools to carve or to create objects.",
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
import bpy
import bgl
import blf
import math
import mathutils
import sys
import random
import bmesh
import bpy_extras
from bpy_extras import view3d_utils
from bpy_extras.view3d_utils import region_2d_to_vector_3d, region_2d_to_location_3d
Profils = [
("CTP_4882",
mathutils.Vector((2.61824, -5.56469, 0)),
[(-1.156501, 0.799282, 0.032334),
(-0.967583, 0.838861, 0.032334),
(-1.10386, 0.846403, 0.032334),
(-1.034712, 0.86089, 0.032334),
(-1.88472, -0.564419, 0.032334),
(-1.924299, -0.375502, 0.032334),
(-1.93184, -0.511778, 0.032334),
(-1.946327, -0.44263, 0.032334),
(-0.219065, -0.869195, 0.032334),
(-0.149916, -0.854708, 0.032334),
(-0.286193, -0.847167, 0.032334),
(-0.097275, -0.807588, 0.032334),
(0.692551, 0.434324, 0.032334),
(0.678064, 0.503472, 0.032334),
(0.670523, 0.367196, 0.032334),
(0.630943, 0.556113, 0.032334),
(-0.780424, -0.44263, 0.032334),
(-0.765937, -0.511778, 0.032334),
(-0.758396, -0.375502, 0.032334),
(-0.718817, -0.564419, 0.032334),
(-0.53496, 0.556113, 0.032334),
(-0.49538, 0.367196, 0.032334),
(-0.487839, 0.503472, 0.032334),
(-0.473352, 0.434324, 0.032334),
(-1.263178, -0.807588, 0.032334),
(-1.452096, -0.847167, 0.032334),
(-1.315819, -0.854708, 0.032334),
(-1.384968, -0.869195, 0.032334),
(0.131191, 0.86089, 0.032334),
(0.062043, 0.846403, 0.032334),
(0.19832, 0.838861, 0.032334),
(0.009402, 0.799282, 0.032334),
(0.946838, -0.869195, 0.032334),
(1.015987, -0.854708, 0.032334),
(0.87971, -0.847167, 0.032334),
(1.068628, -0.807588, 0.032334),
(1.858454, 0.434324, 0.032334),
(1.843967, 0.503472, 0.032334),
(1.836426, 0.367196, 0.032334),
(1.796846, 0.556113, 0.032334),
(0.385479, -0.44263, 0.032334),
(0.399966, -0.511778, 0.032334),
(0.407507, -0.375502, 0.032334),
(0.447086, -0.564419, 0.032334),
(1.297095, 0.86089, 0.032334),
(1.227946, 0.846403, 0.032334),
(1.364223, 0.838861, 0.032334),
(1.175305, 0.799282, 0.032334),
],
[[16, 17, 19], [5, 4, 24], [14, 12, 15], [14, 15, 31], [10, 8, 11], [15, 30, 31], [19, 10, 11],
[11, 14, 31], [31, 18, 11], [8, 9, 11], [18, 16, 19], [12, 13, 15], [18, 19, 11], [28, 29, 31],
[30, 28, 31], [24, 21, 0], [23, 22, 20], [20, 1, 0], [3, 2, 0], [0, 5, 24], [7, 6, 4], [4, 25, 24],
[27, 26, 24], [21, 23, 20], [1, 3, 0], [5, 7, 4], [25, 27, 24], [21, 20, 0], [40, 41, 43], [38, 36, 39],
[38, 39, 47], [34, 32, 35], [39, 46, 47], [43, 34, 35], [35, 38, 47], [47, 42, 35], [32, 33, 35],
[42, 40, 43], [36, 37, 39], [42, 43, 35], [44, 45, 47], [46, 44, 47]]),
("CTP_8354",
mathutils.Vector((-0.06267, -2.43829, -0.0)),
[(-0.534254, -1.0, 0.032334),
(-1.0, -0.534254, 0.032334),
(-0.654798, -0.98413, 0.032334),
(-0.767127, -0.937602, 0.032334),
(-0.863586, -0.863586, 0.032334),
(-0.937602, -0.767127, 0.032334),
(-0.98413, -0.654798, 0.032334),
(1.0, -0.534254, 0.032334),
(0.534254, -1.0, 0.032334),
(0.98413, -0.654798, 0.032334),
(0.937602, -0.767127, 0.032334),
(0.863586, -0.863586, 0.032334),
(0.767127, -0.937602, 0.032334),
(0.654798, -0.98413, 0.032334),
(-1.0, 0.534254, 0.032334),
(-0.534254, 1.0, 0.032334),
(-0.98413, 0.654798, 0.032334),
(-0.937602, 0.767127, 0.032334),
(-0.863586, 0.863586, 0.032334),
(-0.767127, 0.937602, 0.032334),
(-0.654798, 0.98413, 0.032334),
(0.534254, 1.0, 0.032334),
(1.0, 0.534254, 0.032334),
(0.654798, 0.98413, 0.032334),
(0.767127, 0.937602, 0.032334),
(0.863586, 0.863586, 0.032334),
(0.937602, 0.767127, 0.032334),
(0.98413, 0.654798, 0.032334),
(-0.763998, 0.518786, 0.032334),
(-0.763998, -0.518786, 0.032334),
(-0.754202, -0.593189, 0.032334),
(-0.731454, -0.648108, 0.032334),
(-0.695267, -0.695267, 0.032334),
(-0.648108, -0.731454, 0.032334),
(-0.593189, -0.754202, 0.032334),
(-0.518786, -0.763998, 0.032334),
(0.518786, -0.763998, 0.032334),
(0.593189, -0.754202, 0.032334),
(0.648108, -0.731454, 0.032334),
(0.695267, -0.695267, 0.032334),
(0.731454, -0.648108, 0.032334),
(0.754202, -0.593189, 0.032334),
(0.763998, -0.518786, 0.032334),
(0.763998, 0.518786, 0.032334),
(0.754202, 0.593189, 0.032334),
(0.731454, 0.648108, 0.032334),
(0.695267, 0.695267, 0.032334),
(0.648108, 0.731454, 0.032334),
(0.593189, 0.754202, 0.032334),
(0.518786, 0.763998, 0.032334),
(-0.518786, 0.763998, 0.032334),
(-0.593189, 0.754202, 0.032334),
(-0.648108, 0.731454, 0.032334),
(-0.695267, 0.695267, 0.032334),
(-0.731454, 0.648108, 0.032334),
(-0.754202, 0.593189, 0.032334),
(0.518786, 0.518786, 0.032334),
(-0.518786, 0.518786, 0.032334),
(0.518786, -0.518786, 0.032334),
(-0.518786, -0.518786, 0.032334),
(-0.593189, 0.518786, 0.032334),
(-0.593189, -0.518786, 0.032334),
(0.518786, -0.593189, 0.032334),
(-0.518786, -0.593189, 0.032334),
(-0.593189, -0.593189, 0.032334),
(0.593189, 0.518786, 0.032334),
(0.593189, -0.518786, 0.032334),
(0.593189, -0.593189, 0.032334),
(-0.593189, 0.593189, 0.032334),
(-0.518786, 0.593189, 0.032334),
(0.518786, 0.593189, 0.032334),
(0.593189, 0.593189, 0.032334),
(-0.648108, 0.593189, 0.032334),
(-0.648108, 0.518786, 0.032334),
(-0.648108, -0.518786, 0.032334),
(-0.648108, -0.593189, 0.032334),
(-0.695267, 0.593189, 0.032334),
(-0.695267, 0.518786, 0.032334),
(-0.695267, -0.518786, 0.032334),
(-0.695267, -0.593189, 0.032334),
(0.648108, 0.593189, 0.032334),
(0.648108, 0.518786, 0.032334),
(0.648108, -0.518786, 0.032334),
(0.648108, -0.593189, 0.032334),
(0.695267, 0.593189, 0.032334),
(0.695267, 0.518786, 0.032334),
(0.695267, -0.518786, 0.032334),
(0.695267, -0.593189, 0.032334),
],
[[87, 39, 40, 41], [29, 28, 14, 1], [30, 29, 1, 6], [31, 30, 6, 5], [32, 31, 5, 4], [33, 32, 4, 3],
[34, 33, 3, 2], [35, 34, 2, 0], [36, 35, 0, 8], [37, 36, 8, 13], [38, 37, 13, 12], [39, 38, 12, 11],
[40, 39, 11, 10], [41, 40, 10, 9], [42, 41, 9, 7], [43, 42, 7, 22], [44, 43, 22, 27], [45, 44, 27, 26],
[46, 45, 26, 25], [47, 46, 25, 24], [48, 47, 24, 23], [49, 48, 23, 21], [50, 49, 21, 15], [51, 50, 15, 20],
[52, 51, 20, 19], [53, 52, 19, 18], [54, 53, 18, 17], [55, 54, 17, 16], [28, 55, 16, 14], [68, 69, 50, 51],
[63, 35, 36, 62], [69, 57, 56, 70], [84, 85, 43, 44], [64, 34, 35, 63], [57, 59, 58, 56], [85, 86, 42, 43],
[60, 61, 59, 57], [73, 74, 61, 60], [72, 68, 51, 52], [75, 33, 34, 64], [61, 64, 63, 59], [59, 63, 62, 58],
[86, 87, 41, 42], [74, 75, 64, 61], [58, 62, 67, 66], [56, 58, 66, 65], [70, 56, 65, 71], [62, 36, 37, 67],
[49, 70, 71, 48], [50, 69, 70, 49], [60, 57, 69, 68], [73, 60, 68, 72], [46, 84, 44, 45], [78, 79, 75, 74],
[77, 78, 74, 73], [77, 73, 72, 76], [76, 72, 52, 53], [79, 32, 33, 75], [29, 30, 79, 78], [28, 29, 78, 77],
[28, 77, 76, 55], [55, 76, 53, 54], [30, 31, 32, 79], [66, 67, 83, 82], [65, 66, 82, 81], [71, 65, 81, 80],
[48, 71, 80, 47], [67, 37, 38, 83], [82, 83, 87, 86], [81, 82, 86, 85], [80, 81, 85, 84], [47, 80, 84, 46],
[83, 38, 39, 87]]),
("CTP_5585",
mathutils.Vector((5.0114, -2.4281, 0.0)),
[(-0.490711, -1.0, 0.032334),
(-1.0, -0.490711, 0.032334),
(1.0, -0.490711, 0.032334),
(0.490711, -1.0, 0.032334),
(-1.0, 0.490711, 0.032334),
(-0.490711, 1.0, 0.032334),
(0.490711, 1.0, 0.032334),
(1.0, 0.490711, 0.032334),
(-0.51852, 0.291276, 0.032334),
(-0.51852, -0.291276, 0.032334),
(-0.291276, -0.51852, 0.032334),
(0.291276, -0.51852, 0.032334),
(0.51852, -0.291276, 0.032334),
(0.51852, 0.291276, 0.032334),
(0.291276, 0.51852, 0.032334),
(-0.291276, 0.51852, 0.032334),
],
[[11, 12, 13, 14], [9, 8, 4, 1], [10, 9, 1, 0], [11, 10, 0, 3], [12, 11, 3, 2], [13, 12, 2, 7],
[14, 13, 7, 6], [15, 14, 6, 5], [8, 15, 5, 4], [9, 10, 15, 8], [10, 11, 14, 15]]),
("CTP_6960",
mathutils.Vector((-0.11417, 2.48371, -0.0)),
[(0.0, 1.0, 0.016827),
(-0.382683, 0.92388, 0.016827),
(-0.707107, 0.707107, 0.016827),
(-0.92388, 0.382683, 0.016827),
(-1.0, -0.0, 0.016827),
(-0.92388, -0.382684, 0.016827),
(-0.707107, -0.707107, 0.016827),
(-0.382683, -0.92388, 0.016827),
(-0.0, -1.0, 0.016827),
(0.382683, -0.92388, 0.016827),
(0.707107, -0.707107, 0.016827),
(0.92388, -0.382684, 0.016827),
(1.0, 0.0, 0.016827),
(0.923879, 0.382684, 0.016827),
(0.707107, 0.707107, 0.016827),
(0.382683, 0.92388, 0.016827),
(-0.0, 0.546859, 0.016827),
(-0.209274, 0.505231, 0.016827),
(-0.386687, 0.386687, 0.016827),
(-0.505231, 0.209274, 0.016827),
(-0.546859, -0.0, 0.016827),
(-0.505231, -0.209274, 0.016827),
(-0.386687, -0.386687, 0.016827),
(-0.209274, -0.505231, 0.016827),
(-0.0, -0.546859, 0.016827),
(0.209274, -0.505231, 0.016827),
(0.386687, -0.386688, 0.016827),
(0.505231, -0.209274, 0.016827),
(0.546858, 0.0, 0.016827),
(0.505231, 0.209274, 0.016827),
(0.386687, 0.386688, 0.016827),
(0.209273, 0.505232, 0.016827),
],
[[3, 19, 18, 2], [11, 27, 26, 10], [4, 20, 19, 3], [12, 28, 27, 11], [5, 21, 20, 4], [13, 29, 28, 12],
[6, 22, 21, 5], [14, 30, 29, 13], [7, 23, 22, 6], [15, 31, 30, 14], [8, 24, 23, 7], [1, 17, 16, 0],
[0, 16, 31, 15], [9, 25, 24, 8], [2, 18, 17, 1], [10, 26, 25, 9]]),
("CTP_5359",
mathutils.Vector((5.50446, 2.41669, -0.0)),
[(0.0, 0.714247, 0.023261),
(-0.382683, 0.659879, 0.023261),
(-0.707107, 0.505049, 0.023261),
(-0.92388, 0.273331, 0.023261),
(-1.0, -0.0, 0.023261),
(-0.92388, -0.273331, 0.023261),
(-0.707107, -0.505049, 0.023261),
(-0.382683, -0.659879, 0.023261),
(-0.0, -0.714247, 0.023261),
(0.382683, -0.659879, 0.023261),
(0.707107, -0.505049, 0.023261),
(0.92388, -0.273331, 0.023261),
(1.0, 0.0, 0.023261),
(0.923879, 0.273331, 0.023261),
(0.707107, 0.505049, 0.023261),
(0.382683, 0.659879, 0.023261),
(-0.0, 0.303676, 0.023261),
(-0.162705, 0.28056, 0.023261),
(-0.30064, 0.214731, 0.023261),
(-0.392805, 0.116212, 0.023261),
(-0.425169, -0.0, 0.023261),
(-0.392805, -0.116212, 0.023261),
(-0.30064, -0.214731, 0.023261),
(-0.162705, -0.28056, 0.023261),
(-0.0, -0.303676, 0.023261),
(0.162705, -0.28056, 0.023261),
(0.30064, -0.214731, 0.023261),
(0.392805, -0.116212, 0.023261),
(0.425169, 0.0, 0.023261),
(0.392805, 0.116212, 0.023261),
(0.30064, 0.214731, 0.023261),
(0.162705, 0.28056, 0.023261),
],
[[3, 19, 18, 2], [11, 27, 26, 10], [4, 20, 19, 3], [12, 28, 27, 11], [5, 21, 20, 4], [13, 29, 28, 12],
[6, 22, 21, 5], [14, 30, 29, 13], [7, 23, 22, 6], [15, 31, 30, 14], [8, 24, 23, 7], [1, 17, 16, 0],
[0, 16, 31, 15], [9, 25, 24, 8], [2, 18, 17, 1], [10, 26, 25, 9]]),
("CTP_5424",
mathutils.Vector((2.61824, 2.34147, 0.0)),
[(1.0, -1.0, 0.032334),
(-1.0, 1.0, 0.032334),
(1.0, 1.0, 0.032334),
(0.783867, -0.259989, 0.032334),
(-0.393641, 0.857073, 0.032334),
(0.73142, -0.116299, 0.032334),
(0.657754, 0.02916, 0.032334),
(0.564682, 0.172804, 0.032334),
(0.454497, 0.311098, 0.032334),
(0.329912, 0.440635, 0.032334),
(0.193995, 0.558227, 0.032334),
(0.050092, 0.660978, 0.032334),
(-0.098254, 0.746358, 0.032334),
(-0.247389, 0.812263, 0.032334),
],
[[3, 0, 2], [10, 9, 2], [2, 1, 4], [2, 4, 13], [5, 3, 2], [6, 5, 2], [2, 13, 12], [2, 12, 11], [7, 6, 2],
[8, 7, 2], [2, 11, 10], [9, 8, 2]]),
("CTP_3774",
mathutils.Vector((2.61824, -2.52425, 0.0)),
[(1.0, 0.0, 0.020045),
(-1.0, 0.0, 0.020045),
(0.31903, -0.664947, 0.020045),
(-0.31903, -0.664947, 0.020045),
(-0.31903, 1.0, 0.020045),
(0.31903, 1.0, 0.020045),
(0.31903, 0.0, 0.020045),
(-0.31903, 0.0, 0.020045),
(-1.0, 0.614333, 0.020045),
(-0.614333, 1.0, 0.020045),
(-0.970643, 0.761921, 0.020045),
(-0.887041, 0.887041, 0.020045),
(-0.761921, 0.970643, 0.020045),
(0.614333, 1.0, 0.020045),
(1.0, 0.614333, 0.020045),
(0.761921, 0.970643, 0.020045),
(0.887041, 0.887041, 0.020045),
(0.970643, 0.761921, 0.020045),
(-0.31903, 0.614333, 0.020045),
(0.31903, 0.614333, 0.020045),
(0.31903, 0.761921, 0.020045),
(-0.31903, 0.761921, 0.020045),
(0.31903, 0.887041, 0.020045),
(-0.31903, 0.887041, 0.020045),
(0.614333, 0.614333, 0.020045),
(0.614333, 0.0, 0.020045),
(0.614333, 0.761921, 0.020045),
(0.614333, 0.887041, 0.020045),
(-0.614333, 0.761921, 0.020045),
(-0.614333, 0.0, 0.020045),
(-0.614333, 0.887041, 0.020045),
(-0.614333, 0.614333, 0.020045),
],
[[6, 25, 24, 19], [6, 19, 18, 7], [2, 6, 7, 3], [1, 29, 31, 8], [8, 31, 28, 10], [19, 24, 26, 20],
[18, 19, 20, 21], [21, 20, 22, 23], [10, 28, 30, 11], [20, 26, 27, 22], [22, 27, 13, 5], [23, 22, 5, 4],
[11, 30, 9, 12], [17, 16, 27, 26], [14, 17, 26, 24], [24, 25, 0, 14], [15, 13, 27, 16], [9, 30, 23, 4],
[31, 29, 7, 18], [28, 31, 18, 21], [30, 28, 21, 23]]),
("CTP_4473",
mathutils.Vector((7.31539, 0.0, 0.0)),
[(0.24549, -1.0, 0.022454),
(-0.24549, -1.0, 0.022454),
(-0.24549, 1.0, 0.022454),
(0.24549, 1.0, 0.022454),
(1.0, 0.267452, 0.022454),
(1.0, -0.267452, 0.022454),
(-1.0, -0.267452, 0.022454),
(-1.0, 0.267452, 0.022454),
(0.24549, 0.267452, 0.022454),
(0.24549, -0.267452, 0.022454),
(-0.24549, 0.267452, 0.022454),
(-0.24549, -0.267452, 0.022454),
],
[[8, 3, 2, 10], [0, 9, 11, 1], [4, 8, 9, 5], [8, 10, 11, 9], [10, 7, 6, 11]]),
("CTP_4003",
mathutils.Vector((4.91276, 0.0, 0.0)),
[(-1.0, -1.0, 0.026945),
(1.0, -1.0, 0.026945),
(-1.0, 1.0, 0.026945),
(-0.026763, -1.0, 0.026945),
(-0.026763, 1.0, 0.026945),
(1.0, -0.026763, 0.026945),
(0.238983, 0.965014, 0.026945),
(0.486619, 0.86244, 0.026945),
(0.699268, 0.699268, 0.026945),
(0.86244, 0.486619, 0.026945),
(0.965014, 0.238983, 0.026945),
(0.238983, -1.0, 0.026945),
(0.486619, -1.0, 0.026945),
(0.699268, -1.0, 0.026945),
(0.86244, -1.0, 0.026945),
(-0.026763, 0.479676, 0.026945),
(0.486619, 0.479676, 0.026945),
(0.699268, 0.479676, 0.026945),
(0.238983, 0.479676, 0.026945),
(0.865316, 0.479676, 0.026945),
(-1.0, 0.479676, 0.026945),
(0.86244, 0.479676, 0.026945),
(-0.026763, 0.238983, 0.026945),
(0.486619, 0.238983, 0.026945),
(0.699268, 0.238983, 0.026945),
(0.238983, 0.238983, 0.026945),
(-1.0, 0.238983, 0.026945),
(0.86244, 0.238983, 0.026945),
(-0.026763, -0.026763, 0.026945),
(0.486619, -0.026763, 0.026945),
(0.699268, -0.026763, 0.026945),
(0.238983, -0.026763, 0.026945),
(-1.0, -0.026763, 0.026945),
(0.86244, -0.026763, 0.026945),
],
[[0, 3, 28, 32], [4, 15, 18, 6], [6, 18, 16, 7], [7, 16, 17, 8], [8, 17, 21, 9], [9, 21, 19], [18, 15, 22, 25],
[19, 21, 27, 10], [16, 18, 25, 23], [17, 16, 23, 24], [20, 15, 4, 2], [21, 17, 24, 27], [27, 24, 30, 33],
[23, 25, 31, 29], [24, 23, 29, 30], [25, 22, 28, 31], [26, 22, 15, 20], [10, 27, 33, 5], [31, 28, 3, 11],
[33, 30, 13, 14], [29, 31, 11, 12], [5, 33, 14, 1], [30, 29, 12, 13], [32, 28, 22, 26]]),
("CTP_3430",
mathutils.Vector((2.61824, 0.0, 0.0)),
[(-1.0, -1.0, 0.032334),
(1.0, -1.0, 0.032334),
(-1.0, 1.0, 0.032334),
(1.0, 1.0, 0.032334),
],
[[0, 1, 3, 2]]),
("CTP_7175",
mathutils.Vector((0.0, 0.0, 0.0)),
[(-1.0, -1.0, 0.032334),
(1.0, -1.0, 0.032334),
(-1.0, 1.0, 0.032334),
(1.0, 1.0, 0.032334),
(0.0, 0.0, 0.032334),
(0.0, 0.0, 0.032334),
(0.0, 0.0, 0.032334),
(0.0, 0.0, 0.032334),
(0.0, 0.0, 0.032334),
(-0.636126, 0.636126, 0.032334),
(-0.636126, -0.636126, 0.032334),
(0.636126, -0.636126, 0.032334),
(0.636126, 0.636126, 0.032334),
],
[[10, 9, 2, 0], [11, 10, 0, 1], [12, 11, 1, 3], [9, 12, 3, 2]]),
]
# Cut Type
RECTANGLE = 0
LINE = 1
CIRCLE = 2
# Boolean operation
DIFFERENCE = 0
UNION = 1
class CarverPrefs(bpy.types.AddonPreferences):
bl_idname = __name__
Enable_Tab_01 = bpy.props.BoolProperty(
name="Info",
description="Some general information and settings about the add-on",
default=False
)
Enable_Tab_02 = bpy.props.BoolProperty(
name="Hotkeys",
description="List of the shortcuts used during carving",
default=False
)
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
bpy.types.Scene.Key_Create = bpy.props.StringProperty(
name="Object creation",
description="Object creation",
maxlen=1,
default="C")
bpy.types.Scene.Key_Update = bpy.props.StringProperty(
name="Auto Bevel Update",
description="Auto Bevel Update",
maxlen=1,
default="A",
)
bpy.types.Scene.Key_Bool = bpy.props.StringProperty(
name="Boolean type",
description="Boolean operation type",
maxlen=1,
default="T",
)
bpy.types.Scene.Key_Brush = bpy.props.StringProperty(
name="Brush Mode",
description="Brush Mode",
maxlen=1,
default="B",
)
bpy.types.Scene.Key_Help = bpy.props.StringProperty(
name="Help display",
description="Help display",
maxlen=1,
default="H",
)
bpy.types.Scene.Key_Instant = bpy.props.StringProperty(
name="Instantiate",
description="Instantiate object",
maxlen=1,
default="I",
)
bpy.types.Scene.Key_Close = bpy.props.StringProperty(
name="Close polygonal shape",
description="Close polygonal shape",
maxlen=1,
default="X",
)
bpy.types.Scene.Key_Apply = bpy.props.StringProperty(
name="Apply operation",
description="Apply operation",
maxlen=1,
default="Q",
)
bpy.types.Scene.Key_Scale = bpy.props.StringProperty(
name="Scale object",
description="Scale object",
maxlen=1,
default="S",
)
bpy.types.Scene.Key_Gapy = bpy.props.StringProperty(
name="Gap rows",
description="Scale gap between columns",
maxlen=1,
default="J",
)
bpy.types.Scene.Key_Gapx = bpy.props.StringProperty(
name="Gap columns",
description="Scale gap between columns",
maxlen=1,
default="U",
)
bpy.types.Scene.Key_Depth = bpy.props.StringProperty(
name="Depth",
description="Cursor depth or solidify pattern",
maxlen=1,
default="D",
)
bpy.types.Scene.Key_BrushDepth = bpy.props.StringProperty(
name="Brush Depth",
description="Brush depth",
maxlen=1,
default="C",
)
bpy.types.Scene.Key_Subadd = bpy.props.StringProperty(
name="Add subdivision",
description="Add subdivision",
maxlen=1,
default="X",
)
bpy.types.Scene.Key_Subrem = bpy.props.StringProperty(
name="Remove subdivision",
description="Remove subdivision",
maxlen=1,
default="W",
)
bpy.types.Scene.Key_Randrot = bpy.props.StringProperty(
name="Random rotation",
description="Random rotation",
maxlen=1,
default="R",
)
bpy.types.Scene.Key_Solver = bpy.props.StringProperty(
name="Solver",
description="Switch between Carve and BMesh Boolean solver\n"
"depending on a specific use case",
maxlen=1,
default="V",
)
bpy.types.Scene.ProfilePrefix = bpy.props.StringProperty(
name="Profile prefix",
description="Prefix to look for profiles with",
default="Carver_Profile-"
)
bpy.types.Scene.CarverSolver = bpy.props.EnumProperty(
name="Boolean Solver",
description="Boolean solver to use by default\n",
default="CARVE",
items=(
('CARVE', 'Carve', "Carve solver, as the legacy one, can handle\n"
"basic coplanar but can often fail with\n"
"non-closed geometry"),
('BMESH', 'BMesh', "BMesh solver is faster, but cannot handle\n"
"coplanar and self-intersecting geometry")
)
)
def draw(self, context):
scene = context.scene
layout = self.layout
layout.prop(self, "Enable_Tab_01", text="Info and Settings", icon="QUESTION")
if self.Enable_Tab_01:
layout.label(text="Carver Operator:", icon="LAYER_ACTIVE")
layout.label(text="Select a Mesh Object and press [CTRL]+[SHIFT]+[X] to carve",
icon="LAYER_USED")
layout.label(text="To finish carving press [ESC] or [RIGHT CLICK]",
icon="LAYER_USED")
layout.prop(scene, "ProfilePrefix", text="Profile prefix")
layout.prop(scene, "CarverSolver", text="Solver")
layout.prop(self, "Enable_Tab_02", text="Keys", icon="KEYINGSET")
if self.Enable_Tab_02:
split = layout.split()
col = split.column()
col.label("Object Creation:")
col.prop(scene, "Key_Create", text="")
col.label("Auto bevel update:")
col.prop(scene, "Key_Update", text="")
col.label("Boolean operation type:")
col.prop(scene, "Key_Bool", text="")
col.label("Solver:")
col.prop(scene, "Key_Solver", text="")
col = split.column()
col.label("Brush Mode:")
col.prop(scene, "Key_Brush", text="")
col.label("Help display:")
col.prop(scene, "Key_Help", text="")
col.label("Instantiate object:")
col.prop(scene, "Key_Instant", text="")
col.label("Brush Depth:")
col.prop(scene, "Key_BrushDepth", text="")
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
col = split.column()
col.label("Close polygonal shape:")
col.prop(scene, "Key_Close", text="")
col.label("Apply operation:")
col.prop(scene, "Key_Apply", text="")
col.label("Scale object:")
col.prop(scene, "Key_Scale", text="")
col = split.column()
col.label("Gap rows:")
col.prop(scene, "Key_Gapy", text="")
col.label("Gap columns:")
col.prop(scene, "Key_Gapx", text="")
col.label("Depth / Solidify:")
col.prop(scene, "Key_Depth", text="")
col = split.column()
col.label("Subdiv add:")
col.prop(scene, "Key_Subadd", text="")
col.label("Subdiv Remove:")
col.prop(scene, "Key_Subrem", text="")
col.label("Random rotation:")
col.prop(scene, "Key_Randrot", text="")
# Draw Text (Center position)
def DrawCenterText(text, xt, yt, Size, Color, self):
font_id = 0
Sshadow_x = 2
Sshadow_y = -2
blf.size(font_id, Size, 72)
blf.position(font_id, xt + Sshadow_x - blf.dimensions(font_id, text)[0] / 2, yt + Sshadow_y, 0)
bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
blf.draw(font_id, text)
blf.position(font_id, xt - blf.dimensions(font_id, text)[0] / 2, yt, 0)
if Color is not None:
mColor = mathutils.Color((Color[0], Color[1], Color[2]))
bgl.glColor4f(mColor.r, mColor.g, mColor.b, 1.0)
else:
bgl.glColor4f(1.0, 1.0, 1.0, 1.0)
blf.draw(font_id, text)
# Draw text (Left position)
def DrawLeftText(text, xt, yt, Size, Color, self):
font_id = 0
Sshadow_x = 2
Sshadow_y = -2
blf.size(font_id, Size, 72)
blf.position(font_id, xt + Sshadow_x, yt + Sshadow_y, 0)
bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
blf.draw(font_id, text)
blf.position(font_id, xt, yt, 0)
if Color is not None:
mColor = mathutils.Color((Color[0], Color[1], Color[2]))
bgl.glColor4f(mColor.r, mColor.g, mColor.b, 1.0)
else:
bgl.glColor4f(1.0, 1.0, 1.0, 1.0)
blf.draw(font_id, text)
# Draw text (Right position)
def DrawRightText(text, xt, yt, Size, Color, self):
font_id = 0
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
Sshadow_x = 2
Sshadow_y = -2
blf.size(font_id, Size, 72)
blf.position(font_id, xt + Sshadow_x - blf.dimensions(font_id, text)[0], yt + Sshadow_y, 0)
bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
blf.draw(font_id, text)
blf.position(font_id, xt - blf.dimensions(font_id, text)[0], yt, 0)
if Color is not None:
mColor = mathutils.Color((Color[0], Color[1], Color[2]))
bgl.glColor4f(mColor.r, mColor.g, mColor.b, 1.0)
else:
bgl.glColor4f(1.0, 1.0, 1.0, 1.0)
blf.draw(font_id, text)
# Opengl draws
def draw_callback_px(self, context):
font_id = 0
region = context.region
# Width screen
overlap = context.user_preferences.system.use_region_overlap
t_panel_width = 0
if overlap:
for region in context.area.regions:
if region.type == 'TOOLS':
t_panel_width = region.width
# Initial position
xt = int(region.width / 2.0)
yt = 130
if region.width >= 850:
xt = int(region.width / 2.0)
yt = 150
# Command Display
if self.CreateMode and ((self.ObjectMode == False) and (self.ProfileMode == False)):
BooleanMode = "Create"
else:
if self.ObjectMode or self.ProfileMode:
if self.BoolOps == DIFFERENCE:
BooleanType = "Difference) [T]"
else:
BooleanType = "Union) [T]"
if self.ObjectMode:
BooleanMode = "Object Brush (" + BooleanType
else:
BooleanMode = "Profil Brush (" + BooleanType
else:
if (self.shift == False) and (self.ForceRebool == False):
BooleanMode = "Difference"
else:
BooleanMode = "Rebool"
UIColor = (0.992, 0.5518, 0.0, 1.0)
# Display boolean mode
if region.width >= 850:
DrawCenterText(BooleanMode, xt, yt, 40, UIColor, self)
else:
DrawCenterText(BooleanMode, xt, yt, 20, UIColor, self)
# Separator (Line)
LineWidth = 75
if region.width >= 850:
LineWidth = 140
bgl.glLineWidth(1)
bgl.glColor4f(1.0, 1.0, 1.0, 1.0)
bgl.glBegin(bgl.GL_LINE_STRIP)
bgl.glVertex2i(int(xt - LineWidth), yt - 8)
bgl.glVertex2i(int(xt + LineWidth), yt - 8)
bgl.glEnd()
# Text position
xt = xt - blf.dimensions(font_id, "Difference")[0] / 2 + 80
# Primitives type
PrimitiveType = "Rectangle "
if self.CutMode == CIRCLE:
PrimitiveType = "Circle "
if self.CutMode == LINE:
PrimitiveType = "Line "
# Variables according to screen size
IFontSize = 12
yInterval = 20
xCmd = 0
yCmd = yt - 30
if region.width >= 850:
IFontSize = 18
yInterval = 25
xCmd = 100
# Color
Color0 = None
Color1 = UIColor
# Help Display
if (self.ObjectMode == False) and (self.ProfileMode == False):
TypeStr = "Cut Type [Space] : "
if self.CreateMode:
TypeStr = "Type [Space] : "
blf.size(font_id, IFontSize, 72)
OpsStr = TypeStr + PrimitiveType
TotalWidth = blf.dimensions(font_id, OpsStr)[0]
xLeft = region.width / 2 - TotalWidth / 2
xLeftP = xLeft + blf.dimensions(font_id, TypeStr)[0]
DrawLeftText(TypeStr, xLeft, yCmd, IFontSize, Color0, self)
DrawLeftText(PrimitiveType, xLeftP, yCmd, IFontSize, Color1, self)
# Depth Cursor
TypeStr = "Cursor Depth [" + context.scene.Key_Depth + "] : "
if self.snapCursor:
BoolStr = "(ON)"
else:
BoolStr = "(OFF)"
OpsStr = TypeStr + BoolStr
TotalWidth = blf.dimensions(font_id, OpsStr)[0]
xLeft = region.width / 2 - TotalWidth / 2
xLeftP = xLeft + blf.dimensions(font_id, TypeStr)[0]
DrawLeftText(TypeStr, xLeft, yCmd - yInterval, IFontSize, Color0, self)
DrawLeftText(BoolStr, xLeftP, yCmd - yInterval, IFontSize, Color1, self)
if self.CreateMode == False:
# Apply Booleans
TypeStr = "Apply Operations [" + context.scene.Key_Apply + "] : "
if self.DontApply:
BoolStr = "(OFF)"
else:
BoolStr = "(ON)"
OpsStr = TypeStr + BoolStr
TotalWidth = blf.dimensions(font_id, OpsStr)[0]
xLeft = region.width / 2 - TotalWidth / 2
xLeftP = xLeft + blf.dimensions(font_id, TypeStr)[0]
DrawLeftText(TypeStr, xLeft, yCmd - yInterval * 2, IFontSize, Color0, self)
DrawLeftText(BoolStr, xLeftP, yCmd - yInterval * 2, IFontSize, Color1, self)
# Auto update for bevel
TypeStr = "Bevel Update [" + context.scene.Key_Update + "] : "
if self.Auto_BevelUpdate:
BoolStr = "(ON)"
else:
BoolStr = "(OFF)"
OpsStr = TypeStr + BoolStr
TotalWidth = blf.dimensions(font_id, OpsStr)[0]
xLeft = region.width / 2 - TotalWidth / 2
xLeftP = xLeft + blf.dimensions(font_id, TypeStr)[0]
DrawLeftText(TypeStr, xLeft, yCmd - yInterval * 3, IFontSize, Color0, self)
DrawLeftText(BoolStr, xLeftP, yCmd - yInterval * 3, IFontSize, Color1, self)
# Subdivisions
if self.CutMode == CIRCLE:
if self.CreateMode == False:
y = yCmd - yInterval * 4
else:
y = yCmd - yInterval * 2
TypeStr = "Subdivisions [" + context.scene.Key_Subrem + "][" + context.scene.Key_Subadd + "] : "
BoolStr = str((int(360 / self.stepAngle[self.step])))
OpsStr = TypeStr + BoolStr
TotalWidth = blf.dimensions(font_id, OpsStr)[0]
xLeft = region.width / 2 - TotalWidth / 2
xLeftP = xLeft + blf.dimensions(font_id, TypeStr)[0]
DrawLeftText(TypeStr, xLeft, y, IFontSize, Color0, self)
DrawLeftText(BoolStr, xLeftP, y, IFontSize, Color1, self)
else:
TypeStr = "Instantiate [" + context.scene.Key_Instant + "] : "
if self.Instantiate:
BoolStr = "(ON)"
else:
BoolStr = "(OFF)"
OpsStr = TypeStr + BoolStr
blf.size(font_id, IFontSize, 72)
TotalWidth = blf.dimensions(font_id, OpsStr)[0]
xLeft = region.width / 2 - TotalWidth / 2
xLeftP = xLeft + blf.dimensions(font_id, TypeStr)[0]
DrawLeftText(TypeStr, xLeft, yCmd, IFontSize, Color0, self)
DrawLeftText(BoolStr, xLeftP, yCmd, IFontSize, Color1, self)
if self.alt:
TypeStr = "Random Rotation [" + context.scene.Key_Randrot + "] : "
if self.RandomRotation:
BoolStr = "(ON)"
else:
BoolStr = "(OFF)"
OpsStr = TypeStr + BoolStr
blf.size(font_id, IFontSize, 72)
TotalWidth = blf.dimensions(font_id, OpsStr)[0]
xLeft = region.width / 2 - TotalWidth / 2
xLeftP = xLeft + blf.dimensions(font_id, TypeStr)[0]
DrawLeftText(TypeStr, xLeft, yCmd - yInterval, IFontSize, Color0, self)
DrawLeftText(BoolStr, xLeftP, yCmd - yInterval, IFontSize, Color1, self)
if self.BrushSolidify:
TypeStr = "Thickness [" + context.scene.Key_Depth + "] : "
if self.ProfileMode:
BoolStr = str(round(self.ProfileBrush.modifiers["CT_SOLIDIFY"].thickness, 2))
if self.ObjectMode:
BoolStr = str(round(self.ObjectBrush.modifiers["CT_SOLIDIFY"].thickness, 2))
OpsStr = TypeStr + BoolStr
blf.size(font_id, IFontSize, 72)
TotalWidth = blf.dimensions(font_id, OpsStr)[0]
xLeft = region.width / 2 - TotalWidth / 2
xLeftP = xLeft + blf.dimensions(font_id, TypeStr)[0]
if self.alt:
DrawLeftText(TypeStr, xLeft, yCmd - yInterval * 2, IFontSize, Color0, self)
DrawLeftText(BoolStr, xLeftP, yCmd - yInterval * 2, IFontSize, Color1, self)
else:
DrawLeftText(TypeStr, xLeft, yCmd - yInterval, IFontSize, Color0, self)
DrawLeftText(BoolStr, xLeftP, yCmd - yInterval, IFontSize, Color1, self)
TypeStr = "Carve Depth [" + context.scene.Key_Depth + "] : "
BoolStr = str(round(self.ObjectBrush.data.vertices[0].co.z, 2))
OpsStr = TypeStr + BoolStr
blf.size(font_id, IFontSize, 72)
TotalWidth = blf.dimensions(font_id, OpsStr)[0]
xLeft = region.width / 2 - TotalWidth / 2
xLeftP = xLeft + blf.dimensions(font_id, TypeStr)[0]
if self.alt:
DrawLeftText(TypeStr, xLeft, yCmd - yInterval * 2, IFontSize, Color0, self)
DrawLeftText(BoolStr, xLeftP, yCmd - yInterval * 2, IFontSize, Color1, self)
else:
DrawLeftText(TypeStr, xLeft, yCmd - yInterval, IFontSize, Color0, self)
DrawLeftText(BoolStr, xLeftP, yCmd - yInterval, IFontSize, Color1, self)
TypeStr = "Brush Depth [" + context.scene.Key_BrushDepth + "] : "
BoolStr = str(round(self.BrushDepthOffset, 2))
OpsStr = TypeStr + BoolStr
blf.size(font_id, IFontSize, 72)
TotalWidth = blf.dimensions(font_id, OpsStr)[0]
xLeft = region.width / 2 - TotalWidth / 2
xLeftP = xLeft + blf.dimensions(font_id, TypeStr)[0]
if self.alt:
DrawLeftText(TypeStr, xLeft, yCmd - yInterval * 3, IFontSize, Color0, self)
DrawLeftText(BoolStr, xLeftP, yCmd - yInterval * 3, IFontSize, Color1, self)
else:
DrawLeftText(TypeStr, xLeft, yCmd - yInterval * 2, IFontSize, Color0, self)
DrawLeftText(BoolStr, xLeftP, yCmd - yInterval * 2, IFontSize, Color1, self)
bgl.glEnable(bgl.GL_BLEND)
if region.width >= 850:
if self.AskHelp == False:
xrect = 40
yrect = 40
bgl.glColor4f(0.0, 0.0, 0.0, 0.3)
bgl.glRecti(xrect, yrect, xrect + 90, yrect + 25)
DrawLeftText("[" + context.scene.Key_Help + "] for help", xrect + 10, yrect + 8, 13, None, self)
else:
xHelp = 30 + t_panel_width
yHelp = 80
Help_FontSize = 12
Help_Interval = 14
if region.width >= 850:
Help_FontSize = 15
Help_Interval = 20
if self.ObjectMode or self.ProfileMode:
if self.ProfileMode:
DrawLeftText("[" + context.scene.Key_Brush + "]", xHelp, yHelp +
Help_Interval * 2, Help_FontSize, UIColor, self)
DrawLeftText(": Object Mode", 150 + t_panel_width, yHelp +
Help_Interval * 2, Help_FontSize, None, self)
else:
DrawLeftText("[" + context.scene.Key_Brush + "]", xHelp, yHelp +
Help_Interval * 2, Help_FontSize, UIColor, self)
DrawLeftText(": Return", 150 + t_panel_width, yHelp + Help_Interval * 2, Help_FontSize, None, self)
else:
DrawLeftText("[" + context.scene.Key_Brush + "]", xHelp, yHelp +
Help_Interval * 2, Help_FontSize, UIColor, self)
DrawLeftText(": Profil Brush", 150 + t_panel_width, yHelp +
Help_Interval * 2, Help_FontSize, None, self)
DrawLeftText("[Ctrl + LMB]", xHelp, yHelp - Help_Interval * 6, Help_FontSize, UIColor, self)
DrawLeftText(": Move Cursor", 150 + t_panel_width, yHelp -
Help_Interval * 6, Help_FontSize, None, self)
if (self.ObjectMode == False) and (self.ProfileMode == False):
if self.CreateMode == False:
DrawLeftText("[" + context.scene.Key_Create + "]", xHelp,
yHelp + Help_Interval, Help_FontSize, UIColor, self)
DrawLeftText(": Create geometry", 150 + t_panel_width,
yHelp + Help_Interval, Help_FontSize, None, self)
else:
DrawLeftText("[" + context.scene.Key_Create + "]", xHelp,
yHelp + Help_Interval, Help_FontSize, UIColor, self)
DrawLeftText(": Cut", 150 + t_panel_width, yHelp + Help_Interval, Help_FontSize, None, self)
if self.CutMode == RECTANGLE:
DrawLeftText("MouseMove", xHelp, yHelp, Help_FontSize, UIColor, self)
DrawLeftText("[Alt]", xHelp, yHelp - Help_Interval, Help_FontSize, UIColor, self)
DrawLeftText("[" + context.scene.Key_Solver + "]", xHelp, yHelp - Help_Interval * 2, Help_FontSize, UIColor, self)
DrawLeftText(": Dimension", 150 + t_panel_width, yHelp, Help_FontSize, None, self)
DrawLeftText(": Move all", 150 + t_panel_width, yHelp - Help_Interval, Help_FontSize, None, self)
DrawLeftText(": Solver [" + context.scene.CarverSolver + "]", 150 + t_panel_width, yHelp - Help_Interval * 2, Help_FontSize, None, self)
if self.CutMode == CIRCLE:
DrawLeftText("MouseMove", xHelp, yHelp, Help_FontSize, UIColor, self)