Example #1
0
        public static bool Initialize()
        {
            if (m_usdInitialized)
            {
                return(true);
            }

            m_usdInitialized = true;

            try {
                // Initializes native USD plugins and ensures plugins are discoverable on the system path.
                SetupUsdPath();

                // Type registration enables automatic conversion from Unity-native types to USD types (e.g.
                // Vector3[] -> VtVec3fArray).
                UnityTypeBindings.RegisterTypes();

                // The DiagnosticHandler propagates USD native errors, warnings and info up to C# exceptions
                // and Debug.Log[Warning] respectively.
                DiagnosticHandler.Register();
            } catch (System.Exception ex) {
                Debug.LogException(ex);
                return(false);
            }
            return(true);
        }
Example #2
0
        public static DiagnosticHandler GetGlobalHandler()
        {
            global::System.IntPtr cPtr = UsdCsPINVOKE.DiagnosticHandler_GetGlobalHandler();
            DiagnosticHandler     ret  = (cPtr == global::System.IntPtr.Zero) ? null : new DiagnosticHandler(cPtr, false);

            return(ret);
        }
Example #3
0
        public static bool Initialize()
        {
            if (m_usdInitialized)
            {
                return(true);
            }

            m_usdInitialized = true;

            try
            {
                // Initializes native USD plugins and ensures plugins are discoverable on the system path.
                SetupUsdPath();

                // The TypeBinder will generate code at runtime as a performance optimization, this must
                // be disabled when IL2CPP is enabled, since dynamic code generation is not possible.
#if ENABLE_IL2CPP
                TypeBinder.EnableCodeGeneration = false;
                Debug.Log("USD: Dynamic code generation disabled for IL2CPP.");
#endif

                // Type registration enables automatic conversion from Unity-native types to USD types (e.g.
                // Vector3[] -> VtVec3fArray).
                UnityTypeBindings.RegisterTypes();

                // The DiagnosticHandler propagates USD native errors, warnings and info up to C# exceptions
                // and Debug.Log[Warning] respectively.
                m_handler = new DiagnosticHandler();
            }
            catch (System.Exception ex)
            {
                Debug.LogException(ex);
                return(false);
            }

            return(true);
        }
Example #4
0
 public static void SetGlobalHandler(DiagnosticHandler handler)
 {
     UsdCsPINVOKE.DiagnosticHandler_SetGlobalHandler(DiagnosticHandler.getCPtr(handler));
 }
Example #5
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(DiagnosticHandler obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }