public AnimationInspectionView(Scene scene, TabPage tabPageAnimations) { _scene = scene; Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; Dock = DockStyle.Fill; InitializeComponent(); tabPageAnimations.Controls.Add(this); listBoxAnimations.Items.Add("None (Bind Pose)"); if (scene.Raw.Animations != null) { foreach (var anim in scene.Raw.Animations) { var dur = anim.DurationInTicks; if (anim.TicksPerSecond > 1e-10) { dur /= anim.TicksPerSecond; } else { dur /= SceneAnimator.DefaultTicksPerSecond; } listBoxAnimations.Items.Add(string.Format("{0} ({1}s)", anim.Name, dur.ToString("0.000"))); } } listBoxAnimations.SelectedIndex = 0; checkBoxLoop.Checked = _scene.SceneAnimator.Loop; _imagePlay = ImageFromResource.Get("open3mod.Images.PlayAnim.png"); _imageStop = ImageFromResource.Get("open3mod.Images.StopAnim.png"); buttonPlay.Image = _imagePlay; // initially, animations are disabled. _scene.SceneAnimator.AnimationPlaybackSpeed = 0.0; labelSpeedValue.Text = "1.0x"; timeSlideControl.Rewind += (o, args) => { if (_scene.SceneAnimator.ActiveAnimation >= 0) { _scene.SceneAnimator.AnimationCursor = args.NewPosition; } }; }
/// <summary> /// Binds a scene to the InspectionView. /// </summary> /// <param name="scene">May be null, in this case the inspector remains disabled</param> public void SetSceneSource(Scene scene) { if (Scene == scene) { return; } Clear(); Scene = scene; if(scene == null) { Enabled = false; return; } Enabled = true; Hierarchy = new HierarchyInspectionView(Scene, tabPageTree); Textures = new TextureInspectionView(Scene, textureFlowPanel); if(Textures.Empty) { // disable the texture tab altogether if there are no textures // this would need to be changed if there was a way to add // new texture slots later on. tabControlInfoViewPicker.TabPages.Remove(tabPageTextures); } Animations = new AnimationInspectionView(Scene, tabPageAnimations); if (Animations.Empty) { // same for animations tabControlInfoViewPicker.TabPages.Remove(tabPageAnimations); } // Materials = new MaterialInspectionView(Scene, ParentForm as MainWindow, materialFlowPanel); }
/// <summary> /// Sets the tab to a permanent "failed to load" state. In this /// state, the tab keeps displaying an error message but nothing /// else. /// </summary> /// <param name="message"></param> public void SetFailed(string message) { State = TabState.Failed; _activeScene = null; _errorMessage = message; }
private void DrawScene(Scene scene, ICameraController view) { Debug.Assert(scene != null); scene.Render(Window.UiState, view, this); }
internal MaterialMapperClassicGl(Scene scene) : base(scene) { }