diff --git a/Reinterop~/CSharpType.cs b/Reinterop~/CSharpType.cs index 802a4868..fdf3eb0e 100644 --- a/Reinterop~/CSharpType.cs +++ b/Reinterop~/CSharpType.cs @@ -7,18 +7,22 @@ internal class CSharpType public readonly CppGenerationContext Context; public readonly InteropTypeKind Kind; public readonly IReadOnlyCollection Namespaces; - public readonly ITypeSymbol Symbol; + public readonly string Name; + public readonly SpecialType SpecialType; + public readonly ITypeSymbol? Symbol; public Compilation Compilation { get { return Context.Compilation; } } - public CSharpType(CppGenerationContext context, InteropTypeKind kind, IReadOnlyCollection namespaces, ITypeSymbol symbol) + public CSharpType(CppGenerationContext context, InteropTypeKind kind, IReadOnlyCollection namespaces, string name, SpecialType specialType, ITypeSymbol? symbol = null) { this.Context = context; this.Kind = kind; this.Namespaces = new List(namespaces); + this.Name = name; + this.SpecialType = specialType; this.Symbol = symbol; } @@ -38,31 +42,41 @@ public static CSharpType FromSymbol(CppGenerationContext context, ITypeSymbol sy namespaces.Reverse(); - return new CSharpType(context, kind, namespaces, symbol); + return new CSharpType(context, kind, namespaces, symbol.Name, symbol.SpecialType, symbol); } public string GetFullyQualifiedNamespace() { - IArrayTypeSymbol? arraySymbol = this.Symbol as IArrayTypeSymbol; - if (arraySymbol != null) - return CSharpType.FromSymbol(this.Context, arraySymbol.ElementType).GetFullyQualifiedNamespace(); + if (this.Symbol != null) + { + IArrayTypeSymbol? arraySymbol = this.Symbol as IArrayTypeSymbol; + if (arraySymbol != null) + return CSharpType.FromSymbol(this.Context, arraySymbol.ElementType).GetFullyQualifiedNamespace(); + else + return Symbol.ContainingNamespace.ToDisplayString(); + } else - return Symbol.ContainingNamespace.ToDisplayString(); + { + return string.Join(".", this.Namespaces); + } } public string GetFullyQualifiedName() { - return Symbol.ToDisplayString(); + if (this.Symbol != null) + return this.Symbol.ToDisplayString(); + else + return this.GetFullyQualifiedNamespace() + "." + this.Name; } private CSharpType AsInteropTypeCommon() { // C++ doesn't specify the size of a bool, and C# uses different sizes in different contexts. // So we explicitly marshal bools as uint8_t / System.Byte. - if (this.Symbol.SpecialType == SpecialType.System_Boolean) + if (this.SpecialType == SpecialType.System_Boolean) return CSharpType.FromSymbol(Context, Compilation.GetSpecialType(SpecialType.System_Byte)); else if (this.Kind == InteropTypeKind.ClassWrapper || this.Kind == InteropTypeKind.NonBlittableStructWrapper || this.Kind == InteropTypeKind.Delegate) - return new CSharpType(Context, InteropTypeKind.Primitive, new string[] { "System" }, Compilation.GetSpecialType(SpecialType.System_IntPtr)); + return CSharpType.FromSymbol(Context, Compilation.GetSpecialType(SpecialType.System_IntPtr)); else return this; } @@ -100,7 +114,7 @@ public CSharpType AsInteropTypeReturn() /// public string GetConversionToInteropType(string variableName) { - if (this.Symbol.SpecialType == SpecialType.System_Boolean) + if (this.SpecialType == SpecialType.System_Boolean) return $"{variableName} ? (byte)1 : (byte)0"; else if (this.Kind == InteropTypeKind.ClassWrapper || this.Kind == InteropTypeKind.NonBlittableStructWrapper || this.Kind == InteropTypeKind.Delegate) return $"Reinterop.ObjectHandleUtility.CreateHandle({variableName})"; @@ -114,7 +128,7 @@ public string GetConversionToInteropType(string variableName) public string GetParameterConversionFromInteropType(string variableName) { - if (this.Symbol.SpecialType == SpecialType.System_Boolean) + if (this.SpecialType == SpecialType.System_Boolean) return $"{variableName} != 0"; else if (this.Kind == InteropTypeKind.ClassWrapper || this.Kind == InteropTypeKind.NonBlittableStructWrapper || this.Kind == InteropTypeKind.Delegate) return $"({this.GetFullyQualifiedName()})Reinterop.ObjectHandleUtility.GetObjectFromHandle({variableName})!"; @@ -128,7 +142,7 @@ public string GetParameterConversionFromInteropType(string variableName) public string GetReturnValueConversionFromInteropType(string variableName) { - if (this.Symbol.SpecialType == SpecialType.System_Boolean) + if (this.SpecialType == SpecialType.System_Boolean) return $"{variableName} != 0"; else if (this.Kind == InteropTypeKind.ClassWrapper || this.Kind == InteropTypeKind.NonBlittableStructWrapper || this.Kind == InteropTypeKind.Delegate) return $"({this.GetFullyQualifiedName()})Reinterop.ObjectHandleUtility.GetObjectAndFreeHandle({variableName})!"; @@ -157,7 +171,9 @@ public static bool IsFirstDerivedFromSecond(ITypeSymbol first, ITypeSymbol secon public CSharpType AsPointer() { - return new CSharpType(this.Context, InteropTypeKind.Primitive, this.Namespaces, this.Compilation.CreatePointerTypeSymbol(this.Symbol)); + if (this.Symbol == null) + return this; + return new CSharpType(this.Context, InteropTypeKind.Primitive, this.Namespaces, this.Symbol.Name, this.Symbol.SpecialType, this.Compilation.CreatePointerTypeSymbol(this.Symbol)); } } } diff --git a/Reinterop~/CodeGenerator.cs b/Reinterop~/CodeGenerator.cs index 315647ca..593ccbec 100644 --- a/Reinterop~/CodeGenerator.cs +++ b/Reinterop~/CodeGenerator.cs @@ -94,7 +94,7 @@ public static void WriteCSharpCode(GeneratorExecutionContext context, CppGenerat if (partialMethods == null || partialMethods.Methods.Count == 0) continue; - context.AddSource(partialMethods.Type.Symbol.Name + "-generated", partialMethods.ToSourceFileString()); + context.AddSource(partialMethods.Type.Name + "-generated", partialMethods.ToSourceFileString()); } } diff --git a/Reinterop~/CustomDelegateGenerator.cs b/Reinterop~/CustomDelegateGenerator.cs index c0b0fd24..3165f2b4 100644 --- a/Reinterop~/CustomDelegateGenerator.cs +++ b/Reinterop~/CustomDelegateGenerator.cs @@ -83,7 +83,7 @@ private void GenerateDelegate(CppGenerationContext context, GeneratedResult resu genericTypeHash = Interop.HashParameters(null, named.TypeArguments); } - string csBaseName = $"{csType.GetFullyQualifiedNamespace().Replace(".", "_")}_{csType.Symbol.Name}{genericTypeHash}_CreateDelegate"; + string csBaseName = $"{csType.GetFullyQualifiedNamespace().Replace(".", "_")}_{csType.Name}{genericTypeHash}_CreateDelegate"; string invokeCallbackName = $"{csType.GetFullyQualifiedNamespace().Replace(".", "_")}_{item.Type.Name}{genericTypeHash}_InvokeCallback"; string disposeCallbackName = $"{csType.GetFullyQualifiedNamespace().Replace(".", "_")}_{item.Type.Name}{genericTypeHash}_DisposeCallback"; @@ -107,16 +107,16 @@ private void GenerateDelegate(CppGenerationContext context, GeneratedResult resu CSharpName: csBaseName + "Delegate", CSharpContent: $$""" - private class {{csType.Symbol.Name}}{{genericTypeHash}}NativeFunction : System.IDisposable + private class {{csType.Name}}{{genericTypeHash}}NativeFunction : System.IDisposable { private IntPtr _callbackFunction; - public {{csType.Symbol.Name}}{{genericTypeHash}}NativeFunction(IntPtr callbackFunction) + public {{csType.Name}}{{genericTypeHash}}NativeFunction(IntPtr callbackFunction) { _callbackFunction = callbackFunction; } - ~{{csType.Symbol.Name}}{{genericTypeHash}}NativeFunction() + ~{{csType.Name}}{{genericTypeHash}}NativeFunction() { Dispose(false); } @@ -139,7 +139,7 @@ private void Dispose(bool disposing) public {{csReturnType.GetFullyQualifiedName()}} Invoke({{string.Join(", ", invokeParameters)}}) { if (_callbackFunction == null) - throw new System.ObjectDisposedException("{{csType.Symbol.Name}}"); + throw new System.ObjectDisposedException("{{csType.Name}}"); {{csResultImplementation}}{{invokeCallbackName}}({{string.Join(", ", callInvokeInteropParameters)}}); {{csReturnImplementation}}; @@ -156,7 +156,7 @@ private void Dispose(bool disposing) [AOT.MonoPInvokeCallback(typeof({{csBaseName}}Type))] private static unsafe IntPtr {{csBaseName}}(IntPtr callbackFunction) { - var receiver = new {{csType.Symbol.Name}}{{genericTypeHash}}NativeFunction(callbackFunction); + var receiver = new {{csType.Name}}{{genericTypeHash}}NativeFunction(callbackFunction); return Reinterop.ObjectHandleUtility.CreateHandle(new {{csType.GetFullyQualifiedName()}}(receiver.Invoke)); } """ diff --git a/Reinterop~/GeneratedCSharpPartialMethodDefinitions.cs b/Reinterop~/GeneratedCSharpPartialMethodDefinitions.cs index cf69cbc2..29df1a92 100644 --- a/Reinterop~/GeneratedCSharpPartialMethodDefinitions.cs +++ b/Reinterop~/GeneratedCSharpPartialMethodDefinitions.cs @@ -40,24 +40,48 @@ public GeneratedCSharpPartialMethodDefinitions(CSharpType type) public string ToSourceFileString() { + if (Type.Symbol == null) + throw new Exception("Type with partial method definitions must have a Symbol."); + // TODO: support structs string kind = "class"; + string interopPrefix = Type.GetFullyQualifiedName().Replace(".", "_"); + if (!string.IsNullOrEmpty(this.Type.Context.BaseNamespace)) + interopPrefix = this.Type.Context.BaseNamespace + "_" + interopPrefix; + if (needsInstance) { return $$""" + using Microsoft.Win32.SafeHandles; using System; + using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; namespace {{Type.GetFullyQualifiedNamespace()}} { {{CSharpTypeUtility.GetAccessString(Type.Symbol.DeclaredAccessibility)}} partial {{kind}} {{Type.Symbol.Name}} : System.IDisposable { + internal class ImplementationHandle : SafeHandleZeroOrMinusOneIsInvalid + { + public ImplementationHandle({{Type.Symbol.Name}} managed) : base(true) + { + SetHandle({{interopPrefix}}_CreateImplementation(Reinterop.ObjectHandleUtility.CreateHandle(managed))); + } + + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] + protected override bool ReleaseHandle() + { + {{interopPrefix}}_DestroyImplementation(this.handle); + return true; + } + } + [System.NonSerialized] - private System.IntPtr _implementation = System.IntPtr.Zero; + private ImplementationHandle _implementation = null; - public IntPtr NativeImplementation + internal ImplementationHandle NativeImplementation { get { return _implementation; } } diff --git a/Reinterop~/Interop.cs b/Reinterop~/Interop.cs index c382d907..a4c888ab 100644 --- a/Reinterop~/Interop.cs +++ b/Reinterop~/Interop.cs @@ -326,7 +326,7 @@ public static (string Name, string Content) CreateCSharpDelegateInit( public static string GetUniqueNameForType(CSharpType type) { - string name = type.Symbol.Name; + string name = type.Name; string genericTypeHash = ""; INamedTypeSymbol? named = type.Symbol as INamedTypeSymbol; if (named != null && named.IsGenericType) diff --git a/Reinterop~/MethodsImplementedInCpp.cs b/Reinterop~/MethodsImplementedInCpp.cs index ab78188b..6a0fa908 100644 --- a/Reinterop~/MethodsImplementedInCpp.cs +++ b/Reinterop~/MethodsImplementedInCpp.cs @@ -49,8 +49,8 @@ public static void Generate(CppGenerationContext context, TypeToGenerate item, G private void CreateImplementation() { Reinterop.ReinteropInitializer.Initialize(); - System.Diagnostics.Debug.Assert(_implementation == System.IntPtr.Zero, "Implementation is already created. Be sure to call CreateImplementation only once."); - _implementation = {{createName}}(Reinterop.ObjectHandleUtility.CreateHandle(this)); + System.Diagnostics.Debug.Assert(this._implementation == null, "Implementation is already created. Be sure to call CreateImplementation only once."); + this._implementation = new ImplementationHandle(this); } """, interopFunctionDeclaration: @@ -59,17 +59,15 @@ private void CreateImplementation() private static extern System.IntPtr {{createName}}(System.IntPtr thiz); """)); - string disposeName = $$"""{{wrapperType.GetFullyQualifiedName(false).Replace("::", "_")}}_Dispose"""; + string destroyName = $$"""{{wrapperType.GetFullyQualifiedName(false).Replace("::", "_")}}_DestroyImplementation"""; result.CppImplementationInvoker.Functions.Add(new( Content: $$""" #if defined(_WIN32) __declspec(dllexport) #endif - void {{disposeName}}(void* handle, void* pImpl) { - const {{wrapperType.GetFullyQualifiedName()}} wrapper{{{objectHandleType.GetFullyQualifiedName()}}(handle)}; + void {{destroyName}}(void* pImpl) { auto pImplTyped = reinterpret_cast<{{implType.GetFullyQualifiedName()}}*>(pImpl); - pImplTyped->JustBeforeDelete(wrapper); delete pImplTyped; } """, @@ -81,39 +79,25 @@ private void CreateImplementation() })); // Always add a protected DisposeImplementation method. + // This method must take a raw IntPtr to the implementation, rather than an ImplementationHandle. + // Otherwise .NET (or at least Unity's Mono) will complain that the handle has already been closed + // when we try to call the destroy method using it. result.CSharpPartialMethodDefinitions.Methods.Add(new( methodDefinition: $$""" protected void DisposeImplementation() { - if (_implementation != System.IntPtr.Zero) - { - {{disposeName}}(Reinterop.ObjectHandleUtility.CreateHandle(this), _implementation); - _implementation = System.IntPtr.Zero; - } + if (this._implementation != null && !this._implementation.IsInvalid) + this._implementation.Dispose(); + this._implementation = null; } """, interopFunctionDeclaration: $$""" [DllImport("{{context.NativeLibraryName}}", CallingConvention=CallingConvention.Cdecl)] - private static extern void {{disposeName}}(System.IntPtr thiz, System.IntPtr implementation); + private static extern void {{destroyName}}(System.IntPtr implementation); """)); - // If there is no finalizer, create one that calls DisposeImplementation. - // But if the other half of this partial class has a finalizer already, we can't add one, so it's on - // the implementer of that other class to call DisposeImplementation themselves. - if (!item.Type.GetMembers("Finalize").Any()) - { - result.CSharpPartialMethodDefinitions.Methods.Add(new( - methodDefinition: - $$""" - ~{{wrapperType.Name}}() - { - DisposeImplementation(); - } - """)); - } - // If there is no parameterless Dispose Method, add one. If the base class has one, call it (and mark it override if needed). // But if the other half of this partial class implements Dispose, it's on the implementer of that other class to // arrange for DisposeImplementation to be called themselves. @@ -126,8 +110,8 @@ protected void DisposeImplementation() public {{(baseDisposeMethod != null && baseDisposeMethod.IsVirtual ? "override " : "")}}void Dispose() { {{(baseDisposeMethod != null - ? "base.Dispose();" // let the base class suppress finalization if desired - : "GC.SuppressFinalize(this);" + ? "base.Dispose();" // call the base class dispose if there is one. + : "" )}} this.DisposeImplementation(); } @@ -205,8 +189,11 @@ protected void DisposeImplementation() genericTypeHash = Interop.HashParameters(null, named.TypeArguments); } - string baseName = $"{csWrapperType.GetFullyQualifiedNamespace().Replace(".", "_")}_{csWrapperType.Symbol.Name}{genericTypeHash}_Property_get_NativeImplementation"; + string baseName = $"{csWrapperType.GetFullyQualifiedNamespace().Replace(".", "_")}_{csWrapperType.Name}{genericTypeHash}_Property_get_NativeImplementation"; + // Ideally the wrapper for NativeImplementation would return an ImplementationHandle. + // But Mono explodes, saying a managed function returning a SafeHandle is not implemented. + // So just use an IntPtr here instead. result.Init.Functions.Add(new( CppName: $"{wrapperType.GetFullyQualifiedName()}::Property_get_NativeImplementation", CppTypeSignature: $"void* (*)(void*)", @@ -214,12 +201,12 @@ protected void DisposeImplementation() CSharpContent: $$""" [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private unsafe delegate IntPtr {{baseName}}Type(IntPtr thiz); + private unsafe delegate System.IntPtr {{baseName}}Type(IntPtr thiz); private static unsafe readonly {{baseName}}Type {{baseName}}Delegate = new {{baseName}}Type({{baseName}}); [AOT.MonoPInvokeCallback(typeof({{baseName}}Type))] - private static unsafe IntPtr {{baseName}}(IntPtr thiz) + private static unsafe System.IntPtr {{baseName}}(IntPtr thiz) { - return ({{csWrapperType.GetParameterConversionFromInteropType("thiz")}}).NativeImplementation; + return ({{csWrapperType.GetParameterConversionFromInteropType("thiz")}}).NativeImplementation.DangerousGetHandle(); } """ )); @@ -346,7 +333,7 @@ private static void GenerateMethod(CppGenerationContext context, TypeToGenerate CSharpType csReturnType = CSharpType.FromSymbol(context, method.ReturnType); var csParameters = method.Parameters.Select(parameter => (Name: parameter.Name, CallName: parameter.Name, Type: CSharpType.FromSymbol(context, parameter.Type))); var csParametersInterop = csParameters; - var implementationPointer = CSharpType.FromSymbol(context, context.Compilation.GetSpecialType(SpecialType.System_IntPtr)); + var implementationPointer = new CSharpType(context, InteropTypeKind.Primitive, csWrapperType.Namespaces, csWrapperType.Name + ".ImplementationHandle", csWrapperType.SpecialType, null); if (!method.IsStatic) { @@ -370,12 +357,12 @@ private static void GenerateMethod(CppGenerationContext context, TypeToGenerate csImplementationLines.Add($"var returnValue = new {csOriginalInteropReturnType.AsInteropTypeReturn().GetFullyQualifiedName()}();"); } - if (csInteropReturnType.Symbol.SpecialType == SpecialType.System_Void) + if (csInteropReturnType.SpecialType == SpecialType.System_Void) csImplementationLines.Add($"{name}({string.Join(", ", csParametersInterop.Select(parameter => parameter.Type.GetConversionToInteropType(parameter.CallName)))});"); else csImplementationLines.Add($"var result = {name}({string.Join(", ", csParametersInterop.Select(parameter => parameter.Type.GetConversionToInteropType(parameter.CallName)))});"); - if (csReturnType.Symbol.SpecialType != SpecialType.System_Void) + if (csReturnType.SpecialType != SpecialType.System_Void) { if (hasStructRewrite) { @@ -400,7 +387,7 @@ private static void GenerateMethod(CppGenerationContext context, TypeToGenerate { implementationCheck = $$""" - if (this._implementation == System.IntPtr.Zero) + if (this._implementation == null || this._implementation.IsInvalid) throw new NotImplementedException("The native implementation is missing so {{method.Name}} cannot be invoked. This may be caused by a missing call to CreateImplementation in one of your constructors, or it may be that the entire native implementation shared library is missing or out of date."); """; } diff --git a/Runtime/Cesium3DTileset.cs b/Runtime/Cesium3DTileset.cs index 8c4c0c89..96447df3 100644 --- a/Runtime/Cesium3DTileset.cs +++ b/Runtime/Cesium3DTileset.cs @@ -39,8 +39,14 @@ public enum CesiumDataSource /// [ExecuteInEditMode] [ReinteropNativeImplementation("CesiumForUnityNative::Cesium3DTilesetImpl", "Cesium3DTilesetImpl.h")] - public partial class Cesium3DTileset : MonoBehaviour + public partial class Cesium3DTileset : MonoBehaviour, IDisposable { + public void Dispose() + { + this.OnDisable(); + this.DisposeImplementation(); + } + /// /// Encapsulates a method that receives details of a tileset load failure. /// diff --git a/native~/Editor/src/CesiumEditorWindowImpl.cpp b/native~/Editor/src/CesiumEditorWindowImpl.cpp index 0c53c10e..3e743af7 100644 --- a/native~/Editor/src/CesiumEditorWindowImpl.cpp +++ b/native~/Editor/src/CesiumEditorWindowImpl.cpp @@ -33,9 +33,6 @@ CesiumEditorWindowImpl::CesiumEditorWindowImpl( CesiumEditorWindowImpl::~CesiumEditorWindowImpl() {} -void CesiumEditorWindowImpl::JustBeforeDelete( - const DotNet::CesiumForUnity::CesiumEditorWindow& window) {} - void CesiumEditorWindowImpl::AddAssetFromIon( const DotNet::CesiumForUnity::CesiumEditorWindow& window, DotNet::System::String name, diff --git a/native~/Editor/src/CesiumEditorWindowImpl.h b/native~/Editor/src/CesiumEditorWindowImpl.h index ea09d70d..32ee1f07 100644 --- a/native~/Editor/src/CesiumEditorWindowImpl.h +++ b/native~/Editor/src/CesiumEditorWindowImpl.h @@ -20,9 +20,6 @@ class CesiumEditorWindowImpl { const DotNet::CesiumForUnity::CesiumEditorWindow& window); ~CesiumEditorWindowImpl(); - void - JustBeforeDelete(const DotNet::CesiumForUnity::CesiumEditorWindow& window); - void AddAssetFromIon( const DotNet::CesiumForUnity::CesiumEditorWindow& window, DotNet::System::String name, diff --git a/native~/Editor/src/CesiumIonSessionImpl.cpp b/native~/Editor/src/CesiumIonSessionImpl.cpp index 7b24eec9..59659200 100644 --- a/native~/Editor/src/CesiumIonSessionImpl.cpp +++ b/native~/Editor/src/CesiumIonSessionImpl.cpp @@ -51,9 +51,6 @@ CesiumIonSessionImpl::CesiumIonSessionImpl( CesiumIonSessionImpl::~CesiumIonSessionImpl() {} -void CesiumIonSessionImpl::JustBeforeDelete( - const DotNet::CesiumForUnity::CesiumIonSession& session) {} - bool CesiumIonSessionImpl::IsConnected( const DotNet::CesiumForUnity::CesiumIonSession& session) { return this->_connection.has_value(); diff --git a/native~/Editor/src/CesiumIonSessionImpl.h b/native~/Editor/src/CesiumIonSessionImpl.h index cdf45e1e..b082fa10 100644 --- a/native~/Editor/src/CesiumIonSessionImpl.h +++ b/native~/Editor/src/CesiumIonSessionImpl.h @@ -38,9 +38,6 @@ class CesiumIonSessionImpl { CesiumIonSessionImpl(const DotNet::CesiumForUnity::CesiumIonSession& session); ~CesiumIonSessionImpl(); - void - JustBeforeDelete(const DotNet::CesiumForUnity::CesiumIonSession& session); - bool IsConnected(const DotNet::CesiumForUnity::CesiumIonSession& session); bool IsConnecting(const DotNet::CesiumForUnity::CesiumIonSession& session); bool IsResuming(const DotNet::CesiumForUnity::CesiumIonSession& session); diff --git a/native~/Editor/src/IonAssetsTreeViewImpl.cpp b/native~/Editor/src/IonAssetsTreeViewImpl.cpp index 59113437..95cf46c8 100644 --- a/native~/Editor/src/IonAssetsTreeViewImpl.cpp +++ b/native~/Editor/src/IonAssetsTreeViewImpl.cpp @@ -32,9 +32,6 @@ IonAssetsTreeViewImpl::IonAssetsTreeViewImpl( IonAssetsTreeViewImpl::~IonAssetsTreeViewImpl() {} -void IonAssetsTreeViewImpl::JustBeforeDelete( - const DotNet::CesiumForUnity::IonAssetsTreeView& treeView) {} - int IonAssetsTreeViewImpl::GetAssetsCount( const DotNet::CesiumForUnity::IonAssetsTreeView& treeView) { return this->_assets.size(); diff --git a/native~/Editor/src/IonAssetsTreeViewImpl.h b/native~/Editor/src/IonAssetsTreeViewImpl.h index f6885b07..5c701461 100644 --- a/native~/Editor/src/IonAssetsTreeViewImpl.h +++ b/native~/Editor/src/IonAssetsTreeViewImpl.h @@ -21,9 +21,6 @@ class IonAssetsTreeViewImpl { const DotNet::CesiumForUnity::IonAssetsTreeView& treeView); ~IonAssetsTreeViewImpl(); - void - JustBeforeDelete(const DotNet::CesiumForUnity::IonAssetsTreeView& treeView); - int GetAssetsCount(const DotNet::CesiumForUnity::IonAssetsTreeView& treeView); void CellGUI( diff --git a/native~/Editor/src/IonTokenTroubleshootingWindowImpl.cpp b/native~/Editor/src/IonTokenTroubleshootingWindowImpl.cpp index 6e7f7d81..50870e2a 100644 --- a/native~/Editor/src/IonTokenTroubleshootingWindowImpl.cpp +++ b/native~/Editor/src/IonTokenTroubleshootingWindowImpl.cpp @@ -24,9 +24,6 @@ IonTokenTroubleshootingWindowImpl::IonTokenTroubleshootingWindowImpl( IonTokenTroubleshootingWindowImpl::~IonTokenTroubleshootingWindowImpl() {} -void IonTokenTroubleshootingWindowImpl::JustBeforeDelete( - const DotNet::CesiumForUnity::IonTokenTroubleshootingWindow& window) {} - namespace { void getTokenTroubleShootingDetails( diff --git a/native~/Editor/src/IonTokenTroubleshootingWindowImpl.h b/native~/Editor/src/IonTokenTroubleshootingWindowImpl.h index b2854a02..f50ce178 100644 --- a/native~/Editor/src/IonTokenTroubleshootingWindowImpl.h +++ b/native~/Editor/src/IonTokenTroubleshootingWindowImpl.h @@ -15,9 +15,6 @@ class IonTokenTroubleshootingWindowImpl { const DotNet::CesiumForUnity::IonTokenTroubleshootingWindow& window); ~IonTokenTroubleshootingWindowImpl(); - void JustBeforeDelete( - const DotNet::CesiumForUnity::IonTokenTroubleshootingWindow& window); - void GetTroubleshootingDetails( const DotNet::CesiumForUnity::IonTokenTroubleshootingWindow& window); diff --git a/native~/Editor/src/SelectIonTokenWindowImpl.cpp b/native~/Editor/src/SelectIonTokenWindowImpl.cpp index e12fe735..16dfcf14 100644 --- a/native~/Editor/src/SelectIonTokenWindowImpl.cpp +++ b/native~/Editor/src/SelectIonTokenWindowImpl.cpp @@ -166,10 +166,7 @@ SelectIonTokenWindowImpl::SelectIonTokenWindowImpl( .createPromise>()), _future(this->_promise->getFuture().share()) {} -SelectIonTokenWindowImpl::~SelectIonTokenWindowImpl() {} - -void SelectIonTokenWindowImpl::JustBeforeDelete( - const DotNet::CesiumForUnity::SelectIonTokenWindow& window) { +SelectIonTokenWindowImpl::~SelectIonTokenWindowImpl() { if (_promise) { this->_promise->resolve(std::nullopt); } diff --git a/native~/Editor/src/SelectIonTokenWindowImpl.h b/native~/Editor/src/SelectIonTokenWindowImpl.h index f423d29b..41725435 100644 --- a/native~/Editor/src/SelectIonTokenWindowImpl.h +++ b/native~/Editor/src/SelectIonTokenWindowImpl.h @@ -32,9 +32,6 @@ class SelectIonTokenWindowImpl { const DotNet::CesiumForUnity::SelectIonTokenWindow& window); ~SelectIonTokenWindowImpl(); - void - JustBeforeDelete(const DotNet::CesiumForUnity::SelectIonTokenWindow& window); - void RefreshTokens(const DotNet::CesiumForUnity::SelectIonTokenWindow& window); diff --git a/native~/Runtime/src/Cesium3DTilesetImpl.cpp b/native~/Runtime/src/Cesium3DTilesetImpl.cpp index c4cef81c..95edfe45 100644 --- a/native~/Runtime/src/Cesium3DTilesetImpl.cpp +++ b/native~/Runtime/src/Cesium3DTilesetImpl.cpp @@ -53,11 +53,6 @@ Cesium3DTilesetImpl::Cesium3DTilesetImpl( Cesium3DTilesetImpl::~Cesium3DTilesetImpl() {} -void Cesium3DTilesetImpl::JustBeforeDelete( - const DotNet::CesiumForUnity::Cesium3DTileset& tileset) { - this->OnDisable(tileset); -} - void Cesium3DTilesetImpl::Start( const DotNet::CesiumForUnity::Cesium3DTileset& tileset) {} diff --git a/native~/Runtime/src/Cesium3DTilesetImpl.h b/native~/Runtime/src/Cesium3DTilesetImpl.h index eb006e28..66cf05a1 100644 --- a/native~/Runtime/src/Cesium3DTilesetImpl.h +++ b/native~/Runtime/src/Cesium3DTilesetImpl.h @@ -28,7 +28,6 @@ class Cesium3DTilesetImpl { Cesium3DTilesetImpl(const DotNet::CesiumForUnity::Cesium3DTileset& tileset); ~Cesium3DTilesetImpl(); - void JustBeforeDelete(const DotNet::CesiumForUnity::Cesium3DTileset& tileset); void Start(const DotNet::CesiumForUnity::Cesium3DTileset& tileset); void Update(const DotNet::CesiumForUnity::Cesium3DTileset& tileset); void OnValidate(const DotNet::CesiumForUnity::Cesium3DTileset& tileset); diff --git a/native~/Runtime/src/CesiumBingMapsRasterOverlayImpl.cpp b/native~/Runtime/src/CesiumBingMapsRasterOverlayImpl.cpp index 382d76f4..3a6afab9 100644 --- a/native~/Runtime/src/CesiumBingMapsRasterOverlayImpl.cpp +++ b/native~/Runtime/src/CesiumBingMapsRasterOverlayImpl.cpp @@ -23,9 +23,6 @@ CesiumBingMapsRasterOverlayImpl::CesiumBingMapsRasterOverlayImpl( CesiumBingMapsRasterOverlayImpl::~CesiumBingMapsRasterOverlayImpl() {} -void CesiumBingMapsRasterOverlayImpl::JustBeforeDelete( - const ::DotNet::CesiumForUnity::CesiumBingMapsRasterOverlay& overlay) {} - void CesiumBingMapsRasterOverlayImpl::AddToTileset( const ::DotNet::CesiumForUnity::CesiumBingMapsRasterOverlay& overlay, const ::DotNet::CesiumForUnity::Cesium3DTileset& tileset) { diff --git a/native~/Runtime/src/CesiumBingMapsRasterOverlayImpl.h b/native~/Runtime/src/CesiumBingMapsRasterOverlayImpl.h index b0bb4ba5..dc89a83c 100644 --- a/native~/Runtime/src/CesiumBingMapsRasterOverlayImpl.h +++ b/native~/Runtime/src/CesiumBingMapsRasterOverlayImpl.h @@ -19,8 +19,6 @@ class CesiumBingMapsRasterOverlayImpl { const DotNet::CesiumForUnity::CesiumBingMapsRasterOverlay& overlay); ~CesiumBingMapsRasterOverlayImpl(); - void JustBeforeDelete( - const ::DotNet::CesiumForUnity::CesiumBingMapsRasterOverlay& overlay); void AddToTileset( const ::DotNet::CesiumForUnity::CesiumBingMapsRasterOverlay& overlay, const ::DotNet::CesiumForUnity::Cesium3DTileset& tileset); diff --git a/native~/Runtime/src/CesiumCreditSystemImpl.cpp b/native~/Runtime/src/CesiumCreditSystemImpl.cpp index 530fc6a7..03130ad6 100644 --- a/native~/Runtime/src/CesiumCreditSystemImpl.cpp +++ b/native~/Runtime/src/CesiumCreditSystemImpl.cpp @@ -37,9 +37,6 @@ CesiumCreditSystemImpl::CesiumCreditSystemImpl( CesiumCreditSystemImpl::~CesiumCreditSystemImpl() {} -void CesiumCreditSystemImpl::JustBeforeDelete( - const CesiumForUnity::CesiumCreditSystem& creditSystem) {} - void CesiumCreditSystemImpl::Update( const CesiumForUnity::CesiumCreditSystem& creditSystem) { if (!_pCreditSystem) { diff --git a/native~/Runtime/src/CesiumCreditSystemImpl.h b/native~/Runtime/src/CesiumCreditSystemImpl.h index 67117ab1..19fe0d2e 100644 --- a/native~/Runtime/src/CesiumCreditSystemImpl.h +++ b/native~/Runtime/src/CesiumCreditSystemImpl.h @@ -28,8 +28,6 @@ class CesiumCreditSystemImpl { const DotNet::CesiumForUnity::CesiumCreditSystem& creditSystem); ~CesiumCreditSystemImpl(); - void JustBeforeDelete( - const DotNet::CesiumForUnity::CesiumCreditSystem& creditSystem); void Update(const DotNet::CesiumForUnity::CesiumCreditSystem& creditSystem); const std::shared_ptr& diff --git a/native~/Runtime/src/CesiumGeoreferenceImpl.cpp b/native~/Runtime/src/CesiumGeoreferenceImpl.cpp index f9721766..f390b05f 100644 --- a/native~/Runtime/src/CesiumGeoreferenceImpl.cpp +++ b/native~/Runtime/src/CesiumGeoreferenceImpl.cpp @@ -55,9 +55,6 @@ CesiumGeoreferenceImpl::CesiumGeoreferenceImpl( CesiumGeoreferenceImpl::~CesiumGeoreferenceImpl() {} -void CesiumGeoreferenceImpl::JustBeforeDelete( - const DotNet::CesiumForUnity::CesiumGeoreference& georeference) {} - void CesiumGeoreferenceImpl::RecalculateOrigin( const DotNet::CesiumForUnity::CesiumGeoreference& georeference) { LocalHorizontalCoordinateSystem coordinateSystem = diff --git a/native~/Runtime/src/CesiumGeoreferenceImpl.h b/native~/Runtime/src/CesiumGeoreferenceImpl.h index 29204f3d..409ac4cb 100644 --- a/native~/Runtime/src/CesiumGeoreferenceImpl.h +++ b/native~/Runtime/src/CesiumGeoreferenceImpl.h @@ -19,8 +19,6 @@ class CesiumGeoreferenceImpl { const DotNet::CesiumForUnity::CesiumGeoreference& georeference); ~CesiumGeoreferenceImpl(); - void JustBeforeDelete( - const DotNet::CesiumForUnity::CesiumGeoreference& georeference); void RecalculateOrigin( const DotNet::CesiumForUnity::CesiumGeoreference& georeference); void InitializeOrigin( diff --git a/native~/Runtime/src/CesiumIonRasterOverlayImpl.cpp b/native~/Runtime/src/CesiumIonRasterOverlayImpl.cpp index 250e0969..bf614b39 100644 --- a/native~/Runtime/src/CesiumIonRasterOverlayImpl.cpp +++ b/native~/Runtime/src/CesiumIonRasterOverlayImpl.cpp @@ -24,9 +24,6 @@ CesiumIonRasterOverlayImpl::CesiumIonRasterOverlayImpl( CesiumIonRasterOverlayImpl::~CesiumIonRasterOverlayImpl() {} -void CesiumIonRasterOverlayImpl::JustBeforeDelete( - const ::DotNet::CesiumForUnity::CesiumIonRasterOverlay& overlay) {} - void CesiumIonRasterOverlayImpl::AddToTileset( const ::DotNet::CesiumForUnity::CesiumIonRasterOverlay& overlay, const ::DotNet::CesiumForUnity::Cesium3DTileset& tileset) { diff --git a/native~/Runtime/src/CesiumIonRasterOverlayImpl.h b/native~/Runtime/src/CesiumIonRasterOverlayImpl.h index 0e50718a..73f8c769 100644 --- a/native~/Runtime/src/CesiumIonRasterOverlayImpl.h +++ b/native~/Runtime/src/CesiumIonRasterOverlayImpl.h @@ -19,8 +19,6 @@ class CesiumIonRasterOverlayImpl { const DotNet::CesiumForUnity::CesiumIonRasterOverlay& overlay); ~CesiumIonRasterOverlayImpl(); - void JustBeforeDelete( - const ::DotNet::CesiumForUnity::CesiumIonRasterOverlay& overlay); void AddToTileset( const ::DotNet::CesiumForUnity::CesiumIonRasterOverlay& overlay, const ::DotNet::CesiumForUnity::Cesium3DTileset& tileset); diff --git a/native~/Runtime/src/CesiumMetadataImpl.h b/native~/Runtime/src/CesiumMetadataImpl.h index f0166efd..946a49b9 100644 --- a/native~/Runtime/src/CesiumMetadataImpl.h +++ b/native~/Runtime/src/CesiumMetadataImpl.h @@ -32,8 +32,6 @@ class CesiumMetadataImpl { public: ~CesiumMetadataImpl(){}; CesiumMetadataImpl(const DotNet::CesiumForUnity::CesiumMetadata& metadata){}; - void - JustBeforeDelete(const DotNet::CesiumForUnity::CesiumMetadata& metadata){}; void loadMetadata( int32_t instanceID, const CesiumGltf::Model* pModel, diff --git a/native~/Runtime/src/CesiumTileMapServiceRasterOverlayImpl.cpp b/native~/Runtime/src/CesiumTileMapServiceRasterOverlayImpl.cpp index ec1d402b..df60cdd0 100644 --- a/native~/Runtime/src/CesiumTileMapServiceRasterOverlayImpl.cpp +++ b/native~/Runtime/src/CesiumTileMapServiceRasterOverlayImpl.cpp @@ -23,10 +23,6 @@ CesiumTileMapServiceRasterOverlayImpl::CesiumTileMapServiceRasterOverlayImpl( CesiumTileMapServiceRasterOverlayImpl:: ~CesiumTileMapServiceRasterOverlayImpl() {} -void CesiumTileMapServiceRasterOverlayImpl::JustBeforeDelete( - const ::DotNet::CesiumForUnity::CesiumTileMapServiceRasterOverlay& - overlay) {} - void CesiumTileMapServiceRasterOverlayImpl::AddToTileset( const ::DotNet::CesiumForUnity::CesiumTileMapServiceRasterOverlay& overlay, const ::DotNet::CesiumForUnity::Cesium3DTileset& tileset) { diff --git a/native~/Runtime/src/CesiumTileMapServiceRasterOverlayImpl.h b/native~/Runtime/src/CesiumTileMapServiceRasterOverlayImpl.h index 99309abc..363a93f9 100644 --- a/native~/Runtime/src/CesiumTileMapServiceRasterOverlayImpl.h +++ b/native~/Runtime/src/CesiumTileMapServiceRasterOverlayImpl.h @@ -19,9 +19,6 @@ class CesiumTileMapServiceRasterOverlayImpl { const DotNet::CesiumForUnity::CesiumTileMapServiceRasterOverlay& overlay); ~CesiumTileMapServiceRasterOverlayImpl(); - void JustBeforeDelete( - const ::DotNet::CesiumForUnity::CesiumTileMapServiceRasterOverlay& - overlay); void AddToTileset( const ::DotNet::CesiumForUnity::CesiumTileMapServiceRasterOverlay& overlay, diff --git a/native~/Runtime/src/CesiumWebMapServiceRasterOverlayImpl.cpp b/native~/Runtime/src/CesiumWebMapServiceRasterOverlayImpl.cpp index e1239ac1..3f532b1a 100644 --- a/native~/Runtime/src/CesiumWebMapServiceRasterOverlayImpl.cpp +++ b/native~/Runtime/src/CesiumWebMapServiceRasterOverlayImpl.cpp @@ -22,10 +22,6 @@ CesiumWebMapServiceRasterOverlayImpl::CesiumWebMapServiceRasterOverlayImpl( CesiumWebMapServiceRasterOverlayImpl::~CesiumWebMapServiceRasterOverlayImpl() {} -void CesiumWebMapServiceRasterOverlayImpl::JustBeforeDelete( - const ::DotNet::CesiumForUnity::CesiumWebMapServiceRasterOverlay& overlay) { -} - void CesiumWebMapServiceRasterOverlayImpl::AddToTileset( const ::DotNet::CesiumForUnity::CesiumWebMapServiceRasterOverlay& overlay, const ::DotNet::CesiumForUnity::Cesium3DTileset& tileset) { diff --git a/native~/Runtime/src/CesiumWebMapServiceRasterOverlayImpl.h b/native~/Runtime/src/CesiumWebMapServiceRasterOverlayImpl.h index 8a9d465b..0093f751 100644 --- a/native~/Runtime/src/CesiumWebMapServiceRasterOverlayImpl.h +++ b/native~/Runtime/src/CesiumWebMapServiceRasterOverlayImpl.h @@ -19,9 +19,6 @@ class CesiumWebMapServiceRasterOverlayImpl { const DotNet::CesiumForUnity::CesiumWebMapServiceRasterOverlay& overlay); ~CesiumWebMapServiceRasterOverlayImpl(); - void JustBeforeDelete( - const ::DotNet::CesiumForUnity::CesiumWebMapServiceRasterOverlay& - overlay); void AddToTileset( const ::DotNet::CesiumForUnity::CesiumWebMapServiceRasterOverlay& overlay, const ::DotNet::CesiumForUnity::Cesium3DTileset& tileset); diff --git a/native~/Runtime/src/MetadataPropertyImpl.h b/native~/Runtime/src/MetadataPropertyImpl.h index ddfa9643..3158c48d 100644 --- a/native~/Runtime/src/MetadataPropertyImpl.h +++ b/native~/Runtime/src/MetadataPropertyImpl.h @@ -74,8 +74,6 @@ class MetadataPropertyImpl { ~MetadataPropertyImpl(){}; MetadataPropertyImpl( const DotNet::CesiumForUnity::MetadataProperty& property){}; - void - JustBeforeDelete(const DotNet::CesiumForUnity::MetadataProperty& property){}; DotNet::System::String GetPropertyName(const DotNet::CesiumForUnity::MetadataProperty& property); void SetProperty( @@ -136,4 +134,4 @@ class MetadataPropertyImpl { PropertyType _propertyType; ValueType _value; }; -} // namespace CesiumForUnityNative \ No newline at end of file +} // namespace CesiumForUnityNative diff --git a/native~/Shared/src/NativeDownloadHandlerImpl.cpp b/native~/Shared/src/NativeDownloadHandlerImpl.cpp index 8978eb9e..2cfea8d7 100644 --- a/native~/Shared/src/NativeDownloadHandlerImpl.cpp +++ b/native~/Shared/src/NativeDownloadHandlerImpl.cpp @@ -7,9 +7,6 @@ namespace CesiumForUnityNative { NativeDownloadHandlerImpl::NativeDownloadHandlerImpl( const NativeDownloadHandler& handler) {} -void NativeDownloadHandlerImpl::JustBeforeDelete( - const NativeDownloadHandler& handler) {} - bool NativeDownloadHandlerImpl::ReceiveDataNative( const NativeDownloadHandler& handler, void* data, diff --git a/native~/Shared/src/NativeDownloadHandlerImpl.h b/native~/Shared/src/NativeDownloadHandlerImpl.h index 80883a7d..b5f7d190 100644 --- a/native~/Shared/src/NativeDownloadHandlerImpl.h +++ b/native~/Shared/src/NativeDownloadHandlerImpl.h @@ -16,8 +16,6 @@ class NativeDownloadHandlerImpl { public: NativeDownloadHandlerImpl( const ::DotNet::CesiumForUnity::NativeDownloadHandler& handler); - void JustBeforeDelete( - const ::DotNet::CesiumForUnity::NativeDownloadHandler& handler); bool ReceiveDataNative( const ::DotNet::CesiumForUnity::NativeDownloadHandler& handler, void* data,