Compare commits

..

2 Commits

Author SHA1 Message Date
Matthew Gordon 5e92c691a8 Clean up whitespace and dead code 2025-06-04 20:28:45 -03:00
Matthew Gordon 77a821cae0 Add build instructions to README 2025-06-04 20:27:05 -03:00
2 changed files with 28 additions and 19 deletions

View File

@ -1,3 +1,19 @@
# blender-mapping-tools # blender-mapping-tools
Blender extension for creating maps Blender extension for creating maps
## Building
TODO: make a proper build system.
For Blender 4.4:
```sh
pip download rasterio --dest ./wheels --only-binary==:all: --python-version=3.11
# Or replcace ".." below with any directory.
# blender_mapping_tools-0.1.0.zip will be placed in that directory.
blender --command extension build --output-dir ..
```
Then install `blender_mapping_tools-0.1.0.zip` as an extension in blender. It
will add a "Mesh from GeoTIFF" option to the "Add" menu.

View File

@ -38,7 +38,6 @@ class GridTriangleGenerator():
self.grid_size_y = grid_size_y self.grid_size_y = grid_size_y
def __len__(self): def __len__(self):
#return (self.grid_size_x - 1) * (self.grid_size_y - 1) * 2
return (self.grid_size_x - 1) * (self.grid_size_y - 1) return (self.grid_size_x - 1) * (self.grid_size_y - 1)
def __iter__(self): def __iter__(self):
@ -52,8 +51,6 @@ class GridTriangleGenerator():
v10 = j * self.grid_size_x + i + 1 v10 = j * self.grid_size_x + i + 1
v11 = (j + 1) * self.grid_size_x + i + 1 v11 = (j + 1) * self.grid_size_x + i + 1
yield (v00, v10, v11, v01) yield (v00, v10, v11, v01)
#yield (v00, v10, v01)
#yield (v01, v10, v11)
class CreateMeshFromGeotiffOperator(bpy.types.Operator, ImportHelper): class CreateMeshFromGeotiffOperator(bpy.types.Operator, ImportHelper):
@ -91,10 +88,6 @@ class CreateMeshFromGeotiffOperator(bpy.types.Operator, ImportHelper):
return {'FINISHED'} return {'FINISHED'}
def construct_mesh(self, grid_size_x, grid_size_y, cell_size_x, cell_size_y, dem_array): def construct_mesh(self, grid_size_x, grid_size_y, cell_size_x, cell_size_y, dem_array):
#grid_size_x = 10
#grid_size_y = 15
#cell_size_x = 0.75
#cell_size_y = 0.5
return (GridVertexGenerator(grid_size_x, grid_size_y, cell_size_x, cell_size_y, dem_array), return (GridVertexGenerator(grid_size_x, grid_size_y, cell_size_x, cell_size_y, dem_array),
[], [],
GridTriangleGenerator(grid_size_x, grid_size_y, cell_size_x, cell_size_y)) GridTriangleGenerator(grid_size_x, grid_size_y, cell_size_x, cell_size_y))