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 #####
20 from bpy
.types
import (
24 from bpy
.props
import (
33 # Class to define properties
34 class TracerProperties(PropertyGroup
):
35 """Options for tools"""
36 curve_spline
: EnumProperty(
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",
44 curve_handle
: EnumProperty(
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",
53 curve_resolution
: IntProperty(
54 name
="Bevel Resolution",
57 description
="Adjust the Bevel resolution"
59 curve_depth
: FloatProperty(
63 description
="Adjust the Bevel depth"
69 description
="Adjust the Surface resolution"
71 curve_join
: BoolProperty(
74 description
="Join all the curves after they have been created"
76 curve_smooth
: BoolProperty(
79 description
="Render curve smooth"
81 # Option to Duplicate Mesh
82 object_duplicate
: BoolProperty(
85 description
="Apply curve to a copy of object"
87 # Distort Mesh options
88 distort_modscale
: IntProperty(
89 name
="Modulation Scale",
92 description
="Add a scale to modulate the curve at random points, set to 0 to disable"
94 distort_noise
: FloatProperty(
98 description
="Adjust noise added to mesh before adding curve"
101 particle_step
: IntProperty(
105 description
="Sample one every this number of frames"
107 particle_auto
: BoolProperty(
108 name
="Auto Frame Range",
110 description
="Calculate Frame Range from particles life"
112 particle_f_start
: IntProperty(
116 description
='Start frame'
118 particle_f_end
: IntProperty(
122 description
="End frame"
124 # F-Curve Modifier Properties
125 fcnoise_rot
: BoolProperty(
128 description
="Affect Rotation"
130 fcnoise_loc
: BoolProperty(
133 description
="Affect Location"
135 fcnoise_scale
: BoolProperty(
138 description
="Affect Scale"
140 fcnoise_amp
: IntProperty(
144 description
="Adjust the amplitude"
146 fcnoise_timescale
: FloatProperty(
150 description
="Adjust the time scale"
152 fcnoise_key
: BoolProperty(
155 description
="Keyframe is needed for tool, this adds a LocRotScale keyframe"
157 show_curve_settings
: BoolProperty(
158 name
="Curve Settings",
160 description
="Change the curve settings for the created curve"
162 material_settings
: BoolProperty(
163 name
="Material Settings",
165 description
="Change the material settings for the created curve"
167 particle_settings
: BoolProperty(
168 name
="Particle Settings",
170 description
="Show the settings for the created curve"
172 animation_settings
: BoolProperty(
173 name
="Animation Settings",
175 description
="Show the settings for the Animations"
177 distort_curve
: BoolProperty(
178 name
="Add Distortion",
180 description
="Set options to distort the final curve"
182 connect_noise
: BoolProperty(
183 name
="F-Curve Noise",
185 description
="Adds F-Curve Noise Modifier to selected objects"
187 settings_objectTrace
: BoolProperty(
188 name
="Object Trace Settings",
190 description
="Trace selected mesh object with a curve"
192 settings_objectsConnect
: BoolProperty(
193 name
="Objects Connect Settings",
195 description
="Connect objects with a curve controlled by hooks"
197 settings_objectTrace
: BoolProperty(
198 name
="Object Trace Settings",
200 description
="Trace selected mesh object with a curve"
202 respect_order
: BoolProperty(
205 description
="Remember order objects were selected"
207 settings_particleTrace
: BoolProperty(
208 name
="Particle Trace Settings",
210 description
="Trace particle path with a curve"
212 settings_particleConnect
: BoolProperty(
213 name
="Particle Connect Settings",
215 description
="Connect particles with a curves and animated over particle lifetime"
217 settings_growCurve
: BoolProperty(
218 name
="Grow Curve Settings",
220 description
="Animate curve bevel over time by keyframing points radius"
222 settings_fcurve
: BoolProperty(
223 name
="F-Curve Settings",
225 description
="F-Curve Settings"
227 settings_toggle
: BoolProperty(
230 description
="Toggle Settings"
233 anim_auto
: BoolProperty(
234 name
="Auto Frame Range",
236 description
="Automatically calculate Frame Range"
238 anim_f_start
: IntProperty(
242 description
="Start frame / Hidden object"
244 anim_length
: IntProperty(
247 soft_max
=1000, max=2500,
249 description
="Animation Length"
251 anim_f_fade
: IntProperty(
254 soft_max
=250, max=2500,
256 description
="Fade after this frames / Zero means no fade"
258 anim_delay
: IntProperty(
262 description
="Frames it takes a point to grow"
264 anim_tails
: BoolProperty(
265 name
='Tails on endpoints',
267 description
='Set radius to zero for open splines endpoints'
269 anim_keepr
: BoolProperty(
272 description
="Try to keep radius data from original curve"
274 animate
: BoolProperty(
275 name
="Animate Result",
277 description
="Animate the final curve objects"
279 # Convert to Curve options
280 convert_conti
: BoolProperty(
283 description
="Create a continuous curve using verts from mesh"
285 convert_everyedge
: BoolProperty(
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",
297 convert_joinbefore
: BoolProperty(
298 name
="Join objects before convert",
300 description
="Join all selected mesh to one object before converting to mesh"
302 # Mesh Follow Options
303 fol_edge_select
: BoolProperty(
306 description
="Grow from edges"
308 fol_vert_select
: BoolProperty(
311 description
="Grow from verts"
313 fol_face_select
: BoolProperty(
316 description
="Grow from faces"
318 fol_mesh_type
: EnumProperty(
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(
331 description
="Start frame for range to trace"
333 fol_end_frame
: IntProperty(
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,
343 description
="percentage of total verts to trace"
345 fol_sel_option
: EnumProperty(
346 name
="Selection type",
347 description
="Choose which objects to follow",
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",
357 default
=(0.0, 0.3, 0.6),
360 trace_mat_random
: BoolProperty(
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",
373 mat_run_color_blender
: BoolProperty(
374 name
="Run Color Blender",
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",
387 name
="Define a color palette"
389 # Custom property for how many keyframes to skip
394 description
="Number of frames between each keyframes"
396 # Custom property to enable/disable random order for the
397 mmBoolRandom
: BoolProperty(
400 description
="Randomize the order of the colors"
402 # Custom Color properties
403 mmColor1
: FloatVectorProperty(
405 default
=(0.8, 0.8, 0.8),
406 description
="Custom Color 1", subtype
="COLOR"
408 mmColor2
: FloatVectorProperty(
410 default
=(0.8, 0.8, 0.3),
411 description
="Custom Color 2",
414 mmColor3
: FloatVectorProperty(
416 default
=(0.8, 0.5, 0.6),
417 description
="Custom Color 3",
420 mmColor4
: FloatVectorProperty(
422 default
=(0.2, 0.8, 0.289),
423 description
="Custom Color 4",
426 mmColor5
: FloatVectorProperty(
428 default
=(1.0, 0.348, 0.8),
429 description
="Custom Color 5",
432 mmColor6
: FloatVectorProperty(
434 default
=(0.4, 0.67, 0.8),
435 description
="Custom Color 6",
438 mmColor7
: FloatVectorProperty(
440 default
=(0.66, 0.88, 0.8),
441 description
="Custom Color 7",
444 mmColor8
: FloatVectorProperty(
446 default
=(0.8, 0.38, 0.22),
447 description
="Custom Color 8",
450 # BW Color properties
451 bwColor1
: FloatVectorProperty(
453 default
=(0.0, 0.0, 0.0),
454 description
="Black/White Color 1",
457 bwColor2
: FloatVectorProperty(
459 default
=(1.0, 1.0, 1.0),
460 description
="Black/White Color 2",
463 # Bright Color properties
464 brightColor1
: FloatVectorProperty(
466 default
=(1.0, 0.0, 0.75),
467 description
="Bright Color 1",
470 brightColor2
: FloatVectorProperty(
472 default
=(0.0, 1.0, 1.0),
473 description
="Bright Color 2",
476 brightColor3
: FloatVectorProperty(
478 default
=(0.0, 1.0, 0.0),
479 description
="Bright Color 3",
482 brightColor4
: FloatVectorProperty(
484 default
=(1.0, 1.0, 0.0),
485 description
="Bright Color 4", subtype
="COLOR"
487 # Earth Color Properties
488 earthColor1
: FloatVectorProperty(
490 default
=(0.068, 0.019, 0.014),
491 description
="Earth Color 1",
494 earthColor2
: FloatVectorProperty(
496 default
=(0.089, 0.060, 0.047),
497 description
="Earth Color 2",
500 earthColor3
: FloatVectorProperty(
502 default
=(0.188, 0.168, 0.066),
503 description
="Earth Color 3",
506 earthColor4
: FloatVectorProperty(
508 default
=(0.445, 0.296, 0.065),
509 description
="Earth Color 4",
512 earthColor5
: FloatVectorProperty(
514 default
=(0.745, 0.332, 0.065),
515 description
="Earth Color 5",
518 # Green to Blue Color properties
519 greenblueColor1
: FloatVectorProperty(
521 default
=(0.296, 0.445, 0.074),
522 description
="Green/Blue Color 1",
525 greenblueColor2
: FloatVectorProperty(
527 default
=(0.651, 1.0, 0.223),
528 description
="Green/Blue Color 2",
531 greenblueColor3
: FloatVectorProperty(
533 default
=(0.037, 0.047, 0.084),
534 description
="Green/Blue Color 3",
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(
564 items
=btrace_menu_items
,