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