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