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

Dear , 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 in case you change the way you name them.

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 now, renaming is a process that requires everyone else to adjust to my decision to rename a node.

Slate Build CS Dependencies Required

Dear ,

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:

**Load Texture 2D From File!

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

With 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!

Sweeney liked node!

Enjoy!

PS: Make sure to include the file extension when you use 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:

Hi , are TMaps replicated?

Awesome . Would it be possible to add access to the pixel array via node as in your other one? Or perhaps a more generalized Texture Reference 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 and/or launch to Android, it fails.

When it was a BP only project, I was able to build to without any issues. The only difference between 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/ 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 !

:slight_smile:


**Build Issues**

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

If anyone who is routinely building for 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? 

 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 :



```


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

_ 


```



C++ Development

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

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

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


**NDK Required for Plugin Builds**

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

**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 unless Epic has already resolved 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 matter as I’ve not been developing for in my own projects.

:slight_smile:

Get OS Platform

You can use 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

:)

Thanks for the quick reply and considering you are doing 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 sort of thing has been resolved by Epic already in preparation for plugins being sold on marketplace, so if your development $ and can be used elsewhere I would indeed recommend waiting!

:slight_smile:

Wow Thanks . 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 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 with your SaveStringToFile Node?

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

Thanks,

Thanks

I figured out how to create an array of 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.


Hi,
what about plugin support for 4.8?

Hi,

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 is really neat grizfb75!

Thanks for sharing your research and BP development with us!

Thanks for the pics!

:heart:

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  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:

Stupid question, does plugin auto update through UE4?

Hello , I’m wondering whether or not the Victory Plugin needs these nodes?:

•Round vector to nearest multiple of wildcard, for example: round the x, y, and z’s to nearest multiple of 50.
•Round float to wildcard decimal places.