The Editor and the game are two separate programs. You cannot add dependencies to Editor modules from within your game. It works in the “Development Editor” configuration, because that is actually building an Editor. It does not work in the “Development” configuration, because that is building a game.
Texture factories are a concept in the Editor that does not belong into games. What are you trying to accomplish? Are you trying to load or generate textures at run-time?
You can load a texture manually in some formats using the ImageWrapperModule and then create a texture from that. Here is an example of loading a png and creating a UTexture. If you have a stream of uncompressed data then you may not need to use the image wrapper.
// Represents the entire file in memory.
TArray<uint8> RawFileData;
if( FFileHelper::LoadFileToArray( RawFileData, "<path to file>" ) )
{
IImageWrapperModule& ImageWrapperModule = FModuleManager::LoadModuleChecked<IImageWrapperModule>( FName("ImageWrapper") );
// Note: PNG format. Other formats are supported
IImageWrapperPtr ImageWrapper = ImageWrapperModule.CreateImageWrapper( EImageFormat::PNG );
if ( ImageWrapper.IsValid() && ImageWrapper->SetCompressed( RawFileData.GetData(), RawFileData.Num() ) )
{
const TArray<uint8>* UncompressedBGRA = NULL;
if ( ImageWrapper->GetRaw( ERGBFormat::BGRA, 8, UncompressedRGBA) )
{
// Create the UTexture for rendering
UTexture2D* MyTexture = UTexture2D::CreateTransient( ImageWrapper->GetWidth(), ImageWrapper->GetHeight(), PF_B8G8R8A8 );
// Fill in the source data from the file
uint8* TextureData = MyTexture->PlatformData->Mips[0].BulkData.Lock( LOCK_READ_WRITE );
FMemory::Memcpy( TextureData, UncompressedBGRA.GetTypedData(), UncompressedBGRA.Num() );
MyTexture->PlatformData->Mips[0].BulkData.Unlock();
// Update the rendering resource from data.
MyTexture->UpdateResource();
}
}
}
using ‘PlataformData’ instead of ‘Source’ as is in the code “:: UTextureFactory ImportTexture-EditorFactories.cpp” ends the need to use the module ‘UnrealEd’. The code works with a ‘stream’ even just generated a buffer Response-> GetContent () and it worked for new Textures, but to do this with an existing texture at runtime caused an access violation in the UE4, most likely by the need to initialize the texture, not found this form in component ‘plataformdata’ like in Source.Init() function, another method was used to launch the new texture into the texture of the ActorItr->StaticMeshComponent desired, but now my problems are solved, OverrideTexture in Editor and the same code but without the ‘noop’ function in development. Thanks for listening ‘Matt’ and ‘gmpreussner’