private void glTFImportButton_Click(object sender, EventArgs e) { var dialog = new OpenFileDialog(); dialog.Title = "Select a glTF/glb file."; FormsUtils.StaExecute(() => { dialog.ShowDialog(); }); if (dialog.FileName == null) { return; } var importer = new GLTFImporter(); importer.Process(dialog.FileName); var anims = importer.Animations; var animC = Content.Content.Get().AvatarAnimations as AvatarAnimationProvider; foreach (var anim in anims) { animC.Runtime.Add(anim.Name + "-runtime.anim", ulong.MaxValue - (ulong)(RuntimeID++), anim); } RefreshAllList(); }
private void ImportGLTFButton_Click(object sender, EventArgs e) { var dialog = new OpenFileDialog(); dialog.Filter = "glTF Binary Package|*.glb|glTF Separate/Embedded|*.gltf"; dialog.Title = "Select a glTF/glb file."; FormsUtils.StaExecute(() => { dialog.ShowDialog(); }); if (dialog.FileName == "") { return; } var importer = new GLTFImporter(); importer.Process(dialog.FileName); var anims = importer.Animations; // add to runtime ClearScene(); var animC = Content.Content.Get().AvatarAnimations as AvatarAnimationProvider; foreach (var anim in anims) { animC.Runtime.Add(anim.Name + "-runtime.anim", ulong.MaxValue - (RuntimeID++), anim); SceneAnimations.Add(new AvatarToolAnimation(anim, anim.Name + "-runtime")); } var generator = new AppearanceGenerator(); foreach (var mesh in importer.Meshes) { generator.GenerateAppearanceTSO(new List <ImportMeshGroup>() { mesh }, mesh.Name + "-runtime", true); SceneMeshes.Add(new AvatarToolRuntimeMesh(false, mesh.Name + "-runtime", mesh)); } SetImportMode(true, Path.GetFileName(dialog.FileName)); RefreshSceneAnims(); RefreshSceneMeshes(); }