public void Render(Pipeline pipeline, Outliner outliner, TimelineWindow timeline)
        {
            //Display based on selected objects
            var node = outliner.SelectedNode;

            if (node == null)
            {
                return;
            }

            bool valueChanged = ActiveNode != node;

            if (valueChanged)
            {
                ActiveNode = node;
            }

            //Clear and reset all animations when an animation is clicked.
            if (valueChanged && node.Tag is Toolbox.Core.Animations.STAnimation)
            {
                timeline.ResetAnimations();
            }

            //Check for editor purpose node handling
            foreach (var n in outliner.SelectedNodes)
            {
                CheckEditorSelectedNodes(pipeline, timeline, n, valueChanged);
            }

            //Archive files have multiple purpose editors (hex, tag properties, text previewer)
            if (node is ArchiveHiearchy)
            {
                LoadArchiveProperties(node, valueChanged);
            }
            else
            {
                LoadProperties(node, valueChanged);
            }
        }
        private void CheckEditorSelectedNodes(Pipeline pipeline, TimelineWindow timeline, NodeBase node, bool valueChanged)
        {
            //Most data types are stored via tag so ignore null types
            if (node.Tag == null)
            {
                return;
            }

            //Check for active changes for functions that load only once on click
            if (valueChanged)
            {
                if (node.Tag is Toolbox.Core.Animations.STAnimation)
                {
                    var anim = (Toolbox.Core.Animations.STAnimation)node.Tag;
                    timeline.AddAnimation(anim, false);
                    timeline.SetFrame(0);
                }
                if (node.Tag is CameraAnimation)
                {
                    pipeline.AddCameraAnimation(node.Tag as CameraAnimation);
                }
                //Container to batch play multiple animations at once
                if (node.Tag is IAnimationContainer)
                {
                    timeline.ClearAnimations();
                    foreach (var anim in ((IAnimationContainer)node.Tag).AnimationList)
                    {
                        timeline.AddAnimation(anim, false);
                    }
                    timeline.SetFrame(0);
                }
            }

            //Keep track of the selected bone index for debug shading (view assigned bone weights)
            if (node.Tag is STBone)
            {
                Runtime.SelectedBoneIndex = ((STBone)node.Tag).Index;
            }
        }
Пример #3
0
 public Viewport(TimelineWindow window)
 {
     Pipeline     = new Pipeline();
     parentWindow = window;
 }