Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Load Texture 2D From File!

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


    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!

    Click image for larger version

Name:	LoadImageFromFile2.jpg
Views:	8
Size:	201.0 KB
ID:	1083832

    Click image for larger version

Name:	LoadImageFromFile.jpg
Views:	8
Size:	238.0 KB
ID:	1083833

    ~~~

    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.

    Code:
    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;
    }
    ~~~

    Latest plugin download on the UE4 Wiki: (8 mb)
    https://wiki.unrealengine.com/File:VictoryPlugin.zip

    ~~~

    Victory Plugin on Media Fire

    If your browser is not updating the Wiki download page to the most recent version, you can use my alternative Media Fire download link!

    Please note clicking this link will not start a download instantly, it will just take you to the Media Fire file description.

    https://www.mediafire.com/?g6uf9kt5ueb2upj

    Enjoy!



    Rama
    Last edited by Rama; 08-15-2015, 02:09 PM.
    100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

    UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

    Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

    Comment


      Hey Rama, what's new about the node? You have already posted it here: https://forums.unrealengine.com/show...l=1#post210419 Your last post seems to be the exact same one, I'm just a bit confused
      Easy to use UMG Mini Map on the UE4 Marketplace.
      Forum thread: https://forums.unrealengine.com/show...-Plug-and-Play

      Comment


        Originally posted by John Alcatraz View Post
        Hey Rama, what's new about the node? You have already posted it here: https://forums.unrealengine.com/show...l=1#post210419 Your last post seems to be the exact same one, I'm just a bit confused
        It's not that there's anything new, if there is I will tell you, I repost nodes periodically for newcomers and as reminders for people who've not tried certain nodes yet.

        I also do this to recenter the thread on its focus of being a whole bunch of extra BP nodes that I am giving to the Community to play with!

        I hope you are having fun today!



        Rama
        Last edited by Rama; 08-15-2015, 02:19 PM.
        100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

        UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

        Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

        Comment


          Sound Classes SFX/Music Separate Sliders

          Thanks again for the "Victory Sound Volume Change" and "Victory Get Sound Volume" class blueprint, helped so much. Best part about it, I didn't even have to create save object files for the setting. It automatically saves the volume for you.

          I even made a short tutorial on how to use it.


          I thought this was going to be more complicated but realized it was really easy to set up.

          Isaac
          Isaac Nichols
          Game Developer & Music Producer - Threaded Pixel Studios
          Currently working on Drones & Ruins a Sci-Fi twin-stick shooter.

          Comment


            Originally posted by NicholasT View Post
            Hi Rama,

            This plugin is awesome! Very handy thank you.

            I am having an issue with the Capture Component 2d Save Image node. It works well when I play in editor, however when it is packaged into an exe, the game crashes whenever I trigger the save image node. (See image attached)

            Is this a known issue?
            Old code
            Fix incoming soon'ish.
            New code is directly from released versions of Ground Branch, which has been packaged into an exe multiple times.
            Stay tuned
            Rule#21: Be polite, be professional, but have a plan to kill everyone you meet.

            Comment


              Improved Get Vertex Locations of Static Mesh

              Now works in Packaged Games


              Click image for larger version

Name:	vertex.jpg
Views:	15
Size:	176.5 KB
ID:	1083978

              Click image for larger version

Name:	vertex2.jpg
Views:	4
Size:	187.3 KB
ID:	1083979

              My C++ Code For You

              See my PhysX wiki for the basic build.cs setup:
              https://wiki.unrealengine.com/PhysX,...o_Your_Project

              Here is the code I wrote to get all of the transformed vertex positions using the Body Instance and PhysX code!

              I am doing many safety checks to ensure the Body Instance data is valid before utilizing it, and the result is that now you can get accurate vertex locations in packaged games!

              Code:
              //~~~ PhysX ~~~
              #include "PhysXIncludes.h"
              #include "PhysicsPublic.h"		//For the ptou conversions
              //~~~~~~~~~~~
              
              //Get Transformed Vertex positions of any static mesh! -Rama
              bool UVictoryBPFunctionLibrary::GetStaticMeshVertexLocations(UStaticMeshComponent* Comp, TArray<FVector>& VertexPositions)
              {
              	
              	if(!Comp || !Comp->IsValidLowLevel()) 
              	{
              		return false;
              	}
              	//~~~~~~~~~~~~~~~~~~~~~~~
              	
              	//Component Transform
              	FTransform RV_Transform = Comp->GetComponentTransform(); 
              	
              	//Body Setup valid?
              	UBodySetup* BodySetup = Comp->GetBodySetup();
              	
              	if(!BodySetup || !BodySetup->IsValidLowLevel())
              	{
              		return false;
              	}  
              	
              	//Get the Px Mesh!
              	PxTriangleMesh* TriMesh = BodySetup->TriMesh;
              	 
              	if(!TriMesh) 
              	{
              		return false;
              	}
              	//~~~~~~~~~~~~~~~~
              	
              	//Number of vertices
              	PxU32 VertexCount 			= TriMesh->getNbVertices();
              	
              	//Vertex array
              	const PxVec3* Vertices 	= TriMesh->getVertices();
              	
              	//For each vertex, transform the position to match the component Transform 
              	for(PxU32 v = 0; v < VertexCount; v++)
              	{ 
              		VertexPositions.Add(RV_Transform.TransformPosition(P2UVector(Vertices[v])));
              	}
              	
              	return true;
              }


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

              Enjoy!



              Rama
              100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

              UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

              Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

              Comment


                Can someone tell me how "Create Texture Render Target 2D" works correctly? I try to use it to create icons of meshes that have up to three different, user-chosen colors (so I can't use simple textures and tint them). I do it in front of a pink (255,0,255) screen and set up the clear color to match the color of the screen but the output looks like this:

                The greenish color is the button behind the image.

                It's supposed to look like this:

                Minus the pink color.
                Attached Files

                Comment


                  Hello all,

                  I am trying to convert a group of spawned static meshes into an Instanced Static Mesh, and then Spawn multiple copies of that ISM, using blueprints. the "Victory ISM Convert to Victory ISM Actors" Node works great, but I can't for the life of me figure out the 2nd part which is spawning multiple copy's of that created ISMActor into the level. Can someone please give me some tips on this blueprint setup? Which nodes do I need to use to Spawn that Victory ISMActor properly?
                  Last edited by KingRaul; 08-19-2015, 10:34 AM.

                  Comment


                    Originally posted by DasMatze View Post
                    Can someone tell me how "Create Texture Render Target 2D" works correctly? I try to use it to create icons of meshes that have up to three different, user-chosen colors (so I can't use simple textures and tint them). I do it in front of a pink (255,0,255) screen and set up the clear color to match the color of the screen but the output looks like this:

                    The greenish color is the button behind the image.

                    It's supposed to look like this:

                    Minus the pink color.
                    An update for this is on the way - Rama contact me about it the other day
                    New version swaps the red / blue channels and sets the alpha based on the clear colour RGB values.
                    Rule#21: Be polite, be professional, but have a plan to kill everyone you meet.

                    Comment


                      New and Improved Save Texture Render Target 2D Image To Disk

                      Dear Community,

                      Community Member Kris has updated the "CaptureComponent2D_SaveImage" BP node in my Victory BP Library!

                      This latest version has been tested in packaged games and has been packaged and tested many times for Kris's UE4 game Ground Branch.

                      ~~~

                      Capture Component 2D ~ Save Image To Disk

                      Click image for larger version

Name:	CaptureComponentPictureByKris.jpg
Views:	1
Size:	30.9 KB
ID:	1084071

                      Click image for larger version

Name:	CaptureComponentPictureByKris2.jpg
Views:	1
Size:	226.5 KB
ID:	1084072

                      ~~~

                      Overview

                      This node let's you save a snapshot from your Capture Component 2D as an image file on your hard disk!

                      If your scene capture component is not set to update every tick, make sure to use Kris's method of moving the component to force an update.

                      Supply the filename of your choosing, making sure to supply an absolute path ("C:/YourDir/NewImage.png" for example).

                      You can check out my Victory BP File Path Nodes to assist in this process.

                      Thank you Kris for contributing such a valueable node to my Victory Plugin!



                      ~~~

                      Latest plugin download on the UE4 Wiki: (8 mb)
                      https://wiki.unrealengine.com/File:VictoryPlugin.zip

                      ~~~

                      Victory Plugin on Media Fire

                      If your browser is not updating the Wiki download page to the most recent version, you can use my alternative Media Fire download link!

                      Please note clicking this link will not start a download instantly, it will just take you to the Media Fire file description.

                      https://www.mediafire.com/?g6uf9kt5ueb2upj

                      Enjoy!



                      Rama
                      Last edited by Rama; 08-20-2015, 02:42 AM.
                      100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

                      UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

                      Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

                      Comment


                        Hi Rama,

                        I have a slightly stupid question. Is there are some sort of a list of all these extra blueprint nodes? I thought you keep them in the first post but it doesn't look to be up-to-date. Right now it becomes a bit difficult to locate a discussion or description on specific node if one forgot it's name
                        Youtube Channel

                        Comment


                          This doesn't work with packaged builds in 4.8, it's a great plugin but only for prototyping in the editor until Rama fixes the plugin for 4.8
                          Last edited by Chaoss; 08-20-2015, 06:25 AM.

                          Comment


                            I too, am very interested in the "Texture2D to LinearColor Array" node that would allow us to use "Get Pixel" with an existing Texture2D.

                            Also I wondered what platforms the "Load Texture 2D from File Pixels" and "Save Pixels" nodes work on currently? I am guessing just PC? If so, that would be another request - to allow it to work on all platforms (maybe check the "Create Save Game Object" node? I think that works on any platform).

                            Amazing work on all these things, you must be a machine
                            Last edited by Spoondog; 08-21-2015, 12:28 AM.
                            Dev Blog
                            Twitter: @TheRealSpoonDog
                            150 FREE Blueprint functions for your project

                            Comment


                              Originally posted by Spoondog View Post
                              I too, am very interested in nodes that would allow us to use "Get Pixel" and "Save Pixels" with Texture2D, so we can use them in a material. If you get time
                              What would your use case be for that? I'm working on displaying some pixel data from an external source (that isn't an image from disk or an asset) using Rama's work as an example, so I might be able to help.

                              Comment


                                Originally posted by BoredEngineer View Post
                                Hi Rama,

                                I have a slightly stupid question. Is there are some sort of a list of all these extra blueprint nodes? I thought you keep them in the first post but it doesn't look to be up-to-date. Right now it becomes a bit difficult to locate a discussion or description on specific node if one forgot it's name
                                I second that...I have been tempted to DL this plugin for a few months, but haven't because there isn't enough documentation of what these nodes do exactly. It might be great for those well-versed in C++ and know how to use them properly, but some of us aren't that savvy just yet

                                Even so, I am sure there would be plenty of intermediate/semi-advanced BP users that could/would benefit from this and proper/current documentation in a central location would be fantastic.
                                Website/Portfolio: http://www.VictorBurgosGames.com

                                Join me on stream: https://www.twitch.tv/BurgosGames for UE4 Game Dev. If you need help, just stop by and ask!

                                Wishlist Neko Ghost, Jump! a 2D/3D Puzzle-Platformer : https://store.steampowered.com/app/1...ko_Ghost_Jump/

                                Comment

                                Working...
                                X