1 # SPDX-License-Identifier: GPL-2.0-or-later
4 from bpy
.types
import (
8 from bpy
.props
import (
17 # Class to define properties
18 class TracerProperties(PropertyGroup
):
19 """Options for tools"""
20 curve_spline
: EnumProperty(
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",
28 curve_handle
: EnumProperty(
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",
37 curve_resolution
: IntProperty(
38 name
="Bevel Resolution",
41 description
="Adjust the Bevel resolution"
43 curve_depth
: FloatProperty(
47 description
="Adjust the Bevel depth"
53 description
="Adjust the Surface resolution"
55 curve_join
: BoolProperty(
58 description
="Join all the curves after they have been created"
60 curve_smooth
: BoolProperty(
63 description
="Render curve smooth"
65 # Option to Duplicate Mesh
66 object_duplicate
: BoolProperty(
69 description
="Apply curve to a copy of object"
71 # Distort Mesh options
72 distort_modscale
: IntProperty(
73 name
="Modulation Scale",
76 description
="Add a scale to modulate the curve at random points, set to 0 to disable"
78 distort_noise
: FloatProperty(
82 description
="Adjust noise added to mesh before adding curve"
85 particle_step
: IntProperty(
89 description
="Sample one every this number of frames"
91 particle_auto
: BoolProperty(
92 name
="Auto Frame Range",
94 description
="Calculate Frame Range from particles life"
96 particle_f_start
: IntProperty(
100 description
='Start frame'
102 particle_f_end
: IntProperty(
106 description
="End frame"
108 # F-Curve Modifier Properties
109 fcnoise_rot
: BoolProperty(
112 description
="Affect Rotation"
114 fcnoise_loc
: BoolProperty(
117 description
="Affect Location"
119 fcnoise_scale
: BoolProperty(
122 description
="Affect Scale"
124 fcnoise_amp
: IntProperty(
128 description
="Adjust the amplitude"
130 fcnoise_timescale
: FloatProperty(
134 description
="Adjust the time scale"
136 fcnoise_key
: BoolProperty(
139 description
="Keyframe is needed for tool, this adds a LocRotScale keyframe"
141 show_curve_settings
: BoolProperty(
142 name
="Curve Settings",
144 description
="Change the curve settings for the created curve"
146 material_settings
: BoolProperty(
147 name
="Material Settings",
149 description
="Change the material settings for the created curve"
151 particle_settings
: BoolProperty(
152 name
="Particle Settings",
154 description
="Show the settings for the created curve"
156 animation_settings
: BoolProperty(
157 name
="Animation Settings",
159 description
="Show the settings for the Animations"
161 distort_curve
: BoolProperty(
162 name
="Add Distortion",
164 description
="Set options to distort the final curve"
166 connect_noise
: BoolProperty(
167 name
="F-Curve Noise",
169 description
="Adds F-Curve Noise Modifier to selected objects"
171 settings_objectTrace
: BoolProperty(
172 name
="Object Trace Settings",
174 description
="Trace selected mesh object with a curve"
176 settings_objectsConnect
: BoolProperty(
177 name
="Objects Connect Settings",
179 description
="Connect objects with a curve controlled by hooks"
181 settings_objectTrace
: BoolProperty(
182 name
="Object Trace Settings",
184 description
="Trace selected mesh object with a curve"
186 respect_order
: BoolProperty(
189 description
="Remember order objects were selected"
191 settings_particleTrace
: BoolProperty(
192 name
="Particle Trace Settings",
194 description
="Trace particle path with a curve"
196 settings_particleConnect
: BoolProperty(
197 name
="Particle Connect Settings",
199 description
="Connect particles with a curves and animated over particle lifetime"
201 settings_growCurve
: BoolProperty(
202 name
="Grow Curve Settings",
204 description
="Animate curve bevel over time by keyframing points radius"
206 settings_fcurve
: BoolProperty(
207 name
="F-Curve Settings",
209 description
="F-Curve Settings"
211 settings_toggle
: BoolProperty(
214 description
="Toggle Settings"
217 anim_auto
: BoolProperty(
218 name
="Auto Frame Range",
220 description
="Automatically calculate Frame Range"
222 anim_f_start
: IntProperty(
226 description
="Start frame / Hidden object"
228 anim_length
: IntProperty(
231 soft_max
=1000, max=2500,
233 description
="Animation Length"
235 anim_f_fade
: IntProperty(
238 soft_max
=250, max=2500,
240 description
="Fade after this frames / Zero means no fade"
242 anim_delay
: IntProperty(
246 description
="Frames it takes a point to grow"
248 anim_tails
: BoolProperty(
249 name
='Tails on endpoints',
251 description
='Set radius to zero for open splines endpoints'
253 anim_keepr
: BoolProperty(
256 description
="Try to keep radius data from original curve"
258 animate
: BoolProperty(
259 name
="Animate Result",
261 description
="Animate the final curve objects"
263 # Convert to Curve options
264 convert_conti
: BoolProperty(
267 description
="Create a continuous curve using verts from mesh"
269 convert_everyedge
: BoolProperty(
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",
281 convert_joinbefore
: BoolProperty(
282 name
="Join objects before convert",
284 description
="Join all selected mesh to one object before converting to mesh"
286 # Mesh Follow Options
287 fol_edge_select
: BoolProperty(
290 description
="Grow from edges"
292 fol_vert_select
: BoolProperty(
295 description
="Grow from verts"
297 fol_face_select
: BoolProperty(
300 description
="Grow from faces"
302 fol_mesh_type
: EnumProperty(
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(
315 description
="Start frame for range to trace"
317 fol_end_frame
: IntProperty(
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,
327 description
="percentage of total verts to trace"
329 fol_sel_option
: EnumProperty(
330 name
="Selection type",
331 description
="Choose which objects to follow",
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",
341 default
=(0.0, 0.3, 0.6),
344 trace_mat_random
: BoolProperty(
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",
357 mat_run_color_blender
: BoolProperty(
358 name
="Run Color Blender",
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",
371 name
="Define a color palette"
373 # Custom property for how many keyframes to skip
378 description
="Number of frames between each keyframes"
380 # Custom property to enable/disable random order for the
381 mmBoolRandom
: BoolProperty(
384 description
="Randomize the order of the colors"
386 # Custom Color properties
387 mmColor1
: FloatVectorProperty(
389 default
=(0.8, 0.8, 0.8),
390 description
="Custom Color 1", subtype
="COLOR"
392 mmColor2
: FloatVectorProperty(
394 default
=(0.8, 0.8, 0.3),
395 description
="Custom Color 2",
398 mmColor3
: FloatVectorProperty(
400 default
=(0.8, 0.5, 0.6),
401 description
="Custom Color 3",
404 mmColor4
: FloatVectorProperty(
406 default
=(0.2, 0.8, 0.289),
407 description
="Custom Color 4",
410 mmColor5
: FloatVectorProperty(
412 default
=(1.0, 0.348, 0.8),
413 description
="Custom Color 5",
416 mmColor6
: FloatVectorProperty(
418 default
=(0.4, 0.67, 0.8),
419 description
="Custom Color 6",
422 mmColor7
: FloatVectorProperty(
424 default
=(0.66, 0.88, 0.8),
425 description
="Custom Color 7",
428 mmColor8
: FloatVectorProperty(
430 default
=(0.8, 0.38, 0.22),
431 description
="Custom Color 8",
434 # BW Color properties
435 bwColor1
: FloatVectorProperty(
437 default
=(0.0, 0.0, 0.0),
438 description
="Black/White Color 1",
441 bwColor2
: FloatVectorProperty(
443 default
=(1.0, 1.0, 1.0),
444 description
="Black/White Color 2",
447 # Bright Color properties
448 brightColor1
: FloatVectorProperty(
450 default
=(1.0, 0.0, 0.75),
451 description
="Bright Color 1",
454 brightColor2
: FloatVectorProperty(
456 default
=(0.0, 1.0, 1.0),
457 description
="Bright Color 2",
460 brightColor3
: FloatVectorProperty(
462 default
=(0.0, 1.0, 0.0),
463 description
="Bright Color 3",
466 brightColor4
: FloatVectorProperty(
468 default
=(1.0, 1.0, 0.0),
469 description
="Bright Color 4", subtype
="COLOR"
471 # Earth Color Properties
472 earthColor1
: FloatVectorProperty(
474 default
=(0.068, 0.019, 0.014),
475 description
="Earth Color 1",
478 earthColor2
: FloatVectorProperty(
480 default
=(0.089, 0.060, 0.047),
481 description
="Earth Color 2",
484 earthColor3
: FloatVectorProperty(
486 default
=(0.188, 0.168, 0.066),
487 description
="Earth Color 3",
490 earthColor4
: FloatVectorProperty(
492 default
=(0.445, 0.296, 0.065),
493 description
="Earth Color 4",
496 earthColor5
: FloatVectorProperty(
498 default
=(0.745, 0.332, 0.065),
499 description
="Earth Color 5",
502 # Green to Blue Color properties
503 greenblueColor1
: FloatVectorProperty(
505 default
=(0.296, 0.445, 0.074),
506 description
="Green/Blue Color 1",
509 greenblueColor2
: FloatVectorProperty(
511 default
=(0.651, 1.0, 0.223),
512 description
="Green/Blue Color 2",
515 greenblueColor3
: FloatVectorProperty(
517 default
=(0.037, 0.047, 0.084),
518 description
="Green/Blue Color 3",
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(
548 items
=btrace_menu_items
,