set OSC_ENGINE_VERSION value to compile for an earlier version
This commit is contained in:
monsieurgustav
2014-10-16 20:01:13 +02:00
parent 4a503995ea
commit cb3d2d8abb
4 changed files with 37 additions and 3 deletions
@@ -90,15 +90,25 @@ struct FOscDataElemStruct
void SetString(FName value)
{
#if OSC_ENGINE_VERSION < 40500
static_assert(sizeof(value) <= sizeof(Data), "Too short to hold the string value.");
Data = *reinterpret_cast<const int64*>(&value);
#else
static_assert(sizeof(FMinimalName) <= sizeof(Data), "Too short to hold the string value.");
const auto mininal = NameToMinimalName(value);
Data = *reinterpret_cast<const int64*>(&mininal);
#endif
Type = STRING;
Data = *reinterpret_cast<int64*>(&value);
assert(value == AsStringValue());
}
FName AsStringValue() const
{
#if OSC_ENGINE_VERSION < 40500
return *reinterpret_cast<const FName *>(&Data);
#else
return MinimalNameToName(*reinterpret_cast<const FMinimalName *>(&Data));
#endif
}
bool IsString() const
+4
View File
@@ -1,6 +1,10 @@
#pragma once
// Target engine version. Used to enable compatibility code.
#define OSC_ENGINE_VERSION 40500
/* Public Dependencies
*****************************************************************************/
@@ -150,7 +150,11 @@ void UOscDispatcher::Callback(const FArrayReaderPtr& data, const FIPv4Endpoint&)
{
FSimpleDelegateGraphTask::CreateAndDispatchWhenReady(
FSimpleDelegateGraphTask::FDelegate::CreateUObject(this, &UOscDispatcher::CallbackMainThread),
#if OSC_ENGINE_VERSION < 40500
TEXT("OscDispatcherProcessMessages"),
#else
TStatId(),
#endif
nullptr,
ENamedThreads::GameThread);
}
+18 -2
View File
@@ -8,6 +8,7 @@ Integration
===========
Put the "OSC" folder in a "Plugins" folder in the project root.
e.g. "/MyProject/Plugins/OSC"
@@ -15,12 +16,27 @@ Usage
=====
- Receiver:
Set the listening port in the plugin settings.
Add a OscReceiverComponent to your Blueprint class.
Bind the OnOscReceived custom event.
Add a OscReceiverComponent to your Blueprint class and bind the OnOscReceived custom event, or
Subclass the OscReceiverActor and bind the OnOscReceived custom event.
Use the PopFloat/Int/Bool/String functions to retrieve the OSC message parameters.
- Sender:
Set the "send to" addresses in the plugin settings.
Use the PushFloat/Int/Bool/String functions to build the OSC message parameters.
Use the SendOsc function to send the OSC message
Engine version
=====
Tested on UE 4.4, UE 4.5 (Windows, MacOSX)
Set the OSC_ENGINE_VERSION value (in Source/OSC/Private/Osc.h) to compile for a specific engine version.