[Bf-extensions-cvs] [d93ef9e6] master: Ant landscape, remove original file: mention rBAfcab90a6a004
meta-androcto
noreply at git.blender.org
Wed Jun 14 08:58:29 CEST 2017
Commit: d93ef9e6a674d35c3df82aea6c8316272763a7d4
Author: meta-androcto
Date: Wed Jun 14 16:58:05 2017 +1000
Branches: master
https://developer.blender.org/rBAd93ef9e6a674d35c3df82aea6c8316272763a7d4
Ant landscape, remove original file: mention rBAfcab90a6a004
===================================================================
D add_mesh_ant_landscape.py
===================================================================
diff --git a/add_mesh_ant_landscape.py b/add_mesh_ant_landscape.py
deleted file mode 100644
index eaa19b54..00000000
--- a/add_mesh_ant_landscape.py
+++ /dev/null
@@ -1,1422 +0,0 @@
-# ##### 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 #####
-
-bl_info = {
- "name": "A.N.T. Landscape",
- "author": "Jimmy Hazevoet",
- "version": (0, 1, 6),
- "blender": (2, 77, 0),
- "location": "View3D > Add > Mesh",
- "description": "Another Noise Tool: Add a landscape primitive",
- "warning": "",
- "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
- "Scripts/Add_Mesh/ANT_Landscape",
- "category": "Add Mesh",
-}
-
-"""
-# -------------------------------------------------------------
-- UPDATE: A.N.T. Landscape - Version 0,1,6 (5/2017)
-# -------------------------------------------------------------
- - NEW:
- -
- - Use Blender internal texture data block - texture nodes
- - Variable X and Y grid size and variable X and Y subdivisions
- - Triangulate faces
- - Slope map, z normal to vertex group weight,
- and optional select vertices on flat area's
- - Place landscape at cursor position or at world center
- - Noise variations (from old A.N.T. Blender-2.49 addon)
- - Variable X and Y noise size (and X Y Offset since version 0.1.5)
- - Plateau and Sealevel renamed to Maximum (plateau) and Minimum (now: seabed)
- - Variable X and Y edge fallof with variable edge level (now: sealevel)
- - Add water plane with variable height
- - Use materials
- - Some small changes and fixes
- -
-
-# -------------------------------------------------------------
-# Another Noise Tool: Landscape mesh generator
-# -------------------------------------------------------------
-MESH OPTIONS:
-Mesh update: Turn this on for interactive mesh refresh.
-Sphere: Generate sphere or a grid mesh.
-Smooth: Generate smooth shaded mesh.
-Triangulate: Triangulate faces
-Subdivision X Y: Number of mesh X Y subdivisions, higher numbers gives more detail but slows down the script.
-Mesh size X Y: X,Y size of the grid mesh in blender units.
-X_Offset: Noise x offset in blender units (make tiled terrain)
-Y_Offset: Noise y offset in blender units
-Cursor: Place at cursor location
-Vertex Group: Slope map, z normal value to vertex group weight,
- and select vertices on flat area's
-
-NOISE OPTIONS: ( Many of these options are the same as in blender textures. )
-Random seed: Use this to randomise the origin of the noise function.
-Noise size: Size of the noise.
-Noise type: Available noise types: multiFractal, ridgedMFractal, fBm, hybridMFractal, heteroTerrain,
- Turbulence, Distorted Noise, Marble, Shattered_hTerrain, Strata_hTerrain, Planet_noise
-Noise basis: Blender, Perlin, NewPerlin, Voronoi_F1, Voronoi_F2, Voronoi_F3, Voronoi_F4, Voronoi_F2-F1,
- Voronoi Crackle, Cellnoise
-Distortion: Distortion amount.
-Hard: Hard/Soft turbulence noise.
-Depth: Noise depth, number of frequencies in the fBm.
-Dimension: Musgrave: Fractal dimension of the roughest areas.
-Lacunarity: Musgrave: Gap between successive frequencies.
-Offset: Musgrave: Raises the terrain from sea level.
-Gain: Musgrave: Scale factor.
-Marble Bias: Sin, Tri, Saw
-Marble Sharpnes: Soft, Sharp, Sharper
-Marble Shape: Shape of the marble function: Default, Ring, Swirl, Bumps, Wave, X, Y
-
-TERRAIN OPTIONS:
-Height: Scale terrain height.
-Invert: Invert terrain height.
-Offset: Terrain height offset.
-Seabed: Flattens terrain at seabed level.
-Plateau: Flattens terrain at plateau level.
-Falloff: Terrain height falloff: X falloff, Y falloff, XY falloff
-Edge Level: Falloff edge level, sealevel
-FalloffSizeX: Scale falloff x
-FalloffSizeY: Scale falloff y
-Strata: Strata amount, number of strata / terrace layers.
-Strata type: Strata types, Smooth, Sharp-sub, Sharp-add, Quantize
-
-WATER: Add water plane
-Level: Adjust plane level
-
-MATERIAL: Use materials
-"""
-
-# import modules
-import bpy
-from bpy.props import (
- BoolProperty,
- EnumProperty,
- FloatProperty,
- IntProperty,
- StringProperty,
- FloatVectorProperty,
- )
-from mathutils import Vector
-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).
-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, edges, faces)
-
- # Update mesh geometry after adding stuff.
- mesh.update()
-
- from bpy_extras import object_utils
-
- return object_utils.object_data_add(context, mesh, operator=None)
-
-
-# ------------------------------------------------------------
-# Generate XY Grid
-def grid_gen(sub_d_x, sub_d_y, tri, meshsize_x, meshsize_y, options, 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 = landscape_gen(x, y, 0, meshsize_x, meshsize_y, options)
-
- 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, options, 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 = landscape_gen(u, v, w, meshsize, meshsize, options) / 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 ANTSlopeVGroup(bpy.types.Operator):
- bl_idname = "mesh.ant_slope_vgroup"
- bl_label = "Slope Map"
- bl_description = "Slope map - z normal value to vertex group weight"
- #bl_options = {'REGISTER'}
-
- 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"
- )
-
- 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
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list