plugin github page
The MacroMachine Plugin automates global operation workflows.
Define simple actions, like applying terrain to certain slopes, and combine many actions into a Macro, that is executed with a single click across the whole map.
Actions and Macros are saved into the plugins folder and available in all worldpainter projects.
Its comparable to chaining many global operations, and be able to save that workflow so it can be reused.
- go to the release page
- select the top most Macro-Machine release
- download the Macro-Machine-Plugin-x.x.x.jar file
- open worldpainter
- go to top bar -> tools -> open plugins folder
- place the downloaded jar file in the folder
- restart worldpainter
- Find the Macro tool and left click it. The macro panel will open.
- Select the macro you want to execute by left clicking it in the tree view.
- Press “Apply Macros” on the bottom, the macro will execute globally on the whole map.
- Click into worldpainter or close the Macro Panel.
- Deselect macro tool, reselect macro tool to open the panel again.
Let’s create a simple macro that creates a mask for us: add all Swamp and Desert biome to selection.
- Create a new macro by clicking “Create Macro”. A new macro with the name “New mapping macro” appears in the tree panel.
- Left click “New Mapping Macro”. It is now shown in the macro designer on the right.
- The macro is a list of actions that are run in fixed order. Topmost action goes first, bottom most action goes last. Right now the list is still empty.
- Click “Add”, then select “create new action” in the dialog. A new action is created and added to the list. Press “save” to save the changes we made to this macro.
- In the tree view (left), expand the Macro. You can see that is now has an action listed. Select the action
- The Action Designer now opens on the right. Select “biome” as input, “set” as type, “selection block” as output.
- In the table on the right, set “swamp” and “desert” to “Selection Block: ON”. This means when the action is executed, all blocks that are “swamp” or “desert” biome are set to be selected. All blocks that are a different biome are deselected.
- Save your progressof this action with the “save” key
- Select the macro where the action lives in.
- Press “execute macro”
- All swamp and desert biome blocks are now selected, everything else is deselected
- check the “log” tab, to see some statistics about your action.
Not all actions are simple “if this, then this”, like our desert-and-swamp-to-selection example. If you want to paint pine trees in flat slopes and reduce the amount the steeper it gets, a 1:1 mapping for each angle is very tedious. For this, the gradient editor exists.
- Create an action with input: slope, type: set, output: pines
- The x axis (bottom) is the input values
- The y axis (left) is the output value
- The curve shows you which input is mapped to which output value
- Left click into the curve to add a new point
- Drag points to change where you want them
- Right click to delete a point
- Values between points are automatically interpolated
- the curve below means that pines are set with strength=10 when the slope is 0°. the steeper the area, the lower pine strength gets, up until 60° slope with strength=7. Then it falls to strength=0 at slope=70°.
- You can edit values in the table, but only where points are set. Editable values are black, Interpolated values are grey.
- Run the action on a world with a mountain
- Sometimes the input can be interpolated, but the output is fixed values, like mapping slope to annotation colors. If that happens, the gradient editor is available and you can define input ranges to map to specific values:
If you only want to operate on some parts of the map, you should use the action filter. Create an action that uses an input to set the action filter. Any actions in the macro after the filter action will ignore blocks that were previously filtered out. Use Always-set-ActionFilter to reset the filter and allow all blocks. Each filter is limited to its macro and does not influence other macros. More restrictive filters usually also mean better performance, because less tiles have to be touched by the macro.
Use the “Always” input to apply an output everywhere. Always still respects previous Action-Filters and will ignore filtered out blocks.
Spraypaint output will spraypaint a layer onto blocks with certain chance for each block.
This input/output only exists during the execution of the macro. it allows you to save values for the duration fo the execution. The alpine macro uses it to store the chance for snow in each block over multple actions, before finally applying it to snow. Its also more performance-friendly than saving the value into a layer in the world.
You can call a macro inside of another macro. But beware: if macro A calls Macro B and macro B calls Macro A, you get an infinite loop. The system will detect it and now allow you to save such a state.
It’s not yet possible to use custom layers as inputs or outputs. We are working on it.
Q: What does this panel do A: Look for the “?” button and hover over buttons to see tooltips.
Q: If i click “Apply macros”, nothing on my map happens A: check the log. usually, the macro does something under special circumstances that dont exist on your map, f.e. because the map is flat and the macro tries to paint mountains in steep areas.
Q: Something broke, what now? A: Send a bug report to @IR0NSIGHT in the discord https://discord.gg/9kRJEMfGeE or on github here. You can find your log files in the parent folder of top bar -> tools -> open plugins folder. The logs are calles logfile0.txt usually, please include the latest log file.
Leave a Reply