Fix #105009: AnimAll: Error when inserting key on string attribute
[blender-addons.git] / ant_landscape / __init__.py
blob959333ea925877b5704697bfe4010242156bd9f3
1 # SPDX-FileCopyrightText: 2017-2022 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 # Another Noise Tool - Suite (W.I.P.)
6 # Jimmy Hazevoet 5/2017
8 bl_info = {
9 "name": "A.N.T.Landscape",
10 "author": "Jimmy Hazevoet",
11 "version": (0, 1, 8),
12 "blender": (2, 80, 0),
13 "location": "View3D > Sidebar > Create Tab",
14 "description": "Another Noise Tool: Landscape and Displace",
15 "warning": "",
16 "doc_url": "{BLENDER_MANUAL_URL}/addons/add_mesh/ant_landscape.html",
17 "category": "Add Mesh",
20 if "bpy" in locals():
21 import importlib
22 importlib.reload(add_mesh_ant_landscape)
23 importlib.reload(mesh_ant_displace)
24 importlib.reload(ant_functions)
25 importlib.reload(ant_noise)
26 else:
27 from ant_landscape import add_mesh_ant_landscape
28 from ant_landscape import mesh_ant_displace
29 from ant_landscape import ant_functions
30 from ant_landscape import ant_noise
32 import bpy
34 from bpy.props import (
35 BoolProperty,
36 FloatProperty,
37 IntProperty,
38 StringProperty,
39 PointerProperty,
40 EnumProperty,
42 from .ant_functions import (
43 draw_ant_refresh,
44 draw_ant_main,
45 draw_ant_noise,
46 draw_ant_displace,
49 # ------------------------------------------------------------
50 # Menu's and panels
53 def menu_func_eroder(self, context):
54 ob = bpy.context.active_object
55 if ob and (ob.ant_landscape.keys() and not ob.ant_landscape['sphere_mesh']):
56 self.layout.operator('mesh.eroder', text="Landscape Eroder", icon='SMOOTHCURVE')
59 def menu_func_landscape(self, context):
60 layout = self.layout
61 layout.separator()
62 self.layout.operator('mesh.landscape_add', text="Landscape", icon="RNDCURVE")
65 # Landscape Add Panel
66 class AntLandscapeAddPanel(bpy.types.Panel):
67 bl_category = "Create"
68 bl_label = "Landscape"
69 bl_idname = "ANTLANDSCAPE_PT_add"
70 bl_space_type = "VIEW_3D"
71 bl_region_type = "UI"
72 bl_context = "objectmode"
73 bl_options = {'DEFAULT_CLOSED'}
75 def draw(self, context):
76 col = self.layout.column()
77 col.operator('mesh.landscape_add', text="Landscape", icon="RNDCURVE")
80 # Landscape Tools:
81 class AntLandscapeToolsPanel(bpy.types.Panel):
82 bl_category = "Create"
83 bl_label = "Landscape Tools"
84 bl_idname = "ANTLANDSCAPE_PT_tools"
85 bl_space_type = "VIEW_3D"
86 bl_region_type = "UI"
87 bl_context = "objectmode"
88 bl_options = {'DEFAULT_CLOSED'}
90 @classmethod
91 def poll(cls, context):
92 ob = bpy.context.active_object
93 return (ob and ob.type == 'MESH')
95 def draw(self, context):
96 layout = self.layout
97 ob = context.active_object
98 col = layout.column()
99 col.operator('mesh.ant_displace', text="Mesh Displace", icon="RNDCURVE")
100 col.operator('mesh.ant_slope_map', icon='GROUP_VERTEX')
101 if ob.ant_landscape.keys() and not ob.ant_landscape['sphere_mesh']:
102 col.operator('mesh.eroder', text="Landscape Eroder", icon='SMOOTHCURVE')
105 # Landscape Main Settings
106 class AntMainSettingsPanel(bpy.types.Panel):
107 bl_category = "Create"
108 bl_label = "Landscape Main"
109 bl_idname = "ANTLANDSCAPE_PT_main"
110 bl_space_type = "VIEW_3D"
111 bl_region_type = "UI"
112 bl_options = {'DEFAULT_CLOSED'}
114 @classmethod
115 def poll(cls, context):
116 ob = bpy.context.active_object
117 return ob.ant_landscape.keys() if ob else False
119 def draw(self, context):
120 layout = self.layout
121 scene = context.scene
122 ob = bpy.context.active_object
123 ant = ob.ant_landscape
124 box = layout.box()
125 col = box.column(align=False)
126 col.scale_y = 1.5
127 col.operator('mesh.ant_landscape_regenerate', text="Regenerate", icon="LOOP_FORWARDS")
128 row = box.row(align=True)
129 split = row.split(align=True)
130 split.prop(ant, "smooth_mesh", toggle=True, text="Smooth", icon='SHADING_SOLID')
131 split.prop(ant, "tri_face", toggle=True, text="Triangulate", icon='MESH_DATA')
132 if ant.sphere_mesh:
133 split.prop(ant, "remove_double", toggle=True, text="Remove Doubles", icon='MESH_DATA')
134 box.prop(ant, "ant_terrain_name")
135 box.prop_search(ant, "land_material", bpy.data, "materials")
136 col = box.column(align=True)
137 col.prop(ant, "subdivision_x")
138 col.prop(ant, "subdivision_y")
139 col = box.column(align=True)
140 if ant.sphere_mesh:
141 col.prop(ant, "mesh_size")
142 else:
143 col.prop(ant, "mesh_size_x")
144 col.prop(ant, "mesh_size_y")
147 # Landscape Noise Settings
148 class AntNoiseSettingsPanel(bpy.types.Panel):
149 bl_category = "Create"
150 bl_label = "Landscape Noise"
151 bl_idname = "ANTLANDSCAPE_PT_noise"
152 bl_space_type = "VIEW_3D"
153 bl_region_type = "UI"
154 bl_options = {'DEFAULT_CLOSED'}
156 @classmethod
157 def poll(cls, context):
158 ob = bpy.context.active_object
159 return ob.ant_landscape.keys() if ob else False
161 def draw(self, context):
162 layout = self.layout
163 scene = context.scene
164 ob = bpy.context.active_object
165 ant = ob.ant_landscape
166 box = layout.box()
167 col = box.column(align=True)
168 col.scale_y = 1.5
169 if ant.sphere_mesh:
170 col.operator('mesh.ant_landscape_regenerate', text="Regenerate", icon="LOOP_FORWARDS")
171 else:
172 col.operator('mesh.ant_landscape_refresh', text="Refresh", icon="FILE_REFRESH")
174 box.prop(ant, "noise_type")
175 if ant.noise_type == "blender_texture":
176 box.prop_search(ant, "texture_block", bpy.data, "textures")
177 else:
178 box.prop(ant, "basis_type")
180 col = box.column(align=True)
181 col.prop(ant, "random_seed")
182 col = box.column(align=True)
183 col.prop(ant, "noise_offset_x")
184 col.prop(ant, "noise_offset_y")
185 if ant.sphere_mesh:
186 col.prop(ant, "noise_offset_z")
187 col.prop(ant, "noise_size_x")
188 col.prop(ant, "noise_size_y")
189 if ant.sphere_mesh:
190 col.prop(ant, "noise_size_z")
191 col = box.column(align=True)
192 col.prop(ant, "noise_size")
194 col = box.column(align=True)
195 if ant.noise_type == "multi_fractal":
196 col.prop(ant, "noise_depth")
197 col.prop(ant, "dimension")
198 col.prop(ant, "lacunarity")
199 elif ant.noise_type == "ridged_multi_fractal":
200 col.prop(ant, "noise_depth")
201 col.prop(ant, "dimension")
202 col.prop(ant, "lacunarity")
203 col.prop(ant, "offset")
204 col.prop(ant, "gain")
205 elif ant.noise_type == "hybrid_multi_fractal":
206 col.prop(ant, "noise_depth")
207 col.prop(ant, "dimension")
208 col.prop(ant, "lacunarity")
209 col.prop(ant, "offset")
210 col.prop(ant, "gain")
211 elif ant.noise_type == "hetero_terrain":
212 col.prop(ant, "noise_depth")
213 col.prop(ant, "dimension")
214 col.prop(ant, "lacunarity")
215 col.prop(ant, "offset")
216 elif ant.noise_type == "fractal":
217 col.prop(ant, "noise_depth")
218 col.prop(ant, "dimension")
219 col.prop(ant, "lacunarity")
220 elif ant.noise_type == "turbulence_vector":
221 col.prop(ant, "noise_depth")
222 col.prop(ant, "amplitude")
223 col.prop(ant, "frequency")
224 col.separator()
225 row = col.row(align=True)
226 row.prop(ant, "hard_noise", expand=True)
227 elif ant.noise_type == "variable_lacunarity":
228 box.prop(ant, "vl_basis_type")
229 box.prop(ant, "distortion")
230 elif ant.noise_type == "marble_noise":
231 box.prop(ant, "marble_shape")
232 box.prop(ant, "marble_bias")
233 box.prop(ant, "marble_sharp")
234 col = box.column(align=True)
235 col.prop(ant, "distortion")
236 col.prop(ant, "noise_depth")
237 col.separator()
238 row = col.row(align=True)
239 row.prop(ant, "hard_noise", expand=True)
240 elif ant.noise_type == "shattered_hterrain":
241 col.prop(ant, "noise_depth")
242 col.prop(ant, "dimension")
243 col.prop(ant, "lacunarity")
244 col.prop(ant, "offset")
245 col.prop(ant, "distortion")
246 elif ant.noise_type == "strata_hterrain":
247 col.prop(ant, "noise_depth")
248 col.prop(ant, "dimension")
249 col.prop(ant, "lacunarity")
250 col.prop(ant, "offset")
251 col.prop(ant, "distortion", text="Strata")
252 elif ant.noise_type == "ant_turbulence":
253 col.prop(ant, "noise_depth")
254 col.prop(ant, "amplitude")
255 col.prop(ant, "frequency")
256 col.prop(ant, "distortion")
257 col.separator()
258 row = col.row(align=True)
259 row.prop(ant, "hard_noise", expand=True)
260 elif ant.noise_type == "vl_noise_turbulence":
261 col.prop(ant, "noise_depth")
262 col.prop(ant, "amplitude")
263 col.prop(ant, "frequency")
264 col.prop(ant, "distortion")
265 col.separator()
266 box.prop(ant, "vl_basis_type")
267 col.separator()
268 row = col.row(align=True)
269 row.prop(ant, "hard_noise", expand=True)
270 elif ant.noise_type == "vl_hTerrain":
271 col.prop(ant, "noise_depth")
272 col.prop(ant, "dimension")
273 col.prop(ant, "lacunarity")
274 col.prop(ant, "offset")
275 col.prop(ant, "distortion")
276 col.separator()
277 box.prop(ant, "vl_basis_type")
278 elif ant.noise_type == "distorted_heteroTerrain":
279 col.prop(ant, "noise_depth")
280 col.prop(ant, "dimension")
281 col.prop(ant, "lacunarity")
282 col.prop(ant, "offset")
283 col.prop(ant, "distortion")
284 col.separator()
285 col.prop(ant, "vl_basis_type")
286 elif ant.noise_type == "double_multiFractal":
287 col.prop(ant, "noise_depth")
288 col.prop(ant, "dimension")
289 col.prop(ant, "lacunarity")
290 col.prop(ant, "offset")
291 col.prop(ant, "gain")
292 col.separator()
293 box.prop(ant, "vl_basis_type")
294 elif ant.noise_type == "rocks_noise":
295 col.prop(ant, "noise_depth")
296 col.prop(ant, "distortion")
297 col.separator()
298 row = col.row(align=True)
299 row.prop(ant, "hard_noise", expand=True)
300 elif ant.noise_type == "slick_rock":
301 col.prop(ant, "noise_depth")
302 col.prop(ant, "dimension")
303 col.prop(ant, "lacunarity")
304 col.prop(ant, "gain")
305 col.prop(ant, "offset")
306 col.prop(ant, "distortion")
307 col.separator()
308 box.prop(ant, "vl_basis_type")
309 elif ant.noise_type == "planet_noise":
310 col.prop(ant, "noise_depth")
311 col.separator()
312 row = col.row(align=True)
313 row.prop(ant, "hard_noise", expand=True)
315 # Effects mix
316 col = box.column(align=False)
317 box.prop(ant, "fx_type")
318 if ant.fx_type != "0":
319 if int(ant.fx_type) <= 12:
320 box.prop(ant, "fx_bias")
322 box.prop(ant, "fx_mix_mode")
323 col = box.column(align=True)
324 col.prop(ant, "fx_mixfactor")
326 col = box.column(align=True)
327 col.prop(ant, "fx_loc_x")
328 col.prop(ant, "fx_loc_y")
329 col.prop(ant, "fx_size")
331 col = box.column(align=True)
332 col.prop(ant, "fx_depth")
333 if ant.fx_depth != 0:
334 col.prop(ant, "fx_frequency")
335 col.prop(ant, "fx_amplitude")
336 col.prop(ant, "fx_turb")
338 col = box.column(align=True)
339 row = col.row(align=True).split(factor=0.92, align=True)
340 row.prop(ant, "fx_height")
341 row.prop(ant, "fx_invert", toggle=True, text="", icon='ARROW_LEFTRIGHT')
342 col.prop(ant, "fx_offset")
345 # Landscape Displace Settings
346 class AntDisplaceSettingsPanel(bpy.types.Panel):
347 bl_category = "Create"
348 bl_label = "Landscape Displace"
349 bl_idname = "ANTLANDSCAPE_PT_disp"
350 bl_space_type = "VIEW_3D"
351 bl_region_type = "UI"
352 bl_options = {'DEFAULT_CLOSED'}
354 @classmethod
355 def poll(cls, context):
356 ob = bpy.context.active_object
357 return ob.ant_landscape.keys() if ob else False
359 def draw(self, context):
360 layout = self.layout
361 scene = context.scene
362 ob = bpy.context.active_object
363 ant = ob.ant_landscape
364 box = layout.box()
365 col = box.column(align=True)
366 col.scale_y = 1.5
367 if ant.sphere_mesh:
368 col.operator('mesh.ant_landscape_regenerate', text="Regenerate", icon="LOOP_FORWARDS")
369 else:
370 col.operator('mesh.ant_landscape_refresh', text="Refresh", icon="FILE_REFRESH")
372 col = box.column(align=True)
373 row = col.row(align=True).split(factor=0.92, align=True)
374 row.prop(ant, "height")
375 row.prop(ant, "height_invert", toggle=True, text="", icon='ARROW_LEFTRIGHT')
376 col.prop(ant, "height_offset")
377 col.prop(ant, "maximum")
378 col.prop(ant, "minimum")
379 if not ant.sphere_mesh:
380 col = box.column()
381 col.prop(ant, "edge_falloff")
382 if ant.edge_falloff != "0":
383 col = box.column(align=True)
384 col.prop(ant, "edge_level")
385 if ant.edge_falloff in ["2", "3"]:
386 col.prop(ant, "falloff_x")
387 if ant.edge_falloff in ["1", "3"]:
388 col.prop(ant, "falloff_y")
390 col = box.column()
391 col.prop(ant, "strata_type")
392 if ant.strata_type != "0":
393 col = box.column()
394 col.prop(ant, "strata")
395 col = box.column()
396 col.prop_search(ant, "vert_group", ob, "vertex_groups")
399 # ------------------------------------------------------------
400 # Properties group
401 class AntLandscapePropertiesGroup(bpy.types.PropertyGroup):
403 ant_terrain_name: StringProperty(
404 name="Name",
405 default="Landscape"
407 land_material: StringProperty(
408 name='Material',
409 default="",
410 description="Terrain material"
412 water_material: StringProperty(
413 name='Material',
414 default="",
415 description="Water plane material"
417 texture_block: StringProperty(
418 name="Texture",
419 default=""
421 at_cursor: BoolProperty(
422 name="Cursor",
423 default=True,
424 description="Place at cursor location",
426 smooth_mesh: BoolProperty(
427 name="Smooth",
428 default=True,
429 description="Shade smooth"
431 tri_face: BoolProperty(
432 name="Triangulate",
433 default=False,
434 description="Triangulate faces"
436 sphere_mesh: BoolProperty(
437 name="Sphere",
438 default=False,
439 description="Generate uv sphere - remove doubles when ready"
441 subdivision_x: IntProperty(
442 name="Subdivisions X",
443 default=128,
444 min=4,
445 max=6400,
446 description="Mesh X subdivisions"
448 subdivision_y: IntProperty(
449 default=128,
450 name="Subdivisions Y",
451 min=4,
452 max=6400,
453 description="Mesh Y subdivisions"
455 mesh_size: FloatProperty(
456 default=2.0,
457 name="Mesh Size",
458 min=0.01,
459 max=100000.0,
460 description="Mesh size"
462 mesh_size_x: FloatProperty(
463 default=2.0,
464 name="Mesh Size X",
465 min=0.01,
466 description="Mesh x size"
468 mesh_size_y: FloatProperty(
469 name="Mesh Size Y",
470 default=2.0,
471 min=0.01,
472 description="Mesh y size"
475 random_seed: IntProperty(
476 name="Random Seed",
477 default=0,
478 min=0,
479 description="Randomize noise origin"
481 noise_offset_x: FloatProperty(
482 name="Offset X",
483 default=0.0,
484 description="Noise X Offset"
486 noise_offset_y: FloatProperty(
487 name="Offset Y",
488 default=0.0,
489 description="Noise Y Offset"
491 noise_offset_z: FloatProperty(
492 name="Offset Z",
493 default=0.0,
494 description="Noise Z Offset"
496 noise_size_x: FloatProperty(
497 default=1.0,
498 name="Size X",
499 min=0.01,
500 max=1000.0,
501 description="Noise x size"
503 noise_size_y: FloatProperty(
504 name="Size Y",
505 default=1.0,
506 min=0.01,
507 max=1000.0,
508 description="Noise y size"
510 noise_size_z: FloatProperty(
511 name="Size Z",
512 default=1.0,
513 min=0.01,
514 max=1000.0,
515 description="Noise Z size"
517 noise_size: FloatProperty(
518 name="Noise Size",
519 default=1.0,
520 min=0.01,
521 max=1000.0,
522 description="Noise size"
524 noise_type: EnumProperty(
525 name="Noise Type",
526 default='hetero_terrain',
527 description="Noise type",
528 items=[
529 ('multi_fractal', "Multi Fractal", "Blender: Multi Fractal algorithm", 0),
530 ('ridged_multi_fractal', "Ridged MFractal", "Blender: Ridged Multi Fractal", 1),
531 ('hybrid_multi_fractal', "Hybrid MFractal", "Blender: Hybrid Multi Fractal", 2),
532 ('hetero_terrain', "Hetero Terrain", "Blender: Hetero Terrain", 3),
533 ('fractal', "fBm Fractal", "Blender: fBm - Fractional Browninian motion", 4),
534 ('turbulence_vector', "Turbulence", "Blender: Turbulence Vector", 5),
535 ('variable_lacunarity', "Distorted Noise", "Blender: Distorted Noise", 6),
536 ('marble_noise', "Marble", "A.N.T.: Marble Noise", 7),
537 ('shattered_hterrain', "Shattered hTerrain", "A.N.T.: Shattered hTerrain", 8),
538 ('strata_hterrain', "Strata hTerrain", "A.N.T: Strata hTerrain", 9),
539 ('ant_turbulence', "Another Noise", "A.N.T: Turbulence variation", 10),
540 ('vl_noise_turbulence', "vlNoise turbulence", "A.N.T: Real vlNoise turbulence", 11),
541 ('vl_hTerrain', "vlNoise hTerrain", "A.N.T: vlNoise hTerrain", 12),
542 ('distorted_heteroTerrain', "Distorted hTerrain", "A.N.T distorted hTerrain", 13),
543 ('double_multiFractal', "Double MultiFractal", "A.N.T: double multiFractal", 14),
544 ('rocks_noise', "Noise Rocks", "A.N.T: turbulence variation", 15),
545 ('slick_rock', "Slick Rock", "A.N.T: slick rock", 16),
546 ('planet_noise', "Planet Noise", "Planet Noise by: Farsthary", 17),
547 ('blender_texture', "Blender Texture - Texture Nodes", "Blender texture data block", 18)]
549 basis_type: EnumProperty(
550 name="Noise Basis",
551 default=ant_noise.noise_basis_default,
552 description="Noise basis algorithms",
553 items=ant_noise.noise_basis
555 vl_basis_type: EnumProperty(
556 name="vlNoise Basis",
557 default=ant_noise.noise_basis_default,
558 description="VLNoise basis algorithms",
559 items=ant_noise.noise_basis
561 distortion: FloatProperty(
562 name="Distortion",
563 default=1.0,
564 min=0.01,
565 max=100.0,
566 description="Distortion amount"
568 hard_noise: EnumProperty(
569 name="Soft Hard",
570 default="0",
571 description="Soft Noise, Hard noise",
572 items=[
573 ("0", "Soft", "Soft Noise", 0),
574 ("1", "Hard", "Hard noise", 1)]
576 noise_depth: IntProperty(
577 name="Depth",
578 default=8,
579 min=0,
580 max=16,
581 description="Noise Depth - number of frequencies in the fBm"
583 amplitude: FloatProperty(
584 name="Amp",
585 default=0.5,
586 min=0.01,
587 max=1.0,
588 description="Amplitude"
590 frequency: FloatProperty(
591 name="Freq",
592 default=2.0,
593 min=0.01,
594 max=5.0,
595 description="Frequency"
597 dimension: FloatProperty(
598 name="Dimension",
599 default=1.0,
600 min=0.01,
601 max=2.0,
602 description="H - fractal dimension of the roughest areas"
604 lacunarity: FloatProperty(
605 name="Lacunarity",
606 min=0.01,
607 max=6.0,
608 default=2.0,
609 description="Lacunarity - gap between successive frequencies"
611 offset: FloatProperty(
612 name="Offset",
613 default=1.0,
614 min=0.01,
615 max=6.0,
616 description="Offset - raises the terrain from sea level"
618 gain: FloatProperty(
619 name="Gain",
620 default=1.0,
621 min=0.01,
622 max=6.0,
623 description="Gain - scale factor"
625 marble_bias: EnumProperty(
626 name="Bias",
627 default="0",
628 description="Marble bias",
629 items=[
630 ("0", "Sin", "Sin", 0),
631 ("1", "Cos", "Cos", 1),
632 ("2", "Tri", "Tri", 2),
633 ("3", "Saw", "Saw", 3)]
635 marble_sharp: EnumProperty(
636 name="Sharp",
637 default="0",
638 description="Marble sharpness",
639 items=[
640 ("0", "Soft", "Soft", 0),
641 ("1", "Sharp", "Sharp", 1),
642 ("2", "Sharper", "Sharper", 2),
643 ("3", "Soft inv.", "Soft", 3),
644 ("4", "Sharp inv.", "Sharp", 4),
645 ("5", "Sharper inv.", "Sharper", 5)]
647 marble_shape: EnumProperty(
648 name="Shape",
649 default="0",
650 description="Marble shape",
651 items=[
652 ("0", "Default", "Default", 0),
653 ("1", "Ring", "Ring", 1),
654 ("2", "Swirl", "Swirl", 2),
655 ("3", "Bump", "Bump", 3),
656 ("4", "Wave", "Wave", 4),
657 ("5", "Z", "Z", 5),
658 ("6", "Y", "Y", 6),
659 ("7", "X", "X", 7)]
661 height: FloatProperty(
662 name="Height",
663 default=0.5,
664 min=-10000.0,
665 max=10000.0,
666 description="Noise intensity scale"
668 height_invert: BoolProperty(
669 name="Invert",
670 default=False,
671 description="Height invert",
673 height_offset: FloatProperty(
674 name="Offset",
675 default=0.0,
676 min=-10000.0,
677 max=10000.0,
678 description="Height offset"
680 fx_mixfactor: FloatProperty(
681 name="Mix Factor",
682 default=0.0,
683 min=-1.0,
684 max=1.0,
685 description="Effect mix factor: -1.0 = Noise, +1.0 = Effect"
687 fx_mix_mode: EnumProperty(
688 name="Effect Mix",
689 default="0",
690 description="Effect mix mode",
691 items=[
692 ("0", "Mix", "Mix", 0),
693 ("1", "Add", "Add", 1),
694 ("2", "Sub", "Subtract", 2),
695 ("3", "Mul", "Multiply", 3),
696 ("4", "Abs", "Absolute", 4),
697 ("5", "Scr", "Screen", 5),
698 ("6", "Mod", "Modulo", 6),
699 ("7", "Min", "Minimum", 7),
700 ("8", "Max", "Maximum", 8)
703 fx_type: EnumProperty(
704 name="Effect Type",
705 default="0",
706 description="Effect type",
707 items=[
708 ("0", "None", "No effect", 0),
709 ("1", "Gradient", "Gradient", 1),
710 ("2", "Waves", "Waves - Bumps", 2),
711 ("3", "Zigzag", "Zigzag", 3),
712 ("4", "Wavy", "Wavy", 4),
713 ("5", "Bump", "Bump", 5),
714 ("6", "Dots", "Dots", 6),
715 ("7", "Rings", "Rings", 7),
716 ("8", "Spiral", "Spiral", 8),
717 ("9", "Square", "Square", 9),
718 ("10", "Blocks", "Blocks", 10),
719 ("11", "Grid", "Grid", 11),
720 ("12", "Tech", "Tech", 12),
721 ("13", "Crackle", "Crackle", 13),
722 ("14", "Cracks", "Cracks", 14),
723 ("15", "Rock", "Rock noise", 15),
724 ("16", "Lunar", "Craters", 16),
725 ("17", "Cosine", "Cosine", 17),
726 ("18", "Spikey", "Spikey", 18),
727 ("19", "Stone", "Stone", 19),
728 ("20", "Flat Turb", "Flat turbulence", 20),
729 ("21", "Flat Voronoi", "Flat voronoi", 21)
732 fx_bias: EnumProperty(
733 name="Effect Bias",
734 default="0",
735 description="Effect bias type",
736 items=[
737 ("0", "Sin", "Sin", 0),
738 ("1", "Cos", "Cos", 1),
739 ("2", "Tri", "Tri", 2),
740 ("3", "Saw", "Saw", 3),
741 ("4", "None", "None", 4)]
743 fx_turb: FloatProperty(
744 name="Distortion",
745 default=0.0,
746 min=0.0,
747 max=1000.0,
748 description="Effect turbulence distortion"
750 fx_depth: IntProperty(
751 name="Depth",
752 default=0,
753 min=0,
754 max=16,
755 description="Effect depth - number of frequencies"
757 fx_amplitude: FloatProperty(
758 name="Amp",
759 default=0.5,
760 min=0.01,
761 max=1.0,
762 description="Amplitude"
764 fx_frequency: FloatProperty(
765 name="Freq",
766 default=2.0,
767 min=0.01,
768 max=5.0,
769 description="Frequency"
771 fx_size: FloatProperty(
772 name="Effect Size",
773 default=1.0,
774 min=0.01,
775 max=1000.0,
776 description="Effect size"
778 fx_loc_x: FloatProperty(
779 name="Offset X",
780 default=0.0,
781 description="Effect x offset"
783 fx_loc_y: FloatProperty(
784 name="Offset Y",
785 default=0.0,
786 description="Effect y offset"
788 fx_height: FloatProperty(
789 name="Intensity",
790 default=1.0,
791 min=-1000.0,
792 max=1000.0,
793 description="Effect intensity scale"
795 fx_invert: BoolProperty(
796 name="Invert",
797 default=False,
798 description="Effect invert"
800 fx_offset: FloatProperty(
801 name="Offset",
802 default=0.0,
803 min=-1000.0,
804 max=1000.0,
805 description="Effect height offset"
808 edge_falloff: EnumProperty(
809 name="Falloff",
810 default="3",
811 description="Flatten edges",
812 items=[
813 ("0", "None", "None", 0),
814 ("1", "Y", "Y Falloff", 1),
815 ("2", "X", "X Falloff", 2),
816 ("3", "X Y", "X Y Falloff", 3)]
818 falloff_x: FloatProperty(
819 name="Falloff X",
820 default=4.0,
821 min=0.1,
822 max=100.0,
823 description="Falloff x scale"
825 falloff_y: FloatProperty(
826 name="Falloff Y",
827 default=4.0,
828 min=0.1,
829 max=100.0,
830 description="Falloff y scale"
832 edge_level: FloatProperty(
833 name="Edge Level",
834 default=0.0,
835 min=-10000.0,
836 max=10000.0,
837 description="Edge level, sealevel offset"
839 maximum: FloatProperty(
840 name="Maximum",
841 default=1.0,
842 min=-10000.0,
843 max=10000.0,
844 description="Maximum, flattens terrain at plateau level"
846 minimum: FloatProperty(
847 name="Minimum",
848 default=-1.0,
849 min=-10000.0,
850 max=10000.0,
851 description="Minimum, flattens terrain at seabed level"
853 vert_group: StringProperty(
854 name="Vertex Group",
855 default=""
857 strata: FloatProperty(
858 name="Amount",
859 default=5.0,
860 min=0.01,
861 max=1000.0,
862 description="Strata layers / terraces"
864 strata_type: EnumProperty(
865 name="Strata",
866 default="0",
867 description="Strata types",
868 items=[
869 ("0", "None", "No strata", 0),
870 ("1", "Smooth", "Smooth transitions", 1),
871 ("2", "Sharp Sub", "Sharp subtract transitions", 2),
872 ("3", "Sharp Add", "Sharp add transitions", 3),
873 ("4", "Quantize", "Quantize", 4),
874 ("5", "Quantize Mix", "Quantize mixed", 5)]
876 water_plane: BoolProperty(
877 name="Water Plane",
878 default=False,
879 description="Add water plane"
881 water_level: FloatProperty(
882 name="Level",
883 default=0.01,
884 min=-10000.0,
885 max=10000.0,
886 description="Water level"
888 remove_double: BoolProperty(
889 name="Remove Doubles",
890 default=False,
891 description="Remove doubles"
893 refresh: BoolProperty(
894 name="Refresh",
895 default=False,
896 description="Refresh"
898 auto_refresh: BoolProperty(
899 name="Auto",
900 default=True,
901 description="Automatic refresh"
904 # ------------------------------------------------------------
905 # Register:
908 classes = (
909 AntLandscapeAddPanel,
910 AntLandscapeToolsPanel,
911 AntMainSettingsPanel,
912 AntNoiseSettingsPanel,
913 AntDisplaceSettingsPanel,
914 AntLandscapePropertiesGroup,
915 add_mesh_ant_landscape.AntAddLandscape,
916 mesh_ant_displace.AntMeshDisplace,
917 ant_functions.AntLandscapeRefresh,
918 ant_functions.AntLandscapeRegenerate,
919 ant_functions.AntVgSlopeMap,
920 ant_functions.Eroder,
924 def register():
925 for cls in classes:
926 bpy.utils.register_class(cls)
928 bpy.types.VIEW3D_MT_mesh_add.append(menu_func_landscape)
929 bpy.types.Object.ant_landscape = PointerProperty(
930 type=AntLandscapePropertiesGroup,
931 name="ANT_Landscape",
932 description="Landscape properties")
933 bpy.types.VIEW3D_MT_paint_weight.append(menu_func_eroder)
936 def unregister():
937 for cls in reversed(classes):
938 bpy.utils.unregister_class(cls)
939 bpy.types.VIEW3D_MT_mesh_add.remove(menu_func_landscape)
940 bpy.types.VIEW3D_MT_paint_weight.remove(menu_func_eroder)
943 if __name__ == "__main__":
944 register()