Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmy Hazevoet <jimhazevoet@gmail.com>2017-06-14 09:54:07 +0300
committermeta-androcto <meta.androcto1@gmail.com>2017-06-14 09:54:07 +0300
commitfcab90a6a0042b29ec9ffcb5e2ece224ea78e1c1 (patch)
tree510ba6afb05a80832aaf02735eb1511c58f02d09
parent16dbda9caabd065a1eb5b0e6af0e3596fe313442 (diff)
ANT landscape: complete update, folder system
-rw-r--r--ant_landscape/__init__.py757
-rw-r--r--ant_landscape/add_mesh_ant_landscape.py668
-rw-r--r--ant_landscape/ant_functions.py930
-rw-r--r--ant_landscape/ant_landscape_refresh.py243
-rw-r--r--ant_landscape/mesh_ant_displace.py562
-rw-r--r--mesh_tissue/lattice.py421
-rw-r--r--presets/operator/mesh.landscape_add/abstract.py39
-rw-r--r--presets/operator/mesh.landscape_add/canion.py37
-rw-r--r--presets/operator/mesh.landscape_add/cauliflower_hills.py43
-rw-r--r--presets/operator/mesh.landscape_add/cristaline.py39
-rw-r--r--presets/operator/mesh.landscape_add/default.py39
-rw-r--r--presets/operator/mesh.landscape_add/default_large.py37
-rw-r--r--presets/operator/mesh.landscape_add/flatstone.py37
-rw-r--r--presets/operator/mesh.landscape_add/land_and_water.py54
-rw-r--r--presets/operator/mesh.landscape_add/mountain.py43
-rw-r--r--presets/operator/mesh.landscape_add/planet_noise.py39
-rw-r--r--presets/operator/mesh.landscape_add/plateau.py61
-rw-r--r--presets/operator/mesh.landscape_add/slick_rock.py59
-rw-r--r--presets/operator/mesh.landscape_add/smooth_terrain.py37
-rw-r--r--presets/operator/mesh.landscape_add/techno_grid.py41
-rw-r--r--presets/operator/mesh.landscape_add/terrain_large.py41
-rw-r--r--presets/operator/mesh.landscape_add/vlnoise_turbulence.py59
-rw-r--r--presets/operator/mesh.landscape_add/voronoi_hills.py45
-rw-r--r--presets/operator/mesh.landscape_add/vulcano.py39
24 files changed, 4045 insertions, 325 deletions
diff --git a/ant_landscape/__init__.py b/ant_landscape/__init__.py
new file mode 100644
index 00000000..02f66ec4
--- /dev/null
+++ b/ant_landscape/__init__.py
@@ -0,0 +1,757 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# Another Noise Tool - Suite
+# Jim Hazevoet 5/2017
+
+bl_info = {
+ "name": "A.N.T.Landscape",
+ "author": "Jim Hazevoet",
+ "version": (0, 1, 6),
+ "blender": (2, 77, 0),
+ "location": "View3D > Tool Shelf",
+ "description": "Another Noise Tool: Landscape and Displace",
+ "warning": "",
+ "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
+ "Scripts/Add_Mesh/ANT_Landscape",
+ "category": "Add Mesh",
+}
+
+if "bpy" in locals():
+ import importlib
+ importlib.reload(add_mesh_ant_landscape)
+ importlib.reload(ant_landscape_refresh)
+ importlib.reload(mesh_ant_displace)
+ importlib.reload(ant_functions)
+else:
+ from ant_landscape import add_mesh_ant_landscape
+ from ant_landscape import ant_landscape_refresh
+ from ant_landscape import mesh_ant_displace
+ from ant_landscape import ant_functions
+
+import bpy
+
+from bpy.props import (
+ BoolProperty,
+ FloatProperty,
+ IntProperty,
+ StringProperty,
+ PointerProperty,
+ EnumProperty,
+ )
+'''
+from .ant_functions import (
+ draw_ant_refresh,
+ draw_ant_main,
+ draw_ant_noise,
+ draw_ant_displace,
+ )
+'''
+
+# ------------------------------------------------------------
+# Menu and panels
+
+# Define "Landscape" menu
+def menu_func_landscape(self, context):
+ self.layout.operator('mesh.landscape_add', text="Landscape", icon="RNDCURVE")
+
+
+# Landscape Add Panel
+class panel_func_add_landscape(bpy.types.Panel):
+ bl_space_type = "VIEW_3D"
+ bl_context = "objectmode"
+ bl_region_type = "TOOLS"
+ bl_label = "ANT Landscape"
+ bl_category = "Create"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def draw(self, context):
+ col = self.layout.column()
+ col.operator('mesh.landscape_add', text="Landscape", icon="RNDCURVE")
+
+
+# Landscape Tools:
+class AntLandscapeToolsPanel(bpy.types.Panel):
+ bl_space_type = "VIEW_3D"
+ bl_context = "objectmode"
+ bl_region_type = "TOOLS"
+ bl_label = "ANT Displace/Slopemap"
+ bl_category = "Tools"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def draw(self, context):
+ layout = self.layout
+ ob = context.active_object
+ if ob and ob.type == 'MESH':
+ box = layout.box()
+ col = box.column()
+ col.label("Mesh:")
+ col.operator('mesh.ant_displace', text="Displace", icon="RNDCURVE")
+ col = box.column()
+ col.operator('mesh.ant_slope_map', icon='GROUP_VERTEX')
+ else:
+ box = layout.box()
+ col = box.column()
+ col.label("Select a Mesh Object")
+
+
+# Landscape Settings:
+class AntLandscapeSettingsPanel(bpy.types.Panel):
+ bl_space_type = "VIEW_3D"
+ bl_context = "objectmode"
+ bl_region_type = "TOOLS"
+ bl_category = "Create"
+ bl_options = {'DEFAULT_CLOSED'}
+ bl_label = "ANT Landscape Settings"
+ # bl_space_type = 'PROPERTIES'
+ # bl_region_type = 'WINDOW'
+ # bl_context = "world"
+
+ def draw(self, context):
+ layout = self.layout
+ scene = context.scene
+ ob = bpy.context.active_object
+
+ if ob and ob.ant_landscape.keys():
+ ant = ob.ant_landscape
+ box = layout.box()
+ split = box.column().row().split()
+ split.scale_y = 1.5
+ split.operator('mesh.ant_landscape_regenerate', text="", icon="LOOP_FORWARDS")
+ split.operator('mesh.ant_landscape_refresh', text="", icon="FILE_REFRESH")
+
+ box = layout.box()
+ box.prop(ant, "show_main_settings", toggle=True)
+ if ant.show_main_settings:
+ #row = box.row(align=True)
+ #split = row.split(align=True)
+ #split.prop(ant, "at_cursor", toggle=True, icon_only=True, icon='CURSOR')
+ #split.prop(ant, "smooth_mesh", toggle=True, icon_only=True, icon='SOLID')
+ #split.prop(ant, "sphere_mesh", toggle=True)
+ #split.prop(ant, "tri_face", toggle=True, icon_only=True, icon='MESH_DATA')
+ #box.prop(ant, "ant_terrain_name")
+ #box.prop_search(ant, "land_material", bpy.data, "materials")
+ col = box.column(align=True)
+ col.prop(ant, "subdivision_x")
+ col.prop(ant, "subdivision_y")
+ col = box.column(align=True)
+ if ant.sphere_mesh:
+ col.prop(ant, "mesh_size")
+ else:
+ col.prop(ant, "mesh_size_x")
+ col.prop(ant, "mesh_size_y")
+
+ box = layout.box()
+ box.prop(ant, "show_noise_settings", toggle=True)
+ if ant.show_noise_settings:
+ box.prop(ant, "noise_type")
+ if ant.noise_type == "blender_texture":
+ box.prop_search(ant, "texture_block", bpy.data, "textures")
+ else:
+ box.prop(ant, "basis_type")
+
+ col = box.column(align=True)
+ col.prop(ant, "random_seed")
+ col = box.column(align=True)
+ col.prop(ant, "noise_offset_x")
+ col.prop(ant, "noise_offset_y")
+ col.prop(ant, "noise_offset_z")
+ col.prop(ant, "noise_size_x")
+ col.prop(ant, "noise_size_y")
+ col.prop(ant, "noise_size_z")
+ col = box.column(align=True)
+ col.prop(ant, "noise_size")
+
+ col = box.column(align=True)
+ if ant.noise_type == "multi_fractal":
+ col.prop(ant, "noise_depth")
+ col.prop(ant, "dimension")
+ col.prop(ant, "lacunarity")
+ elif ant.noise_type == "ridged_multi_fractal":
+ col.prop(ant, "noise_depth")
+ col.prop(ant, "dimension")
+ col.prop(ant, "lacunarity")
+ col.prop(ant, "offset")
+ col.prop(ant, "gain")
+ elif ant.noise_type == "hybrid_multi_fractal":
+ col.prop(ant, "noise_depth")
+ col.prop(ant, "dimension")
+ col.prop(ant, "lacunarity")
+ col.prop(ant, "offset")
+ col.prop(ant, "gain")
+ elif ant.noise_type == "hetero_terrain":
+ col.prop(ant, "noise_depth")
+ col.prop(ant, "dimension")
+ col.prop(ant, "lacunarity")
+ col.prop(ant, "offset")
+ elif ant.noise_type == "fractal":
+ col.prop(ant, "noise_depth")
+ col.prop(ant, "dimension")
+ col.prop(ant, "lacunarity")
+ elif ant.noise_type == "turbulence_vector":
+ col.prop(ant, "noise_depth")
+ col.prop(ant, "amplitude")
+ col.prop(ant, "frequency")
+ col.separator()
+ row = col.row(align=True)
+ row.prop(ant, "hard_noise", expand=True)
+ elif ant.noise_type == "variable_lacunarity":
+ box.prop(ant, "vl_basis_type")
+ box.prop(ant, "distortion")
+ elif ant.noise_type == "marble_noise":
+ box.prop(ant, "marble_shape")
+ box.prop(ant, "marble_bias")
+ box.prop(ant, "marble_sharp")
+ col = box.column(align=True)
+ col.prop(ant, "distortion")
+ col.prop(ant, "noise_depth")
+ col.separator()
+ row = col.row(align=True)
+ row.prop(ant, "hard_noise", expand=True)
+ elif ant.noise_type == "shattered_hterrain":
+ col.prop(ant, "noise_depth")
+ col.prop(ant, "dimension")
+ col.prop(ant, "lacunarity")
+ col.prop(ant, "offset")
+ col.prop(ant, "distortion")
+ elif ant.noise_type == "strata_hterrain":
+ col.prop(ant, "noise_depth")
+ col.prop(ant, "dimension")
+ col.prop(ant, "lacunarity")
+ col.prop(ant, "offset")
+ col.prop(ant, "distortion", text="Strata")
+ elif ant.noise_type == "ant_turbulence":
+ col.prop(ant, "noise_depth")
+ col.prop(ant, "amplitude")
+ col.prop(ant, "frequency")
+ col.prop(ant, "distortion")
+ col.separator()
+ row = col.row(align=True)
+ row.prop(ant, "hard_noise", expand=True)
+ elif ant.noise_type == "vl_noise_turbulence":
+ col.prop(ant, "noise_depth")
+ col.prop(ant, "amplitude")
+ col.prop(ant, "frequency")
+ col.prop(ant, "distortion")
+ col.separator()
+ col.prop(ant, "vl_basis_type")
+ col.separator()
+ row = col.row(align=True)
+ row.prop(ant, "hard_noise", expand=True)
+ elif ant.noise_type == "vl_hTerrain":
+ col.prop(ant, "noise_depth")
+ col.prop(ant, "dimension")
+ col.prop(ant, "lacunarity")
+ col.prop(ant, "offset")
+ col.prop(ant, "distortion")
+ col.separator()
+ col.prop(ant, "vl_basis_type")
+ elif ant.noise_type == "distorted_heteroTerrain":
+ col.prop(ant, "noise_depth")
+ col.prop(ant, "dimension")
+ col.prop(ant, "lacunarity")
+ col.prop(ant, "offset")
+ col.prop(ant, "distortion")
+ col.separator()
+ col.prop(ant, "vl_basis_type")
+ elif ant.noise_type == "double_multiFractal":
+ col.prop(ant, "noise_depth")
+ col.prop(ant, "dimension")
+ col.prop(ant, "lacunarity")
+ col.prop(ant, "offset")
+ col.prop(ant, "gain")
+ col.separator()
+ col.prop(ant, "vl_basis_type")
+ elif ant.noise_type == "slick_rock":
+ col.prop(ant, "noise_depth")
+ col.prop(ant, "dimension")
+ col.prop(ant, "lacunarity")
+ col.prop(ant, "gain")
+ col.prop(ant, "offset")
+ col.prop(ant, "distortion")
+ col.separator()
+ col.prop(ant, "vl_basis_type")
+ elif ant.noise_type == "planet_noise":
+ col.prop(ant, "noise_depth")
+ col.separator()
+ row = col.row(align=True)
+ row.prop(ant, "hard_noise", expand=True)
+
+ box = layout.box()
+ box.prop(ant, "show_displace_settings", toggle=True)
+ if ant.show_displace_settings:
+ col = box.column(align=True)
+ row = col.row(align=True).split(0.92, align=True)
+ row.prop(ant, "height")
+ row.prop(ant, "height_invert", toggle=True, text="", icon='ARROW_LEFTRIGHT')
+ col.prop(ant, "height_offset")
+ col.prop(ant, "maximum")
+ col.prop(ant, "minimum")
+
+ if not ant.sphere_mesh:
+ col = box.column()
+ col.prop(ant, "edge_falloff")
+ if ant.edge_falloff is not "0":
+ col = box.column(align=True)
+ col.prop(ant, "edge_level")
+ if ant.edge_falloff in ["2", "3"]:
+ col.prop(ant, "falloff_x")
+ if ant.edge_falloff in ["1", "3"]:
+ col.prop(ant, "falloff_y")
+
+ col = box.column()
+ col.prop(ant, "strata_type")
+ if ant.strata_type is not "0":
+ col = box.column()
+ col.prop(ant, "strata")
+
+ else:
+ box = layout.box()
+ col = box.column()
+ col.label("Select a Landscape Object")
+
+
+# ------------------------------------------------------------
+# Properties group
+class AntLandscapePropertiesGroup(bpy.types.PropertyGroup):
+
+ ant_terrain_name = StringProperty(
+ name="Name",
+ default="Landscape"
+ )
+ land_material = StringProperty(
+ name='Material',
+ default="",
+ description="Terrain material"
+ )
+ water_material = StringProperty(
+ name='Material',
+ default="",
+ description="Water plane material"
+ )
+ texture_block = StringProperty(
+ name="Texture",
+ default=""
+ )
+ at_cursor = BoolProperty(
+ name="Cursor",
+ default=True,
+ description="Place at cursor location",
+ )
+ smooth_mesh = BoolProperty(
+ name="Smooth",
+ default=True,
+ description="Shade smooth"
+ )
+ tri_face = BoolProperty(
+ name="Triangulate",
+ default=False,
+ description="Triangulate faces"
+ )
+ sphere_mesh = BoolProperty(
+ name="Sphere",
+ default=False,
+ description="Generate uv sphere - remove doubles when ready"
+ )
+ subdivision_x = IntProperty(
+ name="Subdivisions X",
+ default=128,
+ min=4,
+ max=6400,
+ description="Mesh X subdivisions"
+ )
+ subdivision_y = IntProperty(
+ default=128,
+ name="Subdivisions Y",
+ min=4,
+ max=6400,
+ description="Mesh Y subdivisions"
+ )
+ mesh_size = FloatProperty(
+ default=2.0,
+ name="Mesh Size",
+ min=0.01,
+ max=100000.0,
+ description="Mesh size"
+ )
+ mesh_size_x = FloatProperty(
+ default=2.0,
+ name="Mesh Size X",
+ min=0.01,
+ description="Mesh x size"
+ )
+ mesh_size_y = FloatProperty(
+ name="Mesh Size Y",
+ default=2.0,
+ min=0.01,
+ description="Mesh y size"
+ )
+
+ random_seed = IntProperty(
+ name="Random Seed",
+ default=0,
+ min=0,
+ description="Randomize noise origin"
+ )
+ noise_offset_x = FloatProperty(
+ name="Offset X",
+ default=0.0,
+ description="Noise X Offset"
+ )
+ noise_offset_y = FloatProperty(
+ name="Offset Y",
+ default=0.0,
+ description="Noise Y Offset"
+ )
+ noise_offset_z = FloatProperty(
+ name="Offset Z",
+ default=0.0,
+ description="Noise Z Offset"
+ )
+ noise_size_x = FloatProperty(
+ default=1.0,
+ name="Size X",
+ min=0.01,
+ max=1000.0,
+ description="Noise x size"
+ )
+ noise_size_y = FloatProperty(
+ name="Size Y",
+ default=1.0,
+ min=0.01,
+ max=1000.0,
+ description="Noise y size"
+ )
+ noise_size_z = FloatProperty(
+ name="Size Z",
+ default=1.0,
+ min=0.01,
+ max=1000.0,
+ description="Noise Z size"
+ )
+ noise_size = FloatProperty(
+ name="Noise Size",
+ default=1.0,
+ min=0.01,
+ max=1000.0,
+ description="Noise size"
+ )
+ noise_type = EnumProperty(
+ name="Noise Type",
+ default='hetero_terrain',
+ description="Noise type",
+ items = [
+ ('multi_fractal', "Multi Fractal", "Blender: Multi Fractal algorithm", 0),
+ ('ridged_multi_fractal', "Ridged MFractal", "Blender: Ridged Multi Fractal", 1),
+ ('hybrid_multi_fractal', "Hybrid MFractal", "Blender: Hybrid Multi Fractal", 2),
+ ('hetero_terrain', "Hetero Terrain", "Blender: Hetero Terrain", 3),
+ ('fractal', "fBm Fractal", "Blender: fBm - Fractional Browninian motion", 4),
+ ('turbulence_vector', "Turbulence", "Blender: Turbulence Vector", 5),
+ ('variable_lacunarity', "Distorted Noise", "Blender: Distorted Noise", 6),
+ ('marble_noise', "Marble", "A.N.T.: Marble Noise", 7),
+ ('shattered_hterrain', "Shattered hTerrain", "A.N.T.: Shattered hTerrain", 8),
+ ('strata_hterrain', "Strata hTerrain", "A.N.T: Strata hTerrain", 9),
+ ('ant_turbulence', "Another Turbulence", "A.N.T: Turbulence variation", 10),
+ ('vl_noise_turbulence', "vlNoise turbulence", "A.N.T: vlNoise turbulence", 11),
+ ('vl_hTerrain', "vlNoise hTerrain", "A.N.T: vlNoise hTerrain", 12),
+ ('distorted_heteroTerrain', "Distorted hTerrain", "A.N.T distorted hTerrain", 13),
+ ('double_multiFractal', "Double MultiFractal", "A.N.T: double multiFractal", 14),
+ ('slick_rock', "Slick Rock", "A.N.T: slick rock", 15),
+ ('planet_noise', "Planet Noise", "Planet Noise by: Farsthary", 16),
+ ('blender_texture', "Blender Texture - Texture Nodes", "Blender texture data block", 17)]
+ )
+ basis_type = EnumProperty(
+ name="Noise Basis",
+ default="0",
+ description="Noise basis algorithms",
+ items = [
+ ("0", "Blender", "Blender default noise", 0),
+ ("1", "Perlin", "Perlin noise", 1),
+ ("2", "New Perlin", "New Perlin noise", 2),
+ ("3", "Voronoi F1", "Voronoi F1", 3),
+ ("4", "Voronoi F2", "Voronoi F2", 4),
+ ("5", "Voronoi F3", "Voronoi F3", 5),
+ ("6", "Voronoi F4", "Voronoi F4", 6),
+ ("7", "Voronoi F2-F1", "Voronoi F2-F1", 7),
+ ("8", "Voronoi Crackle", "Voronoi Crackle", 8),
+ ("9", "Cell Noise", "Cell noise", 9)]
+ )
+ vl_basis_type = EnumProperty(
+ name="vlNoise Basis",
+ default="0",
+ description="VLNoise basis algorithms",
+ items = [
+ ("0", "Blender", "Blender default noise", 0),
+ ("1", "Perlin", "Perlin noise", 1),
+ ("2", "New Perlin", "New Perlin noise", 2),
+ ("3", "Voronoi F1", "Voronoi F1", 3),
+ ("4", "Voronoi F2", "Voronoi F2", 4),
+ ("5", "Voronoi F3", "Voronoi F3", 5),
+ ("6", "Voronoi F4", "Voronoi F4", 6),
+ ("7", "Voronoi F2-F1", "Voronoi F2-F1", 7),
+ ("8", "Voronoi Crackle", "Voronoi Crackle", 8),
+ ("9", "Cell Noise", "Cell noise", 9)]
+ )
+ distortion = FloatProperty(
+ name="Distortion",
+ default=1.0,
+ min=0.01,
+ max=100.0,
+ description="Distortion amount"
+ )
+ hard_noise = EnumProperty(
+ name="Soft Hard",
+ default="0",
+ description="Soft Noise, Hard noise",
+ items = [
+ ("0", "Soft", "Soft Noise", 0),
+ ("1", "Hard", "Hard noise", 1)]
+ )
+ noise_depth = IntProperty(
+ name="Depth",
+ default=8,
+ min=0,
+ max=16,
+ description="Noise Depth - number of frequencies in the fBm"
+ )
+ amplitude = FloatProperty(
+ name="Amp",
+ default=0.5,
+ min=0.01,
+ max=1.0,
+ description="Amplitude"
+ )
+ frequency = FloatProperty(
+ name="Freq",
+ default=2.0,
+ min=0.01,
+ max=5.0,
+ description="Frequency"
+ )
+ dimension = FloatProperty(
+ name="Dimension",
+ default=1.0,
+ min=0.01,
+ max=2.0,
+ description="H - fractal dimension of the roughest areas"
+ )
+ lacunarity = FloatProperty(
+ name="Lacunarity",
+ min=0.01,
+ max=6.0,
+ default=2.0,
+ description="Lacunarity - gap between successive frequencies"
+ )
+ offset = FloatProperty(
+ name="Offset",
+ default=1.0,
+ min=0.01,
+ max=6.0,
+ description="Offset - raises the terrain from sea level"
+ )
+ gain = FloatProperty(
+ name="Gain",
+ default=1.0,
+ min=0.01,
+ max=6.0,
+ description="Gain - scale factor"
+ )
+ marble_bias = EnumProperty(
+ name="Bias",
+ default="0",
+ description="Marble bias",
+ items = [
+ ("0", "Sin", "Sin", 0),
+ ("1", "Cos", "Cos", 1),
+ ("2", "Tri", "Tri", 2),
+ ("3", "Saw", "Saw", 3)]
+ )
+ marble_sharp = EnumProperty(
+ name="Sharp",
+ default="0",
+ description="Marble sharpness",
+ items = [
+ ("0", "Soft", "Soft", 0),
+ ("1", "Sharp", "Sharp", 1),
+ ("2", "Sharper", "Sharper", 2),
+ ("3", "Soft inv.", "Soft", 3),
+ ("4", "Sharp inv.", "Sharp", 4),
+ ("5", "Sharper inv.", "Sharper", 5)]
+ )
+ marble_shape = EnumProperty(
+ name="Shape",
+ default="0",
+ description="Marble shape",
+ items= [
+ ("0", "Default", "Default", 0),
+ ("1", "Ring", "Ring", 1),
+ ("2", "Swirl", "Swirl", 2),
+ ("3", "Bump", "Bump", 3),
+ ("4", "Wave", "Wave", 4),
+ ("5", "Z", "Z", 5),
+ ("6", "Y", "Y", 6),
+ ("7", "X", "X", 7)]
+ )
+ height = FloatProperty(
+ name="Height",
+ default=0.5,
+ min=-10000.0,
+ max=10000.0,
+ description="Noise intensity scale"
+ )
+ height_invert = BoolProperty(
+ name="Invert",
+ default=False,
+ description="Height invert",
+ )
+ height_offset = FloatProperty(
+ name="Offset",
+ default=0.0,
+ min=-10000.0,
+ max=10000.0,
+ description="Height offset"
+ )
+ edge_falloff = EnumProperty(
+ name="Falloff",
+ default="3",
+ description="Flatten edges",
+ items = [
+ ("0", "None", "None", 0),
+ ("1", "Y", "Y Falloff", 1),
+ ("2", "X", "X Falloff", 2),
+ ("3", "X Y", "X Y Falloff", 3)]
+ )
+ falloff_x = FloatProperty(
+ name="Falloff X",
+ default=4.0,
+ min=0.1,
+ max=100.0,
+ description="Falloff x scale"
+ )
+ falloff_y = FloatProperty(
+ name="Falloff Y",
+ default=4.0,
+ min=0.1,
+ max=100.0,
+ description="Falloff y scale"
+ )
+ edge_level = FloatProperty(
+ name="Edge Level",
+ default=0.0,
+ min=-10000.0,
+ max=10000.0,
+ description="Edge level, sealevel offset"
+ )
+ maximum = FloatProperty(
+ name="Maximum",
+ default=1.0,
+ min=-10000.0,
+ max=10000.0,
+ description="Maximum, flattens terrain at plateau level"
+ )
+ minimum = FloatProperty(
+ name="Minimum",
+ default=-1.0,
+ min=-10000.0,
+ max=10000.0,
+ description="Minimum, flattens terrain at seabed level"
+ )
+ use_vgroup = BoolProperty(
+ name="Vertex Group Weight",
+ default=False,
+ description="Use active vertex group weight"
+ )
+ strata = FloatProperty(
+ name="Amount",
+ default=5.0,
+ min=0.01,
+ max=1000.0,
+ description="Strata layers / terraces"
+ )
+ strata_type = EnumProperty(
+ name="Strata",
+ default="0",
+ description="Strata types",
+ items = [
+ ("0", "None", "No strata", 0),
+ ("1", "Smooth", "Smooth transitions", 1),
+ ("2", "Sharp Sub", "Sharp substract transitions", 2),
+ ("3", "Sharp Add", "Sharp add transitions", 3),
+ ("4", "Posterize", "Posterize", 4),
+ ("5", "Posterize Mix", "Posterize mixed", 5)]
+ )
+ water_plane = BoolProperty(
+ name="Water Plane",
+ default=False,
+ description="Add water plane"
+ )
+ water_level = FloatProperty(
+ name="Level",
+ default=0.01,
+ min=-10000.0,
+ max=10000.0,
+ description="Water level"
+ )
+ remove_double = BoolProperty(
+ name="Remove Doubles",
+ default=False,
+ description="Remove doubles"
+ )
+ show_main_settings = BoolProperty(
+ name="Main Settings",
+ default=True,
+ description="Show settings"
+ )
+ show_noise_settings = BoolProperty(
+ name="Noise Settings",
+ default=True,
+ description="Show noise settings"
+ )
+ show_displace_settings = BoolProperty(
+ name="Displace Settings",
+ default=True,
+ description="Show displace settings"
+ )
+ refresh = BoolProperty(
+ name="Refresh",
+ default=False,
+ description="Refresh"
+ )
+ auto_refresh = BoolProperty(
+ name="Auto",
+ default=True,
+ description="Automatic refresh"
+ )
+
+
+# ------------------------------------------------------------
+# Register:
+
+def register():
+ bpy.utils.register_module(__name__)
+ bpy.types.INFO_MT_mesh_add.append(menu_func_landscape)
+ bpy.types.Object.ant_landscape = PointerProperty(type=AntLandscapePropertiesGroup, name="ANT_Landscape", description="Landscape properties", options={'ANIMATABLE'})
+
+
+def unregister():
+ bpy.utils.unregister_module(__name__)
+ bpy.types.INFO_MT_mesh_add.remove(menu_func_landscape)
+ #del bpy.types.Object.AntLandscapePropertiesGroup
+
+if __name__ == "__main__":
+ register()
diff --git a/ant_landscape/add_mesh_ant_landscape.py b/ant_landscape/add_mesh_ant_landscape.py
new file mode 100644
index 00000000..cad52c44
--- /dev/null
+++ b/ant_landscape/add_mesh_ant_landscape.py
@@ -0,0 +1,668 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# Another Noise Tool - Landscape
+# Jim Hazevoet
+
+# import modules
+import bpy
+from bpy.props import (
+ BoolProperty,
+ EnumProperty,
+ FloatProperty,
+ IntProperty,
+ StringProperty,
+ FloatVectorProperty,
+ )
+
+from .ant_functions import (
+ grid_gen,
+ sphere_gen,
+ create_mesh_object,
+ store_properties,
+ draw_ant_refresh,
+ draw_ant_main,
+ draw_ant_noise,
+ draw_ant_displace,
+ draw_ant_water,
+ )
+
+# ------------------------------------------------------------
+# Add landscape
+class AntAddLandscape(bpy.types.Operator):
+ bl_idname = "mesh.landscape_add"
+ bl_label = "Another Noise Tool - Landscape"
+ bl_description = "Add landscape mesh"
+ bl_options = {'REGISTER', 'UNDO', 'PRESET'}
+
+ ant_terrain_name = StringProperty(
+ name="Name",
+ default="Landscape"
+ )
+ land_material = StringProperty(
+ name='Material',
+ default="",
+ description="Terrain material"
+ )
+ water_material = StringProperty(
+ name='Material',
+ default="",
+ description="Water plane material"
+ )
+ texture_block = StringProperty(
+ name="Texture",
+ default=""
+ )
+ at_cursor = BoolProperty(
+ name="Cursor",
+ default=True,
+ description="Place at cursor location",
+ )
+ smooth_mesh = BoolProperty(
+ name="Smooth",
+ default=True,
+ description="Shade smooth"
+ )
+ tri_face = BoolProperty(
+ name="Triangulate",
+ default=False,
+ description="Triangulate faces"
+ )
+ sphere_mesh = BoolProperty(
+ name="Sphere",
+ default=False,
+ description="Generate uv sphere - remove doubles when ready"
+ )
+ subdivision_x = IntProperty(
+ name="Subdivisions X",
+ default=128,
+ min=4,
+ max=6400,
+ description="Mesh X subdivisions"
+ )
+ subdivision_y = IntProperty(
+ default=128,
+ name="Subdivisions Y",
+ min=4,
+ max=6400,
+ description="Mesh Y subdivisions"
+ )
+ mesh_size = FloatProperty(
+ default=2.0,
+ name="Mesh Size",
+ min=0.01,
+ max=100000.0,
+ description="Mesh size"
+ )
+ mesh_size_x = FloatProperty(
+ default=2.0,
+ name="Mesh Size X",
+ min=0.01,
+ description="Mesh x size"
+ )
+ mesh_size_y = FloatProperty(
+ name="Mesh Size Y",
+ default=2.0,
+ min=0.01,
+ description="Mesh y size"
+ )
+
+ random_seed = IntProperty(
+ name="Random Seed",
+ default=0,
+ min=0,
+ description="Randomize noise origin"
+ )
+ noise_offset_x = FloatProperty(
+ name="Offset X",
+ default=0.0,
+ description="Noise X Offset"
+ )
+ noise_offset_y = FloatProperty(
+ name="Offset Y",
+ default=0.0,
+ description="Noise Y Offset"
+ )
+ noise_offset_z = FloatProperty(
+ name="Offset Z",
+ default=0.0,
+ description="Noise Z Offset"
+ )
+ noise_size_x = FloatProperty(
+ default=1.0,
+ name="Size X",
+ min=0.01,
+ max=1000.0,
+ description="Noise x size"
+ )
+ noise_size_y = FloatProperty(
+ name="Size Y",
+ default=1.0,
+ min=0.01,
+ max=1000.0,
+ description="Noise y size"
+ )
+ noise_size_z = FloatProperty(
+ name="Size Z",
+ default=1.0,
+ min=0.01,
+ max=1000.0,
+ description="Noise Z size"
+ )
+ noise_size = FloatProperty(
+ name="Noise Size",
+ default=1.0,
+ min=0.01,
+ max=1000.0,
+ description="Noise size"
+ )
+ noise_type = EnumProperty(
+ name="Noise Type",
+ default='hetero_terrain',
+ description="Noise type",
+ items = [
+ ('multi_fractal', "Multi Fractal", "Blender: Multi Fractal algorithm", 0),
+ ('ridged_multi_fractal', "Ridged MFractal", "Blender: Ridged Multi Fractal", 1),
+ ('hybrid_multi_fractal', "Hybrid MFractal", "Blender: Hybrid Multi Fractal", 2),
+ ('hetero_terrain', "Hetero Terrain", "Blender: Hetero Terrain", 3),
+ ('fractal', "fBm Fractal", "Blender: fBm - Fractional Browninian motion", 4),
+ ('turbulence_vector', "Turbulence", "Blender: Turbulence Vector", 5),
+ ('variable_lacunarity', "Distorted Noise", "Blender: Distorted Noise", 6),
+ ('marble_noise', "Marble", "A.N.T.: Marble Noise", 7),
+ ('shattered_hterrain', "Shattered hTerrain", "A.N.T.: Shattered hTerrain", 8),
+ ('strata_hterrain', "Strata hTerrain", "A.N.T: Strata hTerrain", 9),
+ ('ant_turbulence', "Another Turbulence", "A.N.T: Turbulence variation", 10),
+ ('vl_noise_turbulence', "vlNoise turbulence", "A.N.T: vlNoise turbulence", 11),
+ ('vl_hTerrain', "vlNoise hTerrain", "A.N.T: vlNoise hTerrain", 12),
+ ('distorted_heteroTerrain', "Distorted hTerrain", "A.N.T distorted hTerrain", 13),
+ ('double_multiFractal', "Double MultiFractal", "A.N.T: double multiFractal", 14),
+ ('slick_rock', "Slick Rock", "A.N.T: slick rock", 15),
+ ('planet_noise', "Planet Noise", "Planet Noise by: Farsthary", 16),
+ ('blender_texture', "Blender Texture - Texture Nodes", "Blender texture data block", 17)]
+ )
+ basis_type = EnumProperty(
+ name="Noise Basis",
+ default="0",
+ description="Noise basis algorithms",
+ items = [
+ ("0", "Blender", "Blender default noise", 0),
+ ("1", "Perlin", "Perlin noise", 1),
+ ("2", "New Perlin", "New Perlin noise", 2),
+ ("3", "Voronoi F1", "Voronoi F1", 3),
+ ("4", "Voronoi F2", "Voronoi F2", 4),
+ ("5", "Voronoi F3", "Voronoi F3", 5),
+ ("6", "Voronoi F4", "Voronoi F4", 6),
+ ("7", "Voronoi F2-F1", "Voronoi F2-F1", 7),
+ ("8", "Voronoi Crackle", "Voronoi Crackle", 8),
+ ("9", "Cell Noise", "Cell noise", 9)]
+ )
+ vl_basis_type = EnumProperty(
+ name="vlNoise Basis",
+ default="0",
+ description="VLNoise basis algorithms",
+ items = [
+ ("0", "Blender", "Blender default noise", 0),
+ ("1", "Perlin", "Perlin noise", 1),
+ ("2", "New Perlin", "New Perlin noise", 2),
+ ("3", "Voronoi F1", "Voronoi F1", 3),
+ ("4", "Voronoi F2", "Voronoi F2", 4),
+ ("5", "Voronoi F3", "Voronoi F3", 5),
+ ("6", "Voronoi F4", "Voronoi F4", 6),
+ ("7", "Voronoi F2-F1", "Voronoi F2-F1", 7),
+ ("8", "Voronoi Crackle", "Voronoi Crackle", 8),
+ ("9", "Cell Noise", "Cell noise", 9)]
+ )
+ distortion = FloatProperty(
+ name="Distortion",
+ default=1.0,
+ min=0.01,
+ max=100.0,
+ description="Distortion amount"
+ )
+ hard_noise = EnumProperty(
+ name="Soft Hard",
+ default="0",
+ description="Soft Noise, Hard noise",
+ items = [
+ ("0", "Soft", "Soft Noise", 0),
+ ("1", "Hard", "Hard noise", 1)]
+ )
+ noise_depth = IntProperty(
+ name="Depth",
+ default=8,
+ min=0,
+ max=16,
+ description="Noise Depth - number of frequencies in the fBm"
+ )
+ amplitude = FloatProperty(
+ name="Amp",
+ default=0.5,
+ min=0.01,
+ max=1.0,
+ description="Amplitude"
+ )
+ frequency = FloatProperty(
+ name="Freq",
+ default=2.0,
+ min=0.01,
+ max=5.0,
+ description="Frequency"
+ )
+ dimension = FloatProperty(
+ name="Dimension",
+ default=1.0,
+ min=0.01,
+ max=2.0,
+ description="H - fractal dimension of the roughest areas"
+ )
+ lacunarity = FloatProperty(
+ name="Lacunarity",
+ min=0.01,
+ max=6.0,
+ default=2.0,
+ description="Lacunarity - gap between successive frequencies"
+ )
+ offset = FloatProperty(
+ name="Offset",
+ default=1.0,
+ min=0.01,
+ max=6.0,
+ description="Offset - raises the terrain from sea level"
+ )
+ gain = FloatProperty(
+ name="Gain",
+ default=1.0,
+ min=0.01,
+ max=6.0,
+ description="Gain - scale factor"
+ )
+ marble_bias = EnumProperty(
+ name="Bias",
+ default="0",
+ description="Marble bias",
+ items = [
+ ("0", "Sin", "Sin", 0),
+ ("1", "Cos", "Cos", 1),
+ ("2", "Tri", "Tri", 2),
+ ("3", "Saw", "Saw", 3)]
+ )
+ marble_sharp = EnumProperty(
+ name="Sharp",
+ default="0",
+ description="Marble sharpness",
+ items = [
+ ("0", "Soft", "Soft", 0),
+ ("1", "Sharp", "Sharp", 1),
+ ("2", "Sharper", "Sharper", 2),
+ ("3", "Soft inv.", "Soft", 3),
+ ("4", "Sharp inv.", "Sharp", 4),
+ ("5", "Sharper inv.", "Sharper", 5)]
+ )
+ marble_shape = EnumProperty(
+ name="Shape",
+ default="0",
+ description="Marble shape",
+ items= [
+ ("0", "Default", "Default", 0),
+ ("1", "Ring", "Ring", 1),
+ ("2", "Swirl", "Swirl", 2),
+ ("3", "Bump", "Bump", 3),
+ ("4", "Wave", "Wave", 4),
+ ("5", "Z", "Z", 5),
+ ("6", "Y", "Y", 6),
+ ("7", "X", "X", 7)]
+ )
+ height = FloatProperty(
+ name="Height",
+ default=0.5,
+ min=-10000.0,
+ max=10000.0,
+ description="Noise intensity scale"
+ )
+ height_invert = BoolProperty(
+ name="Invert",
+ default=False,
+ description="Height invert",
+ )
+ height_offset = FloatProperty(
+ name="Offset",
+ default=0.0,
+ min=-10000.0,
+ max=10000.0,
+ description="Height offset"
+ )
+ edge_falloff = EnumProperty(
+ name="Falloff",
+ default="3",
+ description="Flatten edges",
+ items = [
+ ("0", "None", "None", 0),
+ ("1", "Y", "Y Falloff", 1),
+ ("2", "X", "X Falloff", 2),
+ ("3", "X Y", "X Y Falloff", 3)]
+ )
+ falloff_x = FloatProperty(
+ name="Falloff X",
+ default=4.0,
+ min=0.1,
+ max=100.0,
+ description="Falloff x scale"
+ )
+ falloff_y = FloatProperty(
+ name="Falloff Y",
+ default=4.0,
+ min=0.1,
+ max=100.0,
+ description="Falloff y scale"
+ )
+ edge_level = FloatProperty(
+ name="Edge Level",
+ default=0.0,
+ min=-10000.0,
+ max=10000.0,
+ description="Edge level, sealevel offset"
+ )
+ maximum = FloatProperty(
+ name="Maximum",
+ default=1.0,
+ min=-10000.0,
+ max=10000.0,
+ description="Maximum, flattens terrain at plateau level"
+ )
+ minimum = FloatProperty(
+ name="Minimum",
+ default=-1.0,
+ min=-10000.0,
+ max=10000.0,
+ description="Minimum, flattens terrain at seabed level"
+ )
+ use_vgroup = BoolProperty(
+ name="Vertex Group Weight",
+ default=False,
+ description="Use active vertex group weight"
+ )
+ strata = FloatProperty(
+ name="Amount",
+ default=5.0,
+ min=0.01,
+ max=1000.0,
+ description="Strata layers / terraces"
+ )
+ strata_type = EnumProperty(
+ name="Strata",
+ default="0",
+ description="Strata types",
+ items = [
+ ("0", "None", "No strata", 0),
+ ("1", "Smooth", "Smooth transitions", 1),
+ ("2", "Sharp Sub", "Sharp substract transitions", 2),
+ ("3", "Sharp Add", "Sharp add transitions", 3),
+ ("4", "Posterize", "Posterize", 4),
+ ("5", "Posterize Mix", "Posterize mixed", 5)]
+ )
+ water_plane = BoolProperty(
+ name="Water Plane",
+ default=False,
+ description="Add water plane"
+ )
+ water_level = FloatProperty(
+ name="Level",
+ default=0.01,
+ min=-10000.0,
+ max=10000.0,
+ description="Water level"
+ )
+ remove_double = BoolProperty(
+ name="Remove Doubles",
+ default=False,
+ description="Remove doubles"
+ )
+ show_main_settings = BoolProperty(
+ name="Main Settings",
+ default=True,
+ description="Show settings"
+ )
+ show_noise_settings = BoolProperty(
+ name="Noise Settings",
+ default=True,
+ description="Show noise settings"
+ )
+ show_displace_settings = BoolProperty(
+ name="Displace Settings",
+ default=True,
+ description="Show displace settings"
+ )
+ refresh = BoolProperty(
+ name="Refresh",
+ default=False,
+ description="Refresh"
+ )
+ auto_refresh = BoolProperty(
+ name="Auto",
+ default=True,
+ description="Automatic refresh"
+ )
+
+
+ def draw(self, context):
+ draw_ant_refresh(self, context)
+ draw_ant_main(self, context, generate=True)
+ draw_ant_noise(self, context)
+ draw_ant_displace(self, context, generate=True)
+ draw_ant_water(self, context)
+
+
+ def invoke(self, context, event):
+ self.refresh = True
+ return self.execute(context)
+
+
+ def execute(self, context):
+ if not self.refresh:
+ return {'PASS_THROUGH'}
+
+ # turn off undo
+ undo = bpy.context.user_preferences.edit.use_global_undo
+ bpy.context.user_preferences.edit.use_global_undo = False
+
+ # deselect all objects when in object mode
+ if bpy.ops.object.select_all.poll():
+ bpy.ops.object.select_all(action='DESELECT')
+
+ # Properties
+ ant_props = [
+ self.ant_terrain_name,
+ self.at_cursor,
+ self.smooth_mesh,
+ self.tri_face,
+ self.sphere_mesh,
+ self.land_material,
+ self.water_material,
+ self.texture_block,
+ self.subdivision_x,
+ self.subdivision_y,
+ self.mesh_size_x,
+ self.mesh_size_y,
+ self.mesh_size,
+ self.random_seed,
+ self.noise_offset_x,
+ self.noise_offset_y,
+ self.noise_offset_z,
+ self.noise_size_x,
+ self.noise_size_y,
+ self.noise_size_z,
+ self.noise_size,
+ self.noise_type,
+ self.basis_type,
+ self.vl_basis_type,
+ self.distortion,
+ self.hard_noise,
+ self.noise_depth,
+ self.amplitude,
+ self.frequency,
+ self.dimension,
+ self.lacunarity,
+ self.offset,
+ self.gain,
+ self.marble_bias,
+ self.marble_sharp,
+ self.marble_shape,
+ self.height,
+ self.height_invert,
+ self.height_offset,
+ self.maximum,
+ self.minimum,
+ self.edge_falloff,
+ self.edge_level,
+ self.falloff_x,
+ self.falloff_y,
+ self.strata_type,
+ self.strata,
+ self.water_plane,
+ self.water_level,
+ self.use_vgroup,
+ self.remove_double
+ ]
+
+ scene = context.scene
+
+ # Main function, create landscape mesh object
+ if self.ant_terrain_name != "":
+ new_name = self.ant_terrain_name
+ else:
+ new_name = "Landscape"
+
+ if self.sphere_mesh:
+ # sphere
+ verts, faces = sphere_gen(
+ self.subdivision_y,
+ self.subdivision_x,
+ self.tri_face,
+ self.mesh_size,
+ ant_props,
+ False,
+ 0.0
+ )
+ new_ob = create_mesh_object(context, verts, [], faces, new_name)
+ if self.remove_double:
+ new_ob.select = True
+ bpy.ops.object.mode_set(mode = 'EDIT')
+ bpy.ops.mesh.remove_doubles(threshold=0.0001, use_unselected=False)
+ bpy.ops.object.mode_set(mode = 'OBJECT')
+ else:
+ # grid
+ verts, faces = grid_gen(
+ self.subdivision_x,
+ self.subdivision_y,
+ self.tri_face,
+ self.mesh_size_x,
+ self.mesh_size_y,
+ ant_props,
+ False,
+ 0.0
+ )
+ new_ob = create_mesh_object(context, verts, [], faces, new_name)
+
+ new_ob.select = True
+
+ if self.smooth_mesh:
+ bpy.ops.object.shade_smooth()
+
+ if not self.at_cursor:
+ new_ob.object.location = (0.0, 0.0, 0.0)
+
+ # Landscape Material
+ if self.land_material != "" and self.land_material in bpy.data.materials:
+ mat = bpy.data.materials[self.land_material]
+ bpy.context.object.data.materials.append(mat)
+
+ # Water plane
+ if self.water_plane:
+ if self.sphere_mesh:
+ # sphere
+ verts, faces = sphere_gen(
+ self.subdivision_y,
+ self.subdivision_x,
+ self.tri_face,
+ self.mesh_size,
+ ant_props,
+ self.water_plane,
+ self.water_level
+ )
+ wobj = create_mesh_object(context, verts, [], faces, new_name+"_plane")
+ if self.remove_double:
+ wobj.select = True
+ bpy.ops.object.mode_set(mode = 'EDIT')
+ bpy.ops.mesh.remove_doubles(threshold=0.0001, use_unselected=False)
+ bpy.ops.object.mode_set(mode = 'OBJECT')
+ else:
+ # grid
+ verts, faces = grid_gen(
+ 2,
+ 2,
+ self.tri_face,
+ self.mesh_size_x,
+ self.mesh_size_y,
+ ant_props,
+ self.water_plane,
+ self.water_level
+ )
+ wobj = create_mesh_object(context, verts, [], faces, new_name+"_plane")
+
+ wobj.select = True
+
+ if self.smooth_mesh:
+ bpy.ops.object.shade_smooth()
+
+ if not self.at_cursor:
+ wobj.object.location = (0.0, 0.0, 0.0)
+
+ # Water Material
+ if self.water_material != "" and self.water_material in bpy.data.materials:
+ mat = bpy.data.materials[self.water_material]
+ bpy.context.object.data.materials.append(mat)
+
+ # select landscape and make active
+ new_ob.select = True
+ scene.objects.active = new_ob.object
+ #
+ new_ob = store_properties(self, new_ob.object)
+
+ if self.auto_refresh is False:
+ self.refresh = False
+
+ # restore pre operator undo state
+ context.user_preferences.edit.use_global_undo = undo
+
+ return {'FINISHED'}
+
+'''
+# ------------------------------------------------------------
+# Register:
+
+def register():
+ bpy.utils.register_module(__name__)
+
+
+def unregister():
+ bpy.utils.unregister_module(__name__)
+
+
+if __name__ == "__main__":
+ register()
+''' \ No newline at end of file
diff --git a/ant_landscape/ant_functions.py b/ant_landscape/ant_functions.py
new file mode 100644
index 00000000..74412d17
--- /dev/null
+++ b/ant_landscape/ant_functions.py
@@ -0,0 +1,930 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# Another Noise Tool - Functions
+# Jim Hazevoet
+
+# import modules
+import bpy
+from bpy.props import (
+ BoolProperty,
+ FloatProperty,
+ StringProperty,
+ EnumProperty,
+ IntProperty,
+ PointerProperty
+ )
+from mathutils.noise import (
+ seed_set,
+ turbulence,
+ turbulence_vector,
+ fractal,
+ hybrid_multi_fractal,
+ multi_fractal,
+ ridged_multi_fractal,
+ hetero_terrain,
+ random_unit_vector,
+ variable_lacunarity,
+ )
+from math import (
+ floor, sqrt,
+ sin, cos, pi,
+ )
+
+# ------------------------------------------------------------
+# Create a new mesh (object) from verts/edges/faces.
+# verts/edges/faces ... List of vertices/edges/faces for the
+# new mesh (as used in from_pydata).
+# name ... Name of the new mesh (& object)
+
+from bpy_extras import object_utils
+
+def create_mesh_object(context, verts, edges, faces, name):
+ # Create new mesh
+ mesh = bpy.data.meshes.new(name)
+
+ # Make a mesh from a list of verts/edges/faces.
+ mesh.from_pydata(verts, [], faces)
+
+ # Update mesh geometry after adding stuff.
+ mesh.update()
+
+ #new_ob = bpy.data.objects.new(name, mesh)
+ #context.scene.objects.link(new_ob)
+ return object_utils.object_data_add(context, mesh, operator=None)
+ #return new_ob
+
+
+# Generate XY Grid
+def grid_gen(sub_d_x, sub_d_y, tri, meshsize_x, meshsize_y, props, water_plane, water_level):
+ verts = []
+ faces = []
+ for i in range (0, sub_d_x):
+ x = meshsize_x * (i / (sub_d_x - 1) - 1 / 2)
+ for j in range(0, sub_d_y):
+ y = meshsize_y * (j / (sub_d_y - 1) - 1 / 2)
+ if water_plane:
+ z = water_level
+ else:
+ z = noise_gen((x, y, 0), props)
+
+ verts.append((x,y,z))
+
+ count = 0
+ for i in range (0, sub_d_y * (sub_d_x - 1)):
+ if count < sub_d_y - 1 :
+ A = i + 1
+ B = i
+ C = (i + sub_d_y)
+ D = (i + sub_d_y) + 1
+ if tri:
+ faces.append((A, B, D))
+ faces.append((B, C, D))
+ else:
+ faces.append((A, B, C, D))
+ count = count + 1
+ else:
+ count = 0
+
+ return verts, faces
+
+
+# Generate UV Sphere
+def sphere_gen(sub_d_x, sub_d_y, tri, meshsize, props, water_plane, water_level):
+ verts = []
+ faces = []
+ sub_d_x += 1
+ sub_d_y += 1
+ for i in range(0, sub_d_x):
+ for j in range(0, sub_d_y):
+ u = sin(j * pi * 2 / (sub_d_y - 1)) * cos(-pi / 2 + i * pi / (sub_d_x - 1)) * meshsize / 2
+ v = cos(j * pi * 2 / (sub_d_y - 1)) * cos(-pi / 2 + i * pi / (sub_d_x - 1)) * meshsize / 2
+ w = sin(-pi / 2 + i * pi / (sub_d_x - 1)) * meshsize / 2
+ if water_plane:
+ h = water_level
+ else:
+ h = noise_gen((u, v, w), props) / meshsize
+ verts.append(((u + u * h), (v + v * h), (w + w * h)))
+
+ count = 0
+ for i in range (0, sub_d_y * (sub_d_x - 1)):
+ if count < sub_d_y - 1 :
+ A = i + 1
+ B = i
+ C = (i + sub_d_y)
+ D = (i + sub_d_y) + 1
+ if tri:
+ faces.append((A, B, D))
+ faces.append((B, C, D))
+ else:
+ faces.append((A, B, C, D))
+ count = count + 1
+ else:
+ count = 0
+
+ return verts, faces
+
+
+# Z normal value to vertex group (Slope map)
+class AntVgSlopeMap(bpy.types.Operator):
+ bl_idname = "mesh.ant_slope_map"
+ bl_label = "Weight from Slope"
+ bl_description = "A.N.T. Slope Map - z normal value to vertex group weight"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ z_method = EnumProperty(
+ name="Method:",
+ default='SLOPE_Z',
+ items=[
+ ('SLOPE_Z', "Slope Z", "Slope for planar mesh"),
+ ('SLOPE_XYZ', "Slope XYZ", "Slope for spherical mesh")
+ ])
+ group_name = StringProperty(
+ name="Vertex Group Name:",
+ default="Slope",
+ description="Name"
+ )
+ select_flat = BoolProperty(
+ name="Vert Select:",
+ default=True,
+ description="Select vertices on flat surface"
+ )
+ select_range = FloatProperty(
+ name="Vert Select Range:",
+ default=0.0,
+ min=0.0,
+ max=1.0,
+ description="Increase to select more vertices"
+ )
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.object
+ return (ob and ob.type == 'MESH')
+
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ return wm.invoke_props_dialog(self)
+
+
+ def execute(self, context):
+ message = "Popup Values: %d, %f, %s, %s" % \
+ (self.select_flat, self.select_range, self.group_name, self.z_method)
+ self.report({'INFO'}, message)
+
+ ob = bpy.context.active_object
+ dim = ob.dimensions
+
+ if self.select_flat:
+ bpy.ops.object.mode_set(mode='EDIT')
+ bpy.ops.mesh.select_all(action='DESELECT')
+ bpy.context.tool_settings.mesh_select_mode = [True, False, False]
+ bpy.ops.object.mode_set(mode='OBJECT')
+
+ bpy.ops.object.vertex_group_add()
+ vg_normal = ob.vertex_groups.active
+
+ for v in ob.data.vertices:
+ if self.z_method == 'SLOPE_XYZ':
+ zval = (v.co.normalized() * v.normal.normalized()) * 2 - 1
+ else:
+ zval = v.normal[2]
+
+ vg_normal.add([v.index], zval, 'REPLACE')
+
+ if self.select_flat:
+ if zval >= (1.0 - self.select_range):
+ v.select = True
+
+ vg_normal.name = self.group_name
+
+ return {'FINISHED'}
+
+
+# ------------------------------------------------------------
+# A.N.T. Noise:
+
+# Functions for marble_noise:
+def sin_bias(a):
+ return 0.5 + 0.5 * sin(a)
+
+
+def cos_bias(a):
+ return 0.5 + 0.5 * cos(a)
+
+
+def tri_bias(a):
+ b = 2 * pi
+ a = 1 - 2 * abs(floor((a * (1 / b)) + 0.5) - (a * (1 / b)))
+ return a
+
+
+def saw_bias(a):
+ b = 2 * pi
+ n = int(a / b)
+ a -= n * b
+ if a < 0:
+ a += b
+ return a / b
+
+
+def soft(a):
+ return a
+
+
+def sharp(a):
+ return a**0.5
+
+
+def sharper(a):
+ return sharp(sharp(a))
+
+
+def shapes(x, y, z, shape=0):
+ p = pi
+ if shape is 1:
+ # ring
+ x = x * p
+ y = y * p
+ s = cos(x**2 + y**2) / (x**2 + y**2 + 0.5)
+ elif shape is 2:
+ # swirl
+ x = x * p
+ y = y * p
+ s = ((x * sin(x * x + y * y) + y * cos(x * x + y * y)) / (x**2 + y**2 + 0.5))
+ elif shape is 3:
+ # bumps
+ x = x * p
+ y = y * p
+ z = z * p
+ s = 1 - ((cos(x * p) + cos(y * p) + cos(z * p)) - 0.5)
+ elif shape is 4:
+ # wave
+ x = x * p * 2
+ y = y * p * 2
+ s = sin(x + sin(y))
+ elif shape is 5:
+ # x grad.
+ s = (z * p)
+ elif shape is 6:
+ # y grad.
+ s = (y * p)
+ elif shape is 7:
+ # x grad.
+ s = (x * p)
+ else:
+ # marble default
+ s = ((x + y + z) * 5)
+ return s
+
+
+# marble_noise
+def marble_noise(x, y, z, origin, size, shape, bias, sharpnes, turb, depth, hard, basis, amp, freq):
+
+ s = shapes(x, y, z, shape)
+ x += origin[0]
+ y += origin[1]
+ z += origin[2]
+ value = s + turb * turbulence_vector((x, y, z), depth, hard, basis)[1]
+
+ if bias is 1:
+ value = cos_bias(value)
+ elif bias is 2:
+ value = tri_bias(value)
+ elif bias is 3:
+ value = saw_bias(value)
+ else:
+ value = sin_bias(value)
+
+ if sharpnes is 1:
+ value = 1.0 - sharp(value)
+ elif sharpnes is 2:
+ value = 1.0 - sharper(value)
+ elif sharpnes is 3:
+ value = soft(value)
+ elif sharpnes is 4:
+ value = sharp(value)
+ elif sharpnes is 5:
+ value = sharper(value)
+ else:
+ value = 1.0 - soft(value)
+
+ return value
+
+
+# vl_noise_turbulence:
+def vlnTurbMode(coords, distort, basis, vlbasis, hardnoise):
+ # hard noise
+ if hardnoise:
+ return (abs(-variable_lacunarity(coords, distort, basis, vlbasis)))
+ # soft noise
+ else:
+ return variable_lacunarity(coords, distort, basis, vlbasis)
+
+
+def vl_noise_turbulence(coords, distort, depth, basis, vlbasis, hardnoise, amp, freq):
+ x, y, z = coords
+ value = vlnTurbMode(coords, distort, basis, vlbasis, hardnoise)
+ i=0
+ for i in range(depth):
+ i+=1
+ value += vlnTurbMode((x * (freq * i), y * (freq * i), z * (freq * i)), distort, basis, vlbasis, hardnoise) * (amp * 0.5 / i)
+ return value
+
+
+## duo_multiFractal:
+def double_multiFractal(coords, H, lacunarity, octaves, offset, gain, basis, vlbasis):
+ x, y, z = coords
+ n1 = multi_fractal((x * 1.5 + 1, y * 1.5 + 1, z * 1.5 + 1), 1.0, 1.0, 1.0, basis) * (offset * 0.5)
+ n2 = multi_fractal((x - 1, y - 1, z - 1), H, lacunarity, octaves, vlbasis) * (gain * 0.5)
+ return (n1 * n1 + n2 * n2) * 0.5
+
+
+## distorted_heteroTerrain:
+def distorted_heteroTerrain(coords, H, lacunarity, octaves, offset, distort, basis, vlbasis):
+ x, y, z = coords
+ h1 = (hetero_terrain((x, y, z), 1.0, 2.0, 1.0, 1.0, basis) * 0.5)
+ d = h1 * distort
+ h2 = (hetero_terrain((x + d, y + d, z + d), H, lacunarity, octaves, offset, vlbasis) * 0.25)
+ return (h1 * h1 + h2 * h2) * 0.5
+
+
+## SlickRock:
+def slick_rock(coords, H, lacunarity, octaves, offset, gain, distort, basis, vlbasis):
+ x, y, z = coords
+ n = multi_fractal((x,y,z), 1.0, 2.0, 2.0, basis) * distort * 0.25
+ r = ridged_multi_fractal((x + n, y + n, z + n), H, lacunarity, octaves, offset + 0.1, gain * 2, vlbasis)
+ return (n + (n * r)) * 0.5
+
+
+## vlhTerrain
+def vl_hTerrain(coords, H, lacunarity, octaves, offset, basis, vlbasis, distort):
+ x, y, z = coords
+ ht = hetero_terrain((x, y, z), H, lacunarity, octaves, offset, basis ) * 0.25
+ vl = ht * variable_lacunarity((x, y, z), distort, basis, vlbasis) * 0.5 + 0.5
+ return vl * ht
+
+
+# another turbulence
+def ant_turbulence(coords, depth, hardnoise, nbasis, amp, freq, distortion):
+ x, y, z = coords
+ tv = turbulence_vector((x + 1, y + 2, z + 3), depth, hardnoise, nbasis, amp, freq)
+ d = (distortion * tv[0]) * 0.25
+ return (d + ((tv[0] - tv[1]) * (tv[2])**2))
+
+
+# shattered_hterrain:
+def shattered_hterrain(coords, H, lacunarity, octaves, offset, distort, basis):
+ x, y, z = coords
+ d = (turbulence_vector(coords, 6, 0, 0)[0] * 0.5 + 0.5) * distort * 0.5
+ t1 = (turbulence_vector((x + d, y + d, z + d), 0, 0, 7)[0] + 0.5)
+ t2 = (hetero_terrain((x * 2, y * 2, z * 2), H, lacunarity, octaves, offset, basis) * 0.5)
+ return ((t1 * t2) + t2 * 0.5) * 0.5
+
+
+# strata_hterrain
+def strata_hterrain(coords, H, lacunarity, octaves, offset, distort, basis):
+ x, y, z = coords
+ value = hetero_terrain((x, y, z), H, lacunarity, octaves, offset, basis) * 0.5
+ steps = (sin(value * (distort * 5) * pi) * (0.1 / (distort * 5) * pi))
+ return (value * (1.0 - 0.5) + steps * 0.5)
+
+
+# Planet Noise by: Farsthary
+# https://farsthary.com/2010/11/24/new-planet-procedural-texture/
+def planet_noise(coords, oct=6, hard=0, noisebasis=1, nabla=0.001):
+ x, y, z = coords
+ d = 0.001
+ offset = nabla * 1000
+ x = turbulence((x, y, z), oct, hard, noisebasis)
+ y = turbulence((x + offset, y, z), oct, hard, noisebasis)
+ z = turbulence((x, y + offset, z), oct, hard, noisebasis)
+ xdy = x - turbulence((x, y + d, z), oct, hard, noisebasis)
+ xdz = x - turbulence((x, y, z + d), oct, hard, noisebasis)
+ ydx = y - turbulence((x + d, y, z), oct, hard, noisebasis)
+ ydz = y - turbulence((x, y, z + d), oct, hard, noisebasis)
+ zdx = z - turbulence((x + d, y, z), oct, hard, noisebasis)
+ zdy = z - turbulence((x, y + d, z), oct, hard, noisebasis)
+ return (zdy - ydz), (zdx - xdz), (ydx - xdy)
+
+
+# ------------------------------------------------------------
+# landscape_gen
+def noise_gen(coords, props):
+
+ terrain_name = props[0]
+ cursor = props[1]
+ smooth = props[2]
+ triface = props[3]
+ sphere = props[4]
+ land_mat = props[5]
+ water_mat = props[6]
+ texture_name = props[7]
+ subd_x = props[8]
+ subd_y = props[9]
+ meshsize_x = props[10]
+ meshsize_y = props[11]
+ meshsize = props[12]
+ rseed = props[13]
+ x_offset = props[14]
+ y_offset = props[15]
+ z_offset = props[16]
+ size_x = props[17]
+ size_y = props[18]
+ size_z = props[19]
+ nsize = props[20]
+ ntype = props[21]
+ nbasis = int(props[22])
+ vlbasis = int(props[23])
+ distortion = props[24]
+ hardnoise = int(props[25])
+ depth = props[26]
+ amp = props[27]
+ freq = props[28]
+ dimension = props[29]
+ lacunarity = props[30]
+ offset = props[31]
+ gain = props[32]
+ marblebias = int(props[33])
+ marblesharpnes = int(props[34])
+ marbleshape = int(props[35])
+ height = props[36]
+ height_invert = props[37]
+ height_offset = props[38]
+ maximum = props[39]
+ minimum = props[40]
+ falloff = int(props[41])
+ edge_level = props[42]
+ falloffsize_x = props[43]
+ falloffsize_y = props[44]
+ stratatype = props[45]
+ strata = props[46]
+ addwater = props[47]
+ waterlevel = props[48]
+
+ x, y, z = coords
+
+ # Origin
+ if rseed is 0:
+ origin = x_offset, y_offset, z_offset
+ origin_x = x_offset
+ origin_y = y_offset
+ origin_z = z_offset
+ o_range = 1.0
+ else:
+ # Randomise origin
+ o_range = 10000.0
+ seed_set(rseed)
+ origin = random_unit_vector()
+ ox = (origin[0] * o_range)
+ oy = (origin[1] * o_range)
+ oz = (origin[2] * o_range)
+ origin_x = (ox - (ox / 2)) + x_offset
+ origin_y = (oy - (oy / 2)) + y_offset
+ origin_z = (oz - (oz / 2)) + z_offset
+
+ ncoords = (x / (nsize * size_x) + origin_x, y / (nsize * size_y) + origin_y, z / (nsize * size_z) + origin_z)
+
+ # Noise basis type's
+ if nbasis == 9:
+ nbasis = 14 # Cellnoise
+ if vlbasis == 9:
+ vlbasis = 14
+
+ # Noise type's
+ if ntype in [0, 'multi_fractal']:
+ value = multi_fractal(ncoords, dimension, lacunarity, depth, nbasis) * 0.5
+
+ elif ntype in [1, 'ridged_multi_fractal']:
+ value = ridged_multi_fractal(ncoords, dimension, lacunarity, depth, offset, gain, nbasis) * 0.5
+
+ elif ntype in [2, 'hybrid_multi_fractal']:
+ value = hybrid_multi_fractal(ncoords, dimension, lacunarity, depth, offset, gain, nbasis) * 0.5
+
+ elif ntype in [3, 'hetero_terrain']:
+ value = hetero_terrain(ncoords, dimension, lacunarity, depth, offset, nbasis) * 0.25
+
+ elif ntype in [4, 'fractal']:
+ value = fractal(ncoords, dimension, lacunarity, depth, nbasis)
+
+ elif ntype in [5, 'turbulence_vector']:
+ value = turbulence_vector(ncoords, depth, hardnoise, nbasis, amp, freq)[0]
+
+ elif ntype in [6, 'variable_lacunarity']:
+ value = variable_lacunarity(ncoords, distortion, nbasis, vlbasis)
+
+ elif ntype in [7, 'marble_noise']:
+ value = marble_noise(
+ (ncoords[0] - origin_x + x_offset),
+ (ncoords[1] - origin_y + y_offset),
+ (ncoords[2] - origin_z + z_offset),
+ (origin[0] + x_offset, origin[1] + y_offset, origin[2] + z_offset), nsize,
+ marbleshape, marblebias, marblesharpnes,
+ distortion, depth, hardnoise, nbasis, amp, freq
+ )
+ elif ntype in [8, 'shattered_hterrain']:
+ value = shattered_hterrain(ncoords, dimension, lacunarity, depth, offset, distortion, nbasis)
+
+ elif ntype in [9, 'strata_hterrain']:
+ value = strata_hterrain(ncoords, dimension, lacunarity, depth, offset, distortion, nbasis)
+
+ elif ntype in [10, 'ant_turbulence']:
+ value = ant_turbulence(ncoords, depth, hardnoise, nbasis, amp, freq, distortion)
+
+ elif ntype in [11, 'vl_noise_turbulence']:
+ value = vl_noise_turbulence(ncoords, distortion, depth, nbasis, vlbasis, hardnoise, amp, freq)
+
+ elif ntype in [12, 'vl_hTerrain']:
+ value = vl_hTerrain(ncoords, dimension, lacunarity, depth, offset, nbasis, vlbasis, distortion)
+
+ elif ntype in [13, 'distorted_heteroTerrain']:
+ value = distorted_heteroTerrain(ncoords, dimension, lacunarity, depth, offset, distortion, nbasis, vlbasis)
+
+ elif ntype in [14, 'double_multiFractal']:
+ value = double_multiFractal(ncoords, dimension, lacunarity, depth, offset, gain, nbasis, vlbasis)
+
+ elif ntype in [15, 'slick_rock']:
+ value = slick_rock(ncoords,dimension, lacunarity, depth, offset, gain, distortion, nbasis, vlbasis)
+
+ elif ntype in [16, 'planet_noise']:
+ value = planet_noise(ncoords, depth, hardnoise, nbasis)[2] * 0.5 + 0.5
+
+ elif ntype in [17, 'blender_texture']:
+ if texture_name != "" and texture_name in bpy.data.textures:
+ value = bpy.data.textures[texture_name].evaluate(ncoords)[3]
+ else:
+ value = 0.0
+ else:
+ value = 0.5
+
+ # Adjust height
+ if height_invert:
+ value = (1.0 - value) * height + height_offset
+ else:
+ value = value * height + height_offset
+
+ # Edge falloff:
+ if not sphere:
+ if falloff:
+ ratio_x, ratio_y = abs(x) * 2 / meshsize_x, abs(y) * 2 / meshsize_y
+ fallofftypes = [0,
+ sqrt(ratio_y**falloffsize_y),
+ sqrt(ratio_x**falloffsize_x),
+ sqrt(ratio_x**falloffsize_x + ratio_y**falloffsize_y)
+ ]
+ dist = fallofftypes[falloff]
+ value -= edge_level
+ if(dist < 1.0):
+ dist = (dist * dist * (3 - 2 * dist))
+ value = (value - value * dist) + edge_level
+ else:
+ value = edge_level
+
+ # Strata / terrace / layers
+ if stratatype not in [0, "0"]:
+ if stratatype in [1, "1"]:
+ strata = strata / height
+ strata *= 2
+ steps = (sin(value * strata * pi) * (0.1 / strata * pi))
+ value = (value * 0.5 + steps * 0.5) * 2.0
+
+ elif stratatype in [2, "2"]:
+ strata = strata / height
+ steps = -abs(sin(value * strata * pi) * (0.1 / strata * pi))
+ value = (value * 0.5 + steps * 0.5) * 2.0
+
+ elif stratatype in [3, "3"]:
+ strata = strata / height
+ steps = abs(sin(value * strata * pi) * (0.1 / strata * pi))
+ value = (value * 0.5 + steps * 0.5) * 2.0
+
+ elif stratatype in [4, "4"]:
+ strata = strata / height
+ value = int( value * strata ) * 1.0 / strata
+
+ elif stratatype in [5, "5"]:
+ strata = strata / height
+ steps = (int( value * strata ) * 1.0 / strata)
+ value = (value * (1.0 - 0.5) + steps * 0.5)
+
+ # Clamp height min max
+ if (value < minimum):
+ value = minimum
+ if (value > maximum):
+ value = maximum
+
+ return value
+
+
+# ------------------------------------------------------------
+# draw properties
+
+def draw_ant_refresh(self, context):
+ layout = self.layout
+ if self.auto_refresh is False:
+ self.refresh = False
+ elif self.auto_refresh is True:
+ self.refresh = True
+ row = layout.box().row()
+ split = row.split()
+ split.scale_y = 1.5
+ split.prop(self, "auto_refresh", toggle=True, icon_only=True, icon='AUTO')
+ split.prop(self, "refresh", toggle=True, icon_only=True, icon='FILE_REFRESH')
+
+
+def draw_ant_main(self, context, generate=True):
+ layout = self.layout
+ box = layout.box()
+ box.prop(self, "show_main_settings", toggle=True)
+ if self.show_main_settings:
+ if generate:
+ row = box.row(align=True)
+ split = row.split(align=True)
+ split.prop(self, "at_cursor", toggle=True, icon_only=True, icon='CURSOR')
+ split.prop(self, "smooth_mesh", toggle=True, icon_only=True, icon='SOLID')
+ split.prop(self, "tri_face", toggle=True, icon_only=True, icon='MESH_DATA')
+
+ if not self.sphere_mesh:
+ row = box.row(align=True)
+ row.prop(self, "sphere_mesh", toggle=True)
+ else:
+ row = box.row(align=True)
+ split = row.split(0.5, align=True)
+ split.prop(self, "sphere_mesh", toggle=True)
+ split.prop(self, "remove_double", toggle=True)
+
+ box.prop(self, "ant_terrain_name")
+ box.prop_search(self, "land_material", bpy.data, "materials")
+
+ col = box.column(align=True)
+ col.prop(self, "subdivision_x")
+ col.prop(self, "subdivision_y")
+ col = box.column(align=True)
+ if self.sphere_mesh:
+ col.prop(self, "mesh_size")
+ else:
+ col.prop(self, "mesh_size_x")
+ col.prop(self, "mesh_size_y")
+
+
+def draw_ant_noise(self, context):
+ layout = self.layout
+ box = layout.box()
+ box.prop(self, "show_noise_settings", toggle=True)
+ if self.show_noise_settings:
+ box.prop(self, "noise_type")
+ if self.noise_type == "blender_texture":
+ box.prop_search(self, "texture_block", bpy.data, "textures")
+ else:
+ box.prop(self, "basis_type")
+
+ col = box.column(align=True)
+ col.prop(self, "random_seed")
+ col = box.column(align=True)
+ col.prop(self, "noise_offset_x")
+ col.prop(self, "noise_offset_y")
+ col.prop(self, "noise_offset_z")
+ col.prop(self, "noise_size_x")
+ col.prop(self, "noise_size_y")
+ col.prop(self, "noise_size_z")
+ col = box.column(align=True)
+ col.prop(self, "noise_size")
+
+ col = box.column(align=True)
+ if self.noise_type == "multi_fractal":
+ col.prop(self, "noise_depth")
+ col.prop(self, "dimension")
+ col.prop(self, "lacunarity")
+ elif self.noise_type == "ridged_multi_fractal":
+ col.prop(self, "noise_depth")
+ col.prop(self, "dimension")
+ col.prop(self, "lacunarity")
+ col.prop(self, "offset")
+ col.prop(self, "gain")
+ elif self.noise_type == "hybrid_multi_fractal":
+ col.prop(self, "noise_depth")
+ col.prop(self, "dimension")
+ col.prop(self, "lacunarity")
+ col.prop(self, "offset")
+ col.prop(self, "gain")
+ elif self.noise_type == "hetero_terrain":
+ col.prop(self, "noise_depth")
+ col.prop(self, "dimension")
+ col.prop(self, "lacunarity")
+ col.prop(self, "offset")
+ elif self.noise_type == "fractal":
+ col.prop(self, "noise_depth")
+ col.prop(self, "dimension")
+ col.prop(self, "lacunarity")
+ elif self.noise_type == "turbulence_vector":
+ col.prop(self, "noise_depth")
+ col.prop(self, "amplitude")
+ col.prop(self, "frequency")
+ col.separator()
+ row = col.row(align=True)
+ row.prop(self, "hard_noise", expand=True)
+ elif self.noise_type == "variable_lacunarity":
+ box.prop(self, "vl_basis_type")
+ box.prop(self, "distortion")
+ elif self.noise_type == "marble_noise":
+ box.prop(self, "marble_shape")
+ box.prop(self, "marble_bias")
+ box.prop(self, "marble_sharp")
+ col = box.column(align=True)
+ col.prop(self, "distortion")
+ col.prop(self, "noise_depth")
+ col.separator()
+ row = col.row(align=True)
+ row.prop(self, "hard_noise", expand=True)
+ elif self.noise_type == "shattered_hterrain":
+ col.prop(self, "noise_depth")
+ col.prop(self, "dimension")
+ col.prop(self, "lacunarity")
+ col.prop(self, "offset")
+ col.prop(self, "distortion")
+ elif self.noise_type == "strata_hterrain":
+ col.prop(self, "noise_depth")
+ col.prop(self, "dimension")
+ col.prop(self, "lacunarity")
+ col.prop(self, "offset")
+ col.prop(self, "distortion", text="Strata")
+ elif self.noise_type == "ant_turbulence":
+ col.prop(self, "noise_depth")
+ col.prop(self, "amplitude")
+ col.prop(self, "frequency")
+ col.prop(self, "distortion")
+ col.separator()
+ row = col.row(align=True)
+ row.prop(self, "hard_noise", expand=True)
+ elif self.noise_type == "vl_noise_turbulence":
+ col.prop(self, "noise_depth")
+ col.prop(self, "amplitude")
+ col.prop(self, "frequency")
+ col.prop(self, "distortion")
+ col.separator()
+ col.prop(self, "vl_basis_type")
+ col.separator()
+ row = col.row(align=True)
+ row.prop(self, "hard_noise", expand=True)
+ elif self.noise_type == "vl_hTerrain":
+ col.prop(self, "noise_depth")
+ col.prop(self, "dimension")
+ col.prop(self, "lacunarity")
+ col.prop(self, "offset")
+ col.prop(self, "distortion")
+ col.separator()
+ col.prop(self, "vl_basis_type")
+ elif self.noise_type == "distorted_heteroTerrain":
+ col.prop(self, "noise_depth")
+ col.prop(self, "dimension")
+ col.prop(self, "lacunarity")
+ col.prop(self, "offset")
+ col.prop(self, "distortion")
+ col.separator()
+ col.prop(self, "vl_basis_type")
+ elif self.noise_type == "double_multiFractal":
+ col.prop(self, "noise_depth")
+ col.prop(self, "dimension")
+ col.prop(self, "lacunarity")
+ col.prop(self, "offset")
+ col.prop(self, "gain")
+ col.separator()
+ col.prop(self, "vl_basis_type")
+ elif self.noise_type == "slick_rock":
+ col.prop(self, "noise_depth")
+ col.prop(self, "dimension")
+ col.prop(self, "lacunarity")
+ col.prop(self, "gain")
+ col.prop(self, "offset")
+ col.prop(self, "distortion")
+ col.separator()
+ col.prop(self, "vl_basis_type")
+ elif self.noise_type == "planet_noise":
+ col.prop(self, "noise_depth")
+ col.separator()
+ row = col.row(align=True)
+ row.prop(self, "hard_noise", expand=True)
+
+
+def draw_ant_displace(self, context, generate=True):
+ layout = self.layout
+ box = layout.box()
+ box.prop(self, "show_displace_settings", toggle=True)
+ if self.show_displace_settings:
+ col = box.column(align=True)
+ row = col.row(align=True).split(0.92, align=True)
+ row.prop(self, "height")
+ row.prop(self, "height_invert", toggle=True, text="", icon='ARROW_LEFTRIGHT')
+ col.prop(self, "height_offset")
+ col.prop(self, "maximum")
+ col.prop(self, "minimum")
+ if generate:
+ if not self.sphere_mesh:
+ col = box.column()
+ col.prop(self, "edge_falloff")
+ if self.edge_falloff is not "0":
+ col = box.column(align=True)
+ col.prop(self, "edge_level")
+ if self.edge_falloff in ["2", "3"]:
+ col.prop(self, "falloff_x")
+ if self.edge_falloff in ["1", "3"]:
+ col.prop(self, "falloff_y")
+ else:
+ col = box.column(align=False)
+ col.prop(self, "use_vgroup", toggle=True)
+
+ col = box.column()
+ col.prop(self, "strata_type")
+ if self.strata_type is not "0":
+ col = box.column()
+ col.prop(self, "strata")
+
+
+def draw_ant_water(self, context):
+ layout = self.layout
+ box = layout.box()
+ col = box.column()
+ col.prop(self, "water_plane", toggle=True)
+ if self.water_plane:
+ col = box.column(align=True)
+ col.prop_search(self, "water_material", bpy.data, "materials")
+ col = box.column()
+ col.prop(self, "water_level")
+
+
+# Store propereties
+def store_properties(operator, ob):
+ ob.ant_landscape.ant_terrain_name = operator.ant_terrain_name
+ ob.ant_landscape.at_cursor = operator.at_cursor
+ ob.ant_landscape.smooth_mesh = operator.smooth_mesh
+ ob.ant_landscape.tri_face = operator.tri_face
+ ob.ant_landscape.sphere_mesh = operator.sphere_mesh
+ ob.ant_landscape.land_material = operator.land_material
+ ob.ant_landscape.water_material = operator.water_material
+ ob.ant_landscape.texture_block = operator.texture_block
+ ob.ant_landscape.subdivision_x = operator.subdivision_x
+ ob.ant_landscape.subdivision_y = operator.subdivision_y
+ ob.ant_landscape.mesh_size_x = operator.mesh_size_x
+ ob.ant_landscape.mesh_size_y = operator.mesh_size_y
+ ob.ant_landscape.mesh_size = operator.mesh_size
+ ob.ant_landscape.random_seed = operator.random_seed
+ ob.ant_landscape.noise_offset_x = operator.noise_offset_x
+ ob.ant_landscape.noise_offset_y = operator.noise_offset_y
+ ob.ant_landscape.noise_offset_z = operator.noise_offset_z
+ ob.ant_landscape.noise_size_x = operator.noise_size_x
+ ob.ant_landscape.noise_size_y = operator.noise_size_y
+ ob.ant_landscape.noise_size_z = operator.noise_size_z
+ ob.ant_landscape.noise_size = operator.noise_size
+ ob.ant_landscape.noise_type = operator.noise_type
+ ob.ant_landscape.basis_type = operator.basis_type
+ ob.ant_landscape.vl_basis_type = operator.vl_basis_type
+ ob.ant_landscape.distortion = operator.distortion
+ ob.ant_landscape.hard_noise = operator.hard_noise
+ ob.ant_landscape.noise_depth = operator.noise_depth
+ ob.ant_landscape.amplitude = operator.amplitude
+ ob.ant_landscape.frequency = operator.frequency
+ ob.ant_landscape.dimension = operator.dimension
+ ob.ant_landscape.lacunarity = operator.lacunarity
+ ob.ant_landscape.offset = operator.offset
+ ob.ant_landscape.gain = operator.gain
+ ob.ant_landscape.marble_bias = operator.marble_bias
+ ob.ant_landscape.marble_sharp = operator.marble_sharp
+ ob.ant_landscape.marble_shape = operator.marble_shape
+ ob.ant_landscape.height = operator.height
+ ob.ant_landscape.height_invert = operator.height_invert
+ ob.ant_landscape.height_offset = operator.height_offset
+ ob.ant_landscape.maximum = operator.maximum
+ ob.ant_landscape.minimum = operator.minimum
+ ob.ant_landscape.edge_falloff = operator.edge_falloff
+ ob.ant_landscape.edge_level = operator.edge_level
+ ob.ant_landscape.falloff_x = operator.falloff_x
+ ob.ant_landscape.falloff_y = operator.falloff_y
+ ob.ant_landscape.strata_type = operator.strata_type
+ ob.ant_landscape.strata = operator.strata
+ ob.ant_landscape.water_plane = operator.water_plane
+ ob.ant_landscape.water_level = operator.water_level
+ ob.ant_landscape.use_vgroup = operator.use_vgroup
+ ob.ant_landscape.show_main_settings = operator.show_main_settings
+ ob.ant_landscape.show_noise_settings = operator.show_noise_settings
+ ob.ant_landscape.show_displace_settings = operator.show_displace_settings
+ #print("A.N.T. Landscape Object Properties:")
+ #for k in ob.ant_landscape.keys():
+ # print(k, "-", ob.ant_landscape[k])
+ return ob
+
diff --git a/ant_landscape/ant_landscape_refresh.py b/ant_landscape/ant_landscape_refresh.py
new file mode 100644
index 00000000..ae3710de
--- /dev/null
+++ b/ant_landscape/ant_landscape_refresh.py
@@ -0,0 +1,243 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# Another Noise Tool - Landscape Redraw - Regenerate
+# Jim Hazevoet
+
+
+# ------------------------------------------------------------
+# import modules
+import bpy
+
+from .ant_functions import (
+ noise_gen,
+ grid_gen,
+ sphere_gen,
+ create_mesh_object,
+ store_properties,
+ )
+
+# ------------------------------------------------------------
+# Do refresh - redraw
+class AntLandscapeRefresh(bpy.types.Operator):
+ bl_idname = "mesh.ant_landscape_refresh"
+ bl_label = "Refresh"
+ bl_description = "Refresh landscape with current settings"
+ bl_options = {'REGISTER', 'UNDO'}
+
+
+ @classmethod
+ def poll(cls, context):
+ ob = bpy.context.active_object
+ return (ob.ant_landscape and not ob.ant_landscape['sphere_mesh'])
+
+
+ def execute(self, context):
+ # turn off undo
+ undo = bpy.context.user_preferences.edit.use_global_undo
+ bpy.context.user_preferences.edit.use_global_undo = False
+
+ # ant object items
+ obj = bpy.context.active_object
+
+ bpy.ops.object.mode_set(mode = 'EDIT')
+ bpy.ops.object.mode_set(mode = 'OBJECT')
+
+
+ if obj and obj.ant_landscape.keys():
+ obi = obj.ant_landscape.items()
+ #print("Refresh A.N.T. Landscape Grid")
+ #for k in obi.keys():
+ # print(k, "-", obi[k])
+ prop = []
+ for i in range(len(obi)):
+ prop.append(obi[i][1])
+
+ # redraw verts
+ mesh = obj.data
+ for v in mesh.vertices:
+ v.co[2] = 0
+ v.co[2] = noise_gen(v.co, prop)
+ mesh.update()
+ else:
+ pass
+
+ # restore pre operator undo state
+ context.user_preferences.edit.use_global_undo = undo
+
+ return {'FINISHED'}
+
+
+# ------------------------------------------------------------
+# Do regenerate
+class AntLandscapeRegenerate(bpy.types.Operator):
+ bl_idname = "mesh.ant_landscape_regenerate"
+ bl_label = "Regenerate"
+ bl_description = "Regenerate landscape with current settings"
+ bl_options = {'REGISTER', 'UNDO'}
+
+
+ @classmethod
+ def poll(cls, context):
+ return bpy.context.active_object.ant_landscape
+
+
+ def execute(self, context):
+
+ # turn off undo
+ undo = bpy.context.user_preferences.edit.use_global_undo
+ bpy.context.user_preferences.edit.use_global_undo = False
+
+ scene = bpy.context.scene
+ # ant object items
+ obj = bpy.context.active_object
+
+ if obj and obj.ant_landscape.keys():
+ ob = obj.ant_landscape
+ obi = ob.items()
+ #print("Regenerate A.N.T. Landscape Grid")
+ #for k in obi.keys():
+ # print(k, "-", obi[k])
+ ant_props = []
+ for i in range(len(obi)):
+ ant_props.append(obi[i][1])
+
+ new_name = ob.ant_terrain_name
+
+ # Main function, create landscape mesh object
+ if ob["sphere_mesh"]:
+ # sphere
+ verts, faces = sphere_gen(
+ ob["subdivision_y"],
+ ob["subdivision_x"],
+ ob["tri_face"],
+ ob["mesh_size"],
+ ant_props,
+ False,
+ 0.0
+ )
+ new_ob = create_mesh_object(context, verts, [], faces, new_name).object
+ else:
+ # grid
+ verts, faces = grid_gen(
+ ob["subdivision_x"],
+ ob["subdivision_y"],
+ ob["tri_face"],
+ ob["mesh_size_x"],
+ ob["mesh_size_y"],
+ ant_props,
+ False,
+ 0.0
+ )
+ new_ob = create_mesh_object(context, verts, [], faces, new_name).object
+
+ new_ob.select = True
+
+ if ob["smooth_mesh"]:
+ bpy.ops.object.shade_smooth()
+
+ # Landscape Material
+ if ob["land_material"] != "" and ob["land_material"] in bpy.data.materials:
+ mat = bpy.data.materials[ob["land_material"]]
+ bpy.context.object.data.materials.append(mat)
+
+ # Water plane
+ if ob["water_plane"]:
+ if ob["sphere_mesh"]:
+ # sphere
+ verts, faces = sphere_gen(
+ ob["subdivision_y"],
+ ob["subdivision_x"],
+ ob["tri_face"],
+ ob["mesh_size"],
+ ant_props,
+ ob["water_plane"],
+ ob["water_level"]
+ )
+ wobj = create_mesh_object(context, verts, [], faces, new_name+"_plane").object
+ else:
+ # grid
+ verts, faces = grid_gen(
+ 2,
+ 2,
+ ob["tri_face"],
+ ob["mesh_size_x"],
+ ob["mesh_size_y"],
+ ant_props,
+ ob["water_plane"],
+ ob["water_level"]
+ )
+ wobj = create_mesh_object(context, verts, [], faces, new_name+"_plane").object
+
+ wobj.select = True
+
+ if ob["smooth_mesh"]:
+ bpy.ops.object.shade_smooth()
+
+ # Water Material
+ if ob["water_material"] != "" and ob["water_material"] in bpy.data.materials:
+ mat = bpy.data.materials[ob["water_material"]]
+ bpy.context.object.data.materials.append(mat)
+
+ # Loc Rot Scale
+ if ob["water_plane"]:
+ wobj.location = obj.location
+ wobj.rotation_euler = obj.rotation_euler
+ wobj.scale = obj.scale
+ wobj.select = False
+
+
+ new_ob.location = obj.location
+ new_ob.rotation_euler = obj.rotation_euler
+ new_ob.scale = obj.scale
+
+ # Store props
+ new_ob = store_properties(ob, new_ob)
+
+ # Delete old object
+ new_ob.select = False
+
+ obj.select = True
+ scene.objects.active = obj
+ bpy.ops.object.delete(use_global=False)
+ #scene.update()
+
+ # Select landscape and make active
+ new_ob.select = True
+ scene.objects.active = new_ob
+
+ # restore pre operator undo state
+ context.user_preferences.edit.use_global_undo = undo
+
+ return {'FINISHED'}
+
+'''
+# ------------------------------------------------------------
+# Register:
+
+def register():
+ bpy.utils.register_module(__name__)
+
+
+def unregister():
+ bpy.utils.unregister_module(__name__)
+
+
+if __name__ == "__main__":
+ register()
+''' \ No newline at end of file
diff --git a/ant_landscape/mesh_ant_displace.py b/ant_landscape/mesh_ant_displace.py
new file mode 100644
index 00000000..7a1c17ea
--- /dev/null
+++ b/ant_landscape/mesh_ant_displace.py
@@ -0,0 +1,562 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# Another Noise Tool - Mesh Displace
+# Jim Hazevoet
+
+# ------------------------------------------------------------
+# import modules
+import bpy
+from bpy.props import (
+ BoolProperty,
+ EnumProperty,
+ FloatProperty,
+ IntProperty,
+ StringProperty,
+ FloatVectorProperty,
+ )
+
+from .ant_functions import (
+ noise_gen,
+ draw_ant_refresh,
+ draw_ant_noise,
+ draw_ant_displace,
+ )
+
+# ------------------------------------------------------------
+# Do vert displacement
+class AntMeshDisplace(bpy.types.Operator):
+ bl_idname = "mesh.ant_displace"
+ bl_label = "Another Noise Tool - Displace"
+ bl_description = "Displace mesh vertices"
+ bl_options = {'REGISTER', 'UNDO', 'PRESET'}
+
+ ant_terrain_name = StringProperty(
+ name="Name",
+ default="Landscape"
+ )
+ land_material = StringProperty(
+ name='Material',
+ default="",
+ description="Terrain material"
+ )
+ water_material = StringProperty(
+ name='Material',
+ default="",
+ description="Water plane material"
+ )
+ texture_block = StringProperty(
+ name="Texture",
+ default=""
+ )
+ at_cursor = BoolProperty(
+ name="Cursor",
+ default=True,
+ description="Place at cursor location",
+ )
+ smooth_mesh = BoolProperty(
+ name="Smooth",
+ default=True,
+ description="Shade smooth"
+ )
+ tri_face = BoolProperty(
+ name="Triangulate",
+ default=False,
+ description="Triangulate faces"
+ )
+ sphere_mesh = BoolProperty(
+ name="Sphere",
+ default=False,
+ description="Generate uv sphere - remove doubles when ready"
+ )
+ subdivision_x = IntProperty(
+ name="Subdivisions X",
+ default=128,
+ min=4,
+ max=6400,
+ description="Mesh X subdivisions"
+ )
+ subdivision_y = IntProperty(
+ default=128,
+ name="Subdivisions Y",
+ min=4,
+ max=6400,
+ description="Mesh Y subdivisions"
+ )
+ mesh_size = FloatProperty(
+ default=2.0,
+ name="Mesh Size",
+ min=0.01,
+ max=100000.0,
+ description="Mesh size"
+ )
+ mesh_size_x = FloatProperty(
+ default=2.0,
+ name="Mesh Size X",
+ min=0.01,
+ description="Mesh x size"
+ )
+ mesh_size_y = FloatProperty(
+ name="Mesh Size Y",
+ default=2.0,
+ min=0.01,
+ description="Mesh y size"
+ )
+
+ random_seed = IntProperty(
+ name="Random Seed",
+ default=0,
+ min=0,
+ description="Randomize noise origin"
+ )
+ noise_offset_x = FloatProperty(
+ name="Offset X",
+ default=0.0,
+ description="Noise X Offset"
+ )
+ noise_offset_y = FloatProperty(
+ name="Offset Y",
+ default=0.0,
+ description="Noise Y Offset"
+ )
+ noise_offset_z = FloatProperty(
+ name="Offset Z",
+ default=0.0,
+ description="Noise Z Offset"
+ )
+ noise_size_x = FloatProperty(
+ default=1.0,
+ name="Size X",
+ min=0.01,
+ max=1000.0,
+ description="Noise x size"
+ )
+ noise_size_y = FloatProperty(
+ name="Size Y",
+ default=1.0,
+ min=0.01,
+ max=1000.0,
+ description="Noise y size"
+ )
+ noise_size_z = FloatProperty(
+ name="Size Z",
+ default=1.0,
+ min=0.01,
+ max=1000.0,
+ description="Noise Z size"
+ )
+ noise_size = FloatProperty(
+ name="Noise Size",
+ default=1.0,
+ min=0.01,
+ max=1000.0,
+ description="Noise size"
+ )
+ noise_type = EnumProperty(
+ name="Noise Type",
+ default='hetero_terrain',
+ description="Noise type",
+ items = [
+ ('multi_fractal', "Multi Fractal", "Blender: Multi Fractal algorithm", 0),
+ ('ridged_multi_fractal', "Ridged MFractal", "Blender: Ridged Multi Fractal", 1),
+ ('hybrid_multi_fractal', "Hybrid MFractal", "Blender: Hybrid Multi Fractal", 2),
+ ('hetero_terrain', "Hetero Terrain", "Blender: Hetero Terrain", 3),
+ ('fractal', "fBm Fractal", "Blender: fBm - Fractional Browninian motion", 4),
+ ('turbulence_vector', "Turbulence", "Blender: Turbulence Vector", 5),
+ ('variable_lacunarity', "Distorted Noise", "Blender: Distorted Noise", 6),
+ ('marble_noise', "Marble", "A.N.T.: Marble Noise", 7),
+ ('shattered_hterrain', "Shattered hTerrain", "A.N.T.: Shattered hTerrain", 8),
+ ('strata_hterrain', "Strata hTerrain", "A.N.T: Strata hTerrain", 9),
+ ('ant_turbulence', "Another Turbulence", "A.N.T: Turbulence variation", 10),
+ ('vl_noise_turbulence', "vlNoise turbulence", "A.N.T: vlNoise turbulence", 11),
+ ('vl_hTerrain', "vlNoise hTerrain", "A.N.T: vlNoise hTerrain", 12),
+ ('distorted_heteroTerrain', "Distorted hTerrain", "A.N.T distorted hTerrain", 13),
+ ('double_multiFractal', "Double MultiFractal", "A.N.T: double multiFractal", 14),
+ ('slick_rock', "Slick Rock", "A.N.T: slick rock", 15),
+ ('planet_noise', "Planet Noise", "Planet Noise by: Farsthary", 16),
+ ('blender_texture', "Blender Texture - Texture Nodes", "Blender texture data block", 17)]
+ )
+ basis_type = EnumProperty(
+ name="Noise Basis",
+ default="0",
+ description="Noise basis algorithms",
+ items = [
+ ("0", "Blender", "Blender default noise", 0),
+ ("1", "Perlin", "Perlin noise", 1),
+ ("2", "New Perlin", "New Perlin noise", 2),
+ ("3", "Voronoi F1", "Voronoi F1", 3),
+ ("4", "Voronoi F2", "Voronoi F2", 4),
+ ("5", "Voronoi F3", "Voronoi F3", 5),
+ ("6", "Voronoi F4", "Voronoi F4", 6),
+ ("7", "Voronoi F2-F1", "Voronoi F2-F1", 7),
+ ("8", "Voronoi Crackle", "Voronoi Crackle", 8),
+ ("9", "Cell Noise", "Cell noise", 9)]
+ )
+ vl_basis_type = EnumProperty(
+ name="vlNoise Basis",
+ default="0",
+ description="VLNoise basis algorithms",
+ items = [
+ ("0", "Blender", "Blender default noise", 0),
+ ("1", "Perlin", "Perlin noise", 1),
+ ("2", "New Perlin", "New Perlin noise", 2),
+ ("3", "Voronoi F1", "Voronoi F1", 3),
+ ("4", "Voronoi F2", "Voronoi F2", 4),
+ ("5", "Voronoi F3", "Voronoi F3", 5),
+ ("6", "Voronoi F4", "Voronoi F4", 6),
+ ("7", "Voronoi F2-F1", "Voronoi F2-F1", 7),
+ ("8", "Voronoi Crackle", "Voronoi Crackle", 8),
+ ("9", "Cell Noise", "Cell noise", 9)]
+ )
+ distortion = FloatProperty(
+ name="Distortion",
+ default=1.0,
+ min=0.01,
+ max=100.0,
+ description="Distortion amount"
+ )
+ hard_noise = EnumProperty(
+ name="Soft Hard",
+ default="0",
+ description="Soft Noise, Hard noise",
+ items = [
+ ("0", "Soft", "Soft Noise", 0),
+ ("1", "Hard", "Hard noise", 1)]
+ )
+ noise_depth = IntProperty(
+ name="Depth",
+ default=8,
+ min=0,
+ max=16,
+ description="Noise Depth - number of frequencies in the fBm"
+ )
+ amplitude = FloatProperty(
+ name="Amp",
+ default=0.5,
+ min=0.01,
+ max=1.0,
+ description="Amplitude"
+ )
+ frequency = FloatProperty(
+ name="Freq",
+ default=2.0,
+ min=0.01,
+ max=5.0,
+ description="Frequency"
+ )
+ dimension = FloatProperty(
+ name="Dimension",
+ default=1.0,
+ min=0.01,
+ max=2.0,
+ description="H - fractal dimension of the roughest areas"
+ )
+ lacunarity = FloatProperty(
+ name="Lacunarity",
+ min=0.01,
+ max=6.0,
+ default=2.0,
+ description="Lacunarity - gap between successive frequencies"
+ )
+ offset = FloatProperty(
+ name="Offset",
+ default=1.0,
+ min=0.01,
+ max=6.0,
+ description="Offset - raises the terrain from sea level"
+ )
+ gain = FloatProperty(
+ name="Gain",
+ default=1.0,
+ min=0.01,
+ max=6.0,
+ description="Gain - scale factor"
+ )
+ marble_bias = EnumProperty(
+ name="Bias",
+ default="0",
+ description="Marble bias",
+ items = [
+ ("0", "Sin", "Sin", 0),
+ ("1", "Cos", "Cos", 1),
+ ("2", "Tri", "Tri", 2),
+ ("3", "Saw", "Saw", 3)]
+ )
+ marble_sharp = EnumProperty(
+ name="Sharp",
+ default="0",
+ description="Marble sharpness",
+ items = [
+ ("0", "Soft", "Soft", 0),
+ ("1", "Sharp", "Sharp", 1),
+ ("2", "Sharper", "Sharper", 2),
+ ("3", "Soft inv.", "Soft", 3),
+ ("4", "Sharp inv.", "Sharp", 4),
+ ("5", "Sharper inv.", "Sharper", 5)]
+ )
+ marble_shape = EnumProperty(
+ name="Shape",
+ default="0",
+ description="Marble shape",
+ items= [
+ ("0", "Default", "Default", 0),
+ ("1", "Ring", "Ring", 1),
+ ("2", "Swirl", "Swirl", 2),
+ ("3", "Bump", "Bump", 3),
+ ("4", "Wave", "Wave", 4),
+ ("5", "Z", "Z", 5),
+ ("6", "Y", "Y", 6),
+ ("7", "X", "X", 7)]
+ )
+ height = FloatProperty(
+ name="Height",
+ default=0.5,
+ min=-10000.0,
+ max=10000.0,
+ description="Noise intensity scale"
+ )
+ height_invert = BoolProperty(
+ name="Invert",
+ default=False,
+ description="Height invert",
+ )
+ height_offset = FloatProperty(
+ name="Offset",
+ default=0.0,
+ min=-10000.0,
+ max=10000.0,
+ description="Height offset"
+ )
+ edge_falloff = EnumProperty(
+ name="Falloff",
+ default="0",
+ description="Flatten edges",
+ items = [
+ ("0", "None", "None", 0),
+ ("1", "Y", "Y Falloff", 1),
+ ("2", "X", "X Falloff", 2),
+ ("3", "X Y", "X Y Falloff", 3)]
+ )
+ falloff_x = FloatProperty(
+ name="Falloff X",
+ default=4.0,
+ min=0.1,
+ max=100.0,
+ description="Falloff x scale"
+ )
+ falloff_y = FloatProperty(
+ name="Falloff Y",
+ default=4.0,
+ min=0.1,
+ max=100.0,
+ description="Falloff y scale"
+ )
+ edge_level = FloatProperty(
+ name="Edge Level",
+ default=0.0,
+ min=-10000.0,
+ max=10000.0,
+ description="Edge level, sealevel offset"
+ )
+ maximum = FloatProperty(
+ name="Maximum",
+ default=1.0,
+ min=-10000.0,
+ max=10000.0,
+ description="Maximum, flattens terrain at plateau level"
+ )
+ minimum = FloatProperty(
+ name="Minimum",
+ default=-1.0,
+ min=-10000.0,
+ max=10000.0,
+ description="Minimum, flattens terrain at seabed level"
+ )
+ use_vgroup = BoolProperty(
+ name="Vertex Group Weight",
+ default=False,
+ description="Use active vertex group weight"
+ )
+ strata = FloatProperty(
+ name="Amount",
+ default=5.0,
+ min=0.01,
+ max=1000.0,
+ description="Strata layers / terraces"
+ )
+ strata_type = EnumProperty(
+ name="Strata",
+ default="0",
+ description="Strata types",
+ items = [
+ ("0", "None", "No strata", 0),
+ ("1", "Smooth", "Smooth transitions", 1),
+ ("2", "Sharp Sub", "Sharp substract transitions", 2),
+ ("3", "Sharp Add", "Sharp add transitions", 3),
+ ("4", "Posterize", "Posterize", 4),
+ ("5", "Posterize Mix", "Posterize mixed", 5)]
+ )
+ water_plane = BoolProperty(
+ name="Water Plane",
+ default=False,
+ description="Add water plane"
+ )
+ water_level = FloatProperty(
+ name="Level",
+ default=0.01,
+ min=-10000.0,
+ max=10000.0,
+ description="Water level"
+ )
+ remove_double = BoolProperty(
+ name="Remove Doubles",
+ default=False,
+ description="Remove doubles"
+ )
+ show_main_settings = BoolProperty(
+ name="Main Settings",
+ default=True,
+ description="Show settings"
+ )
+ show_noise_settings = BoolProperty(
+ name="Noise Settings",
+ default=True,
+ description="Show noise settings"
+ )
+ show_displace_settings = BoolProperty(
+ name="Displace Settings",
+ default=True,
+ description="Show terrain settings"
+ )
+ refresh = BoolProperty(
+ name="Refresh",
+ default=False,
+ description="Refresh"
+ )
+ auto_refresh = BoolProperty(
+ name="Auto",
+ default=False,
+ description="Automatic refresh"
+ )
+
+
+ def draw(self, context):
+ draw_ant_refresh(self, context)
+ draw_ant_noise(self, context)
+ draw_ant_displace(self, context, generate=False)
+
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.object
+ return (ob and ob.type == 'MESH')
+
+
+ def invoke(self, context, event):
+ self.refresh = True
+ return self.execute(context)
+
+
+ def execute(self, context):
+ if not self.refresh:
+ return {'PASS_THROUGH'}
+
+ # turn off undo
+ undo = bpy.context.user_preferences.edit.use_global_undo
+ bpy.context.user_preferences.edit.use_global_undo = False
+
+ ob = context.object
+
+ # Properties:
+ props = [
+ self.ant_terrain_name,
+ self.at_cursor,
+ self.smooth_mesh,
+ self.tri_face,
+ self.sphere_mesh,
+ self.land_material,
+ self.water_material,
+ self.texture_block,
+ self.subdivision_x,
+ self.subdivision_y,
+ self.mesh_size_x,
+ self.mesh_size_y,
+ self.mesh_size,
+ self.random_seed,
+ self.noise_offset_x,
+ self.noise_offset_y,
+ self.noise_offset_z,
+ self.noise_size_x,
+ self.noise_size_y,
+ self.noise_size_z,
+ self.noise_size,
+ self.noise_type,
+ self.basis_type,
+ self.vl_basis_type,
+ self.distortion,
+ self.hard_noise,
+ self.noise_depth,
+ self.amplitude,
+ self.frequency,
+ self.dimension,
+ self.lacunarity,
+ self.offset,
+ self.gain,
+ self.marble_bias,
+ self.marble_sharp,
+ self.marble_shape,
+ self.height,
+ self.height_invert,
+ self.height_offset,
+ self.maximum,
+ self.minimum,
+ self.edge_falloff,
+ self.edge_level,
+ self.falloff_x,
+ self.falloff_y,
+ self.strata_type,
+ self.strata,
+ self.water_plane,
+ self.water_level,
+ self.use_vgroup
+ ]
+
+ # do displace
+ mesh = ob.data
+
+ if self.use_vgroup is True:
+ vertex_group = ob.vertex_groups.active
+ if vertex_group:
+ for v in mesh.vertices:
+ v.co += vertex_group.weight(v.index) * v.normal * noise_gen(v.co, props)
+
+ else:
+ for v in mesh.vertices:
+ v.co += v.normal * noise_gen(v.co, props)
+ mesh.update()
+
+ if bpy.ops.object.shade_smooth == True:
+ bpy.ops.object.shade_smooth()
+
+ if self.auto_refresh is False:
+ self.refresh = False
+
+ # restore pre operator undo state
+ context.user_preferences.edit.use_global_undo = undo
+
+ return {'FINISHED'}
diff --git a/mesh_tissue/lattice.py b/mesh_tissue/lattice.py
new file mode 100644
index 00000000..2a62fe6c
--- /dev/null
+++ b/mesh_tissue/lattice.py
@@ -0,0 +1,421 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+#---------------------------- LATTICE ALONG SURFACE ---------------------------#
+#--------------------------------- version 0.3 --------------------------------#
+# #
+# Automatically generate and assign a lattice that follows the active surface. #
+# #
+# (c) Alessandro Zomparelli #
+# (2017) #
+# #
+# http://www.co-de-it.com/ #
+# #
+################################################################################
+
+import bpy, bmesh
+from mathutils import Vector, Matrix
+
+bl_info = {
+ "name": "Lattice",
+ "author": "Alessandro Zomparelli (Co-de-iT)",
+ "version": (0, 3),
+ "blender": (2, 7, 8),
+ "location": "",
+ "description": "Generate a Lattice based on a grid mesh",
+ "warning": "",
+ "wiki_url": "",
+ "tracker_url": "",
+ "category": "Mesh"}
+
+
+def not_in(element, grid):
+ output = True
+ for loop in grid:
+ if element in loop:
+ output = False
+ break
+ return output
+
+def grid_from_mesh(mesh, swap_uv):
+ bm = bmesh.new()
+ bm.from_mesh(mesh)
+ verts_grid = []
+ edges_grid = []
+ faces_grid = []
+
+ running_grid = True
+ while running_grid:
+ verts_loop = []
+ edges_loop = []
+ faces_loop = []
+
+ # storing first point
+ verts_candidates = []
+ if len(faces_grid) == 0: verts_candidates = bm.verts # for first loop check all vertices
+ else: verts_candidates = [v for v in bm.faces[faces_grid[-1][0]].verts if not_in(v.index, verts_grid)] # for other loops start form the vertices of the first face the last loop, skipping already used vertices
+
+ # check for last loop
+ is_last = False
+ for vert in verts_candidates:
+ if len(vert.link_faces) == 1: # check if corner vertex
+ vert.select = True
+ verts_loop.append(vert.index)
+ is_last = True
+ break
+ if not is_last:
+ for vert in verts_candidates:
+ new_link_faces = [f for f in vert.link_faces if not_in(f.index, faces_grid)]
+ if len(new_link_faces) < 2: # check if corner vertex
+ vert.select = True
+ verts_loop.append(vert.index)
+ break
+
+ running_loop = len(verts_loop) > 0
+
+ while running_loop:
+ bm.verts.ensure_lookup_table()
+ id = verts_loop[-1]
+ link_edges = bm.verts[id].link_edges
+ # storing second point
+ if len(verts_loop) == 1: # only one vertex stored in the loop
+ if len(faces_grid) == 0: ### first loop ###
+ edge = link_edges[swap_uv] # chose direction
+ for vert in edge.verts:
+ if vert.index != id:
+ vert.select = True
+ verts_loop.append(vert.index) # new vertex
+ edges_loop.append(edge.index) # chosen edge
+ faces_loop.append(edge.link_faces[0].index) # only one face
+ #edge.link_faces[0].select = True
+ else: ### other loops ###
+ for edge in bm.faces[faces_grid[-1][0]].edges: # start from the edges of the first face of the last loop
+ if bm.verts[verts_loop[0]] in edge.verts and bm.verts[verts_grid[-1][0]] not in edge.verts: # chose an edge starting from the first vertex that is not returning back
+ for vert in edge.verts:
+ if vert.index != id:
+ vert.select = True
+ verts_loop.append(vert.index)
+ edges_loop.append(edge.index)
+ for face in edge.link_faces:
+ if not_in(face.index,faces_grid):
+ faces_loop.append(face.index)
+ # continuing the loop
+ else:
+ for edge in link_edges:
+ for vert in edge.verts:
+ store_data = False
+ if not_in(vert.index, verts_grid) and vert.index not in verts_loop:
+ if len(faces_loop) > 0:
+ bm.faces.ensure_lookup_table()
+ if vert not in bm.faces[faces_loop[-1]].verts: store_data = True
+ else:
+ store_data = True
+ if store_data:
+ vert.select = True
+ verts_loop.append(vert.index)
+ edges_loop.append(edge.index)
+ for face in edge.link_faces:
+ if not_in(face.index, faces_grid):
+ faces_loop.append(face.index)
+ break
+ # ending condition
+ if verts_loop[-1] == id or verts_loop[-1] == verts_loop[0]: running_loop = False
+
+ verts_grid.append(verts_loop)
+ edges_grid.append(edges_loop)
+ faces_grid.append(faces_loop)
+ if len(faces_loop) == 0: running_grid = False
+ return verts_grid, edges_grid, faces_grid
+
+class lattice_along_surface(bpy.types.Operator):
+ bl_idname = "object.lattice_along_surface"
+ bl_label = "Lattice along Surface"
+ bl_description = ("Automatically add a Lattice modifier to the selected "
+ "object, adapting it to the active one.\nThe active "
+ "object must be a rectangular grid compatible with the "
+ "Lattice's topology.")
+ bl_options = {'REGISTER', 'UNDO'}
+
+ set_parent = bpy.props.BoolProperty(
+ name="Set Parent", default=True,
+ description="Automatically set the Lattice as parent")
+
+ flipNormals = bpy.props.BoolProperty(
+ name="Flip Normals", default=False,
+ description="Flip normals direction")
+
+ swapUV = bpy.props.BoolProperty(
+ name="Swap UV", default=False,
+ description="Flip grid's U and V")
+
+ flipU = bpy.props.BoolProperty(
+ name="Flip U", default=False,
+ description="Flip grid's U")
+
+ flipV = bpy.props.BoolProperty(
+ name="Flip V", default=False,
+ description="Flip grid's V")
+
+ flipW = bpy.props.BoolProperty(
+ name="Flip W", default=False,
+ description="Flip grid's W")
+
+ use_groups = bpy.props.BoolProperty(
+ name="Vertex Group", default=False,
+ description="Use active Vertex Group for lattice's thickness")
+
+ high_quality_lattice = bpy.props.BoolProperty(
+ name="High quality", default=True,
+ description="Increase the the subdivisions in normal direction for a "
+ "more correct result")
+
+ hide_lattice = bpy.props.BoolProperty(
+ name="Hide Lattice", default=True,
+ description="Automatically hide the Lattice object")
+
+ scale_x = bpy.props.FloatProperty(
+ name="Scale X", default=1, min=0.001,
+ max=1, description="Object scale")
+
+ scale_y = bpy.props.FloatProperty(
+ name="Scale Y", default=1, min=0.001,
+ max=1, description="Object scale")
+
+ scale_z = bpy.props.FloatProperty(
+ name="Scale Z", default=1, min=0.001,
+ max=1, description="Object scale")
+
+ thickness = bpy.props.FloatProperty(
+ name="Thickness", default=1, soft_min=0,
+ soft_max=5, description="Lattice thickness")
+
+ displace = bpy.props.FloatProperty(
+ name="Displace", default=0, soft_min=-1,
+ soft_max=1, description="Lattice displace")
+
+ def draw(self, context):
+ layout = self.layout
+ col = layout.column(align=True)
+ col.label(text="Thickness:")
+ col.prop(
+ self, "thickness", text="Thickness", icon='NONE', expand=False,
+ slider=True, toggle=False, icon_only=False, event=False,
+ full_event=False, emboss=True, index=-1)
+ col.prop(
+ self, "displace", text="Offset", icon='NONE', expand=False,
+ slider=True, toggle=False, icon_only=False, event=False,
+ full_event=False, emboss=True, index=-1)
+ row = col.row()
+ row.prop(self, "use_groups")
+ col.separator()
+ col.label(text="Scale:")
+ col.prop(
+ self, "scale_x", text="U", icon='NONE', expand=False,
+ slider=True, toggle=False, icon_only=False, event=False,
+ full_event=False, emboss=True, index=-1)
+ col.prop(
+ self, "scale_y", text="V", icon='NONE', expand=False,
+ slider=True, toggle=False, icon_only=False, event=False,
+ full_event=False, emboss=True, index=-1)
+ '''
+ col.prop(
+ self, "scale_z", text="W", icon='NONE', expand=False,
+ slider=True, toggle=False, icon_only=False, event=False,
+ full_event=False, emboss=True, index=-1)
+ '''
+ col.separator()
+ col.label(text="Flip:")
+ row = col.row()
+ row.prop(self, "flipU", text="U")
+ row.prop(self, "flipV", text="V")
+ row.prop(self, "flipW", text="W")
+ col.prop(self, "swapUV")
+ col.prop(self, "flipNormals")
+ col.separator()
+ col.label(text="Lattice Options:")
+ col.prop(self, "high_quality_lattice")
+ col.prop(self, "hide_lattice")
+ col.prop(self, "set_parent")
+
+ def execute(self, context):
+ grid_obj = bpy.context.active_object
+ if grid_obj.type not in ('MESH', 'CURVE', 'SURFACE'):
+ self.report({'ERROR'}, "The surface object is not valid. Only Mesh,"
+ "Curve and Surface objects are allowed.")
+ return {'CANCELLED'}
+ obj = None
+ for o in bpy.context.selected_objects:
+ if o.name != grid_obj.name and o.type in ('MESH', 'CURVE', \
+ 'SURFACE', 'FONT'):
+ obj = o
+ o.select = False
+ break
+ try:
+ obj_dim = obj.dimensions
+ obj_me = obj.to_mesh(bpy.context.scene, apply_modifiers=True,
+ settings = 'PREVIEW')
+ except:
+ self.report({'ERROR'}, "The object to deform is not valid. Only "
+ "Mesh, Curve, Surface and Font objects are allowed.")
+ return {'CANCELLED'}
+
+ bpy.ops.object.duplicate_move()
+ grid_obj = bpy.context.active_object
+ bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
+ grid_mesh = grid_obj.to_mesh(bpy.context.scene, apply_modifiers=True,
+ settings = 'PREVIEW')
+ # CREATING LATTICE
+ min = Vector((0,0,0))
+ max = Vector((0,0,0))
+ first = True
+ for v in obj_me.vertices:
+ vert = obj.matrix_world * v.co
+ if vert[0] < min[0] or first:
+ min[0] = vert[0]
+ if vert[1] < min[1] or first:
+ min[1] = vert[1]
+ if vert[2] < min[2] or first:
+ min[2] = vert[2]
+ if vert[0] > max[0] or first:
+ max[0] = vert[0]
+ if vert[1] > max[1] or first:
+ max[1] = vert[1]
+ if vert[2] > max[2] or first:
+ max[2] = vert[2]
+ first = False
+ bb = max-min
+ lattice_loc = (max+min)/2
+ bpy.ops.object.add(type='LATTICE', view_align=False,
+ enter_editmode=False)
+ lattice = bpy.context.active_object
+ lattice.location = lattice_loc
+ lattice.scale = Vector((bb.x/self.scale_x, bb.y/self.scale_y,
+ bb.z/self.scale_z))
+ if bb.x == 0: lattice.scale.x = 1
+ if bb.y == 0: lattice.scale.y = 1
+ if bb.z == 0: lattice.scale.z = 1
+ bpy.context.scene.objects.active = obj
+ bpy.ops.object.modifier_add(type='LATTICE')
+ obj.modifiers[-1].object = lattice
+
+ # set as parent
+ if self.set_parent:
+ obj.select = True
+ lattice.select = True
+ bpy.context.scene.objects.active = lattice
+ bpy.ops.object.parent_set(type='LATTICE')
+
+ # reading grid structure
+ verts_grid, edges_grid, faces_grid = grid_from_mesh(grid_mesh,
+ swap_uv=self.swapUV)
+ nu = len(verts_grid)
+ nv = len(verts_grid[0])
+ nw = 2
+ scale_normal = self.thickness
+
+ try:
+ lattice.data.points_u = nu
+ lattice.data.points_v = nv
+ lattice.data.points_w = nw
+ for i in range(nu):
+ for j in range(nv):
+ for w in range(nw):
+ if self.use_groups:
+ try:
+ displace = grid_obj.vertex_groups.active.weight(verts_grid[i][j])*scale_normal*bb.z
+ except:
+ displace = scale_normal*bb.z
+ else: displace = scale_normal*bb.z
+ target_point = (grid_mesh.vertices[verts_grid[i][j]].co + grid_mesh.vertices[verts_grid[i][j]].normal*(w + self.displace/2 - 0.5)*displace) - lattice.location
+ if self.flipW: w = 1-w
+ if self.flipU: i = nu-i-1
+ if self.flipV: j = nv-j-1
+ lattice.data.points[i + j*nu + w*nu*nv].co_deform.x = target_point.x / bpy.data.objects[lattice.name].scale.x
+ lattice.data.points[i + j*nu + w*nu*nv].co_deform.y = target_point.y / bpy.data.objects[lattice.name].scale.y
+ lattice.data.points[i + j*nu + w*nu*nv].co_deform.z = target_point.z / bpy.data.objects[lattice.name].scale.z
+ except:
+ bpy.ops.object.mode_set(mode='OBJECT')
+ grid_obj.select = True
+ lattice.select = True
+ obj.select = False
+ bpy.ops.object.delete(use_global=False)
+ bpy.context.scene.objects.active = obj
+ obj.select = True
+ bpy.ops.object.modifier_remove(modifier=obj.modifiers[-1].name)
+ if nu > 64 or nv > 64:
+ self.report({'ERROR'}, "Maximum resolution allowed for Lattice is 64")
+ else:
+ self.report({'ERROR'}, "The grid mesh is not correct")
+ return {'CANCELLED'}
+
+ #grid_obj.data = old_grid_data
+ #print(old_grid_matrix)
+ #grid_obj.matrix_world = old_grid_matrix
+
+ bpy.ops.object.mode_set(mode='OBJECT')
+ grid_obj.select = True
+ lattice.select = False
+ obj.select = False
+ bpy.ops.object.delete(use_global=False)
+ bpy.context.scene.objects.active = lattice
+ lattice.select = True
+ if self.high_quality_lattice: bpy.context.object.data.points_w = 8
+ else: bpy.context.object.data.use_outside = True
+ if self.hide_lattice:
+ bpy.ops.object.hide_view_set(unselected=False)
+ bpy.context.scene.objects.active = obj
+ obj.select = True
+ lattice.select = False
+ if self.flipNormals:
+ try:
+ bpy.ops.object.mode_set(mode='EDIT')
+ bpy.ops.mesh.select_all(action='SELECT')
+ bpy.ops.mesh.flip_normals()
+ bpy.ops.object.mode_set(mode='OBJECT')
+ except:
+ pass
+ return {'FINISHED'}
+
+
+class lattice_along_surface_panel(bpy.types.Panel):
+ bl_label = "Modifiers Tools"
+ bl_category = "Tools"
+ bl_space_type = "VIEW_3D"
+ bl_region_type = "TOOLS"
+ bl_context = (("objectmode"))
+
+ def draw(self, context):
+ layout = self.layout
+ col = layout.column(align=True)
+ try:
+ col.operator("object.lattice_along_surface", icon="MOD_LATTICE")
+ except:
+ pass
+
+
+def register():
+ bpy.utils.register_class(lattice_along_surface)
+ bpy.utils.register_class(lattice_along_surface_panel)
+
+
+def unregister():
+ bpy.utils.unregister_class(lattice_along_surface)
+ bpy.utils.unregister_class(lattice_along_surface_panel)
+
+
+if __name__ == "__main__":
+ register()
diff --git a/presets/operator/mesh.landscape_add/abstract.py b/presets/operator/mesh.landscape_add/abstract.py
index 617332b0..8cb663d4 100644
--- a/presets/operator/mesh.landscape_add/abstract.py
+++ b/presets/operator/mesh.landscape_add/abstract.py
@@ -1,21 +1,27 @@
import bpy
op = bpy.context.active_operator
+op.ant_terrain_name = 'Landscape'
+op.land_material = ''
+op.water_material = ''
+op.texture_block = ''
op.at_cursor = True
op.smooth_mesh = True
op.tri_face = False
op.sphere_mesh = True
-op.subdivision_x = 128
+op.subdivision_x = 256
op.subdivision_y = 128
-op.meshsize = 2.0
-op.meshsize_x = 2.0
-op.meshsize_y = 2.0
+op.mesh_size = 2.0
+op.mesh_size_x = 2.0
+op.mesh_size_y = 3.0
op.random_seed = 387
-op.x_offset = 0.0
-op.y_offset = 0.0
-op.noise_size = 1.0
+op.noise_offset_x = 0.0
+op.noise_offset_y = 0.0
+op.noise_offset_z = 0.0
op.noise_size_x = 1.0
op.noise_size_y = 1.0
+op.noise_size_z = 1.0
+op.noise_size = 1.0
op.noise_type = 'planet_noise'
op.basis_type = '3'
op.vl_basis_type = '3'
@@ -26,29 +32,28 @@ op.amplitude = 0.5
op.frequency = 2.0
op.dimension = 1.0
op.lacunarity = 2.0
-op.moffset = 1.0
+op.offset = 1.0
op.gain = 1.0
op.marble_bias = '0'
op.marble_sharp = '0'
op.marble_shape = '0'
op.height = 1.0
-op.invert = True
-op.offset = 0.0
+op.height_invert = True
+op.height_offset = 0.0
op.edge_falloff = '0'
-op.falloff_size_x = 4.0
-op.falloff_size_y = 4.0
+op.falloff_x = 4.0
+op.falloff_y = 4.0
op.edge_level = 0.0
op.maximum = 1.0
op.minimum = -1.0
+op.use_vgroup = False
op.strata = 5.0
op.strata_type = '3'
op.water_plane = False
op.water_level = 0.009999999776482582
-op.use_mat = False
-op.sel_land_mat = ''
-op.sel_water_mat = ''
+op.remove_double = False
+op.show_main_settings = True
op.show_noise_settings = True
-op.show_terrain_settings = True
+op.show_displace_settings = True
op.refresh = True
op.auto_refresh = True
-op.texture_name = ''
diff --git a/presets/operator/mesh.landscape_add/canion.py b/presets/operator/mesh.landscape_add/canion.py
index 6ac4ad61..6a97d1f3 100644
--- a/presets/operator/mesh.landscape_add/canion.py
+++ b/presets/operator/mesh.landscape_add/canion.py
@@ -1,21 +1,27 @@
import bpy
op = bpy.context.active_operator
+op.ant_terrain_name = 'Landscape'
+op.land_material = ''
+op.water_material = ''
+op.texture_block = ''
op.at_cursor = True
op.smooth_mesh = True
op.tri_face = False
op.sphere_mesh = False
op.subdivision_x = 128
op.subdivision_y = 192
-op.meshsize = 2.0
-op.meshsize_x = 2.0
-op.meshsize_y = 3.0
+op.mesh_size = 2.0
+op.mesh_size_x = 2.0
+op.mesh_size_y = 3.0
op.random_seed = 1
-op.x_offset = 0.25
-op.y_offset = 0.0
-op.noise_size = 1.5
+op.noise_offset_x = 0.0
+op.noise_offset_y = 0.0
+op.noise_offset_z = 0.0
op.noise_size_x = 1.0
op.noise_size_y = 1.25
+op.noise_size_z = 1.0
+op.noise_size = 1.5
op.noise_type = 'marble_noise'
op.basis_type = '0'
op.vl_basis_type = '0'
@@ -26,29 +32,28 @@ op.amplitude = 0.5
op.frequency = 2.0
op.dimension = 1.0
op.lacunarity = 2.0
-op.moffset = 1.0
+op.offset = 1.0
op.gain = 1.0
op.marble_bias = '0'
op.marble_sharp = '0'
op.marble_shape = '4'
op.height = 0.6000000238418579
-op.invert = False
-op.offset = -0.059999994933605194
+op.height_invert = False
+op.height_offset = 0.0
op.edge_falloff = '2'
-op.falloff_size_x = 4.0
-op.falloff_size_y = 10.0
+op.falloff_x = 4.0
+op.falloff_y = 4.0
op.edge_level = 0.15000000596046448
op.maximum = 1.0
op.minimum = -0.20000000298023224
+op.use_vgroup = False
op.strata = 4.0
op.strata_type = '2'
op.water_plane = False
op.water_level = 0.009999999776482582
-op.use_mat = False
-op.sel_land_mat = ''
-op.sel_water_mat = ''
+op.remove_double = False
+op.show_main_settings = True
op.show_noise_settings = True
-op.show_terrain_settings = True
+op.show_displace_settings = True
op.refresh = True
op.auto_refresh = True
-op.texture_name = ''
diff --git a/presets/operator/mesh.landscape_add/cauliflower_hills.py b/presets/operator/mesh.landscape_add/cauliflower_hills.py
index 6063f93e..2371b0d3 100644
--- a/presets/operator/mesh.landscape_add/cauliflower_hills.py
+++ b/presets/operator/mesh.landscape_add/cauliflower_hills.py
@@ -1,22 +1,28 @@
import bpy
op = bpy.context.active_operator
+op.ant_terrain_name = 'Landscape'
+op.land_material = ''
+op.water_material = ''
+op.texture_block = ''
op.at_cursor = True
op.smooth_mesh = True
op.tri_face = False
op.sphere_mesh = False
op.subdivision_x = 128
op.subdivision_y = 128
-op.meshsize = 2.0
-op.meshsize_x = 2.0
-op.meshsize_y = 2.0
+op.mesh_size = 2.0
+op.mesh_size_x = 2.0
+op.mesh_size_y = 2.0
op.random_seed = 860
-op.x_offset = 0.0
-op.y_offset = 0.0
-op.noise_size = 0.5
+op.noise_offset_x = 0.0
+op.noise_offset_y = 0.0
+op.noise_offset_z = 0.0
op.noise_size_x = 1.0
op.noise_size_y = 1.0
-op.noise_type = 'fractal'
+op.noise_size_z = 1.0
+op.noise_size = 0.5
+op.noise_type = 'multi_fractal'
op.basis_type = '3'
op.vl_basis_type = '0'
op.distortion = 1.0
@@ -26,29 +32,28 @@ op.amplitude = 0.5
op.frequency = 2.0
op.dimension = 1.0
op.lacunarity = 5.0
-op.moffset = 1.0
+op.offset = 1.0
op.gain = 1.0
op.marble_bias = '0'
op.marble_sharp = '0'
op.marble_shape = '0'
-op.height = 0.10000000149011612
-op.invert = True
-op.offset = 0.05000000074505806
+op.height = 0.20000000298023224
+op.height_invert = True
+op.height_offset = 0.0
op.edge_falloff = '3'
-op.falloff_size_x = 6.0
-op.falloff_size_y = 6.0
+op.falloff_x = 8.0
+op.falloff_y = 8.0
op.edge_level = 0.0
op.maximum = 1.0
-op.minimum = -0.10999999940395355
+op.minimum = -1.0
+op.use_vgroup = False
op.strata = 5.0
op.strata_type = '0'
op.water_plane = False
op.water_level = 0.009999999776482582
-op.use_mat = False
-op.sel_land_mat = ''
-op.sel_water_mat = ''
+op.remove_double = False
+op.show_main_settings = True
op.show_noise_settings = True
-op.show_terrain_settings = True
+op.show_displace_settings = True
op.refresh = True
op.auto_refresh = True
-op.texture_name = ''
diff --git a/presets/operator/mesh.landscape_add/cristaline.py b/presets/operator/mesh.landscape_add/cristaline.py
index d8a3dc12..89349846 100644
--- a/presets/operator/mesh.landscape_add/cristaline.py
+++ b/presets/operator/mesh.landscape_add/cristaline.py
@@ -1,21 +1,27 @@
import bpy
op = bpy.context.active_operator
+op.ant_terrain_name = 'Landscape'
+op.land_material = ''
+op.water_material = ''
+op.texture_block = ''
op.at_cursor = True
op.smooth_mesh = True
op.tri_face = False
op.sphere_mesh = True
-op.subdivision_x = 128
+op.subdivision_x = 256
op.subdivision_y = 128
-op.meshsize = 2.0
-op.meshsize_x = 2.0
-op.meshsize_y = 2.0
+op.mesh_size = 2.0
+op.mesh_size_x = 2.0
+op.mesh_size_y = 2.0
op.random_seed = 0
-op.x_offset = 0.0
-op.y_offset = 0.0
-op.noise_size = 1.0
+op.noise_offset_x = 0.0
+op.noise_offset_y = 0.0
+op.noise_offset_z = 0.0
op.noise_size_x = 1.0
op.noise_size_y = 1.0
+op.noise_size_z = 1.0
+op.noise_size = 1.0
op.noise_type = 'turbulence_vector'
op.basis_type = '6'
op.vl_basis_type = '0'
@@ -26,29 +32,28 @@ op.amplitude = 0.5
op.frequency = 2.0
op.dimension = 1.0
op.lacunarity = 2.0
-op.moffset = 1.0
+op.offset = 1.0
op.gain = 1.0
op.marble_bias = '0'
op.marble_sharp = '0'
op.marble_shape = '0'
op.height = 1.0
-op.invert = False
-op.offset = 0.0
+op.height_invert = False
+op.height_offset = 0.0
op.edge_falloff = '0'
-op.falloff_size_x = 4.0
-op.falloff_size_y = 4.0
+op.falloff_x = 4.0
+op.falloff_y = 4.0
op.edge_level = 0.0
op.maximum = 2.0
op.minimum = -1.0
+op.use_vgroup = False
op.strata = 5.0
op.strata_type = '0'
op.water_plane = False
op.water_level = 0.009999999776482582
-op.use_mat = False
-op.sel_land_mat = ''
-op.sel_water_mat = ''
+op.remove_double = False
+op.show_main_settings = True
op.show_noise_settings = True
-op.show_terrain_settings = True
+op.show_displace_settings = True
op.refresh = True
op.auto_refresh = True
-op.texture_name = ''
diff --git a/presets/operator/mesh.landscape_add/default.py b/presets/operator/mesh.landscape_add/default.py
index 356686f7..1996b561 100644
--- a/presets/operator/mesh.landscape_add/default.py
+++ b/presets/operator/mesh.landscape_add/default.py
@@ -1,21 +1,27 @@
import bpy
op = bpy.context.active_operator
+op.ant_terrain_name = 'Landscape'
+op.land_material = ''
+op.water_material = ''
+op.texture_block = ''
op.at_cursor = True
op.smooth_mesh = True
op.tri_face = False
op.sphere_mesh = False
op.subdivision_x = 128
op.subdivision_y = 128
-op.meshsize = 2.0
-op.meshsize_x = 2.0
-op.meshsize_y = 2.0
+op.mesh_size = 2.0
+op.mesh_size_x = 2.0
+op.mesh_size_y = 2.0
op.random_seed = 0
-op.x_offset = 0.0
-op.y_offset = 0.0
-op.noise_size = 1.0
+op.noise_offset_x = 0.0
+op.noise_offset_y = 0.0
+op.noise_offset_z = 0.0
op.noise_size_x = 1.0
op.noise_size_y = 1.0
+op.noise_size_z = 1.0
+op.noise_size = 1.0
op.noise_type = 'hetero_terrain'
op.basis_type = '0'
op.vl_basis_type = '0'
@@ -26,29 +32,28 @@ op.amplitude = 0.5
op.frequency = 2.0
op.dimension = 1.0
op.lacunarity = 2.0
-op.moffset = 1.0
+op.offset = 1.0
op.gain = 1.0
op.marble_bias = '0'
op.marble_sharp = '0'
op.marble_shape = '0'
op.height = 0.5
-op.invert = False
-op.offset = 0.0
+op.height_invert = False
+op.height_offset = 0.0
op.edge_falloff = '3'
-op.falloff_size_x = 4.0
-op.falloff_size_y = 4.0
+op.falloff_x = 4.0
+op.falloff_y = 4.0
op.edge_level = 0.0
op.maximum = 1.0
-op.minimum = -0.10999999940395355
+op.minimum = -1.0
+op.use_vgroup = False
op.strata = 5.0
op.strata_type = '0'
op.water_plane = False
op.water_level = 0.009999999776482582
-op.use_mat = False
-op.sel_land_mat = ''
-op.sel_water_mat = ''
+op.remove_double = False
+op.show_main_settings = True
op.show_noise_settings = True
-op.show_terrain_settings = True
+op.show_displace_settings = True
op.refresh = True
op.auto_refresh = True
-op.texture_name = ''
diff --git a/presets/operator/mesh.landscape_add/default_large.py b/presets/operator/mesh.landscape_add/default_large.py
index adb523bd..2295c1e5 100644
--- a/presets/operator/mesh.landscape_add/default_large.py
+++ b/presets/operator/mesh.landscape_add/default_large.py
@@ -1,21 +1,27 @@
import bpy
op = bpy.context.active_operator
+op.ant_terrain_name = 'Landscape'
+op.land_material = ''
+op.water_material = ''
+op.texture_block = ''
op.at_cursor = True
op.smooth_mesh = True
op.tri_face = False
op.sphere_mesh = False
op.subdivision_x = 128
op.subdivision_y = 128
-op.meshsize = 2.0
-op.meshsize_x = 20.0
-op.meshsize_y = 20.0
+op.mesh_size = 2.0
+op.mesh_size_x = 20.0
+op.mesh_size_y = 20.0
op.random_seed = 0
-op.x_offset = 0.0
-op.y_offset = 0.0
-op.noise_size = 10.0
+op.noise_offset_x = 0.0
+op.noise_offset_y = 0.0
+op.noise_offset_z = 0.0
op.noise_size_x = 1.0
op.noise_size_y = 1.0
+op.noise_size_z = 1.0
+op.noise_size = 10.0
op.noise_type = 'hetero_terrain'
op.basis_type = '0'
op.vl_basis_type = '0'
@@ -26,29 +32,28 @@ op.amplitude = 0.5
op.frequency = 2.0
op.dimension = 1.0
op.lacunarity = 2.0
-op.moffset = 1.0
+op.offset = 1.0
op.gain = 1.0
op.marble_bias = '0'
op.marble_sharp = '0'
op.marble_shape = '0'
op.height = 5.0
-op.invert = False
-op.offset = 0.0
+op.height_invert = False
+op.height_offset = 0.0
op.edge_falloff = '3'
-op.falloff_size_x = 4.0
-op.falloff_size_y = 4.0
+op.falloff_x = 4.0
+op.falloff_y = 4.0
op.edge_level = 0.0
op.maximum = 10.0
op.minimum = -1.0
+op.use_vgroup = False
op.strata = 5.0
op.strata_type = '0'
op.water_plane = False
op.water_level = 0.009999999776482582
-op.use_mat = False
-op.sel_land_mat = ''
-op.sel_water_mat = ''
+op.remove_double = False
+op.show_main_settings = True
op.show_noise_settings = True
-op.show_terrain_settings = True
+op.show_displace_settings = True
op.refresh = True
op.auto_refresh = True
-op.texture_name = ''
diff --git a/presets/operator/mesh.landscape_add/flatstone.py b/presets/operator/mesh.landscape_add/flatstone.py
index b7e40c83..edf55b7c 100644
--- a/presets/operator/mesh.landscape_add/flatstone.py
+++ b/presets/operator/mesh.landscape_add/flatstone.py
@@ -1,21 +1,27 @@
import bpy
op = bpy.context.active_operator
+op.ant_terrain_name = 'Landscape'
+op.land_material = ''
+op.water_material = ''
+op.texture_block = ''
op.at_cursor = True
op.smooth_mesh = True
op.tri_face = False
op.sphere_mesh = False
op.subdivision_x = 128
op.subdivision_y = 128
-op.meshsize = 2.0
-op.meshsize_x = 2.0
-op.meshsize_y = 2.0
+op.mesh_size = 2.0
+op.mesh_size_x = 2.0
+op.mesh_size_y = 2.0
op.random_seed = 2
-op.x_offset = 0.0
-op.y_offset = 0.0
-op.noise_size = 0.5
+op.noise_offset_x = 0.0
+op.noise_offset_y = 0.0
+op.noise_offset_z = 0.0
op.noise_size_x = 1.0
op.noise_size_y = 1.0
+op.noise_size_z = 1.0
+op.noise_size = 0.5
op.noise_type = 'fractal'
op.basis_type = '8'
op.vl_basis_type = '0'
@@ -26,29 +32,28 @@ op.amplitude = 0.5
op.frequency = 2.0
op.dimension = 1.0
op.lacunarity = 2.0
-op.moffset = 1.0
+op.offset = 0.009999999776482582
op.gain = 1.0
op.marble_bias = '0'
op.marble_sharp = '0'
op.marble_shape = '0'
op.height = 0.05000000074505806
-op.invert = False
-op.offset = 0.0
+op.height_invert = False
+op.height_offset = 0.0
op.edge_falloff = '0'
-op.falloff_size_x = 4.0
-op.falloff_size_y = 4.0
+op.falloff_x = 4.0
+op.falloff_y = 4.0
op.edge_level = 0.0
op.maximum = 1.0
op.minimum = 0.0
+op.use_vgroup = False
op.strata = 5.0
op.strata_type = '0'
op.water_plane = False
op.water_level = 0.009999999776482582
-op.use_mat = False
-op.sel_land_mat = ''
-op.sel_water_mat = ''
+op.remove_double = False
+op.show_main_settings = True
op.show_noise_settings = True
-op.show_terrain_settings = True
+op.show_displace_settings = True
op.refresh = True
op.auto_refresh = True
-op.texture_name = ''
diff --git a/presets/operator/mesh.landscape_add/land_and_water.py b/presets/operator/mesh.landscape_add/land_and_water.py
deleted file mode 100644
index 441c6602..00000000
--- a/presets/operator/mesh.landscape_add/land_and_water.py
+++ /dev/null
@@ -1,54 +0,0 @@
-import bpy
-op = bpy.context.active_operator
-
-op.at_cursor = True
-op.smooth_mesh = True
-op.tri_face = False
-op.sphere_mesh = False
-op.subdivision_x = 128
-op.subdivision_y = 128
-op.meshsize = 2.0
-op.meshsize_x = 2.0
-op.meshsize_y = 2.0
-op.random_seed = 8
-op.x_offset = 0.0
-op.y_offset = 0.0
-op.noise_size = 1.5
-op.noise_size_x = 1.0
-op.noise_size_y = 1.0
-op.noise_type = 'turbulence_vector'
-op.basis_type = '3'
-op.vl_basis_type = '0'
-op.distortion = 1.0
-op.hard_noise = '1'
-op.noise_depth = 8
-op.amplitude = 0.5
-op.frequency = 2.0
-op.dimension = 1.0
-op.lacunarity = 2.0
-op.moffset = 1.0
-op.gain = 1.0
-op.marble_bias = '0'
-op.marble_sharp = '0'
-op.marble_shape = '0'
-op.height = 0.4000000059604645
-op.invert = False
-op.offset = -0.20000000298023224
-op.edge_falloff = '3'
-op.falloff_size_x = 4.0
-op.falloff_size_y = 4.0
-op.edge_level = 0.0
-op.maximum = 1.0
-op.minimum = -0.10999999940395355
-op.strata = 5.0
-op.strata_type = '0'
-op.water_plane = True
-op.water_level = -0.019999999552965164
-op.use_mat = False
-op.sel_land_mat = ''
-op.sel_water_mat = ''
-op.show_noise_settings = True
-op.show_terrain_settings = True
-op.refresh = True
-op.auto_refresh = True
-op.texture_name = ''
diff --git a/presets/operator/mesh.landscape_add/mountain.py b/presets/operator/mesh.landscape_add/mountain.py
index 2d551001..2d250498 100644
--- a/presets/operator/mesh.landscape_add/mountain.py
+++ b/presets/operator/mesh.landscape_add/mountain.py
@@ -1,24 +1,30 @@
import bpy
op = bpy.context.active_operator
+op.ant_terrain_name = 'Landscape'
+op.land_material = ''
+op.water_material = ''
+op.texture_block = ''
op.at_cursor = True
op.smooth_mesh = True
op.tri_face = False
op.sphere_mesh = False
op.subdivision_x = 128
op.subdivision_y = 128
-op.meshsize = 2.0
-op.meshsize_x = 2.0
-op.meshsize_y = 2.0
+op.mesh_size = 2.0
+op.mesh_size_x = 2.0
+op.mesh_size_y = 2.0
op.random_seed = 3
-op.x_offset = 0.0
-op.y_offset = 0.0
-op.noise_size = 0.75
+op.noise_offset_x = 0.0
+op.noise_offset_y = 0.0
+op.noise_offset_z = 0.0
op.noise_size_x = 1.0
op.noise_size_y = 1.0
+op.noise_size_z = 1.0
+op.noise_size = 0.75
op.noise_type = 'ridged_multi_fractal'
op.basis_type = '0'
-op.vl_basis_type = '0'
+op.vl_basis_type = '7'
op.distortion = 1.0
op.hard_noise = '0'
op.noise_depth = 12
@@ -26,29 +32,28 @@ op.amplitude = 0.5
op.frequency = 2.0
op.dimension = 1.0
op.lacunarity = 2.0
-op.moffset = 0.8500000238418579
-op.gain = 4.5
+op.offset = 0.880000114440918
+op.gain = 4.199997901916504
op.marble_bias = '0'
op.marble_sharp = '0'
op.marble_shape = '0'
op.height = 0.5
-op.invert = False
-op.offset = 0.20000000298023224
+op.height_invert = False
+op.height_offset = 0.25
op.edge_falloff = '3'
-op.falloff_size_x = 2.0
-op.falloff_size_y = 2.0
+op.falloff_x = 2.0
+op.falloff_y = 2.0
op.edge_level = 0.0
op.maximum = 1.0
-op.minimum = -0.10999999940395355
+op.minimum = -1.0
+op.use_vgroup = False
op.strata = 5.0
op.strata_type = '0'
op.water_plane = False
op.water_level = 0.009999999776482582
-op.use_mat = False
-op.sel_land_mat = ''
-op.sel_water_mat = ''
+op.remove_double = False
+op.show_main_settings = True
op.show_noise_settings = True
-op.show_terrain_settings = True
+op.show_displace_settings = True
op.refresh = True
op.auto_refresh = True
-op.texture_name = ''
diff --git a/presets/operator/mesh.landscape_add/planet_noise.py b/presets/operator/mesh.landscape_add/planet_noise.py
index 7cc1015c..c2be84f6 100644
--- a/presets/operator/mesh.landscape_add/planet_noise.py
+++ b/presets/operator/mesh.landscape_add/planet_noise.py
@@ -1,21 +1,27 @@
import bpy
op = bpy.context.active_operator
+op.ant_terrain_name = 'Landscape'
+op.land_material = ''
+op.water_material = ''
+op.texture_block = ''
op.at_cursor = True
op.smooth_mesh = True
op.tri_face = True
op.sphere_mesh = True
op.subdivision_x = 256
op.subdivision_y = 128
-op.meshsize = 2.0
-op.meshsize_x = 2.0
-op.meshsize_y = 2.0
+op.mesh_size = 2.0
+op.mesh_size_x = 2.0
+op.mesh_size_y = 2.0
op.random_seed = 0
-op.x_offset = 0.0
-op.y_offset = 0.0
-op.noise_size = 0.5
+op.noise_offset_x = 0.0
+op.noise_offset_y = 0.0
+op.noise_offset_z = 0.0
op.noise_size_x = 1.0
op.noise_size_y = 1.0
+op.noise_size_z = 1.0
+op.noise_size = 0.5
op.noise_type = 'planet_noise'
op.basis_type = '1'
op.vl_basis_type = '0'
@@ -26,29 +32,28 @@ op.amplitude = 0.5
op.frequency = 2.0
op.dimension = 1.0
op.lacunarity = 2.0
-op.moffset = 1.0
+op.offset = 1.0
op.gain = 1.0
op.marble_bias = '0'
op.marble_sharp = '0'
op.marble_shape = '0'
op.height = 0.10000000149011612
-op.invert = False
-op.offset = 0.0
+op.height_invert = False
+op.height_offset = 0.25
op.edge_falloff = '0'
-op.falloff_size_x = 4.0
-op.falloff_size_y = 4.0
+op.falloff_x = 2.0
+op.falloff_y = 2.0
op.edge_level = 0.0
op.maximum = 1.0
-op.minimum = -0.10999999940395355
+op.minimum = -1.0
+op.use_vgroup = False
op.strata = 5.0
op.strata_type = '0'
op.water_plane = False
op.water_level = 0.009999999776482582
-op.use_mat = False
-op.sel_land_mat = ''
-op.sel_water_mat = ''
+op.remove_double = False
+op.show_main_settings = True
op.show_noise_settings = True
-op.show_terrain_settings = True
+op.show_displace_settings = True
op.refresh = True
op.auto_refresh = True
-op.texture_name = ''
diff --git a/presets/operator/mesh.landscape_add/plateau.py b/presets/operator/mesh.landscape_add/plateau.py
index e6c378ad..4a0689ae 100644
--- a/presets/operator/mesh.landscape_add/plateau.py
+++ b/presets/operator/mesh.landscape_add/plateau.py
@@ -1,54 +1,59 @@
import bpy
op = bpy.context.active_operator
+op.ant_terrain_name = 'Landscape'
+op.land_material = ''
+op.water_material = ''
+op.texture_block = ''
op.at_cursor = True
op.smooth_mesh = True
op.tri_face = False
op.sphere_mesh = False
op.subdivision_x = 128
op.subdivision_y = 128
-op.meshsize = 2.0
-op.meshsize_x = 2.0
-op.meshsize_y = 2.0
-op.random_seed = 285
-op.x_offset = 0.0
-op.y_offset = 0.0
-op.noise_size = 1.0
+op.mesh_size = 2.0
+op.mesh_size_x = 2.0
+op.mesh_size_y = 2.0
+op.random_seed = 488
+op.noise_offset_x = 0.0
+op.noise_offset_y = 0.0
+op.noise_offset_z = 0.0
op.noise_size_x = 1.0
op.noise_size_y = 1.0
-op.noise_type = 'vl_noise_turbulence'
-op.basis_type = '0'
-op.vl_basis_type = '0'
+op.noise_size_z = 1.0
+op.noise_size = 1.0
+op.noise_type = 'shattered_hterrain'
+op.basis_type = '3'
+op.vl_basis_type = '7'
op.distortion = 1.149999976158142
-op.hard_noise = '1'
-op.noise_depth = 6
+op.hard_noise = '0'
+op.noise_depth = 8
op.amplitude = 0.4000000059604645
op.frequency = 2.0
op.dimension = 1.0
op.lacunarity = 2.0
-op.moffset = 1.0
-op.gain = 1.5
+op.offset = 1.0
+op.gain = 1.0
op.marble_bias = '0'
op.marble_sharp = '0'
op.marble_shape = '0'
-op.height = 0.4000000059604645
-op.invert = False
-op.offset = 0.05000000074505806
+op.height = 0.5
+op.height_invert = False
+op.height_offset = 0.20000000298023224
op.edge_falloff = '3'
-op.falloff_size_x = 2.0
-op.falloff_size_y = 2.0
+op.falloff_x = 3.0
+op.falloff_y = 3.0
op.edge_level = 0.0
-op.maximum = 0.20000000298023224
-op.minimum = -0.20000000298023224
-op.strata = 3.0
-op.strata_type = '3'
+op.maximum = 0.25
+op.minimum = 0.0
+op.use_vgroup = False
+op.strata = 2.25
+op.strata_type = '2'
op.water_plane = False
op.water_level = -0.07999999821186066
-op.use_mat = False
-op.sel_land_mat = ''
-op.sel_water_mat = ''
+op.remove_double = False
+op.show_main_settings = True
op.show_noise_settings = True
-op.show_terrain_settings = True
+op.show_displace_settings = True
op.refresh = True
op.auto_refresh = True
-op.texture_name = ''
diff --git a/presets/operator/mesh.landscape_add/slick_rock.py b/presets/operator/mesh.landscape_add/slick_rock.py
new file mode 100644
index 00000000..c875b754
--- /dev/null
+++ b/presets/operator/mesh.landscape_add/slick_rock.py
@@ -0,0 +1,59 @@
+import bpy
+op = bpy.context.active_operator
+
+op.ant_terrain_name = 'Landscape'
+op.land_material = ''
+op.water_material = ''
+op.texture_block = ''
+op.at_cursor = True
+op.smooth_mesh = True
+op.tri_face = False
+op.sphere_mesh = False
+op.subdivision_x = 128
+op.subdivision_y = 128
+op.mesh_size = 2.0
+op.mesh_size_x = 2.0
+op.mesh_size_y = 2.0
+op.random_seed = 75
+op.noise_offset_x = 0.0
+op.noise_offset_y = 0.0
+op.noise_offset_z = 0.0
+op.noise_size_x = 1.0
+op.noise_size_y = 1.0
+op.noise_size_z = 1.0
+op.noise_size = 1.0
+op.noise_type = 'slick_rock'
+op.basis_type = '0'
+op.vl_basis_type = '7'
+op.distortion = 1.0
+op.hard_noise = '0'
+op.noise_depth = 8
+op.amplitude = 0.5
+op.frequency = 2.0
+op.dimension = 1.0
+op.lacunarity = 2.0
+op.offset = 1.100000023841858
+op.gain = 2.5
+op.marble_bias = '0'
+op.marble_sharp = '0'
+op.marble_shape = '0'
+op.height = 0.5
+op.height_invert = False
+op.height_offset = 0.10000000149011612
+op.edge_falloff = '3'
+op.falloff_x = 4.0
+op.falloff_y = 4.0
+op.edge_level = 0.0
+op.maximum = 1.0
+op.minimum = -1.0
+op.use_vgroup = False
+op.strata = 5.0
+op.strata_type = '0'
+op.water_plane = False
+op.water_level = 0.009999999776482582
+op.remove_double = False
+op.show_main_settings = True
+op.show_noise_settings = True
+op.show_displace_settings = True
+op.refresh = True
+op.auto_refresh = True
diff --git a/presets/operator/mesh.landscape_add/smooth_terrain.py b/presets/operator/mesh.landscape_add/smooth_terrain.py
index a468e273..1e66fba1 100644
--- a/presets/operator/mesh.landscape_add/smooth_terrain.py
+++ b/presets/operator/mesh.landscape_add/smooth_terrain.py
@@ -1,21 +1,27 @@
import bpy
op = bpy.context.active_operator
+op.ant_terrain_name = 'Landscape'
+op.land_material = ''
+op.water_material = ''
+op.texture_block = ''
op.at_cursor = True
op.smooth_mesh = True
op.tri_face = False
op.sphere_mesh = False
op.subdivision_x = 128
op.subdivision_y = 128
-op.meshsize = 2.0
-op.meshsize_x = 2.0
-op.meshsize_y = 2.0
+op.mesh_size = 2.0
+op.mesh_size_x = 2.0
+op.mesh_size_y = 2.0
op.random_seed = 11
-op.x_offset = 0.0
-op.y_offset = 0.0
-op.noise_size = 0.8899999260902405
+op.noise_offset_x = 0.0
+op.noise_offset_y = 0.0
+op.noise_offset_z = 0.0
op.noise_size_x = 1.0
op.noise_size_y = 1.0
+op.noise_size_z = 1.0
+op.noise_size = 0.8899999856948853
op.noise_type = 'hybrid_multi_fractal'
op.basis_type = '1'
op.vl_basis_type = '0'
@@ -26,29 +32,28 @@ op.amplitude = 0.5
op.frequency = 2.0
op.dimension = 0.800000011920929
op.lacunarity = 2.2100000381469727
-op.moffset = 0.6499998569488525
+op.offset = 0.559999942779541
op.gain = 3.0
op.marble_bias = '0'
op.marble_sharp = '0'
op.marble_shape = '0'
op.height = 0.2199999988079071
-op.invert = False
-op.offset = -0.07999999821186066
+op.height_invert = False
+op.height_offset = 0.0
op.edge_falloff = '3'
-op.falloff_size_x = 6.0
-op.falloff_size_y = 6.0
+op.falloff_x = 4.0
+op.falloff_y = 4.0
op.edge_level = 0.0
op.maximum = 1.0
op.minimum = -1.0
+op.use_vgroup = False
op.strata = 2.0
op.strata_type = '0'
op.water_plane = False
op.water_level = 0.009999999776482582
-op.use_mat = False
-op.sel_land_mat = ''
-op.sel_water_mat = ''
+op.remove_double = False
+op.show_main_settings = True
op.show_noise_settings = True
-op.show_terrain_settings = True
+op.show_displace_settings = True
op.refresh = True
op.auto_refresh = True
-op.texture_name = ''
diff --git a/presets/operator/mesh.landscape_add/techno_grid.py b/presets/operator/mesh.landscape_add/techno_grid.py
index c3c0edab..da1ac3d8 100644
--- a/presets/operator/mesh.landscape_add/techno_grid.py
+++ b/presets/operator/mesh.landscape_add/techno_grid.py
@@ -1,54 +1,59 @@
import bpy
op = bpy.context.active_operator
+op.ant_terrain_name = 'Landscape'
+op.land_material = ''
+op.water_material = ''
+op.texture_block = ''
op.at_cursor = True
op.smooth_mesh = True
op.tri_face = False
op.sphere_mesh = False
op.subdivision_x = 128
op.subdivision_y = 128
-op.meshsize = 2.0
-op.meshsize_x = 2.0
-op.meshsize_y = 2.0
-op.random_seed = 23
-op.x_offset = 0.0
-op.y_offset = 0.0
-op.noise_size = 0.5
+op.mesh_size = 2.0
+op.mesh_size_x = 2.0
+op.mesh_size_y = 2.0
+op.random_seed = 0
+op.noise_offset_x = 0.0
+op.noise_offset_y = 0.0
+op.noise_offset_z = 0.0
op.noise_size_x = 1.0
op.noise_size_y = 1.0
+op.noise_size_z = 1.0
+op.noise_size = 0.5
op.noise_type = 'variable_lacunarity'
op.basis_type = '9'
op.vl_basis_type = '9'
-op.distortion = 1.5
+op.distortion = 2.0
op.hard_noise = '0'
op.noise_depth = 3
op.amplitude = 0.5
op.frequency = 2.0
op.dimension = 1.0
op.lacunarity = 2.0
-op.moffset = 1.0
+op.offset = 1.0
op.gain = 1.0
op.marble_bias = '0'
op.marble_sharp = '0'
op.marble_shape = '0'
op.height = 0.25
-op.invert = False
-op.offset = 0.0
+op.height_invert = False
+op.height_offset = 0.0
op.edge_falloff = '0'
-op.falloff_size_x = 4.0
-op.falloff_size_y = 4.0
+op.falloff_x = 4.0
+op.falloff_y = 4.0
op.edge_level = 0.0
op.maximum = 1.0
op.minimum = -1.0
+op.use_vgroup = False
op.strata = 2.0
op.strata_type = '4'
op.water_plane = False
op.water_level = 0.009999999776482582
-op.use_mat = False
-op.sel_land_mat = ''
-op.sel_water_mat = ''
+op.remove_double = False
+op.show_main_settings = True
op.show_noise_settings = True
-op.show_terrain_settings = True
+op.show_displace_settings = True
op.refresh = True
op.auto_refresh = True
-op.texture_name = ''
diff --git a/presets/operator/mesh.landscape_add/terrain_large.py b/presets/operator/mesh.landscape_add/terrain_large.py
index 766857fa..20dc3f66 100644
--- a/presets/operator/mesh.landscape_add/terrain_large.py
+++ b/presets/operator/mesh.landscape_add/terrain_large.py
@@ -1,54 +1,59 @@
import bpy
op = bpy.context.active_operator
+op.ant_terrain_name = 'Landscape'
+op.land_material = ''
+op.water_material = ''
+op.texture_block = ''
op.at_cursor = True
op.smooth_mesh = True
op.tri_face = False
op.sphere_mesh = False
op.subdivision_x = 256
op.subdivision_y = 256
-op.meshsize = 2.0
-op.meshsize_x = 20.0
-op.meshsize_y = 20.0
+op.mesh_size = 2.0
+op.mesh_size_x = 20.0
+op.mesh_size_y = 20.0
op.random_seed = 0
-op.x_offset = 0.0
-op.y_offset = 0.0
-op.noise_size = 3.0
+op.noise_offset_x = 0.0
+op.noise_offset_y = 0.0
+op.noise_offset_z = 0.0
op.noise_size_x = 1.0
op.noise_size_y = 1.0
+op.noise_size_z = 1.0
+op.noise_size = 3.0
op.noise_type = 'distorted_heteroTerrain'
op.basis_type = '0'
op.vl_basis_type = '0'
-op.distortion = 1.0
+op.distortion = 0.800000011920929
op.hard_noise = '0'
op.noise_depth = 8
op.amplitude = 0.5
op.frequency = 2.0
-op.dimension = 1.119999885559082
+op.dimension = 1.0
op.lacunarity = 2.0
-op.moffset = 0.8799998760223389
+op.offset = 1.0
op.gain = 1.0
op.marble_bias = '0'
op.marble_sharp = '0'
op.marble_shape = '0'
op.height = 1.0
-op.invert = False
-op.offset = 0.0
+op.height_invert = False
+op.height_offset = 0.0
op.edge_falloff = '0'
-op.falloff_size_x = 6.0
-op.falloff_size_y = 6.0
+op.falloff_x = 4.0
+op.falloff_y = 4.0
op.edge_level = 0.0
op.maximum = 5.0
op.minimum = -0.5
+op.use_vgroup = False
op.strata = 5.0
op.strata_type = '0'
op.water_plane = False
op.water_level = 0.009999999776482582
-op.use_mat = False
-op.sel_land_mat = ''
-op.sel_water_mat = ''
+op.remove_double = False
+op.show_main_settings = True
op.show_noise_settings = True
-op.show_terrain_settings = True
+op.show_displace_settings = True
op.refresh = True
op.auto_refresh = True
-op.texture_name = ''
diff --git a/presets/operator/mesh.landscape_add/vlnoise_turbulence.py b/presets/operator/mesh.landscape_add/vlnoise_turbulence.py
new file mode 100644
index 00000000..832e8318
--- /dev/null
+++ b/presets/operator/mesh.landscape_add/vlnoise_turbulence.py
@@ -0,0 +1,59 @@
+import bpy
+op = bpy.context.active_operator
+
+op.ant_terrain_name = 'Landscape'
+op.land_material = ''
+op.water_material = ''
+op.texture_block = ''
+op.at_cursor = True
+op.smooth_mesh = True
+op.tri_face = False
+op.sphere_mesh = False
+op.subdivision_x = 128
+op.subdivision_y = 128
+op.mesh_size = 2.0
+op.mesh_size_x = 2.0
+op.mesh_size_y = 2.0
+op.random_seed = 56
+op.noise_offset_x = 0.0
+op.noise_offset_y = 0.0
+op.noise_offset_z = 0.0
+op.noise_size_x = 1.0
+op.noise_size_y = 1.0
+op.noise_size_z = 1.0
+op.noise_size = 1.0
+op.noise_type = 'vl_noise_turbulence'
+op.basis_type = '2'
+op.vl_basis_type = '3'
+op.distortion = 1.5
+op.hard_noise = '0'
+op.noise_depth = 3
+op.amplitude = 0.5
+op.frequency = 2.0
+op.dimension = 1.0
+op.lacunarity = 2.0
+op.offset = 0.10000000149011612
+op.gain = 1.0
+op.marble_bias = '0'
+op.marble_sharp = '0'
+op.marble_shape = '0'
+op.height = 0.20999999344348907
+op.height_invert = False
+op.height_offset = 0.11999999731779099
+op.edge_falloff = '3'
+op.falloff_x = 4.0
+op.falloff_y = 4.0
+op.edge_level = 0.0
+op.maximum = 1.0
+op.minimum = 0.0
+op.use_vgroup = False
+op.strata = 5.0
+op.strata_type = '0'
+op.water_plane = False
+op.water_level = 0.009999999776482582
+op.remove_double = False
+op.show_main_settings = True
+op.show_noise_settings = True
+op.show_displace_settings = True
+op.refresh = True
+op.auto_refresh = True
diff --git a/presets/operator/mesh.landscape_add/voronoi_hills.py b/presets/operator/mesh.landscape_add/voronoi_hills.py
index 53ec1515..ccb344c2 100644
--- a/presets/operator/mesh.landscape_add/voronoi_hills.py
+++ b/presets/operator/mesh.landscape_add/voronoi_hills.py
@@ -1,22 +1,28 @@
import bpy
op = bpy.context.active_operator
+op.ant_terrain_name = 'Landscape'
+op.land_material = ''
+op.water_material = ''
+op.texture_block = ''
op.at_cursor = True
op.smooth_mesh = True
op.tri_face = False
op.sphere_mesh = False
op.subdivision_x = 128
op.subdivision_y = 128
-op.meshsize = 2.0
-op.meshsize_x = 2.0
-op.meshsize_y = 2.0
+op.mesh_size = 2.0
+op.mesh_size_x = 2.0
+op.mesh_size_y = 2.0
op.random_seed = 111
-op.x_offset = 0.0
-op.y_offset = 0.0
-op.noise_size = 0.5
+op.noise_offset_x = 0.0
+op.noise_offset_y = 0.0
+op.noise_offset_z = 0.0
op.noise_size_x = 1.0
op.noise_size_y = 1.0
-op.noise_type = 'fractal'
+op.noise_size_z = 1.0
+op.noise_size = 0.5
+op.noise_type = 'multi_fractal'
op.basis_type = '3'
op.vl_basis_type = '0'
op.distortion = 1.0
@@ -26,29 +32,28 @@ op.amplitude = 0.5
op.frequency = 2.0
op.dimension = 1.0
op.lacunarity = 2.0
-op.moffset = 1.0
+op.offset = 1.0
op.gain = 1.0
op.marble_bias = '0'
op.marble_sharp = '0'
op.marble_shape = '0'
-op.height = 0.10000000149011612
-op.invert = True
-op.offset = 0.10000000149011612
-op.edge_falloff = '3'
-op.falloff_size_x = 8.0
-op.falloff_size_y = 8.0
+op.height = 0.25
+op.height_invert = True
+op.height_offset = 0.0
+op.edge_falloff = '0'
+op.falloff_x = 4.0
+op.falloff_y = 4.0
op.edge_level = 0.0
op.maximum = 1.0
-op.minimum = -0.10999999940395355
+op.minimum = 0.0
+op.use_vgroup = False
op.strata = 5.0
op.strata_type = '0'
op.water_plane = False
op.water_level = 0.009999999776482582
-op.use_mat = False
-op.sel_land_mat = ''
-op.sel_water_mat = ''
+op.remove_double = False
+op.show_main_settings = True
op.show_noise_settings = True
-op.show_terrain_settings = True
+op.show_displace_settings = True
op.refresh = True
op.auto_refresh = True
-op.texture_name = ''
diff --git a/presets/operator/mesh.landscape_add/vulcano.py b/presets/operator/mesh.landscape_add/vulcano.py
index 4aea3bbb..d11a7dd7 100644
--- a/presets/operator/mesh.landscape_add/vulcano.py
+++ b/presets/operator/mesh.landscape_add/vulcano.py
@@ -1,54 +1,59 @@
import bpy
op = bpy.context.active_operator
+op.ant_terrain_name = 'Landscape'
+op.land_material = ''
+op.water_material = ''
+op.texture_block = ''
op.at_cursor = True
op.smooth_mesh = True
op.tri_face = False
op.sphere_mesh = False
op.subdivision_x = 128
op.subdivision_y = 128
-op.meshsize = 2.0
-op.meshsize_x = 2.0
-op.meshsize_y = 2.0
+op.mesh_size = 2.0
+op.mesh_size_x = 2.0
+op.mesh_size_y = 2.0
op.random_seed = 7
-op.x_offset = 0.0
-op.y_offset = 0.0
-op.noise_size = 1.0
+op.noise_offset_x = 0.0
+op.noise_offset_y = 0.0
+op.noise_offset_z = 0.0
op.noise_size_x = 1.0
op.noise_size_y = 1.0
+op.noise_size_z = 1.0
+op.noise_size = 1.0
op.noise_type = 'marble_noise'
op.basis_type = '0'
op.vl_basis_type = '0'
op.distortion = 1.5
op.hard_noise = '0'
-op.noise_depth = 9
+op.noise_depth = 8
op.amplitude = 0.5
op.frequency = 2.0
op.dimension = 1.0
op.lacunarity = 2.0
-op.moffset = 1.0
+op.offset = 1.0
op.gain = 1.0
op.marble_bias = '2'
op.marble_sharp = '3'
op.marble_shape = '1'
op.height = 0.800000011920929
-op.invert = False
-op.offset = 0.0
+op.height_invert = False
+op.height_offset = 0.0
op.edge_falloff = '3'
-op.falloff_size_x = 2.0
-op.falloff_size_y = 2.0
+op.falloff_x = 2.0
+op.falloff_y = 2.0
op.edge_level = 0.0
op.maximum = 1.0
op.minimum = -1.0
+op.use_vgroup = False
op.strata = 5.0
op.strata_type = '0'
op.water_plane = False
op.water_level = 0.009999999776482582
-op.use_mat = False
-op.sel_land_mat = ''
-op.sel_water_mat = ''
+op.remove_double = False
+op.show_main_settings = True
op.show_noise_settings = True
-op.show_terrain_settings = True
+op.show_displace_settings = True
op.refresh = True
op.auto_refresh = True
-op.texture_name = ''