Cleanup: trailing space
[blender-addons.git] / btrace / bTrace_props.py
blobb7e824c815e6538a1d211f58fbfa1b618121d44e
1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
19 import bpy
20 from bpy.types import (
21 Panel,
22 PropertyGroup,
24 from bpy.props import (
25 FloatProperty,
26 EnumProperty,
27 IntProperty,
28 BoolProperty,
29 FloatVectorProperty,
33 # Class to define properties
34 class TracerProperties(PropertyGroup):
35 """Options for tools"""
36 curve_spline: EnumProperty(
37 name="Spline",
38 items=(("POLY", "Poly", "Use Poly spline type"),
39 ("NURBS", "Nurbs", "Use Nurbs spline type"),
40 ("BEZIER", "Bezier", "Use Bezier spline type")),
41 description="Choose which type of spline to use when curve is created",
42 default="BEZIER"
44 curve_handle: EnumProperty(
45 name="Handle",
46 items=(("ALIGNED", "Aligned", "Use Aligned Handle Type"),
47 ("AUTOMATIC", "Automatic", "Use Auto Handle Type"),
48 ("FREE_ALIGN", "Free Align", "Use Free Handle Type"),
49 ("VECTOR", "Vector", "Use Vector Handle Type")),
50 description="Choose which type of handle to use when curve is created",
51 default="VECTOR"
53 curve_resolution: IntProperty(
54 name="Bevel Resolution",
55 min=1, max=32,
56 default=4,
57 description="Adjust the Bevel resolution"
59 curve_depth: FloatProperty(
60 name="Bevel Depth",
61 min=0.0, max=100.0,
62 default=0.1,
63 description="Adjust the Bevel depth"
65 curve_u: IntProperty(
66 name="Resolution U",
67 min=0, max=64,
68 default=12,
69 description="Adjust the Surface resolution"
71 curve_join: BoolProperty(
72 name="Join Curves",
73 default=False,
74 description="Join all the curves after they have been created"
76 curve_smooth: BoolProperty(
77 name="Smooth",
78 default=True,
79 description="Render curve smooth"
81 # Option to Duplicate Mesh
82 object_duplicate: BoolProperty(
83 name="Apply to Copy",
84 default=False,
85 description="Apply curve to a copy of object"
87 # Distort Mesh options
88 distort_modscale: IntProperty(
89 name="Modulation Scale",
90 min=0, max=50,
91 default=2,
92 description="Add a scale to modulate the curve at random points, set to 0 to disable"
94 distort_noise: FloatProperty(
95 name="Mesh Noise",
96 min=0.0, max=50.0,
97 default=0.00,
98 description="Adjust noise added to mesh before adding curve"
100 # Particle Options
101 particle_step: IntProperty(
102 name="Step Size",
103 min=1, max=50,
104 default=5,
105 description="Sample one every this number of frames"
107 particle_auto: BoolProperty(
108 name="Auto Frame Range",
109 default=True,
110 description="Calculate Frame Range from particles life"
112 particle_f_start: IntProperty(
113 name='Start Frame',
114 min=1, max=5000,
115 default=1,
116 description='Start frame'
118 particle_f_end: IntProperty(
119 name="End Frame",
120 min=1, max=5000,
121 default=250,
122 description="End frame"
124 # F-Curve Modifier Properties
125 fcnoise_rot: BoolProperty(
126 name="Rotation",
127 default=False,
128 description="Affect Rotation"
130 fcnoise_loc: BoolProperty(
131 name="Location",
132 default=True,
133 description="Affect Location"
135 fcnoise_scale: BoolProperty(
136 name="Scale",
137 default=False,
138 description="Affect Scale"
140 fcnoise_amp: IntProperty(
141 name="Amp",
142 min=1, max=500,
143 default=5,
144 description="Adjust the amplitude"
146 fcnoise_timescale: FloatProperty(
147 name="Time Scale",
148 min=1, max=500,
149 default=50,
150 description="Adjust the time scale"
152 fcnoise_key: BoolProperty(
153 name="Add Keyframe",
154 default=True,
155 description="Keyframe is needed for tool, this adds a LocRotScale keyframe"
157 show_curve_settings: BoolProperty(
158 name="Curve Settings",
159 default=False,
160 description="Change the curve settings for the created curve"
162 material_settings: BoolProperty(
163 name="Material Settings",
164 default=False,
165 description="Change the material settings for the created curve"
167 particle_settings: BoolProperty(
168 name="Particle Settings",
169 default=False,
170 description="Show the settings for the created curve"
172 animation_settings: BoolProperty(
173 name="Animation Settings",
174 default=False,
175 description="Show the settings for the Animations"
177 distort_curve: BoolProperty(
178 name="Add Distortion",
179 default=False,
180 description="Set options to distort the final curve"
182 connect_noise: BoolProperty(
183 name="F-Curve Noise",
184 default=False,
185 description="Adds F-Curve Noise Modifier to selected objects"
187 settings_objectTrace: BoolProperty(
188 name="Object Trace Settings",
189 default=False,
190 description="Trace selected mesh object with a curve"
192 settings_objectsConnect: BoolProperty(
193 name="Objects Connect Settings",
194 default=False,
195 description="Connect objects with a curve controlled by hooks"
197 settings_objectTrace: BoolProperty(
198 name="Object Trace Settings",
199 default=False,
200 description="Trace selected mesh object with a curve"
202 respect_order: BoolProperty(
203 name="Order",
204 default=False,
205 description="Remember order objects were selected"
207 settings_particleTrace: BoolProperty(
208 name="Particle Trace Settings",
209 default=False,
210 description="Trace particle path with a curve"
212 settings_particleConnect: BoolProperty(
213 name="Particle Connect Settings",
214 default=False,
215 description="Connect particles with a curves and animated over particle lifetime"
217 settings_growCurve: BoolProperty(
218 name="Grow Curve Settings",
219 default=False,
220 description="Animate curve bevel over time by keyframing points radius"
222 settings_fcurve: BoolProperty(
223 name="F-Curve Settings",
224 default=False,
225 description="F-Curve Settings"
227 settings_toggle: BoolProperty(
228 name="Settings",
229 default=False,
230 description="Toggle Settings"
232 # Animation Options
233 anim_auto: BoolProperty(
234 name="Auto Frame Range",
235 default=True,
236 description="Automatically calculate Frame Range"
238 anim_f_start: IntProperty(
239 name="Start",
240 min=1, max=2500,
241 default=1,
242 description="Start frame / Hidden object"
244 anim_length: IntProperty(
245 name="Duration",
246 min=1,
247 soft_max=1000, max=2500,
248 default=100,
249 description="Animation Length"
251 anim_f_fade: IntProperty(
252 name="Fade After",
253 min=0,
254 soft_max=250, max=2500,
255 default=10,
256 description="Fade after this frames / Zero means no fade"
258 anim_delay: IntProperty(
259 name="Grow",
260 min=0, max=50,
261 default=5,
262 description="Frames it takes a point to grow"
264 anim_tails: BoolProperty(
265 name='Tails on endpoints',
266 default=True,
267 description='Set radius to zero for open splines endpoints'
269 anim_keepr: BoolProperty(
270 name="Keep Radius",
271 default=True,
272 description="Try to keep radius data from original curve"
274 animate: BoolProperty(
275 name="Animate Result",
276 default=False,
277 description="Animate the final curve objects"
279 # Convert to Curve options
280 convert_conti: BoolProperty(
281 name="Continuous",
282 default=True,
283 description="Create a continuous curve using verts from mesh"
285 convert_everyedge: BoolProperty(
286 name="Every Edge",
287 default=False,
288 description="Create a curve from all verts in a mesh"
290 convert_edgetype: EnumProperty(
291 name="Edge Type for Curves",
292 items=(("CONTI", "Continuous", "Create a continuous curve using verts from mesh"),
293 ("EDGEALL", "All Edges", "Create a curve from every edge in a mesh")),
294 description="Choose which type of spline to use when curve is created",
295 default="CONTI"
297 convert_joinbefore: BoolProperty(
298 name="Join objects before convert",
299 default=False,
300 description="Join all selected mesh to one object before converting to mesh"
302 # Mesh Follow Options
303 fol_edge_select: BoolProperty(
304 name="Edge",
305 default=False,
306 description="Grow from edges"
308 fol_vert_select: BoolProperty(
309 name="Vertex",
310 default=False,
311 description="Grow from verts"
313 fol_face_select: BoolProperty(
314 name="Face",
315 default=True,
316 description="Grow from faces"
318 fol_mesh_type: EnumProperty(
319 name="Mesh type",
320 default="VERTS",
321 description="Mesh feature to draw cruves from",
322 items=(("VERTS", "Verts", "Draw from Verts"),
323 ("EDGES", "Edges", "Draw from Edges"),
324 ("FACES", "Faces", "Draw from Faces"),
325 ("OBJECT", "Object", "Draw from Object origin"))
327 fol_start_frame: IntProperty(
328 name="Start Frame",
329 min=1, max=2500,
330 default=1,
331 description="Start frame for range to trace"
333 fol_end_frame: IntProperty(
334 name="End Frame",
335 min=1, max=2500,
336 default=250,
337 description="End frame for range to trace"
339 fol_perc_verts: FloatProperty(
340 name="Reduce selection by",
341 min=0.001, max=1.000,
342 default=0.5,
343 description="percentage of total verts to trace"
345 fol_sel_option: EnumProperty(
346 name="Selection type",
347 description="Choose which objects to follow",
348 default="RANDOM",
349 items=(("RANDOM", "Random", "Follow Random items"),
350 ("CUSTOM", "Custom Select", "Follow selected items"),
351 ("ALL", "All", "Follow all items"))
353 trace_mat_color: FloatVectorProperty(
354 name="Material Color",
355 description="Choose material color",
356 min=0, max=1,
357 default=(0.0, 0.3, 0.6),
358 subtype="COLOR"
360 trace_mat_random: BoolProperty(
361 name="Random Color",
362 default=False,
363 description='Make the material colors random'
365 # Material custom Properties properties
366 mat_simple_adv_toggle: EnumProperty(
367 name="Material Options",
368 items=(("SIMPLE", "Simple", "Show Simple Material Options"),
369 ("ADVANCED", "Advanced", "Show Advanced Material Options")),
370 description="Choose which Material Options to show",
371 default="SIMPLE"
373 mat_run_color_blender: BoolProperty(
374 name="Run Color Blender",
375 default=False,
376 description="Generate colors from a color scheme"
378 mmColors: EnumProperty(
379 items=(("RANDOM", "Random", "Use random colors"),
380 ("CUSTOM", "Custom", "Use custom colors"),
381 ("BW", "Black/White", "Use Black and White"),
382 ("BRIGHT", "Bright Colors", "Use Bright colors"),
383 ("EARTH", "Earth", "Use Earth colors"),
384 ("GREENBLUE", "Green to Blue", "Use Green to Blue colors")),
385 description="Choose which type of colors the materials uses",
386 default="BRIGHT",
387 name="Define a color palette"
389 # Custom property for how many keyframes to skip
390 mmSkip: IntProperty(
391 name="frames",
392 min=1, max=500,
393 default=20,
394 description="Number of frames between each keyframes"
396 # Custom property to enable/disable random order for the
397 mmBoolRandom: BoolProperty(
398 name="Random Order",
399 default=False,
400 description="Randomize the order of the colors"
402 # Custom Color properties
403 mmColor1: FloatVectorProperty(
404 min=0, max=1,
405 default=(0.8, 0.8, 0.8),
406 description="Custom Color 1", subtype="COLOR"
408 mmColor2: FloatVectorProperty(
409 min=0, max=1,
410 default=(0.8, 0.8, 0.3),
411 description="Custom Color 2",
412 subtype="COLOR"
414 mmColor3: FloatVectorProperty(
415 min=0, max=1,
416 default=(0.8, 0.5, 0.6),
417 description="Custom Color 3",
418 subtype="COLOR"
420 mmColor4: FloatVectorProperty(
421 min=0, max=1,
422 default=(0.2, 0.8, 0.289),
423 description="Custom Color 4",
424 subtype="COLOR"
426 mmColor5: FloatVectorProperty(
427 min=0, max=1,
428 default=(1.0, 0.348, 0.8),
429 description="Custom Color 5",
430 subtype="COLOR"
432 mmColor6: FloatVectorProperty(
433 min=0, max=1,
434 default=(0.4, 0.67, 0.8),
435 description="Custom Color 6",
436 subtype="COLOR"
438 mmColor7: FloatVectorProperty(
439 min=0, max=1,
440 default=(0.66, 0.88, 0.8),
441 description="Custom Color 7",
442 subtype="COLOR"
444 mmColor8: FloatVectorProperty(
445 min=0, max=1,
446 default=(0.8, 0.38, 0.22),
447 description="Custom Color 8",
448 subtype="COLOR"
450 # BW Color properties
451 bwColor1: FloatVectorProperty(
452 min=0, max=1,
453 default=(0.0, 0.0, 0.0),
454 description="Black/White Color 1",
455 subtype="COLOR"
457 bwColor2: FloatVectorProperty(
458 min=0, max=1,
459 default=(1.0, 1.0, 1.0),
460 description="Black/White Color 2",
461 subtype="COLOR"
463 # Bright Color properties
464 brightColor1: FloatVectorProperty(
465 min=0, max=1,
466 default=(1.0, 0.0, 0.75),
467 description="Bright Color 1",
468 subtype="COLOR"
470 brightColor2: FloatVectorProperty(
471 min=0, max=1,
472 default=(0.0, 1.0, 1.0),
473 description="Bright Color 2",
474 subtype="COLOR"
476 brightColor3: FloatVectorProperty(
477 min=0, max=1,
478 default=(0.0, 1.0, 0.0),
479 description="Bright Color 3",
480 subtype="COLOR"
482 brightColor4: FloatVectorProperty(
483 min=0, max=1,
484 default=(1.0, 1.0, 0.0),
485 description="Bright Color 4", subtype="COLOR"
487 # Earth Color Properties
488 earthColor1: FloatVectorProperty(
489 min=0, max=1,
490 default=(0.068, 0.019, 0.014),
491 description="Earth Color 1",
492 subtype="COLOR"
494 earthColor2: FloatVectorProperty(
495 min=0, max=1,
496 default=(0.089, 0.060, 0.047),
497 description="Earth Color 2",
498 subtype="COLOR"
500 earthColor3: FloatVectorProperty(
501 min=0, max=1,
502 default=(0.188, 0.168, 0.066),
503 description="Earth Color 3",
504 subtype="COLOR"
506 earthColor4: FloatVectorProperty(
507 min=0, max=1,
508 default=(0.445, 0.296, 0.065),
509 description="Earth Color 4",
510 subtype="COLOR"
512 earthColor5: FloatVectorProperty(
513 min=0, max=1,
514 default=(0.745, 0.332, 0.065),
515 description="Earth Color 5",
516 subtype="COLOR"
518 # Green to Blue Color properties
519 greenblueColor1: FloatVectorProperty(
520 min=0, max=1,
521 default=(0.296, 0.445, 0.074),
522 description="Green/Blue Color 1",
523 subtype="COLOR"
525 greenblueColor2: FloatVectorProperty(
526 min=0, max=1,
527 default=(0.651, 1.0, 0.223),
528 description="Green/Blue Color 2",
529 subtype="COLOR"
531 greenblueColor3: FloatVectorProperty(
532 min=0, max=1,
533 default=(0.037, 0.047, 0.084),
534 description="Green/Blue Color 3",
535 subtype="COLOR"
538 # Toolbar show/hide booleans for tool options
539 btrace_menu_items = [
540 ('tool_help', "Choose Tool",
541 "Pick one of the options below", "INFO", 0),
542 ('tool_objectTrace', "Object Trace",
543 "Trace selected mesh object with a curve", "FORCE_MAGNETIC", 1),
544 ('tool_objectsConnect', "Objects Connect",
545 "Connect objects with a curve controlled by hooks", "OUTLINER_OB_EMPTY", 2),
546 ('tool_meshFollow', "Mesh Follow",
547 "Follow selection items on animated mesh object", "DRIVER", 3),
548 # ('tool_handwrite', "Handwriting",
549 # "Create and Animate curve using the grease pencil", "BRUSH_DATA", 4),
550 ('tool_particleTrace', "Particle Trace",
551 "Trace particle path with a curve", "PARTICLES", 5),
552 ('tool_particleConnect', "Particle Connect",
553 "Connect particles with a curves and animated over particle lifetime", "MOD_PARTICLES", 6),
554 ('tool_growCurve', "Grow Curve",
555 "Animate curve bevel over time by keyframing points radius", "META_BALL", 7),
556 ('tool_fcurve', "F-Curve Noise",
557 "Add F-Curve noise to selected objects", "RNDCURVE", 8),
558 ('tool_colorblender', "Color Blender",
559 "Pick the color of the created curves", "COLOR", 9),
562 btrace_toolmenu: EnumProperty(
563 name="Tools",
564 items=btrace_menu_items,
565 description="",
566 default='tool_help'