Example #1
0
        public override void OnInspectorGUI()
        {
            base.DrawDefaultInspector();
            if (GUILayout.Button("Export Overides"))
            {
                var importMesh    = (ImportMeshExample)target;
                var oversFilePath = MakeOversPath(importMesh.m_usdFile);

                if (string.IsNullOrEmpty(oversFilePath))
                {
                    Debug.LogWarning("Empty export path.");
                }

                // Let the Scene.Create function throw an exception when it can't create a USD stage.
                var oversScene = Scene.Create(oversFilePath);

                oversScene.UpAxis = importMesh.UsdScene.UpAxis;
                oversScene.Time   = importMesh.m_usdTime;
                oversScene.AddSubLayer(importMesh.UsdScene);

                XformExporter.WriteSparseOverrides(oversScene,
                                                   importMesh.PrimMap,
                                                   importMesh.m_changeHandedness);

                oversScene.Save();
                oversScene.Close();

                Debug.Log("Written: " + oversFilePath);
            }
        }
        public override void OnInspectorGUI()
        {
            base.DrawDefaultInspector();
            if (GUILayout.Button("Export Overides"))
            {
                var importMesh    = (ImportMeshExample)target;
                var oversFilePath = MakeOversPath(importMesh.m_usdFile);

                if (string.IsNullOrEmpty(oversFilePath))
                {
                    Debug.LogWarning("Empty export path.");
                }

                var oversScene = Scene.Create(oversFilePath);

                if (oversScene == null)
                {
                    throw new System.Exception("Failed to create scene file: " + oversFilePath);
                }

                oversScene.UpAxis = importMesh.UsdScene.UpAxis;
                oversScene.Time   = importMesh.m_usdTime;
                oversScene.AddSubLayer(importMesh.UsdScene);

                XformExporter.WriteSparseOverrides(oversScene,
                                                   importMesh.PrimMap,
                                                   importMesh.m_changeHandedness);

                oversScene.Save();
                oversScene.Close();

                Debug.Log("Written: " + oversFilePath);
            }
        }