How can I best resolve these compile errors?

Hi, my projetct work fine in “Development Editor” Configurantion.

But now i want build a package and i have this errors

link text

and when i change the configuration to “development” i have this compile errors

link text

someone have a idea what is wrong in development configuration?

Thks.

the problem remains. when using the module “UnrealEd” and “ImageWrapper” I can´t compile in development mode or generating package

Are you trying to use the UnrealEd module in your game? That’s not a good idea. What are you trying to do exactly?

Why is not good?
i using a code like UTextureFactory::ImportTexture - EditorFactories.cpp

and for that i need

-#include “UnrealEd.h”
-#include “ImageWrapper.h”
-#include “UnrealEdClasses.h”

in development editor everything works like a charm,
but in development or build package get error

new version error file

link text

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?

load image from stream and generate a texture at run-time

1 Like

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’

It seems FImageUtils::ImportFileAsTexture2D(Path) is easyer to use.

It has even a blueprint version :

1 Like