Download

(39) Rama's Extra Blueprint Nodes for You as a Plugin, No C++ Required!

Dear Rama, I feel as if some of the plugin nodes have names that seem a bit odd, for example: “Options Menu Get Display Adapter Screen Resolutions”. I think that a more fitting name could be: “Get Supported Screen Resolutions”, or “Get Display Adapter Screen Resolutions”, I just feel as if it is a bit harder to understand when the title has unnecessary words, and also harder to search. Just thought I’d post this in case you change the way you name them.

Thanks, now it compiles with the added module, but when i add the header to my cpp file (#include “VictoryBPLibrary.h”), it gives me this error:


Error	1	error C1083: Cannot open include file: 'VictoryBPLibrary.h': No such file or directory	C:\OldSchoolNightmare\Source\OldSchoolNightmare\BYM_Building_Base.cpp	8	1	OldSchoolNightmare


Also tried : #include “VictoryBPFunctionLibrary.h” and it gave me this:


Error	1	error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl FSlateFontInfo::~FSlateFontInfo(void)" (__imp_??1FSlateFontInfo@@QEAA@XZ) referenced in function "void __cdecl DestructItems<class FSlateDrawElement>(class FSlateDrawElement *,int)" (??$DestructItems@VFSlateDrawElement@@@@YAXPEAVFSlateDrawElement@@H@Z)	C:\OldSchoolNightmare\Intermediate\ProjectFiles\BYM_Building_Base.cpp.obj	OldSchoolNightmare


I agree the Options Menu part is unnecessary, but if I change the name now, it will invalidate a lot of people’s BP code who are using my plugin.

I will investigate non-destructive ways to rename, perhaps using a meta friendly name.

But you see the issue now, renaming is a process that requires everyone else to adjust to my decision to rename a node.

Slate Build CS Dependencies Required

Dear Sahkan,

The latter is correct:



#include "VictoryBPFunctionLibrary.h"


The problem is that your build cs needs to include the same Slate/UMG modules that I am including in the Victory BP Library plugin.

Refer to the Victory BP Library build cs to see which modules you should add:



 PublicDependencyModuleNames.AddRange(
			new string] { 
				"Core", 
				"CoreUObject", 
				"Engine", 
				"InputCore",
				
				"RHI",
				"RenderCore",
				 
				"HTTP",
				"UMG", "Slate", "SlateCore",
				
				"ImageWrapper",
				
				"PhysX", "APEX" 
			}
		);  


Try adding these to your own public dependencies (project build cs)



"UMG", "Slate", "SlateCore",


That should do it!

:slight_smile:

Rama

Thanks, now it compiles :slight_smile:

**Load Texture 2D From File!

JPG, PNG, BMP, ICO, EXR, and ICNS are Supported File Formats !**

5e04c4d83d602f944fb2cfd946e90787f3b20f70.jpeg

With this node you can load a Texture 2D from a file during runtime!

I output for you the width and height of the loaded image!

Now you can easily create Texture 2D’s from image files in Blueprints, during runtime!

Special Note!

Tim Sweeney liked this node!

Enjoy!

Rama

PS: Make sure to include the file extension when you use this node!


**C++ Code For You**

Here is the core C++ function involved, entire source is in the download! I wrote my own Enum for the file formats.



```


UTexture2D* UVictoryBPFunctionLibrary::Victory_LoadTexture2D_FromFile(const FString& FullFilePath,EJoyImageFormats ImageFormat, bool& IsValid,int32& Width, int32& Height)
{
	IsValid = false;
	UTexture2D* LoadedT2D = NULL;
	
	IImageWrapperModule& ImageWrapperModule = FModuleManager::LoadModuleChecked<IImageWrapperModule>(FName("ImageWrapper"));
	
	IImageWrapperPtr ImageWrapper = ImageWrapperModule.CreateImageWrapper(GetJoyImageFormat(ImageFormat));
 
	//Load From File
	TArray<uint8> RawFileData;
	if (!FFileHelper::LoadFileToArray(RawFileData, * FullFilePath)) 
	{
		return NULL;
	}
	
	  
	//Create T2D!
	if (ImageWrapper.IsValid() && ImageWrapper->SetCompressed(RawFileData.GetData(), RawFileData.Num()))
	{ 
		const TArray<uint8>* UncompressedBGRA = NULL;
		if (ImageWrapper->GetRaw(ERGBFormat::BGRA, 8, UncompressedBGRA))
		{
			LoadedT2D = UTexture2D::CreateTransient(ImageWrapper->GetWidth(), ImageWrapper->GetHeight(), PF_B8G8R8A8);
			
			//Valid?
			if (!LoadedT2D) 
			{
				return NULL;
			}
			
			//Out!
			Width = ImageWrapper->GetWidth();
			Height = ImageWrapper->GetHeight();
			 
			//Copy!
			void* TextureData = LoadedT2D->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE);
			FMemory::Memcpy(TextureData, UncompressedBGRA->GetData(), UncompressedBGRA->Num());
			LoadedT2D->PlatformData->Mips[0].BulkData.Unlock();

			//Update!
			LoadedT2D->UpdateResource();
		}
	}
	 
	// Success!
	IsValid = true;
	return LoadedT2D;
}


```



Download Link (6.5mb)

UE4 Wiki, Plugin Download Page

:slight_smile:

Rama

Hi Rama, are TMaps replicated?

Awesome Rama. Would it be possible to add access to the pixel array via this node as in your other one? Or perhaps a more generalized Texture Reference object to pixel array function?

Cheers,

J^2

Fails on Android

I just converted my project to a C++ project. I can build and run the project in Visual Studio. I can build and compile the project in the editor without any issues. I can package to Win64, no problem. But as soon as I try to package to Android and/or launch to Android, it fails.

When it was a BP only project, I was able to build to Android without any issues. The only difference between this project and BP only project, is that I added the Victory BP plugin. Now if I remove the plugin, I can build again.

Here’s part of the log that specifies my error. It seems that it’s missing something

Thus it cannot create an so file.

ERROR: UBT ERROR: Failed to produce item: C:\Users\Marc-Andre\Google Drive\Hangar 74\UE4\Bengal\Binaries\Android\Bengal-armv7-es2.so

Here’s the last portion of my log file.

Any reason why?

thanks

No they are not replicated automatically, replication like that would have to be orchestated by you just like for most other gameplay features. My recommendation would be to only run the logic requiring TMaps on the server-side and just pass the output/results/effects to clients via custom replicated events.

:slight_smile:

Texture2D -> Pixel array is a great idea, I will have to look into it when I get the chance!

:slight_smile:

Rama


**Android Build Issues**

I have many reports of people compiling my plugin for Android successfully, so I am not sure why you in particular are having an issue.

If anyone who is routinely building for Android can provide any additional insight in the matter that would be great!

Do you have any other log info that seems relevant besides what I've copied above? 

This error does not give me a whole lot to work with.

Here's the first key line:



```


creating C:/Users/Marc-Andre/Google Drive/Hangar 74/UE4/Bengal/Plugins/VictoryPlugin/Binaries/Android/VictoryBPLibrary-Static-armv7-es2.a 

_


```



and then this:



```


C:\Users\Marc-Andre\Google Drive\Hangar 74\UE4\Bengal\Intermediate\Build\Android\Bengal\Development/UELinkerFixups.cpp:615: error: undefined reference to 'EmptyLinkFunctionForStaticInitializationSettings()'

_ 


```



C++ Android Development

Please review the documentation on developing for Android using C++.

There’s probably a build.cs or target.cs adjustment that you need to make to the plugin to support android specifically. I can’t add this to the general plugin since not everyone is building for android.

Epic Docs on Building for Android
https://docs.unrealengine.com/latest/INT/Platforms/Android/Reference/index.html


**Android NDK Required for Plugin Builds**

In particular please note that in order to compile C++ for Android you need these two additinal things, beyond building for BP only.

**Android NDK
Enviro variable -> NDKROOT**
 

Might want to wait for 4.8

Again once 4.8 rolls around it is likely that there will be an easier workflow for plugins in packaged games and not requiring as much C++ awareness or fancy components.

These issues have probably already been resolved because no one can purchase a C++ plugin and ship it to Android unless Epic has already resolved this issues.


**Solution From Another User**

Here's a solution mentioned by another user:



```


i had to rebuild the solution, and compile to the targets (android, ios, etc.) in shipping mode.
Now it works.
Thanks.


```



:)

Additional Input Requested

I know there are people who have gotten my plugin to work great on Android, I’d love to hear their input on this matter as I’ve not been developing for Android in my own projects.

:slight_smile:

Rama

Get OS Platform

You can use this node to script different logic based on which operating system is currently being used!

Platforms you can check for:

**Windows
Mac
Linux

PS4
XBoxOne

iOS
Android

HTML5

WIN RT
WIN RT ARM**


**Download Link (650kb)**

**UE4 Wiki, Plugin Download Page**
https://wiki.unrealengine.com/File:VictoryPlugin.zip

:)

Rama

Thanks for the quick reply and considering you are doing this as a service to us, I very much appreciate. I will wait for 4.8 probably and go from there.

Keep up the good work :wink:

Lovely to hear from you maparizeau!

I really do think a whole lot of this sort of thing has been resolved by Epic already in preparation for plugins being sold on marketplace, so if your development $ and time can be used elsewhere I would indeed recommend waiting!

:slight_smile:

Rama

Wow Thanks Rama. This is really great. I am trying to export various strings to a file, for example the players x,y,z coordinates every second. I would like to save these to the same file however for each time point for a coordinate to be on a separate line or separate by a character e.g. “;”. Do you know of a simple way to implement this with your SaveStringToFile Node?

I am trying to export this data to statistical software for analysis (for a psychology experiment that I hope to do within the Unreal engine).

Thanks, Eric

Thanks

Rama I figured out how to create an array of all the coordinates and then just save that array to a text file at the end of the play. See the Blueprints below as well as the player path graph that I created in R.

adc6f4e3bbdd90aea4f522147231d2772b2b17d1.jpeg

Hi,
what about plugin support for 4.8?

Hi,

Rama has said (multiple times) that preview builds are not supported.
It’s kinda pointless to update the plugin for every preview release (previews are for testing purposes anyway) :stuck_out_tongue: just wait for the final 4.8 release and I’m sure the plugin will be updated :slight_smile:

Woohoo!

Wow this is really neat grizfb75!

Thanks for sharing your research and BP development with us!

Thanks for the pics!

:heart:

Rama

Packaged Build Upload For You

Dear Community,

I’ve released a 4.7.6 version of my plugin that contains the static lib that is needed for packaged games!

If you’ve had any issues packaging my plugin please try the May 29th 2015 build, which is 7.8mb


**More Info**

For more info, you can see this Answerhub post and my solutiion, as confirmed by the original poster.

**Anserhub**
https://answers.unrealengine.com/questions/234322/project-still-not-packaging-with-plugins-after-add.html#answer-235265

Download Link (7.8mb)

UE4 Wiki, Plugin Download Page

:slight_smile:

Rama