@ why i can see the Line of node “draw Thick 3Dline” when shipping packages. (development package and standalone can see). i use UE4.19
Hi,
I’ve been trying to find a way to sample pixels from Texture2D in 4.25 but I get compiler error C2440: ‘static_cast’: cannot convert from ‘const ElementType *’ to ‘const FColor *’.
After some searching, I came across post Static_cast error - C++ - Epic Developer Community Forums.
The solution is to change static_cast to reinterpret_cast.
Confirmed working for my Windows shipping build.
Hope it helps you.
@kevin791129 unfortunately didn’t fix the Victory_GetPixelsArrayFromT2D node on my end, I’m still getting an empty array when I change the cast.
When i package with the custom engine for HTML 4.24, and have builded your plugin into the project, it shows a error message when im using the node “Victory HTML5 set cursor visible”
The error happends when i try to start the game in a web browser, and it says “Uncaught RuntimeError: function signature mismatch”
ONLY happends when i connect the node to execute. When ever that victory node is removed, the package runs fine in the webbrowser.
Hey @ @frostic Was there any solution to ?
no. he never told me a fix for it. but i did try the subsystem launcher version and it works.
Load Texture 2D from File don’t create Mip-Maps. Is there any possibility to implement it or a workaround?
I’m using an older version of the Victory plugin, and am using the “Victory Simulate Key Press” but trying to make it so that W, A, S, and D can simulate axis controls, but under the event type, if Axis is selected, there is no way to set what axis to simulate.
Is a of the newer version of the plugin at ?
Alternatively, does the plugin have a node that assigns the keyboard to a different player index?
Thanks for making awesome plugin by the way, it has saved a lot of .
The debug draw line functions are not allowed in packaged builds on Epic’s end, does anyone know of a way to get around that without requiring a custom engine build?
If so please submit the code to my github and I will add it to the plugin!
[quote="VAD_Norway, post:2517, topic:3448"]
When i package with the custom engine for HTML 4.24, and have builded your plugin into the project, it shows a error message when im using the node "Victory HTML5 set cursor visible"
The error happends when i try to start the game in a web browser, and it says "Uncaught RuntimeError: function signature mismatch"
ONLY happends when i connect the node to execute. When ever that victory node is removed, the package runs fine in the webbrowser.
[/QUOTE]
Sorry, those nodes have not been updated in a while, I've removed them from next version.
Hopefully someone who is doing an HTML5 project can update these files:
VictoryBPHTML.h
VictoryBPHTML.cpp
I looked in 4.25 SlateApplication, I don’t see a function that allows you to supply an axis value, only key values
I can’t easily offer axis option unless SlateApplication or some other part of the Engine supports simulated axis key press
The closed thing is raw gamepad analog input:
virtual bool OnControllerAnalog( FGamepadKeyNames::Type KeyName, int32 ControllerId, float AnalogValue ) override;
[quote="NickGW, post:2512, topic:3448"]
Hey ,
Saw that in 4.25 several of the Get Pixel/s from T2D nodes are now deprecated and you recommend voicing any continued need for them in thread. I'm one of the people who uses those nodes and they've been a critical component of my current project. Not having access to to them is preventing me from moving to 4.25 until a solution is found. I would not have initially said was an urgent need, but as new issues/lack of a in the version I use (4.22) rub up against the needs of the project, I'm finding that upgrading is but a necessity so having these nodes available has become a far more urgent matter.
I hope it's possible to find a solution and thank you so much for plugin. It's enabled me to do things previously out of reach.
[quote="himawari1987, post:2514, topic:3448"]
@why i can see the Line of node "draw Thick 3Dline" when shipping packages. (development package and standalone can see). i use UE4.19
[/QUOTE]
[/QUOTE]
"thank you so much for plugin. It's enabled me to do things previously out of reach."
You're welcome!
Working on the color now :)
♥
[quote=".Gilbert, post:2513, topic:3448"]
@Thanks for the plugin!! it's fantastic.
I just converted a project from 4.24 to 4.25 and replaced the victory plugin with the 4.25 version, works fine, but a function called "Vicrotry Get Pixel from T2D" is listed as deprecated and doesn't work. The blueprint note said to post something here if it's needed urgently, and it very much is.
If there anything you can do about ?
Thanks!
[/QUOTE]
Working on ...
GetPixel and GetPixelArray
Are Back!
**4.25 ****(win32, win64, editor, dev packaged, and shipping)**
[https://www.mediafire.com/file/pgrps...gin25.zip/file](https://www.mediafire.com/file/pgrpsf9my7tv1ae/VictoryPlugin25.zip/file)
Usage
Please note the implementation has changed for GetPixelArray, I traverse the image row-wise now, please see picture for how to traverse the new returned array!
Please note that your texture must be set to compression of VectorDisplacementmap to be used with these nodes! I cancel out with an error if is not the case.
**Source Code Explanation**
I now just use a byte ptr and iterate in sets of 4, which I can do safely because VectorDisplacementmap is the only allowed type (the byte order will always be as expected by my code)
Please also note that VectorDisplacementmap is BGRA ordering, not RGBA.
```
uint8* RawByteArray = (uint8*)RawImageData->Lock(LOCK_READ_ONLY);
//Get!, converting FColor to FLinearColor
FColor ByteColor;
ByteColor.B = RawByteArray[Y * TextureWidth * 4 + (X * 4) ];
ByteColor.G = RawByteArray[Y * TextureWidth * 4 + (X * 4) + 1];
ByteColor.R = RawByteArray[Y * TextureWidth * 4 + (X * 4) + 2];
ByteColor.A = RawByteArray[Y * TextureWidth * 4 + (X * 4) + 3];
//Set!
PixelColor = ByteColor.ReinterpretAsLinear();
RawImageData->Unlock();
```
Full Source Code For Older Versions
If you are using an older version, here are the relevant changes!
VictoryBPFunctionLibrary.h
/** will modify the original T2D to remove sRGB and change compression to VectorDisplacementMap to ensure accurate pixel reading. -*/
UFUNCTION(BlueprintCallable, Category = "Victory BP Library|Load Texture From File",meta=(Keywords="create image png jpg jpeg bmp bitmap ico icon exr icns"))//, DeprecatedFunction, DeprecationMessage=" function will not work until I figure out how to update it to 4.25, if you need it urgently, please post in my ue4 forum thread for plugin"))
static bool Victory_GetPixelFromT2D(UTexture2D* T2D, int32 X, int32 Y, FLinearColor& PixelColor);
/** will modify the original T2D to remove sRGB and change compression to VectorDisplacementMap to ensure accurate pixel reading. -*/
UFUNCTION(BlueprintCallable, Category = "Victory BP Library|Load Texture From File",meta=(Keywords="create image png jpg jpeg bmp bitmap ico icon exr icns"))//, DeprecatedFunction, DeprecationMessage=" function will not work until I figure out how to update it to 4.25, if you need it urgently, please post in my ue4 forum thread for plugin"))
static bool Victory_GetPixelsArrayFromT2D(UTexture2D* T2D, int32& TextureWidth, int32& TextureHeight,TArray<FLinearColor>& PixelArray);
.cpp
bool UVictoryBPFunctionLibrary::Victory_GetPixelFromT2D(UTexture2D* T2D, int32 X, int32 Y, FLinearColor& PixelColor)
{
if(!T2D)
{
return false;
}
if(X <= -1 || Y <= -1)
{
return false;
}
//~~~
if(T2D->CompressionSettings != TC_VectorDisplacementmap)
{
#if WITH_EDITOR
FMessageLog("PIE").Error(FText::Format(LOCTEXT("Victory_GetPixelFromT2D", "UVictoryBPFunctionLibrary::Victory_GetPixelFromT2D >> Texture Compression must be VectorDisplacementmap <3: {0}'"), FText::FromString(T2D->GetName())));
#endif // WITH_EDITOR
return false;
}
//~~~
T2D->SRGB = false;
T2D->CompressionSettings = TC_VectorDisplacementmap;
//Update settings
T2D->UpdateResource();
FTexture2DMipMap& MipsMap = T2D->PlatformData->Mips[0];
int32 TextureWidth = MipsMap.SizeX;
int32 TextureHeight = MipsMap.SizeY;
//Safety check!
if (X >= TextureWidth || Y >= TextureHeight)
{
#if WITH_EDITOR
FMessageLog("PIE").Error(FText::Format(LOCTEXT("Victory_GetPixelFromT2D", "UVictoryBPFunctionLibrary::Victory_GetPixelFromT2D >> X or Y is outside of texture bounds! <3: {0}'"), FText::FromString(FString::FromInt(TextureWidth) + " x " + FString::FromInt(TextureHeight) )));
#endif // WITH_EDITOR
return false;
}
FByteBulkData* RawImageData = &MipsMap.BulkData;
if(!RawImageData)
{
return false;
}
int32 TotalCount = RawImageData->GetElementCount();
if(TotalCount < 1)
{
return false;
}
uint8* RawByteArray = (uint8*)RawImageData->Lock(LOCK_READ_ONLY);
//TC_VectorDisplacementmap UMETA(DisplayName="VectorDisplacementmap (RGBA8)"),
//! 4 because includes alpha <3
/*
for(int32 v = 0; v < TextureWidth * TextureHeight * RawImageData->GetElementSize() * 4; v++)
{
DebugString += FString::FromInt(RawByteArray[v]) + " ";
}
*/
//Texture.cpp
/*
else if (FormatSettings.CompressionSettings == TC_VectorDisplacementmap)
{
TextureFormatName = NameBGRA8;
}
*/
//Get!, converting FColor to FLinearColor
FColor ByteColor;
ByteColor.B = RawByteArray[Y * TextureWidth * 4 + (X * 4) ];
ByteColor.G = RawByteArray[Y * TextureWidth * 4 + (X * 4) + 1];
ByteColor.R = RawByteArray[Y * TextureWidth * 4 + (X * 4) + 2];
ByteColor.A = RawByteArray[Y * TextureWidth * 4 + (X * 4) + 3];
//Set!
PixelColor = ByteColor.ReinterpretAsLinear();
RawImageData->Unlock();
return true;
}
bool UVictoryBPFunctionLibrary::Victory_GetPixelsArrayFromT2D(UTexture2D* T2D, int32& TextureWidth, int32& TextureHeight,TArray<FLinearColor>& PixelArray)
{
if(!T2D)
{
return false;
}
if(T2D->CompressionSettings != TC_VectorDisplacementmap)
{
#if WITH_EDITOR
FMessageLog("PIE").Error(FText::Format(LOCTEXT("Victory_GetPixelFromT2D", "UVictoryBPFunctionLibrary::Victory_GetPixelFromT2D >> Texture Compression must be VectorDisplacementmap <3: {0}'"), FText::FromString(T2D->GetName())));
#endif // WITH_EDITOR
return false;
}
//To prevent overflow in BP if used in a loop
PixelArray.Empty();
T2D->SRGB = false;
T2D->CompressionSettings = TC_VectorDisplacementmap;
//Update settings
T2D->UpdateResource();
FTexture2DMipMap& MyMipMap = T2D->PlatformData->Mips[0];
TextureWidth = MyMipMap.SizeX;
TextureHeight = MyMipMap.SizeY;
FByteBulkData* RawImageData = &MyMipMap.BulkData;
if(!RawImageData)
{
return false;
}
uint8* RawByteArray = (uint8*)RawImageData->Lock(LOCK_READ_ONLY);
for(int32 y = 0; y < TextureHeight; y++)
{
for(int32 x = 0; x < TextureWidth; x++)
{
FColor ByteColor;
ByteColor.B = RawByteArray[y * TextureWidth * 4 + (x * 4) ];
ByteColor.G = RawByteArray[y * TextureWidth * 4 + (x * 4) + 1];
ByteColor.R = RawByteArray[y * TextureWidth * 4 + (x * 4) + 2];
ByteColor.A = RawByteArray[y * TextureWidth * 4 + (x * 4) + 3];
PixelArray.Add(ByteColor.ReinterpretAsLinear());
}
}
RawImageData->Unlock();
return true;
}
Enjoy!
Heck yeah!!! Thanks for the update!
Do the Victory plugins work for iOS
Not yet, but if a developer wants to, they could make an iOS port using the VictoryPlugin Github:
Hee hee!
You’re welcome!
And welcome to the UE4 Community!
Hi @ ,
Thank you very much for the update!
In addition, I have a question, please: do you know any way to ‘read’ strings from a file over the internet (from example: mywebsite.com/myfile.txt)? I have tried some combinations with your ‘Load string from file’ node (which is incredible for local use!), and with the default ‘Download image’ node, with no luck. I wouldn’t care about reading it directly from the web, or downloading that file to disk, and read from it after being already locally saved. I would be very glad if you would have any idea.
Thank you very much and best regards!
I’m trying hard to get to work, but I get tons of HTML 5 errors when I change the function to what you wrote?? I’m a novice at C++, sorry… Also, my original code is fairly different than the bolded part you had… there’s lots of other differences. I tried an old version and updating to the latest version. I’m at a loss and I really need working any suggestions?
Hey @Pinworm “A bunch of HTML 5 errors” means nothing without context. I don’t think you can get any errors while you’re typing code in your IDE.
- What UE version you’re using?
- Have you tried original function from 's plugin before trying to change anything?
- Are you adding new version of the function to your blueprint library, or are you trying to modify 's Plugin code?
- At what stage do you get the errors: when you try to compile, or when you try using the modified function?
- If you’re on version 4.25, most likely the somewhere else. @Nobody confirmed it working in 4.25. If you’re on 4.26, it is possible that they have yet again changed something in the engine about audio data handling, in which case I could not help you, because I’m not updating until full release.
Hey there!
amazing plugin, use it in my project because it have so many use cases! I have a question for you,
Can you expose the “CrouchedHalfHeight” in a function that can be set? because currently it cant be set through blueprint and i think it might be a good addition? Or a function that automatically offsets the capsule based on the half height instead, so you can change the capsule components half height and it allow it to offset too.
For now i created my own function but i just thought it might be a good addition to your plugin!
Anyhow, have a great day/night!
Hey, sorry about my initial post, I’m still getting the hang of C++ so I was pretty confused. I ended up figuring things out a bit. I needed to add a certain line that the compiler auto added for me.
That made it so works to import .ogg, with your fix. Thanks a ton of that, and thanks a ton @for the plugin as well - sorry if I was unappreciative in my first post, it was a moment of frustration
Anyway the HTML 5 errors were unrelated, that’s just what came up and what confused me, but it was because the function was ‘broken’ as I needed to add a certain line like I mentioned.
I just needed to change
“USoundWave* GetSoundWaveFromFile(const FString& FilePath)” to
“USoundWave* UVictoryBPFunctionLibrary::GetSoundWaveFromFile(const FString& FilePath)”
So with your changes and the added change the compiler suggested, .ogg now imports successfully.
That said;
- is UE 4.25.3
- I did try the original function before changing anything, it did not work
- I’m modifying’s Plugin code, changing the function from what it was to what you quoted. However, you wrote “The bolded part is changed” while I had less lines than just that bolded part, if matters.
- I got the errors when compiling, but it was mostly my misunderstanding of C++ and visual studio. The HTML5 errors come up because compiling fails but it’s ‘irrelevant’ or unrelated, basically my misunderstanding.
Sorry for being a novice, appreciate you though
Edit: Initially I had it in my head that function should properly import .wavs but I might have been wrong about that. Importing .ogg is alright, but should be able to import .wavs? Sorry, probably a stupid question
Thanks again though everyone.
@Pinworm I would suggest against modifying’s plugin code and write it in your own BP library function, otherwise you will have to do modification for each’s Plugin update.
You could import .wav in a similar way, but you’d have to do some modifications to the code. And it would only work with .wave 44.1kHz 16bit, because that’s what UE supports. But then you might as well hook up an external library to do decoding and loading files of any audio format.
is why you should sell that audio plugin you gave me bro. it can import tons of different audio formats. I use it for many different things.
It is super awesome. It would be great for the community to have access to etc.