Extra Terrain Tools [Plugin] - Copy, Paste, and Transfer terrain from one place/game to another easily!


Copy, Paste, and Transfer terrain from one place/game to another easily!


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:

  1. 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…)
  2. 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:
image

  1. :blue_square:Region Selection::blue_square:
More Details...

image
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).
image

Once you click on the viewport, a small selection box will appear:
image
You can switch between the scale (resize) and the move handles by pressing R:
Changing Handles

You can scale both sides at the same time by holding Left Shift while dragging the handles
Dragging Both Sides

Press the deselect button or use the [Esc] key to deselect:
image

  1. :link:Copying your Selection::link:
More Details...

To copy the region you selected, just press the Copy Selection button of the plugin:
image

(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.:mountain: Inserting the Region Instance :mountain: (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:
image

Once pressed, you will find a TerrainRegion in the workspace: (automatically selected after you press the button). Copy that into the desired place.
image

4.1. :clipboard:Pasting your selection :clipboard: (In a different place/experience):

More Details...

After you copy the TerrainRegion instance into the other place, select it in the Explorer window.
image

Then, press Paste Selected Region (in the plugin’s menu), or press Control V if you have nothing else in your clipboard:
image

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.
Pasting Terrain

When you’re done, press the Paste button again to confirm.

4.2. :clipboard:Pasting your selection :clipboard: (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.

Pasting Terrain In the Same Place
When you’re done, press the Paste button again to confirm.

  1. EXTRA: :leaves:Pasting air with your selection :leaves:
More Details...

If you don’t want air to be pasted along with your selection, tick off the following checkbox:
image

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)

  1. EXTRA: :link: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.

  1. EXTRA: :red_circle:How to break/bug the plugin :red_circle: (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:

  1. Don’t delete it and the SelectionBox under it.
  2. Don’t move it or resize it using studio’s tools, only the handles provided with the plugin.
  3. Don’t Rotate it at all, might cause inaccurate copying.
  4. Don’t move it from the workspace to a different location.
  5. Don’t change its properties using the properties panel.

image
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:

  1. How to copy and paste terrain within the same place:
  1. 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 :slightly_smiling_face:!
Thank you for reading!

6 Likes

This is great! It’s allowing me to collaborate with a co-dev, where he builds terrain in a small, convenient place, and then I paste it in this way. The alternative, sharing TeamCreate access, would be risky because any misclick might damage the global terrain system, which is just a giant unary blob of data, and which I might not notice until much later (and fiddling around with loading old place versions and trying to patch up areas which were damaged is very hard)

It would be cool if a functionality like this were part of the default tools. It does feel like I should be able to select a terrain region, right-click “copy”, then switch to another studio instance and paste it in, easily move it, etc.

Thanks for creating this!

1 Like