/// <summary> /// Returns the numeric property which represents the integral type of the enum. /// </summary> /// <returns></returns> public UNumericProperty GetUnderlyingProperty() { return(GCHelper.Find <UNumericProperty>(Native_UEnumProperty.GetUnderlyingProperty(Address))); }
/// <summary> /// Returns a pointer to the UEnum of this property /// </summary> /// <returns></returns> public UEnum GetEnum() { return(GCHelper.Find <UEnum>(Native_UEnumProperty.GetEnum(Address))); }
private IntPtr CreateProperty(IntPtr outer, Type type, string propertyName, EPropertyType propertyType, EPropertyType innerPropertyType1, EPropertyType innerPropertyType2) { propertyType = ManagedUnrealTypes.GetPropertyType(type, propertyType); IntPtr propertyClass = ManagedUnrealTypes.GetPropertyClass(propertyType); if (propertyClass == IntPtr.Zero) { return(IntPtr.Zero); } EObjectFlags objectFlags = EObjectFlags.Public | EObjectFlags.Transient | EObjectFlags.MarkAsNative; IntPtr property = NativeReflection.NewObject(outer, propertyClass, new FName(propertyName), objectFlags); Native_UProperty.SetPropertyFlags(property, EPropertyFlags.BlueprintVisible | EPropertyFlags.BlueprintAssignable | EPropertyFlags.Edit); // Set type specific information switch (propertyType) { case EPropertyType.Array: if (!firstRun) { Native_UArrayProperty.Set_Inner(property, CreateProperty(property, typeof(int), propertyName, innerPropertyType1)); } else { Native_UArrayProperty.Set_Inner(property, CreateProperty(property, type.GenericTypeArguments[0], propertyName, innerPropertyType1)); } break; case EPropertyType.Set: Native_USetProperty.Set_ElementProp(property, CreateProperty(property, type.GenericTypeArguments[0], propertyName, innerPropertyType1)); break; case EPropertyType.Map: Native_UMapProperty.Set_KeyProp(property, CreateProperty(property, type.GenericTypeArguments[0], propertyName, innerPropertyType1)); Native_UMapProperty.Set_ValueProp(property, CreateProperty(property, type.GenericTypeArguments[1], propertyName, innerPropertyType2)); break; case EPropertyType.Class: Native_UClassProperty.SetMetaClass(property, UClass.GetClass(type.GenericTypeArguments[0]).Address); break; case EPropertyType.Object: var v1 = ManagedUnrealTypes.GetStaticClass(type); var v2 = ManagedUnrealTypes.GetStaticClass(typeof(UObject)); Native_UObjectPropertyBase.SetPropertyClass(property, v1 == IntPtr.Zero ? v2 : v1); break; case EPropertyType.LazyObject: case EPropertyType.WeakObject: case EPropertyType.SoftObject: Native_UObjectPropertyBase.SetPropertyClass(property, UClass.GetClass(type.GenericTypeArguments[0]).Address); break; case EPropertyType.SoftClass: Native_USoftClassProperty.SetMetaClass(property, UClass.GetClass(type.GenericTypeArguments[0]).Address); break; case EPropertyType.Enum: Native_UEnumProperty.SetEnum(property, ManagedUnrealTypes.GetEnum(type)); break; case EPropertyType.Delegate: //Native_UDelegateProperty.Set_SignatureFunction(property, ManagedUnrealTypes.GetSignatureFunction(type)); break; case EPropertyType.MulticastDelegate: //Native_UMulticastDelegateProperty.Set_SignatureFunction(property, ManagedUnrealTypes.GetSignatureFunction(type)); break; } Native_UField.AddCppProperty(outer, property); return(property); }
/// <summary> /// Set the UEnum of this property. /// Note: May only be called once to lazily initialize the property when using the default constructor. /// </summary> /// <param name="unrealEnum"></param> public void SetEnum(UEnum unrealEnum) { Native_UEnumProperty.SetEnum(Address, unrealEnum == null ? IntPtr.Zero : unrealEnum.Address); }
public static IntPtr GetPropertyClass(EPropertyType propertyType) { switch (propertyType) { case EPropertyType.Bool: return(Native_UBoolProperty.StaticClass()); case EPropertyType.Int8: return(Native_UInt8Property.StaticClass()); case EPropertyType.Int16: return(Native_UInt16Property.StaticClass()); case EPropertyType.Int: return(Native_UIntProperty.StaticClass()); case EPropertyType.Int64: return(Native_UInt64Property.StaticClass()); case EPropertyType.Byte: return(Native_UByteProperty.StaticClass()); case EPropertyType.UInt16: return(Native_UUInt16Property.StaticClass()); case EPropertyType.UInt32: return(Native_UUInt32Property.StaticClass()); case EPropertyType.UInt64: return(Native_UUInt64Property.StaticClass()); case EPropertyType.Double: return(Native_UDoubleProperty.StaticClass()); case EPropertyType.Float: return(Native_UFloatProperty.StaticClass()); case EPropertyType.Enum: return(Native_UEnumProperty.StaticClass()); case EPropertyType.Interface: return(Native_UInterfaceProperty.StaticClass()); case EPropertyType.Struct: return(Native_UStructProperty.StaticClass()); case EPropertyType.Class: return(Native_UClassProperty.StaticClass()); case EPropertyType.Object: return(Native_UObjectProperty.StaticClass()); case EPropertyType.LazyObject: return(Native_ULazyObjectProperty.StaticClass()); case EPropertyType.WeakObject: return(Native_UWeakObjectProperty.StaticClass()); case EPropertyType.SoftClass: return(Native_USoftClassProperty.StaticClass()); case EPropertyType.SoftObject: return(Native_USoftObjectProperty.StaticClass()); case EPropertyType.Delegate: return(Native_UDelegateProperty.StaticClass()); case EPropertyType.MulticastDelegate: return(Native_UMulticastDelegateProperty.StaticClass()); case EPropertyType.Array: return(Native_UArrayProperty.StaticClass()); case EPropertyType.Map: return(Native_UMapProperty.StaticClass()); case EPropertyType.Set: return(Native_USetProperty.StaticClass()); case EPropertyType.Str: return(Native_UStrProperty.StaticClass()); case EPropertyType.Name: return(Native_UNameProperty.StaticClass()); case EPropertyType.Text: return(Native_UTextProperty.StaticClass()); default: return(IntPtr.Zero); } }