private void UpdateViewportSettings(bool UpdateRuntimeValues = false) { if (IsStartup) { return; } Viewport viewport = LibraryGUI.GetActiveViewport(); if (viewport == null) { return; } if (UpdateRuntimeValues) //Update only if necessary since it can be slow { viewport.LoadViewportRuntimeValues(); } viewport.UpdateViewport(); }
private void OnAnimationSelected(TreeNode Node) { if (Node is Animation) { Viewport viewport = LibraryGUI.GetActiveViewport(); if (viewport == null) { return; } if (((Animation)Node).Bones.Count <= 0) { ((Animation)Node).OpenAnimationData(); } string AnimName = Node.Text; AnimName = Regex.Match(AnimName, @"([A-Z][0-9][0-9])(.*)").Groups[0].ToString(); if (AnimName.Length > 3) { AnimName = AnimName.Substring(3); } Animation running = new Animation(AnimName); running.ReplaceMe((Animation)Node); running.Tag = Node; Queue <TreeNode> NodeQueue = new Queue <TreeNode>(); foreach (TreeNode n in treeViewCustom1.Nodes) { NodeQueue.Enqueue(n); } while (NodeQueue.Count > 0) { try { TreeNode n = NodeQueue.Dequeue(); string NodeName = Regex.Match(n.Text, @"([A-Z][0-9][0-9])(.*)").Groups[0].ToString(); if (NodeName.Length <= 3) { Console.WriteLine(NodeName); } else { NodeName = NodeName.Substring(3); } if (n is Animation) { if (n == Node) { continue; } if (NodeName.Equals(AnimName)) { running.Children.Add(n); } } if (n is AnimationGroupNode) { foreach (TreeNode tn in n.Nodes) { NodeQueue.Enqueue(tn); } } } catch { } } if (LibraryGUI.GetAnimationPanel() != null) { LibraryGUI.GetAnimationPanel().CurrentAnimation = running; } } if (Node is IAnimationContainer) { Viewport viewport = LibraryGUI.GetActiveViewport(); if (viewport == null) { return; } var running = ((IAnimationContainer)Node).AnimationController; if (LibraryGUI.GetAnimationPanel() != null) { Console.WriteLine($"running {running.Name}"); LibraryGUI.GetAnimationPanel().CurrentSTAnimation = running; } } }