mirror of
https://github.com/storytold/UE4-OSC.git
synced 2026-10-24 08:15:06 +00:00
breaking change: SendOsc "Address" parameter is now an FName
This commit is contained in:
@@ -63,22 +63,33 @@ void UOscFunctionLibrary::PushInt(FOscDataStruct input, int32 Value, FOscDataStr
|
|||||||
|
|
||||||
void UOscFunctionLibrary::PushString(FOscDataStruct input, FName Value, FOscDataStruct & output)
|
void UOscFunctionLibrary::PushString(FOscDataStruct input, FName Value, FOscDataStruct & output)
|
||||||
{
|
{
|
||||||
|
if(Value.GetDisplayNameEntry()->IsWide())
|
||||||
|
{
|
||||||
|
const auto tmp = Value.GetPlainNameString();
|
||||||
|
UE_LOG(LogOSC, Error, TEXT("Invalid string argument \"%s\": ASCII only"), *tmp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
output = input;
|
output = input;
|
||||||
FOscDataElemStruct elem;
|
FOscDataElemStruct elem;
|
||||||
elem.SetString(Value);
|
elem.SetString(Value);
|
||||||
output.Queue.Add(elem);
|
output.Queue.Add(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UOscFunctionLibrary::SendOsc(const FString & Address, const FOscDataStruct & Data, int32 TargetIndex)
|
void UOscFunctionLibrary::SendOsc(FName Address, const FOscDataStruct & Data, int32 TargetIndex)
|
||||||
{
|
{
|
||||||
|
if(Address.GetDisplayNameEntry()->IsWide())
|
||||||
|
{
|
||||||
|
const auto tmp = Address.GetPlainNameString();
|
||||||
|
UE_LOG(LogOSC, Error, TEXT("Invalid OSC address \"%s\": ASCII only"), *tmp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static_assert(sizeof(uint8) == sizeof(char), "Cannot cast uint8 to char");
|
static_assert(sizeof(uint8) == sizeof(char), "Cannot cast uint8 to char");
|
||||||
uint8 buffer[1024];
|
uint8 buffer[1024];
|
||||||
|
|
||||||
char oscAddress[256];
|
|
||||||
strcpy(oscAddress, TCHAR_TO_ANSI(*Address));
|
|
||||||
|
|
||||||
osc::OutboundPacketStream output((char *)buffer, sizeof(buffer));
|
osc::OutboundPacketStream output((char *)buffer, sizeof(buffer));
|
||||||
output << osc::BeginMessage(oscAddress);
|
output << osc::BeginMessage(Address.GetPlainANSIString());
|
||||||
for(int32 i=Data.Index, n=Data.Queue.Num(); i<n; ++i)
|
for(int32 i=Data.Index, n=Data.Queue.Num(); i<n; ++i)
|
||||||
{
|
{
|
||||||
const auto & elem = Data.Queue[i];
|
const auto & elem = Data.Queue[i];
|
||||||
|
|||||||
@@ -50,5 +50,5 @@ class UOscFunctionLibrary : public UBlueprintFunctionLibrary
|
|||||||
* @param Index index of the destination, -1 for all destinations. (SendTarget list of the plugin settings)
|
* @param Index index of the destination, -1 for all destinations. (SendTarget list of the plugin settings)
|
||||||
*/
|
*/
|
||||||
UFUNCTION(BlueprintCallable, Category=OSC)
|
UFUNCTION(BlueprintCallable, Category=OSC)
|
||||||
static void SendOsc(const FString & Address, const FOscDataStruct & Data, int32 TargetIndex);
|
static void SendOsc(FName Address, const FOscDataStruct & Data, int32 TargetIndex);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user