Introduction:
Hello developers! Recently, I’ve found myself working in different places to divide my work. I’ve noticed that there’s no easy way to take terrain from one place and put it into another, and that there are no buttons for copying and pasting in the same place as well (I am aware that you can use Control C + Control V, but there are no buttons, only key-shortcuts).
The only ways to achieve that were to:
- Use the command bar with the Terrain API. It was an unpleasant process, in which my studio crashed multiple times (due to the corners Vector3s not being set correctly, resulting in negative SizeInCells, which shouldn’t even be possible…)
- Use the excellent “Terrain Save and Load” plugin by sleitnick, or modify its Terrain API ModuleScript. I’ve found that I didn’t want to overwrite my entire Terrain in one place just to paste a small portion (in my case, an island) from the other place into it.
All of the above is why I’ve decided to make this plugin for myself and for everyone to use.
If you find any bugs or have feedback, please let me know in this thread!
⛰️How to Use⛰️:
Under the plugins section, you should see the following button to toggle the plugin widget:
- Region Selection:
More Details...
Using the Region Selection button, you can select your terrain region easily. Simply press the button, and click on where you’d like the selection box to appear (in the studio viewport).
Once you click on the viewport, a small selection box will appear:
You can switch between the scale (resize) and the move handles by pressing R:
You can scale both sides at the same time by holding Left Shift while dragging the handles
Press the deselect button or use the [Esc]
key to deselect:
- Copying your Selection:
More Details...
To copy the region you selected, just press the Copy Selection
button of the plugin:
(You can also use Control + C if you have nothing selected in your explorer)
The button’s title will change to “Copied!” if copied successfully, or “Nothing Selected” if you’ve selected nothing.
3. Inserting the Region Instance (Optional: only do that if you wish to paste the terrain in a different place)
More Details...
To paste your region into a different place, you can use the Insert Region Instance
feature:
Once pressed, you will find a TerrainRegion in the workspace: (automatically selected after you press the button). Copy that into the desired place.
4.1. Pasting your selection (In a different place/experience):
More Details...
After you copy the TerrainRegion instance into the other place, select it in the Explorer window.
Then, press Paste Selected Region
(in the plugin’s menu), or press Control V if you have nothing else in your clipboard:
You should now be able to select where to paste your selection. Like the Region Selection feature, you have to first click on where you’d like the region selection box to appear.
(At any point you can cancel this by right-clicking the paste button, pressing the [Esc]
key, or pressing the deselect button)
It should be orange now and set to the size of the region you selected. (You cannot resize your selection during the pasting step.). Move it to where you’d like to paste it.
When you’re done, press the Paste button again to confirm.
4.2. Pasting your selection (In the same place/experience):
More Details...
After selecting your region and copying it, you can now paste your selection within the same place by clicking the Paste button in the plugin.
You should now be able to select where to paste your selection. Like the Region Selection feature, you have to first click on where you’d like the region selection box to appear.
(At any point you can cancel this by right-clicking the paste button, pressing the [Esc]
key, or pressing the deselect button)
It should be orange now and set to the size of the region you selected. (You cannot resize your selection during the pasting step.). Move it to where you’d like to paste it.
When you’re done, press the Paste button again to confirm.
- EXTRA: Pasting air with your selection
More Details...
If you don’t want air to be pasted along with your selection, tick off the following checkbox:
One reason you might not want to paste it with your selection is that it replaces other materials with air (Such as water, or anything else you might not want to replace while pasting your selection)
- EXTRA: Undo Feature:link: (Control + Z)
More Details...
If you find yourself having pasted a region in the wrong position, or having forgotten to tick off/on the “Paste Empty Cells (air)” checkbox, or even scaled/moved the selection box wrongly, worry not! I added a feature where you can undo any actions that you’ve done by mistake. To undo something, just use the studio’s undo arrows (in the top left), or press Control Z.
- EXTRA: How to break/bug the plugin (In other words, what not to do):
More Details...
I’ve tried to make the plugin as easy to use as possible, but there are several things you shouldn’t do with it (or do at your own risk, you might encounter bugs lol):
Firstly, Don’t mess with the TerrainToolsSelectionBox, which includes:
- Don’t delete it and the SelectionBox under it.
- Don’t move it or resize it using studio’s tools, only the handles provided with the plugin.
- Don’t Rotate it at all, might cause inaccurate copying.
- Don’t move it from the workspace to a different location.
- Don’t change its properties using the properties panel.
Secondly, I haven’t thoroughly tested the “Redo” feature yet. That means that for now, I wouldn’t recommend using it (Control Y).
Video Tutorials:
- How to copy and paste terrain within the same place:
- How to transfer terrain from one game to another:
Source Code
If you would like to see how the plugin works, I've documented my entire code with comments to explain exactly what I've done and why.Visit the link here in Pastebin: Extra Terrain Tools by LightningLion58 - Pastebin.com
Bugs and Feedback:
If you have any suggestions or find any bugs, feel free to reply and I will attempt to fix them as soon as possible!Lastly,
This plugin is completely free and available for anyone to use.
I hope you’ve found this helpful, have a wonderful day/night !
Thank you for reading!