Exemplo n.º 1
0
        /// <summary>
        /// Imports the USD scene incrementally, setting a fixed time budget per frame for import
        /// operations. Uses StartCoroutine.
        /// </summary>
        public void ImportUsdAsCoroutine(GameObject goRoot,
                                         string usdFilePath,
                                         double time,
                                         SceneImportOptions importOptions,
                                         float targetFrameMilliseconds)
        {
            InitUsd.Initialize();
            var scene = Scene.Open(usdFilePath);

            if (scene == null)
            {
                throw new Exception("Failed to open: " + usdFilePath);
            }

            scene.Time = time;
            if (scene == null)
            {
                throw new Exception("Null USD Scene");
            }

            scene.SetInterpolation(importOptions.interpolate ?
                                   Scene.InterpolationMode.Linear :
                                   Scene.InterpolationMode.Held);
            var primMap  = new PrimMap();
            var importer = SceneImporter.BuildScene(scene,
                                                    goRoot,
                                                    importOptions,
                                                    primMap,
                                                    targetFrameMilliseconds,
                                                    composingSubtree: false);

            StartCoroutine(importer);
        }
Exemplo n.º 2
0
        public static void ImportUsd(GameObject goRoot,
                                     Scene scene,
                                     PrimMap primMap,
                                     bool composingSubtree,
                                     SceneImportOptions importOptions)
        {
            if (scene == null)
            {
                throw new ImportException("Null USD Scene");
            }

            scene.SetInterpolation(importOptions.interpolate ?
                                   Scene.InterpolationMode.Linear :
                                   Scene.InterpolationMode.Held);

            SceneImporter.BuildScene(scene,
                                     goRoot,
                                     importOptions,
                                     primMap,
                                     composingSubtree);
        }