Im trying to get the image that is used in my TileMap. At first i thought maybe something like Set Texture from Brush, though that doesnt exist. Only Set Brush from Texture is possible.
Im trying to get individual tile textures out of it to be used in different meshes. Or if i can get the image that is being used as a whole in the tilemap that will also work.
Maybe get some sort of reference from OldSmallHousing_TileMap
The material inside of a tile map isn’t actually cut up into separate parts. It’s just one big image that is offset internally. You would have to do some extra c++ gymnastics to extract the needed tile and output it to a usable brush (probably involving drawing into a render target instance temporarily)
UCLASS(BlueprintType)
class PAPER2D_API UPaperTileSet : public UObject
{
GENERATED_UCLASS_BODY()
private:
// The width and height of a single tile (in pixels)
UPROPERTY(Category=TileSet, BlueprintReadOnly, EditAnywhere, meta=(UIMin=1, ClampMin=1, AllowPrivateAccess="true"))
FIntPoint TileSize;
// The tile sheet texture associated with this tile set
UPROPERTY(Category=TileSet, BlueprintReadOnly, EditAnywhere, meta=(DisplayName="Tile Sheet Texture", AllowPrivateAccess="true"))
UTexture2D* TileSheet;
// Additional source textures for other slots
UPROPERTY(Category = TileSet, EditAnywhere, AssetRegistrySearchable, meta = (DisplayName = "Additional Textures"))
TArray<UTexture*> AdditionalSourceTextures;
These are the functions i think i need, they are in UPaperTileSet, in PaperStyleSet.h.
But I cant include PaperStyleSet in my BlueprintFunctionLibrary.. Really wanted to try to call these functions. Though they are also private. Any tips?
UPaperTileSet has a function called GetTileSheetTexture() to return the utexture2d.
Only problem is that by default the internal TileSet returned from the FPaperTileInfo via GetCel(X,Y) is null. Correction the layers where just swapped. I was able to extract the utexture on layer 1
awesome.
Though im not being able to include: include “PaperTileMap.h” include “PaperTileLayer.h” include “PaperTileSet.h”
I included Paper2D in the modules.
Im getting these errors:
2>C:\Program Files\Epic Games\UE_4.27\Engine\Plugins\2D\Paper2D\Source\Paper2D\Classes\PaperTileSet.h(19): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>C:\Program Files\Epic Games\UE_4.27\Engine\Plugins\2D\Paper2D\Source\Paper2D\Classes\PaperTileSet.h(62): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>C:\Program Files\Epic Games\UE_4.27\Engine\Plugins\2D\Paper2D\Source\Paper2D\Classes\PaperTileSet.h(77): error C2143: syntax error: missing ';' before '<class-head>'
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "PaperTileSet.h"
#include "Kismet/BlueprintFunctionLibrary.h"
//#include "C:/Program Files/Epic Games/UE_4.27/Engine/Plugins/2D/Paper2D/Source/Paper2D/Classes/PaperTileSet.h"
#include "GlobalLibraries.generated.h"
/**
*
*/
//class UPaperTileSet;
UCLASS()
class UKP_API UGlobalLibraries : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Move Camera", Keywords = "Move Camera"), Category = "Editor Camera")
static void MoveCamera(FVector newLocation, FRotator newRotation, float newFoV/*, ELevelViewportType ViewPortType*/);
//UFUNCTION(BlueprintCallable, meta = (DisplayName = "Move Camera", Keywords = "Move Camera"), Category = "Editor Camera")
// static UTexture2D* GetBrushTile(UObject* WorldContextObject, int32 X, int32 Y, int32 layerIndex, UPaperTileMap* TileMap);
};
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
I cant even include just the include “PaperTileSet.h”
It gives me those weird errors. Tried googling around. They say to rebuild. Tried that, and Generate Visual studio. Perhaps its the version 4.27 is freaking out with the PaperTileSet.
This would point towards a needed rebuild. Only other thing that stands out is the use of the word Global in the name of the blueprint library. Maybe it triggers a macro in the pre-compiler for some reason? (a bit of a shot in the dark). Maybe try temporarily renaming the library and see if anything changes.
Try validating your engine install. PaperTileSet has been changed (it has an enter between include “IntMargin.h” and generated in the source files). Maybe you accidentally had it open and modified it with a keystroke causing a cascade of errors?
I try to keep all engine files locked so that vs cannot change them if I’m maybe slightly tired and type where I’m not supposed to.