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