Example #1
0
 internal static void AssertIfInConstructor(IntPtr outer, string errorMessage)
 {
     using (FStringUnsafe errorMessageUnsafe = new FStringUnsafe(errorMessage))
     {
         Native_FObjectInitializer.AssertIfInConstructor(outer, ref errorMessageUnsafe.Array);
     }
 }
Example #2
0
 /// <summary>
 /// Create a component or subobject only to be used with the editor.
 /// </summary>
 /// <param name="outer">outer to construct the subobject in</param>
 /// <param name="subobjectName">name of the new component</param>
 /// <param name="returnType">type of the new component</param>
 /// <param name="transient">true if the component is being assigned to a transient property</param>
 /// <returns></returns>
 public UObject CreateEditorOnlyDefaultSubobject(UObject outer, FName subobjectName, UClass returnType, bool transient)
 {
     return(GCHelper.Find(Native_FObjectInitializer.CreateEditorOnlyDefaultSubobject(NativeObjectInitializer,
                                                                                     outer == null ? IntPtr.Zero : outer.Address,
                                                                                     ref subobjectName,
                                                                                     returnType == null ? IntPtr.Zero : returnType.Address,
                                                                                     transient)));
 }
Example #3
0
 /// <summary>
 /// Indicates that a base class should not create a component
 /// </summary>
 /// <param name="subobjectName">name of the new component or subobject to not create</param>
 public FObjectInitializer DoNotCreateDefaultSubobject(string subobjectName)
 {
     using (FStringUnsafe subobjectNameUnsafe = new FStringUnsafe(subobjectName))
     {
         Native_FObjectInitializer.DoNotCreateDefaultSubobjectStr(NativeObjectInitializer, ref subobjectNameUnsafe.Array);
     }
     return(this);
 }
Example #4
0
 /// <summary>
 /// Create a component or subobject
 /// </summary>
 /// <param name="outer">outer to construct the subobject in</param>
 /// <param name="subobjectFName">name of the new component</param>
 /// <param name="returnType">class of return type, all overrides must be of this type</param>
 /// <param name="classToCreateByDefault">if the derived class has not overridden, create a component of this type (default is TReturnType)</param>
 /// <param name="isRequired">true if the component is required and will always be created even if DoNotCreateDefaultSubobject was sepcified.</param>
 /// <param name="isTransient">true if the component is being assigned to a transient property</param>
 /// <returns></returns>
 public UObject CreateDefaultSubobject(UObject outer, FName subobjectFName, UClass returnType, UClass classToCreateByDefault, bool isRequired, bool isTransient)
 {
     return(GCHelper.Find(Native_FObjectInitializer.CreateDefaultSubobject(NativeObjectInitializer,
                                                                           outer == null ? IntPtr.Zero : outer.Address,
                                                                           ref subobjectFName,
                                                                           returnType == null ? IntPtr.Zero : returnType.Address,
                                                                           classToCreateByDefault == null ? IntPtr.Zero : classToCreateByDefault.Address,
                                                                           isRequired,
                                                                           isTransient)));
 }
Example #5
0
        /// <summary>
        /// Gets ObjectInitializer for the currently constructed object. Can only be used inside of a constructor of UObject-derived class.
        /// </summary>
        public static FObjectInitializer Get()
        {
            FObjectInitializer result            = new FObjectInitializer();
            IntPtr             objectInitializer = Native_FObjectInitializer.Get();

            if (objectInitializer != IntPtr.Zero)
            {
                result.NativeObject            = Native_FObjectInitializer.GetObj(objectInitializer);
                result.NativeObjectInitializer = objectInitializer;
            }
            return(result);
        }
Example #6
0
        private void Constructor(IntPtr objectInitializerPtr)
        {
            Native_UClass.Call_ClassConstructor(ParentClass, objectInitializerPtr);
            FObjectInitializer objectInitializer = new FObjectInitializer(objectInitializerPtr);

            IntPtr sharpStaticClass = Native_USharpClass.StaticClass();
            IntPtr unrealClass      = Native_FObjectInitializer.GetClass(objectInitializerPtr);
            IntPtr sharpClass       = unrealClass;

            while (sharpClass != IntPtr.Zero && !Native_UObjectBaseUtility.IsA(sharpClass, sharpStaticClass))
            {
                sharpClass = Native_UClass.GetSuperClass(sharpClass);
            }

            System.Diagnostics.Debug.Assert(sharpClass != IntPtr.Zero);
        }
Example #7
0
 /// <summary>
 /// Return the class of the object that is being constructed
 /// </summary>
 public UClass GetClass()
 {
     return(GCHelper.Find <UClass>(Native_FObjectInitializer.GetClass(NativeObjectInitializer)));
 }
Example #8
0
 /// <summary>
 /// Return the object that is being constructed
 /// </summary>
 public UObject GetObj()
 {
     return(GCHelper.Find(Native_FObjectInitializer.GetObj(NativeObjectInitializer)));
 }
Example #9
0
 /// <summary>
 /// Return the archetype that this object will copy properties from later
 /// </summary>
 public UObject GetArchetype()
 {
     return(GCHelper.Find(Native_FObjectInitializer.GetArchetype(NativeObjectInitializer)));
 }
Example #10
0
 public FObjectInitializer(IntPtr nativeObjectInitializer)
 {
     NativeObject = nativeObjectInitializer == IntPtr.Zero ?
                    IntPtr.Zero : Native_FObjectInitializer.GetObj(nativeObjectInitializer);
     NativeObjectInitializer = nativeObjectInitializer;
 }
Example #11
0
 public void FinalizeSubobjectClassInitialization()
 {
     Native_FObjectInitializer.FinalizeSubobjectClassInitialization(NativeObjectInitializer);
 }
Example #12
0
 /// <summary>
 /// Internal use only, checks if the override is legal and if not deal with error messages
 /// </summary>
 public bool IslegalOverride(FName componentName, UClass derivedComponentClass, UClass baseComponentClass)
 {
     return(Native_FObjectInitializer.IslegalOverride(NativeObjectInitializer, ref componentName,
                                                      derivedComponentClass == null ? IntPtr.Zero : derivedComponentClass.Address,
                                                      baseComponentClass == null ? IntPtr.Zero : baseComponentClass.Address));
 }
Example #13
0
 /// <summary>
 /// Indicates that a base class should not create a component
 /// </summary>
 /// <param name="subobjectName">name of the new component or subobject to not create</param>
 public FObjectInitializer DoNotCreateDefaultSubobject(FName subobjectName)
 {
     Native_FObjectInitializer.DoNotCreateDefaultSubobject(NativeObjectInitializer, ref subobjectName);
     return(this);
 }
 public FObjectInitializer(IntPtr nativeObjectInitializer)
 {
     NativeObject            = Native_FObjectInitializer.GetObj(nativeObjectInitializer);
     NativeObjectInitializer = nativeObjectInitializer;
 }