1 # SPDX-FileCopyrightText: 2017-2022 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
6 from bpy
.types
import (
10 from bpy
.props
import (
19 # Class to define properties
20 class TracerProperties(PropertyGroup
):
21 """Options for tools"""
22 curve_spline
: EnumProperty(
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",
30 curve_handle
: EnumProperty(
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",
39 curve_resolution
: IntProperty(
40 name
="Bevel Resolution",
43 description
="Adjust the Bevel resolution"
45 curve_depth
: FloatProperty(
49 description
="Adjust the Bevel depth"
55 description
="Adjust the Surface resolution"
57 curve_join
: BoolProperty(
60 description
="Join all the curves after they have been created"
62 curve_smooth
: BoolProperty(
65 description
="Render curve smooth"
67 # Option to Duplicate Mesh
68 object_duplicate
: BoolProperty(
71 description
="Apply curve to a copy of object"
73 # Distort Mesh options
74 distort_modscale
: IntProperty(
75 name
="Modulation Scale",
78 description
="Add a scale to modulate the curve at random points, set to 0 to disable"
80 distort_noise
: FloatProperty(
84 description
="Adjust noise added to mesh before adding curve"
87 particle_step
: IntProperty(
91 description
="Sample one every this number of frames"
93 particle_auto
: BoolProperty(
94 name
="Auto Frame Range",
96 description
="Calculate Frame Range from particles life"
98 particle_f_start
: IntProperty(
102 description
='Start frame'
104 particle_f_end
: IntProperty(
108 description
="End frame"
110 # F-Curve Modifier Properties
111 fcnoise_rot
: BoolProperty(
114 description
="Affect Rotation"
116 fcnoise_loc
: BoolProperty(
119 description
="Affect Location"
121 fcnoise_scale
: BoolProperty(
124 description
="Affect Scale"
126 fcnoise_amp
: IntProperty(
130 description
="Adjust the amplitude"
132 fcnoise_timescale
: FloatProperty(
136 description
="Adjust the time scale"
138 fcnoise_key
: BoolProperty(
141 description
="Keyframe is needed for tool, this adds a LocRotScale keyframe"
143 show_curve_settings
: BoolProperty(
144 name
="Curve Settings",
146 description
="Change the curve settings for the created curve"
148 material_settings
: BoolProperty(
149 name
="Material Settings",
151 description
="Change the material settings for the created curve"
153 particle_settings
: BoolProperty(
154 name
="Particle Settings",
156 description
="Show the settings for the created curve"
158 animation_settings
: BoolProperty(
159 name
="Animation Settings",
161 description
="Show the settings for the Animations"
163 distort_curve
: BoolProperty(
164 name
="Add Distortion",
166 description
="Set options to distort the final curve"
168 connect_noise
: BoolProperty(
169 name
="F-Curve Noise",
171 description
="Adds F-Curve Noise Modifier to selected objects"
173 settings_objectTrace
: BoolProperty(
174 name
="Object Trace Settings",
176 description
="Trace selected mesh object with a curve"
178 settings_objectsConnect
: BoolProperty(
179 name
="Objects Connect Settings",
181 description
="Connect objects with a curve controlled by hooks"
183 settings_objectTrace
: BoolProperty(
184 name
="Object Trace Settings",
186 description
="Trace selected mesh object with a curve"
188 respect_order
: BoolProperty(
191 description
="Remember order objects were selected"
193 settings_particleTrace
: BoolProperty(
194 name
="Particle Trace Settings",
196 description
="Trace particle path with a curve"
198 settings_particleConnect
: BoolProperty(
199 name
="Particle Connect Settings",
201 description
="Connect particles with a curves and animated over particle lifetime"
203 settings_growCurve
: BoolProperty(
204 name
="Grow Curve Settings",
206 description
="Animate curve bevel over time by keyframing points radius"
208 settings_fcurve
: BoolProperty(
209 name
="F-Curve Settings",
211 description
="F-Curve Settings"
213 settings_toggle
: BoolProperty(
216 description
="Toggle Settings"
219 anim_auto
: BoolProperty(
220 name
="Auto Frame Range",
222 description
="Automatically calculate Frame Range"
224 anim_f_start
: IntProperty(
228 description
="Start frame / Hidden object"
230 anim_length
: IntProperty(
233 soft_max
=1000, max=2500,
235 description
="Animation Length"
237 anim_f_fade
: IntProperty(
240 soft_max
=250, max=2500,
242 description
="Fade after this frames / Zero means no fade"
244 anim_delay
: IntProperty(
248 description
="Frames it takes a point to grow"
250 anim_tails
: BoolProperty(
251 name
='Tails on endpoints',
253 description
='Set radius to zero for open splines endpoints'
255 anim_keepr
: BoolProperty(
258 description
="Try to keep radius data from original curve"
260 animate
: BoolProperty(
261 name
="Animate Result",
263 description
="Animate the final curve objects"
265 # Convert to Curve options
266 convert_conti
: BoolProperty(
269 description
="Create a continuous curve using verts from mesh"
271 convert_everyedge
: BoolProperty(
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",
283 convert_joinbefore
: BoolProperty(
284 name
="Join objects before convert",
286 description
="Join all selected mesh to one object before converting to mesh"
288 # Mesh Follow Options
289 fol_edge_select
: BoolProperty(
292 description
="Grow from edges"
294 fol_vert_select
: BoolProperty(
297 description
="Grow from verts"
299 fol_face_select
: BoolProperty(
302 description
="Grow from faces"
304 fol_mesh_type
: EnumProperty(
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(
317 description
="Start frame for range to trace"
319 fol_end_frame
: IntProperty(
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,
329 description
="percentage of total verts to trace"
331 fol_sel_option
: EnumProperty(
332 name
="Selection type",
333 description
="Choose which objects to follow",
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",
343 default
=(0.0, 0.3, 0.6),
346 trace_mat_random
: BoolProperty(
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",
359 mat_run_color_blender
: BoolProperty(
360 name
="Run Color Blender",
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",
373 name
="Define a color palette"
375 # Custom property for how many keyframes to skip
380 description
="Number of frames between each keyframes"
382 # Custom property to enable/disable random order for the
383 mmBoolRandom
: BoolProperty(
386 description
="Randomize the order of the colors"
388 # Custom Color properties
389 mmColor1
: FloatVectorProperty(
391 default
=(0.8, 0.8, 0.8),
392 description
="Custom Color 1", subtype
="COLOR"
394 mmColor2
: FloatVectorProperty(
396 default
=(0.8, 0.8, 0.3),
397 description
="Custom Color 2",
400 mmColor3
: FloatVectorProperty(
402 default
=(0.8, 0.5, 0.6),
403 description
="Custom Color 3",
406 mmColor4
: FloatVectorProperty(
408 default
=(0.2, 0.8, 0.289),
409 description
="Custom Color 4",
412 mmColor5
: FloatVectorProperty(
414 default
=(1.0, 0.348, 0.8),
415 description
="Custom Color 5",
418 mmColor6
: FloatVectorProperty(
420 default
=(0.4, 0.67, 0.8),
421 description
="Custom Color 6",
424 mmColor7
: FloatVectorProperty(
426 default
=(0.66, 0.88, 0.8),
427 description
="Custom Color 7",
430 mmColor8
: FloatVectorProperty(
432 default
=(0.8, 0.38, 0.22),
433 description
="Custom Color 8",
436 # BW Color properties
437 bwColor1
: FloatVectorProperty(
439 default
=(0.0, 0.0, 0.0),
440 description
="Black/White Color 1",
443 bwColor2
: FloatVectorProperty(
445 default
=(1.0, 1.0, 1.0),
446 description
="Black/White Color 2",
449 # Bright Color properties
450 brightColor1
: FloatVectorProperty(
452 default
=(1.0, 0.0, 0.75),
453 description
="Bright Color 1",
456 brightColor2
: FloatVectorProperty(
458 default
=(0.0, 1.0, 1.0),
459 description
="Bright Color 2",
462 brightColor3
: FloatVectorProperty(
464 default
=(0.0, 1.0, 0.0),
465 description
="Bright Color 3",
468 brightColor4
: FloatVectorProperty(
470 default
=(1.0, 1.0, 0.0),
471 description
="Bright Color 4", subtype
="COLOR"
473 # Earth Color Properties
474 earthColor1
: FloatVectorProperty(
476 default
=(0.068, 0.019, 0.014),
477 description
="Earth Color 1",
480 earthColor2
: FloatVectorProperty(
482 default
=(0.089, 0.060, 0.047),
483 description
="Earth Color 2",
486 earthColor3
: FloatVectorProperty(
488 default
=(0.188, 0.168, 0.066),
489 description
="Earth Color 3",
492 earthColor4
: FloatVectorProperty(
494 default
=(0.445, 0.296, 0.065),
495 description
="Earth Color 4",
498 earthColor5
: FloatVectorProperty(
500 default
=(0.745, 0.332, 0.065),
501 description
="Earth Color 5",
504 # Green to Blue Color properties
505 greenblueColor1
: FloatVectorProperty(
507 default
=(0.296, 0.445, 0.074),
508 description
="Green/Blue Color 1",
511 greenblueColor2
: FloatVectorProperty(
513 default
=(0.651, 1.0, 0.223),
514 description
="Green/Blue Color 2",
517 greenblueColor3
: FloatVectorProperty(
519 default
=(0.037, 0.047, 0.084),
520 description
="Green/Blue Color 3",
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(
550 items
=btrace_menu_items
,