Skip to content

Commit ec8f54b

Browse files
Content: add Lawnmower Tutorial (#87)
* initial commit * add info on tes3cmd deleting + linux use * Update: finish lawnmower tutorial - Also completed modding tools page for Lawnmower - included adding details to outgoing links
1 parent d89ccae commit ec8f54b

File tree

8 files changed

+284
-12
lines changed

8 files changed

+284
-12
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
---
2+
title: Using Lawnmower to Delete Clipping Groundcover
3+
aliases:
4+
- Using Lawnmower to Delete Clipping Groundcover
5+
- Lawnmower Groundcover Tutorial
6+
tags:
7+
- Groundcover
8+
- Lawnmower
9+
- Tutorials
10+
- Grass
11+
- Cleaning-Mods
12+
description: How to use `lawnmower.py` script to clean groundcover mods of excess grass
13+
parent: "[[the-lawnmower|Lawnmower]]"
14+
related articles:
15+
- "[[the-lawnmower|Lawnmower]]"
16+
---
17+
## About
18+
19+
> [!infobox|n-th]
20+
>
21+
> ## Lawnmower Groundcover Tutorial
22+
>
23+
> ![[lawnmower-for-morrowind-logo.webp|center]]
24+
>
25+
> ### Tutorial Info
26+
>
27+
> | Type | Name |
28+
> | --- | --- |
29+
> | **Requirements** | - [The Lawnmower](https://www.nexusmods.com/morrowind/mods/53034)<br>- [Tes3conv](https://github.com/Greatness7/tes3conv)<br>- [Python 3.5 or later](https://www.python.org/)<br>- [Tes3cmd](https://modding-openmw.com/mods/tes3cmd/) (optional)<br>- [TESTool](https://www.nexusmods.com/morrowind/mods/47473) (optional) |
30+
> | **Tutorial Files** | Any groundcover plugin you like that has not already had Lawnmower ran on it (the mod description will likely state whether this is the case) |
31+
32+
This tutorial covers how to use [[the-lawnmower|The Lawnmower]] tool to clean [[guides/groundcover/index|groundcover]] mods of excess grass - specifically, grass which clips through or is hidden under other objects.
33+
34+
![[the-lawnmower#^2eccab|clean]]
35+
36+
However, for the purposes of this tutorial we will only be focusing on the titular **Lawnmower**.
37+
38+
### Goals
39+
40+
By the end of this tutorial, you should be able to:
41+
42+
1. Run `lawnmower.py` Python script on a groundcover plugin
43+
2. Compare a groundcover plugin against multiple mods ('chaining')
44+
3. Understand how to use the 'autoclean' plugins to increase the accuracy of The Lawnmower
45+
4. Clean the patched groundcover plugin
46+
47+
### Prerequisites
48+
49+
> [!Info|right wm-sm txt-s] Installing Python
50+
> Whilst it may seem daunting, installation is unremarkable on most platforms.[^1]
51+
>
52+
> See Python [BeginnersGuide / Download](https://wiki.python.org/moin/BeginnersGuide/Download) for help.
53+
54+
In addition to downloading The Lawnmower (tools only), the tool also requires that you have [Tes3conv](https://github.com/Greatness7/tes3conv) and [Python](https://www.python.org/) installed.
55+
56+
Copy `tes3conv.exe` to your Morrowind `Data Files` folder, or install it using a mod manager.
57+
58+
Likewise, copy `lawnmower.py` from The Lawnmower to `Data Files` or install it with a mod manager.
59+
60+
## Running the Script
61+
62+
```mermaid
63+
flowchart LR
64+
65+
A("python") --> B("lawnmower.py") --> C("Morrowind.esm") --> D("Rem_AC.esp") --> E("Rem_AC_out.esp")
66+
A ~~~ |"Python"| A
67+
B ~~~ |"the Python script to execute"| B
68+
C ~~~ |"Input"| C
69+
D ~~~ |"Groundcover"| D
70+
E ~~~ |"Output"| E
71+
72+
73+
```
74+
75+
`lawnmower.py` is a Python script. To run it, open a command-line terminal (e.g., Windows Powershell) and enter `python lawnmower.py`, followed by three plugin names:
76+
77+
1. **Input**: The plugin to compare the groundcover against, e.g., `Morrowind.esm`.
78+
2. **Groundcover mod**: The groundcover plugin Lawnmower will trim, e.g., `Rem_AC.esp`
79+
3. **Output**: The name you give to the trimmed groundcover mod, e.g., `Rem_AC_out.esp`
80+
- Output can be named anything you like, as long as it ends with the extension `.esp` or `.esm`, e.g., `trimmed_mod.esm`.
81+
82+
This would be entered as:
83+
84+
```
85+
python lawnmower.py Morrowind.esm Rem_AC.esp Rem_AC_out.esp
86+
```
87+
88+
Press <kbd>Enter</kbd> to execute the script, and Lawnmower will create the freshly trimmed groundcover plugin '`Rem_AC_out.esp`'.
89+
90+
## Running Lawnmower Against Mutiple Plugins
91+
92+
Also known as 'Chaining' - The steps taken above in [[lawnmower-tutorial#Running the Script|'Running the Script']] can be repeated by substituting different input plugins.
93+
94+
For example, if you add a city overhaul mod which adds numerous buildings to cities (e.g., `cool cities.esp`, and you wish for your previous `Rem_AC_out.esp` to be trimmed of grass clipping through the new buildings, the command can be formatted like so:
95+
96+
```
97+
python lawnmower.py "cool cities.esp" Rem_AC_out.esp "Rem_AC_out 2.esp"
98+
```
99+
100+
```mermaid
101+
flowchart LR
102+
103+
A("python") --> B("lawnmower.py") --> C("cool cities.esp") --> D("Rem_AC_out.esp") --> E("Rem_AC_out 2.esp")
104+
A ~~~ |"Python"| A
105+
B ~~~ |"the Python script to execute"| B
106+
C ~~~ |"Input"| C
107+
D ~~~ |"Groundcover"| D
108+
E ~~~ |"Output"| E
109+
110+
111+
```
112+
113+
This can be repeated for any plugins you wish to compare the groundcover against, and even turned into a <abbr title="Batch File">BAT file</abbr> to be reused.
114+
115+
> [!tip|txt-s] Using Lawnmower with your Entire Mod-List
116+
> Some tools for [[modding-tools/merging-plugins/index|merging plugins]], such as [[habasi|Habasi]], can generate a single merged plugin of your entire mod list. This merged plugin can be used as the `input` plugin for Lawnmower, saving you the trouble of running the script on individual mods.
117+
118+
## Utilizing Autoclean Plugins
119+
120+
Autoclean plugins can be used to increase the accuracy of Lawnmower in detecting clipping groundcover.
121+
122+
Lawnmower comes packaged with two autoclean plugins:
123+
124+
- `autoclean_cities_vanilla.esp`: &nbsp; For Vvardenfell cities
125+
- `autoclean_cities_TR.ESP`: &nbsp; For [Tamriel Rebuilt](https://www.tamriel-rebuilt.org/) cities
126+
127+
These plugins utilize the invisible marker meshes from [[the-lawnmower#Grassblocker|Grassblocker]], which `lawnmower.py` treats as objects when detecting whether grass is clipping. The plugins place these meshes in common areas where unwanted grass is often generated by [[mesh-gen|Mesh Generator]], but which otherwise won't be detected by `lawnmower.py` unless an object covers the area - i.e., a Grassblocker mesh. Mod makers can also create Lawnmower autoclean patches for their own mods using Grassblocker.
128+
129+
The syntax for cleaning a groundcover plugin with an autoclean plugin is the same as any other:
130+
131+
```
132+
python lawnmower.py autoclean_cities_vanilla.esp "my grassmod.esp" "my grassmod_out.esp"
133+
```
134+
135+
## Advanced - Cleaning the Plugin
136+
137+
The caveat to The Lawnmower is that it does not truly delete the grass references it detects.
138+
139+
Instead, it moves their coordinates to `X: 0`, `Y: 0`, `Z: -20,000`, far below the surface of the game world. As groundcover plugins contain tens of thousands of references, these moved references are still taking up file space, even if they are never encountered in-game. Deleting these will not improve performance markedly, but it can make analyzing the output plugin easier.
140+
141+
With a couple of extra steps, the reference count of the output plugin can be greatly reduced.
142+
143+
> [!Note|txt-s right wm-sm] Note on Performance Impact
144+
> Deleting the references likely will not offer any noticeable performance gain, beyond marginally improving plugin load speed upon launching the game.
145+
>
146+
> However, it does make it easier to analyze the output plugin later by removing redundant data, for example:
147+
>
148+
> - Viewing modified cells in [[CSSE]] or [[modding-tools/low-level-editors/index|low-level editors]]: Cells containing only grass moved by Lawnmower will no longer appear as modified.
149+
> - Viewing a text representation of the plugin created by Tes3cmd `dump`, Tes3conv JSON or [[deltaplugin|DeltaPlugin]] YAML: Cleaning the plugin 'declutters' it so redundant data does not clutter the results.
150+
151+
Cleaning the output plugin of redundant `CELL` references involves two steps:
152+
153+
1. Delete the moved grass with [[tes3cmd|Tes3cmd]].
154+
2. Clean the plugin of any empty cells with [[testool|TESTool]].
155+
156+
The second step is useful for instances where Lawnmower has removed all grass from a cell, leaving an empty `CELL` record.
157+
158+
### Step 1 - Tes3cmd
159+
160+
Thankfully, the moved references have one unique thing in common: their coordinates have all been moved to `Z: -20,000`.
161+
162+
The following Tes3cmd `delete` command will delete all the moved references:
163+
164+
```tile="tes3cmd 'delete' command"
165+
tes3cmd delete --instance-match "Z\:-20000" <path-to-plugin>
166+
```
167+
168+
Replace `<path-to-plugin>` with your plugin name.
169+
170+
### Step 2 - TESTool
171+
172+
TESTool can clean empty cells which are otherwise not considered by Tesecmd as 'junk cells'.
173+
174+
Simply run TESTool `Clean ESP/ESM files` on the output plugin.
175+
176+
## Further Reading
177+
178+
- [[the-lawnmower|The Lawnmower]]
179+
- [[mesh-gen|Mesh Generator]]
180+
- [[habasi|Habasi]]
181+
182+
[^1]: "Python for Beginners: Installing", Python.org, accessed August 24, 2024, https://www.python.org/about/gettingstarted/

mmw-content/index.md

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Completed articles so far include:
1616
- [[esp-replacer-patch-beginner-tutorial|ESP-Replacer Patch Beginner Tutorial]]
1717
- [[morrowind-interiors-project|Morrowind Interiors Project]]
1818
- [[simple-texture-animation-in-blender|Simple Texture Animation in Blender]]
19+
- [[the-lawnmower|Lawnmower]]
20+
- [[lawnmower-tutorial|Lawnmower Groundcover Tutorial]]
1921

2022
Work-in-progress articles:
2123
- [[creating-a-patch-for-an-esp|Creating a Patch for an ESP]]

mmw-content/modding-tools/generating-groundcover/the-lawnmower.md

+85-6
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,103 @@ title: The Lawnmower
33
aliases:
44
- The Lawnmower
55
- Lawnmower
6+
- Weedwhacker
7+
- Grassclipper
8+
- Grassblocker
69
tags:
710
- Lawnmower
8-
description:
11+
- Cleaning-Mods
12+
- Groundcover
13+
description: A tool for cleaning groundcover mods of excess grass using Python scripts and Tes3conv.
14+
parent: "[[modding-tools/generating-groundcover/index|Generating Groundcover]]"
15+
related articles:
16+
- "[[lawnmower-tutorial|Lawnmower Groundcover Tutorial]]"
917
---
1018

19+
![[lawnmower-for-morrowind-banner.webp|sban]]
20+
1121
![[maintenance-expand-article#^6fc39d|clean]]
1222

1323
## About
1424

15-
> [!infobox]
25+
> [!infobox|n-th]
1626
>
1727
> ## The Lawnmower
1828
>
19-
> %%![[insert image]]%%
29+
> ![[lawnmower-for-morrowind-logo.webp]]
2030
>
21-
> ### Table Heading
31+
> ### Details
2232
>
2333
> | Type | Name |
2434
> | --- | --- |
25-
> | Row | Row |
26-
> | Row | Row |
35+
> | **Links** | - [NexusMods](https://www.nexusmods.com/morrowind/mods/53034)<br>- [Github](https://github.com/acidzebra/lawnmower) |
36+
> | **Requirements** | - [Python]()<br>- [[tes3conv\|Tes3conv]] |
37+
38+
**The Lawnmower** is a tool for cleaning [[guides/groundcover/index|groundcover]] mods of excess grass using Python scripts and Tes3conv.
39+
40+
> [!NOTE|clean no-t] %%outline of lawnmower tools%%
41+
> The Lawnmower actually comprises four separate tools:
42+
>
43+
> - **[[the-lawnmower#Lawnmower|'Lawnmower']]**: removes clipping and unwanted grass
44+
> - **[[the-lawnmower#Weedwhacker|'Weedwhacker']]**: thins out grass
45+
> - **[[the-lawnmower#Grassclipper|'Grassclipper']]**: fixes floating grass
46+
> - **[[the-lawnmower#Grassblocker|'Grassblocker']]**: makes your mod autoclean-compatible
47+
^2eccab
48+
49+
## Lawnmower
50+
51+
`lawnmower.py` will take an input esp/esm file, a grass mod, and an output file as commandline arguments. It will compare them and if there is any clipping detected between the grass and objects in the mod, it will move the grass out of sight.
52+
53+
Moved grass references have their coordinates set to `Z: 0`, `X: 0`, `Z: -20,000`.
54+
55+
**Usage:**
56+
```
57+
python lawnmower.py "Morrowind.esm" "AesAdGrass_AC.esp" "AesAdGrass_AC_out.esp"
58+
```
59+
60+
## Weedwhacker
61+
62+
`weedwhacker.py` takes a groundcover mod, an output plugin and a number between 1-99 as its arguments. It will reduce the grass references in the output plugin as a percentage according to the number chosen.
63+
64+
**Usage:**
65+
```
66+
python weedwhacker.py "mygrassmod.esp" "mygrassmod_out.esp" 50
67+
```
68+
69+
## Grassclipper
70+
71+
`grassclipper.py` takes two groundcover mods as input, comparing both for matching cells and overwriting the cells of mod A with those of mod B, then saving the combined output.
72+
73+
**Grassclipper** is mainly intended for mod makers to speed up the process of creating groundcover patches after generating grass with [[mesh-gen|Mesh Generator]].
74+
75+
**Usage:**
76+
```
77+
python grassclipper.py "mygrassmod.esp" "mygrassmod_patch.esp" "mygrassmod_combined.esp"
78+
```
79+
80+
> [!Warning]
81+
> In order to work correctly, both groundcover mods must be generated using the same `.ini` configuration from Mesh Generator.
82+
83+
## Grassblocker
84+
85+
**Grassblocker**, rather than being a script, is a method of creating custom 'auto-clean' plugins that can improve the accuracy of `lawnmower.py`.
86+
87+
> [!caption|right wm-sm]
88+
> ![[lawnmower-grassblocker-meshes-in-balmora.webp|wm-sm]]
89+
> Grassblocker meshes in Balmora
90+
91+
This is achieved by utilizing the `grassblocker_` meshes included with Lawnmower:
92+
93+
- `grassblocker_small.nif`
94+
- `grassblocker_medium.nif`
95+
- `grassblocker_large.nif`
96+
- `grassblocker_xl.nif`
97+
- `grassblocker_xxl.nif`
98+
99+
These invisible marker meshes will appear in the Construction Set, but not in-game, and will be detected by `lawnmower.py` like any other reference when checking for grass which clips through other objects.
100+
101+
## Troubleshooting
102+
103+
**Linux**
104+
> "This tool almost works on linux. I had to replace `tes3conv.exe` with `tes3conv` (which is in my $PATH) and remove the check that checks for the file present in the directory"
105+
> \- DorsaiDonal, [Nexus mod page comments](https://www.nexusmods.com/morrowind/mods/53034?tab=posts), 29 November 2023, 10:42AM

mmw-content/modding-tools/merging-plugins/habasi.md

+15-6
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,31 @@ aliases:
55
tags:
66
- Habasi
77
- Combining-plugins
8-
description:
8+
description: Habasi is a command-line tool for merging multiple plugins into one.
9+
parent: "[[modding-tools/merging-plugins/index|Merging Plugins]]"
10+
related articles:
11+
- "[[lawnmower-tutorial|Lawnmower Groundcover Tutorial]]"
12+
- "[[modding-tools/merging-plugins/index|Merging Plugins]]"
913
---
1014

1115
![[maintenance-expand-article#^6fc39d|clean]]
1216

1317
## About
1418

15-
> [!infobox]
19+
> [!infobox|n-th]
1620
>
1721
> ## Habasi
1822
>
19-
> %%![[insert image]]%%
23+
> > [!caption|wfull txt-s]
24+
> > ![[picture-of-habasi-from-uesp.webp|profile ws-med hs-med]]
25+
> > (image credit: [UESP](https://en.uesp.net/wiki/File:MW-npc-Sugar-Lips_Habasi.jpg))
2026
>
21-
> ### Table Heading
27+
> ### Details
2228
>
2329
> | Type | Name |
2430
> | --- | --- |
25-
> | Row | Row |
26-
> | Row | Row |
31+
> | **Links** | [NexusMods](https://www.nexusmods.com/morrowind/mods/53002)<br>[Github](https://github.com/alvazir/habasi/) |
32+
> | **Requirements** | None |
33+
> | **License** | [GNU GPLv3](https://github.com/alvazir/habasi/blob/master/LICENSE) |
34+
35+
**Habasi** is a command-line tool for merging multiple plugins into one.

0 commit comments

Comments
 (0)