Tiling bug fixed and minor changes to get ready for PR
This commit is contained in:
parent
5a5212d25b
commit
25016132da
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -130,9 +130,6 @@ void UMapGeneratorWidget::CookTilesCollisions(const FMapGeneratorMetaInfo& MetaI
|
||||||
|
|
||||||
UWorld* EditorWorld = GEditor->GetEditorWorldContext().World();
|
UWorld* EditorWorld = GEditor->GetEditorWorldContext().World();
|
||||||
|
|
||||||
UE_LOG(LogCarlaToolsMapGenerator, Log, TEXT("%s: HERE! %s -- %s to %s tiles"),
|
|
||||||
*CUR_CLASS_FUNC_LINE, *MapNameToLoad, *GEditor->GetEditorWorldContext().World()->GetName(), *MetaInfo.MapName);
|
|
||||||
|
|
||||||
bool bRecalculateResult = RecalculateCollision();
|
bool bRecalculateResult = RecalculateCollision();
|
||||||
|
|
||||||
if (!bRecalculateResult)
|
if (!bRecalculateResult)
|
||||||
|
@ -446,6 +443,7 @@ bool UMapGeneratorWidget::CreateTilesMaps(const FMapGeneratorMetaInfo& MetaInfo)
|
||||||
*CUR_CLASS_FUNC_LINE, HeightRT->SizeX, HeightRT->SizeY);
|
*CUR_CLASS_FUNC_LINE, HeightRT->SizeX, HeightRT->SizeY);
|
||||||
TArray<uint16> HeightData;
|
TArray<uint16> HeightData;
|
||||||
// TODO: UTexture2D and GetMipData
|
// TODO: UTexture2D and GetMipData
|
||||||
|
UpdateTileRT(i, MetaInfo.SizeY-j-1);
|
||||||
FTextureRenderTargetResource* RenderTargetResource = HeightRT->GameThread_GetRenderTargetResource();
|
FTextureRenderTargetResource* RenderTargetResource = HeightRT->GameThread_GetRenderTargetResource();
|
||||||
FIntRect Rect = FIntRect(0, 0, HeightRT->SizeX, HeightRT->SizeY);
|
FIntRect Rect = FIntRect(0, 0, HeightRT->SizeX, HeightRT->SizeY);
|
||||||
TArray<FLinearColor> HeightmapColor;
|
TArray<FLinearColor> HeightmapColor;
|
||||||
|
@ -557,8 +555,6 @@ bool UMapGeneratorWidget::CookVegetationToTiles(const FMapGeneratorMetaInfo& Met
|
||||||
*CUR_CLASS_FUNC_LINE, *MapNameToLoad);
|
*CUR_CLASS_FUNC_LINE, *MapNameToLoad);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SaveWorld(World);
|
SaveWorld(World);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,10 +70,14 @@ class CARLATOOLS_API UMapGeneratorWidget : public UEditorUtilityWidget
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/// Sets the specified material to @a Landscape
|
||||||
UFUNCTION(BlueprintImplementableEvent)
|
UFUNCTION(BlueprintImplementableEvent)
|
||||||
void AssignLandscapeMaterial(ALandscape* Landscape);
|
void AssignLandscapeMaterial(ALandscape* Landscape);
|
||||||
|
|
||||||
|
/// PROVISIONAL
|
||||||
|
UFUNCTION(BlueprintImplementableEvent)
|
||||||
|
void UpdateTileRT(int OffsetX, int OffsetY);
|
||||||
|
|
||||||
/// Function called by Widget Blueprint which generates all tiles of map
|
/// Function called by Widget Blueprint which generates all tiles of map
|
||||||
/// @a mapName, and saves them in @a destinationPath
|
/// @a mapName, and saves them in @a destinationPath
|
||||||
/// Returns a void string is success and an error message if the process failed
|
/// Returns a void string is success and an error message if the process failed
|
||||||
|
@ -90,9 +94,12 @@ public:
|
||||||
UFUNCTION(Category="Map Generator", BlueprintCallable)
|
UFUNCTION(Category="Map Generator", BlueprintCallable)
|
||||||
void CookVegetationToCurrentTile(const TArray<UProceduralFoliageSpawner*> FoliageSpawners);
|
void CookVegetationToCurrentTile(const TArray<UProceduralFoliageSpawner*> FoliageSpawners);
|
||||||
|
|
||||||
|
/// Recalculate the collisions of the loaded map
|
||||||
UFUNCTION(Category="Map Generator", BlueprintCallable)
|
UFUNCTION(Category="Map Generator", BlueprintCallable)
|
||||||
bool RecalculateCollision();
|
bool RecalculateCollision();
|
||||||
|
|
||||||
|
/// Traverse all tiles of map in @a MetaInfo and recalculates
|
||||||
|
/// the collisions of all of them. Can be called from blueprints
|
||||||
UFUNCTION(Category = "MapGenerator", BlueprintCallable)
|
UFUNCTION(Category = "MapGenerator", BlueprintCallable)
|
||||||
void CookTilesCollisions(const FMapGeneratorMetaInfo& MetaInfo);
|
void CookTilesCollisions(const FMapGeneratorMetaInfo& MetaInfo);
|
||||||
|
|
||||||
|
@ -102,12 +109,17 @@ public:
|
||||||
UFUNCTION(Category="Map Generator", BlueprintCallable)
|
UFUNCTION(Category="Map Generator", BlueprintCallable)
|
||||||
FString SanitizeDirectory(FString InDirectory);
|
FString SanitizeDirectory(FString InDirectory);
|
||||||
|
|
||||||
|
/// Used to find if the @a InDirectory contains a map. If does return true and
|
||||||
|
/// @a OutMapSize and @OutFoundMapName stores the information of the found map
|
||||||
UFUNCTION(Category="Map Generator", BlueprintCallable)
|
UFUNCTION(Category="Map Generator", BlueprintCallable)
|
||||||
bool LoadMapInfoFromPath(FString InDirectory, int& OutMapSize, FString& OutFoundMapName);
|
bool LoadMapInfoFromPath(FString InDirectory, int& OutMapSize, FString& OutFoundMapName);
|
||||||
|
|
||||||
|
/// Spawns rivers of types @a RiverClass
|
||||||
UFUNCTION(Category="MapGenerator", BlueprintCallable)
|
UFUNCTION(Category="MapGenerator", BlueprintCallable)
|
||||||
AActor* GenerateWater(TSubclassOf<class AActor> RiverClass);
|
AActor* GenerateWater(TSubclassOf<class AActor> RiverClass);
|
||||||
|
|
||||||
|
/// Adds weather actor of type @a WeatherActorClass and sets the @a SelectedWeather
|
||||||
|
/// to the map specified in @a MetaInfo
|
||||||
UFUNCTION(Category="MapGenerator", BlueprintCallable)
|
UFUNCTION(Category="MapGenerator", BlueprintCallable)
|
||||||
AActor* AddWeatherToExistingMap(TSubclassOf<class AActor> WeatherActorClass,
|
AActor* AddWeatherToExistingMap(TSubclassOf<class AActor> WeatherActorClass,
|
||||||
const FMapGeneratorMetaInfo& MetaInfo, const FString SelectedWeather);
|
const FMapGeneratorMetaInfo& MetaInfo, const FString SelectedWeather);
|
||||||
|
@ -119,7 +131,8 @@ private:
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
bool LoadWorlds(TArray<FAssetData>& WorldAssetsData, const FString& BaseMapPath, bool bRecursive = true);
|
bool LoadWorlds(TArray<FAssetData>& WorldAssetsData, const FString& BaseMapPath, bool bRecursive = true);
|
||||||
|
|
||||||
|
/// Saves @a WorldToBeSaved. It also saves all dirty packages to asure
|
||||||
|
/// a correct managements of landscapes
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
bool SaveWorld(UWorld* WorldToBeSaved);
|
bool SaveWorld(UWorld* WorldToBeSaved);
|
||||||
|
|
||||||
|
@ -128,6 +141,8 @@ private:
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
bool CreateMainLargeMap(const FMapGeneratorMetaInfo& MetaInfo);
|
bool CreateMainLargeMap(const FMapGeneratorMetaInfo& MetaInfo);
|
||||||
|
|
||||||
|
/// Creates an Opendrive file for the created map map
|
||||||
|
/// specified in @a MetaInfo
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
bool CreateOpenDriveFile(const FMapGeneratorMetaInfo& MetaInfo);
|
bool CreateOpenDriveFile(const FMapGeneratorMetaInfo& MetaInfo);
|
||||||
|
|
||||||
|
@ -155,6 +170,8 @@ private:
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
UWorld* GetWorldFromAssetData(FAssetData& WorldAssetData);
|
UWorld* GetWorldFromAssetData(FAssetData& WorldAssetData);
|
||||||
|
|
||||||
|
/// Returns the Z coordinate of the landscape located in @a World at position
|
||||||
|
/// @a x and @a y.
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
float GetLandscapeSurfaceHeight(UWorld* World, float x, float y, bool bDrawDebugLines);
|
float GetLandscapeSurfaceHeight(UWorld* World, float x, float y, bool bDrawDebugLines);
|
||||||
};
|
};
|
Loading…
Reference in New Issue