2648.patch (4,112 bytes)
Index: Source/NoesisRuntime/Private/NoesisTypeClass.cpp
===================================================================
--- Source/NoesisRuntime/Private/NoesisTypeClass.cpp (revision 12613)
+++ Source/NoesisRuntime/Private/NoesisTypeClass.cpp (revision 12614)
@@ -31,6 +31,9 @@
#include "MaterialDomain.h"
#endif
+// MediaAsset includes
+#include "MediaTexture.h"
+
// Slate includes
#include "Framework/Text/TextLayout.h"
@@ -430,6 +433,25 @@
}
};
+template<>
+struct NoesisTypeTraits<UMediaTexture*>
+{
+ typedef Noesis::TextureSource* NoesisType;
+ static Noesis::Ptr<Noesis::BaseComponent> ToNoesis(UObject* Value)
+ {
+ check(Value == nullptr || Value->IsA<UMediaTexture>());
+ return NoesisCreateComponentForUTexture((UMediaTexture*)Value);
+ }
+ static UObject* ToUnreal(Noesis::BaseComponent* Value)
+ {
+ return nullptr;
+ }
+ static bool Equals(UObject* Left, UObject* Right)
+ {
+ return Left == Right;
+ }
+};
+
template<class T>
Noesis::Ptr<Noesis::BaseComponent> GenericGetter(void* BasePointer, FProperty* Property)
{
@@ -625,8 +647,7 @@
void* Value = Property->template ContainerPtrToValuePtr<void>(BasePointer);
UObject*& Object = *(UObject**)Value;
check(Property->IsA<FObjectProperty>());
- FObjectProperty* ObjectProperty = (FObjectProperty*)Property;
- NoesisClassConversion* ClassConversion = ClassConversions.Find(ObjectProperty->PropertyClass);
+ NoesisClassConversion* ClassConversion = ClassConversions.Find(Object->GetClass());
if (ClassConversion != nullptr)
{
return (*ClassConversion->Wrapper)(Object);
@@ -642,8 +663,9 @@
void* Value = Property->template ContainerPtrToValuePtr<void>(BasePointer);
UObject*& Object = *(UObject**)Value;
check(Property->IsA<FObjectProperty>());
- FObjectProperty* ObjectProperty = (FObjectProperty*)Property;
- NoesisClassConversion* ClassConversion = ClassConversions.Find(ObjectProperty->PropertyClass);
+ UObject* InputObject = NoesisFindUObjectForComponent(Input);
+ UClass* Class = InputObject != nullptr ? InputObject->GetClass() : nullptr;
+ NoesisClassConversion* ClassConversion = Class != nullptr ? ClassConversions.Find(Class) : nullptr;
if (ClassConversion != nullptr)
{
UObject* NewObject = (*ClassConversion->Unwrapper)(Input);
@@ -766,7 +788,9 @@
{
ClassConversions =
{
- {UTexture2D::StaticClass(), NoesisClassConversion::FromType<UTexture2D*>() }
+ {UTexture2D::StaticClass(), NoesisClassConversion::FromType<UTexture2D*>() },
+ {UTextureRenderTarget2D::StaticClass(), NoesisClassConversion::FromType<UTextureRenderTarget2D*>() },
+ {UMediaTexture::StaticClass(), NoesisClassConversion::FromType<UMediaTexture*>() }
};
UScriptStruct* TimespanStruct = nullptr;
@@ -2238,7 +2262,17 @@
Noesis::Ptr<Noesis::BaseComponent> NoesisCreateComponentForUTexture(UTexture* Texture)
{
- return *new NoesisTextureWrapper(Texture);
+ NoesisTextureWrapper** TextureSourcePtr = TextureMap.Find(Texture);
+ if (TextureSourcePtr != nullptr)
+ {
+ return Noesis::Ptr<Noesis::BaseComponent>(*TextureSourcePtr);
+ }
+ else
+ {
+ NoesisTextureWrapper* TextureSource = new NoesisTextureWrapper(Texture);
+ TextureMap.Add(Texture, TextureSource);
+ return Noesis::Ptr<Noesis::BaseComponent>(*TextureSource);
+ }
}
Noesis::Ptr<Noesis::BaseComponent> NoesisCreateComponentForTArray(void* ArrayPtr, FArrayProperty* ArrayProperty)
@@ -3559,20 +3593,6 @@
Wrapper = *new NoesisPostProcessMaterialWrapper(Material);
}
}
- else if (Class->IsChildOf(UTexture2D::StaticClass()) || Class->IsChildOf(UTextureRenderTarget2D::StaticClass()))
- {
- NoesisTextureWrapper** TextureSourcePtr = TextureMap.Find(Object);
- if (TextureSourcePtr != nullptr)
- {
- Wrapper = Noesis::Ptr<Noesis::BaseComponent>(*TextureSourcePtr);
- }
- else
- {
- NoesisTextureWrapper* TextureSource = new NoesisTextureWrapper((UTexture*)Object);
- TextureMap.Add(Object, TextureSource);
- Wrapper = *TextureSource;
- }
- }
else
{
Wrapper = *new NoesisObjectWrapper(Object);