Merge branch 'blender-v3.3-release'
[blender-addons.git] / btrace / bTrace_props.py
blobe7e757a4bc6f6f69a639c4007102d3dbc47b0aa1
1 # SPDX-License-Identifier: GPL-2.0-or-later
3 import bpy
4 from bpy.types import (
5 Panel,
6 PropertyGroup,
8 from bpy.props import (
9 FloatProperty,
10 EnumProperty,
11 IntProperty,
12 BoolProperty,
13 FloatVectorProperty,
17 # Class to define properties
18 class TracerProperties(PropertyGroup):
19 """Options for tools"""
20 curve_spline: EnumProperty(
21 name="Spline",
22 items=(("POLY", "Poly", "Use Poly spline type"),
23 ("NURBS", "Nurbs", "Use Nurbs spline type"),
24 ("BEZIER", "Bezier", "Use Bezier spline type")),
25 description="Choose which type of spline to use when curve is created",
26 default="BEZIER"
28 curve_handle: EnumProperty(
29 name="Handle",
30 items=(("ALIGNED", "Aligned", "Use Aligned Handle Type"),
31 ("AUTOMATIC", "Automatic", "Use Auto Handle Type"),
32 ("FREE_ALIGN", "Free Align", "Use Free Handle Type"),
33 ("VECTOR", "Vector", "Use Vector Handle Type")),
34 description="Choose which type of handle to use when curve is created",
35 default="VECTOR"
37 curve_resolution: IntProperty(
38 name="Bevel Resolution",
39 min=1, max=32,
40 default=4,
41 description="Adjust the Bevel resolution"
43 curve_depth: FloatProperty(
44 name="Bevel Depth",
45 min=0.0, max=100.0,
46 default=0.1,
47 description="Adjust the Bevel depth"
49 curve_u: IntProperty(
50 name="Resolution U",
51 min=0, max=64,
52 default=12,
53 description="Adjust the Surface resolution"
55 curve_join: BoolProperty(
56 name="Join Curves",
57 default=False,
58 description="Join all the curves after they have been created"
60 curve_smooth: BoolProperty(
61 name="Smooth",
62 default=True,
63 description="Render curve smooth"
65 # Option to Duplicate Mesh
66 object_duplicate: BoolProperty(
67 name="Apply to Copy",
68 default=False,
69 description="Apply curve to a copy of object"
71 # Distort Mesh options
72 distort_modscale: IntProperty(
73 name="Modulation Scale",
74 min=0, max=50,
75 default=2,
76 description="Add a scale to modulate the curve at random points, set to 0 to disable"
78 distort_noise: FloatProperty(
79 name="Mesh Noise",
80 min=0.0, max=50.0,
81 default=0.00,
82 description="Adjust noise added to mesh before adding curve"
84 # Particle Options
85 particle_step: IntProperty(
86 name="Step Size",
87 min=1, max=50,
88 default=5,
89 description="Sample one every this number of frames"
91 particle_auto: BoolProperty(
92 name="Auto Frame Range",
93 default=True,
94 description="Calculate Frame Range from particles life"
96 particle_f_start: IntProperty(
97 name='Start Frame',
98 min=1, max=5000,
99 default=1,
100 description='Start frame'
102 particle_f_end: IntProperty(
103 name="End Frame",
104 min=1, max=5000,
105 default=250,
106 description="End frame"
108 # F-Curve Modifier Properties
109 fcnoise_rot: BoolProperty(
110 name="Rotation",
111 default=False,
112 description="Affect Rotation"
114 fcnoise_loc: BoolProperty(
115 name="Location",
116 default=True,
117 description="Affect Location"
119 fcnoise_scale: BoolProperty(
120 name="Scale",
121 default=False,
122 description="Affect Scale"
124 fcnoise_amp: IntProperty(
125 name="Amp",
126 min=1, max=500,
127 default=5,
128 description="Adjust the amplitude"
130 fcnoise_timescale: FloatProperty(
131 name="Time Scale",
132 min=1, max=500,
133 default=50,
134 description="Adjust the time scale"
136 fcnoise_key: BoolProperty(
137 name="Add Keyframe",
138 default=True,
139 description="Keyframe is needed for tool, this adds a LocRotScale keyframe"
141 show_curve_settings: BoolProperty(
142 name="Curve Settings",
143 default=False,
144 description="Change the curve settings for the created curve"
146 material_settings: BoolProperty(
147 name="Material Settings",
148 default=False,
149 description="Change the material settings for the created curve"
151 particle_settings: BoolProperty(
152 name="Particle Settings",
153 default=False,
154 description="Show the settings for the created curve"
156 animation_settings: BoolProperty(
157 name="Animation Settings",
158 default=False,
159 description="Show the settings for the Animations"
161 distort_curve: BoolProperty(
162 name="Add Distortion",
163 default=False,
164 description="Set options to distort the final curve"
166 connect_noise: BoolProperty(
167 name="F-Curve Noise",
168 default=False,
169 description="Adds F-Curve Noise Modifier to selected objects"
171 settings_objectTrace: BoolProperty(
172 name="Object Trace Settings",
173 default=False,
174 description="Trace selected mesh object with a curve"
176 settings_objectsConnect: BoolProperty(
177 name="Objects Connect Settings",
178 default=False,
179 description="Connect objects with a curve controlled by hooks"
181 settings_objectTrace: BoolProperty(
182 name="Object Trace Settings",
183 default=False,
184 description="Trace selected mesh object with a curve"
186 respect_order: BoolProperty(
187 name="Order",
188 default=False,
189 description="Remember order objects were selected"
191 settings_particleTrace: BoolProperty(
192 name="Particle Trace Settings",
193 default=False,
194 description="Trace particle path with a curve"
196 settings_particleConnect: BoolProperty(
197 name="Particle Connect Settings",
198 default=False,
199 description="Connect particles with a curves and animated over particle lifetime"
201 settings_growCurve: BoolProperty(
202 name="Grow Curve Settings",
203 default=False,
204 description="Animate curve bevel over time by keyframing points radius"
206 settings_fcurve: BoolProperty(
207 name="F-Curve Settings",
208 default=False,
209 description="F-Curve Settings"
211 settings_toggle: BoolProperty(
212 name="Settings",
213 default=False,
214 description="Toggle Settings"
216 # Animation Options
217 anim_auto: BoolProperty(
218 name="Auto Frame Range",
219 default=True,
220 description="Automatically calculate Frame Range"
222 anim_f_start: IntProperty(
223 name="Start",
224 min=1, max=2500,
225 default=1,
226 description="Start frame / Hidden object"
228 anim_length: IntProperty(
229 name="Duration",
230 min=1,
231 soft_max=1000, max=2500,
232 default=100,
233 description="Animation Length"
235 anim_f_fade: IntProperty(
236 name="Fade After",
237 min=0,
238 soft_max=250, max=2500,
239 default=10,
240 description="Fade after this frames / Zero means no fade"
242 anim_delay: IntProperty(
243 name="Grow",
244 min=0, max=50,
245 default=5,
246 description="Frames it takes a point to grow"
248 anim_tails: BoolProperty(
249 name='Tails on endpoints',
250 default=True,
251 description='Set radius to zero for open splines endpoints'
253 anim_keepr: BoolProperty(
254 name="Keep Radius",
255 default=True,
256 description="Try to keep radius data from original curve"
258 animate: BoolProperty(
259 name="Animate Result",
260 default=False,
261 description="Animate the final curve objects"
263 # Convert to Curve options
264 convert_conti: BoolProperty(
265 name="Continuous",
266 default=True,
267 description="Create a continuous curve using verts from mesh"
269 convert_everyedge: BoolProperty(
270 name="Every Edge",
271 default=False,
272 description="Create a curve from all verts in a mesh"
274 convert_edgetype: EnumProperty(
275 name="Edge Type for Curves",
276 items=(("CONTI", "Continuous", "Create a continuous curve using verts from mesh"),
277 ("EDGEALL", "All Edges", "Create a curve from every edge in a mesh")),
278 description="Choose which type of spline to use when curve is created",
279 default="CONTI"
281 convert_joinbefore: BoolProperty(
282 name="Join objects before convert",
283 default=False,
284 description="Join all selected mesh to one object before converting to mesh"
286 # Mesh Follow Options
287 fol_edge_select: BoolProperty(
288 name="Edge",
289 default=False,
290 description="Grow from edges"
292 fol_vert_select: BoolProperty(
293 name="Vertex",
294 default=False,
295 description="Grow from verts"
297 fol_face_select: BoolProperty(
298 name="Face",
299 default=True,
300 description="Grow from faces"
302 fol_mesh_type: EnumProperty(
303 name="Mesh type",
304 default="VERTS",
305 description="Mesh feature to draw cruves from",
306 items=(("VERTS", "Verts", "Draw from Verts"),
307 ("EDGES", "Edges", "Draw from Edges"),
308 ("FACES", "Faces", "Draw from Faces"),
309 ("OBJECT", "Object", "Draw from Object origin"))
311 fol_start_frame: IntProperty(
312 name="Start Frame",
313 min=1, max=2500,
314 default=1,
315 description="Start frame for range to trace"
317 fol_end_frame: IntProperty(
318 name="End Frame",
319 min=1, max=2500,
320 default=250,
321 description="End frame for range to trace"
323 fol_perc_verts: FloatProperty(
324 name="Reduce selection by",
325 min=0.001, max=1.000,
326 default=0.5,
327 description="percentage of total verts to trace"
329 fol_sel_option: EnumProperty(
330 name="Selection type",
331 description="Choose which objects to follow",
332 default="RANDOM",
333 items=(("RANDOM", "Random", "Follow Random items"),
334 ("CUSTOM", "Custom Select", "Follow selected items"),
335 ("ALL", "All", "Follow all items"))
337 trace_mat_color: FloatVectorProperty(
338 name="Material Color",
339 description="Choose material color",
340 min=0, max=1,
341 default=(0.0, 0.3, 0.6),
342 subtype="COLOR"
344 trace_mat_random: BoolProperty(
345 name="Random Color",
346 default=False,
347 description='Make the material colors random'
349 # Material custom Properties properties
350 mat_simple_adv_toggle: EnumProperty(
351 name="Material Options",
352 items=(("SIMPLE", "Simple", "Show Simple Material Options"),
353 ("ADVANCED", "Advanced", "Show Advanced Material Options")),
354 description="Choose which Material Options to show",
355 default="SIMPLE"
357 mat_run_color_blender: BoolProperty(
358 name="Run Color Blender",
359 default=False,
360 description="Generate colors from a color scheme"
362 mmColors: EnumProperty(
363 items=(("RANDOM", "Random", "Use random colors"),
364 ("CUSTOM", "Custom", "Use custom colors"),
365 ("BW", "Black/White", "Use Black and White"),
366 ("BRIGHT", "Bright Colors", "Use Bright colors"),
367 ("EARTH", "Earth", "Use Earth colors"),
368 ("GREENBLUE", "Green to Blue", "Use Green to Blue colors")),
369 description="Choose which type of colors the materials uses",
370 default="BRIGHT",
371 name="Define a color palette"
373 # Custom property for how many keyframes to skip
374 mmSkip: IntProperty(
375 name="frames",
376 min=1, max=500,
377 default=20,
378 description="Number of frames between each keyframes"
380 # Custom property to enable/disable random order for the
381 mmBoolRandom: BoolProperty(
382 name="Random Order",
383 default=False,
384 description="Randomize the order of the colors"
386 # Custom Color properties
387 mmColor1: FloatVectorProperty(
388 min=0, max=1,
389 default=(0.8, 0.8, 0.8),
390 description="Custom Color 1", subtype="COLOR"
392 mmColor2: FloatVectorProperty(
393 min=0, max=1,
394 default=(0.8, 0.8, 0.3),
395 description="Custom Color 2",
396 subtype="COLOR"
398 mmColor3: FloatVectorProperty(
399 min=0, max=1,
400 default=(0.8, 0.5, 0.6),
401 description="Custom Color 3",
402 subtype="COLOR"
404 mmColor4: FloatVectorProperty(
405 min=0, max=1,
406 default=(0.2, 0.8, 0.289),
407 description="Custom Color 4",
408 subtype="COLOR"
410 mmColor5: FloatVectorProperty(
411 min=0, max=1,
412 default=(1.0, 0.348, 0.8),
413 description="Custom Color 5",
414 subtype="COLOR"
416 mmColor6: FloatVectorProperty(
417 min=0, max=1,
418 default=(0.4, 0.67, 0.8),
419 description="Custom Color 6",
420 subtype="COLOR"
422 mmColor7: FloatVectorProperty(
423 min=0, max=1,
424 default=(0.66, 0.88, 0.8),
425 description="Custom Color 7",
426 subtype="COLOR"
428 mmColor8: FloatVectorProperty(
429 min=0, max=1,
430 default=(0.8, 0.38, 0.22),
431 description="Custom Color 8",
432 subtype="COLOR"
434 # BW Color properties
435 bwColor1: FloatVectorProperty(
436 min=0, max=1,
437 default=(0.0, 0.0, 0.0),
438 description="Black/White Color 1",
439 subtype="COLOR"
441 bwColor2: FloatVectorProperty(
442 min=0, max=1,
443 default=(1.0, 1.0, 1.0),
444 description="Black/White Color 2",
445 subtype="COLOR"
447 # Bright Color properties
448 brightColor1: FloatVectorProperty(
449 min=0, max=1,
450 default=(1.0, 0.0, 0.75),
451 description="Bright Color 1",
452 subtype="COLOR"
454 brightColor2: FloatVectorProperty(
455 min=0, max=1,
456 default=(0.0, 1.0, 1.0),
457 description="Bright Color 2",
458 subtype="COLOR"
460 brightColor3: FloatVectorProperty(
461 min=0, max=1,
462 default=(0.0, 1.0, 0.0),
463 description="Bright Color 3",
464 subtype="COLOR"
466 brightColor4: FloatVectorProperty(
467 min=0, max=1,
468 default=(1.0, 1.0, 0.0),
469 description="Bright Color 4", subtype="COLOR"
471 # Earth Color Properties
472 earthColor1: FloatVectorProperty(
473 min=0, max=1,
474 default=(0.068, 0.019, 0.014),
475 description="Earth Color 1",
476 subtype="COLOR"
478 earthColor2: FloatVectorProperty(
479 min=0, max=1,
480 default=(0.089, 0.060, 0.047),
481 description="Earth Color 2",
482 subtype="COLOR"
484 earthColor3: FloatVectorProperty(
485 min=0, max=1,
486 default=(0.188, 0.168, 0.066),
487 description="Earth Color 3",
488 subtype="COLOR"
490 earthColor4: FloatVectorProperty(
491 min=0, max=1,
492 default=(0.445, 0.296, 0.065),
493 description="Earth Color 4",
494 subtype="COLOR"
496 earthColor5: FloatVectorProperty(
497 min=0, max=1,
498 default=(0.745, 0.332, 0.065),
499 description="Earth Color 5",
500 subtype="COLOR"
502 # Green to Blue Color properties
503 greenblueColor1: FloatVectorProperty(
504 min=0, max=1,
505 default=(0.296, 0.445, 0.074),
506 description="Green/Blue Color 1",
507 subtype="COLOR"
509 greenblueColor2: FloatVectorProperty(
510 min=0, max=1,
511 default=(0.651, 1.0, 0.223),
512 description="Green/Blue Color 2",
513 subtype="COLOR"
515 greenblueColor3: FloatVectorProperty(
516 min=0, max=1,
517 default=(0.037, 0.047, 0.084),
518 description="Green/Blue Color 3",
519 subtype="COLOR"
522 # Toolbar show/hide booleans for tool options
523 btrace_menu_items = [
524 ('tool_help', "Choose Tool",
525 "Pick one of the options below", "INFO", 0),
526 ('tool_objectTrace', "Object Trace",
527 "Trace selected mesh object with a curve", "FORCE_MAGNETIC", 1),
528 ('tool_objectsConnect', "Objects Connect",
529 "Connect objects with a curve controlled by hooks", "OUTLINER_OB_EMPTY", 2),
530 ('tool_meshFollow', "Mesh Follow",
531 "Follow selection items on animated mesh object", "DRIVER", 3),
532 # ('tool_handwrite', "Handwriting",
533 # "Create and Animate curve using the grease pencil", "BRUSH_DATA", 4),
534 ('tool_particleTrace', "Particle Trace",
535 "Trace particle path with a curve", "PARTICLES", 5),
536 ('tool_particleConnect', "Particle Connect",
537 "Connect particles with a curves and animated over particle lifetime", "MOD_PARTICLES", 6),
538 ('tool_growCurve', "Grow Curve",
539 "Animate curve bevel over time by keyframing points radius", "META_BALL", 7),
540 ('tool_fcurve', "F-Curve Noise",
541 "Add F-Curve noise to selected objects", "RNDCURVE", 8),
542 ('tool_colorblender', "Color Blender",
543 "Pick the color of the created curves", "COLOR", 9),
546 btrace_toolmenu: EnumProperty(
547 name="Tools",
548 items=btrace_menu_items,
549 description="",
550 default='tool_help'