Topic: Regenerating buildings

Hi Alex.

I'm trying to regenerate buildings for a few tiles at once.
I created a little tool with the code you pass me.
Now I found in the forum a related script you shared about generate building.


Just need a little help with the prefabs.
On: "path += "/" + RealWorldTerrainBuildingGenerator.baseContainer.name + ".prefab";" I just should to put my prefab's folder in the "/" thing, right?
Then, to set the "Placement Mode" to Lower Corner, I didn't find the field. Could do you show it? BottomMode?

Thanks, again.
Joan

Post's attachments

Attachment icon Captura-de-pantalla-(364)Low.png 638.89 kb, 66 downloads since 2021-12-01 

Re: Regenerating buildings

Hello.

Unfortunately I didn't understand your question about the prefab path.
Please rephrase this in more detail.

Placement Mode is inside RealWorldTerrainBuildingPrefab class.
You need to set the list of items (RealWorldTerrainWindow.prefs.buildingPrefabs) and for each item you can specify the desired Placement Mode.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Regenerating buildings

Hello Alex.

Thanks for answering.

Ok. In trying to regenerate the buildings for some tiles of the all map (see 364), using prefabs.
Using the script attached.

My doubt is, in which way the prefabs are instanciated? It have been uses those prefabs included in the RealWorldTerrain main window or I have to specify a folder? If I have the prefabs in a different directory that the terrain container, do I should modify line 69: "string path = item.container.folder;"?

Said in other way, can I stablish from witch folder the prefabs has to be load? Or I have to use the RealWorldTerrain main window to put the prefabs manually?

So then, can I stablish the "Placement mode" through the script, for those loaded prefabs? If yes, how I write this? I don't find it in the documentation.

Also I getting problems to get buildings even using the main RWT window. Is there some limitation (cadastre related) about small town in center Europe?

Thanks,

Post's attachments

Attachment icon RegenerateBuildingsWindow.cs 3.64 kb, 88 downloads since 2021-12-02 

Re: Regenerating buildings

1. You can store your prefabs in any project folder and it can have any name.
For RWT, it doesn't matter at all.

2. Unfortunately, no, you cannot change this for existing buildings.

3. Unfortunately, I did not understand your description of the problem with a small town.
Try to rephrase this in more detail.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

5 (edited by quarrytroopers 2021-12-09 12:00:48)

Re: Regenerating buildings

Thanks Alex.

The thing is, once stablish a sort of prefabs for a terrain, I can't find a way to change them if it's not one by one.
It would be nice to be able to specify the prefabs to load for a set of terrains, just as you do for a single terrain when regenerating additional.
Is there no way to overwrite the list of prefabs for each terrain?


RealWorldTerrainWindow.OpenWindow(RealWorldTerrainGenerateType.additional, item);
RealWorldTerrainWindow.prefs.elevationType = RealWorldTerrainElevationType.heightmap;
RealWorldTerrainWindow.prefs.generateBuildings = true;
RealWorldTerrainWindow.prefs.buildingGenerator = 3;
RealWorldTerrainWindow.prefs.buildingPrefabs = houses;  //List

foreach (RealWorldTerrainItem item in items)
{
     // Overwrite the prefabs list for this item(terrain)???

     foreach (RealWorldTerrainBuildingPrefab house in houses)
          {
           house.sizeMode = RealWorldTerrainBuildingPrefab.SizeMode.originalSize;
           house.heightMode = RealWorldTerrainBuildingPrefab.HeightMode.levelBased;
           house.placementMode = RealWorldTerrainBuildingPrefab.PlacementMode.lowerCorner;
           }
}
Sorry for insist in this but, I'm pretty sure there must be some solution.
Thanks for your time.

Re: Regenerating buildings

Each terrain has a meta component in the scene that contains the full generation settings.
https://infinity-code.com/doxygen/real- … 348bff3166
You can iterate over all RealWorldTerrainItem's once and set the necessary settings.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.