Exemplo n.º 1
0
 private void LoadMaterialAnimation(BxlytMaterial material, LytAnimGroup group)
 {
     //Sub groups store tag entries like texture patterns, srt, etc
     foreach (var subGroup in group.SubAnimGroups)
     {
         if (subGroup is LytTexturePatternGroup)
         {
             LoadTexturePatternGroup(material, (LytTexturePatternGroup)subGroup);
         }
         else if (subGroup is LytTextureSRTGroup)
         {
             LoadTextureSRTGroup(material, (LytTextureSRTGroup)subGroup);
         }
         else if (subGroup is LytAlphaTestGroup)
         {
             LoadAlphaTestGroup(material, (LytAlphaTestGroup)subGroup);
         }
         else if (subGroup is LytIndirectSRTGroup)
         {
             LoadIndirectSRTGroup(material, (LytIndirectSRTGroup)subGroup);
         }
         else if (subGroup is LytMaterialColorGroup)
         {
             LoadMaterialColorGroup(material, (LytMaterialColorGroup)subGroup);
         }
     }
 }
Exemplo n.º 2
0
 private void LoadPaneAnimation(BasePane pane, LytAnimGroup group)
 {
     //Sub groups store tag entries like vertex colors, srt, etc
     foreach (var subGroup in group.SubAnimGroups)
     {
         if (subGroup is LytVertexColorGroup)
         {
             LoadVertexColorGroup(pane, (LytVertexColorGroup)subGroup);
         }
         else if (subGroup is LytPaneSRTGroup)
         {
             LoadPaneSRTGroup(pane, (LytPaneSRTGroup)subGroup);
         }
         else if (subGroup is LytVisibiltyGroup)
         {
             LoadVisibiltyGroup(pane, (LytVisibiltyGroup)subGroup);
         }
     }
 }
Exemplo n.º 3
0
        private TreeNode LoadAnimNode(LytAnimGroup group)
        {
            var node = new TreeNode(group.Name)
            {
                Tag = group,
            };

            foreach (var subGroup in group.SubAnimGroups)
            {
                var subNode = new TreeNode(subGroup.Name)
                {
                    Tag = subGroup,
                };
                node.Nodes.Add(subNode);
                foreach (LytAnimTrack track in subGroup.GetTracks())
                {
                    if (!track.HasKeys)
                    {
                        continue;
                    }

                    var trackNode = new TreeNode(track.Name)
                    {
                        Tag = track,
                    };
                    subNode.Nodes.Add(trackNode);

                    foreach (LytKeyFrame keyFrame in track.KeyFrames)
                    {
                        var keyNode = new TreeNode($"Key Frame {keyFrame.Frame}")
                        {
                            Tag = keyFrame,
                        };
                        trackNode.Nodes.Add(keyNode);
                    }
                }
            }
            return(node);
        }
Exemplo n.º 4
0
        private void LoadAnimationGroup(LytAnimGroup entry)
        {
            ActiveGroup = entry;

            float frame      = ActiveAnimation.Frame;
            float startFrame = ActiveAnimation.StartFrame;

            Console.WriteLine("frame " + frame);

            if (paneSRTPanel == null || paneSRTPanel.IsDisposed || paneSRTPanel.Disposing)
            {
                stFlowLayoutPanel1.Controls.Clear();
                paneSRTPanel = new LytKeyPanePanel();
                paneVisPanel = new LytKeyVisibiltyPane();

                AddDropPanel(paneSRTPanel, "Pane SRT");
                AddDropPanel(paneVisPanel, "Pane Visibilty");
            }
            if (entry.Target == AnimationTarget.Pane)
            {
                BasePane pane = null;

                //If pane cannot be found use a new one and fill default values
                if (ActiveAnimation.parentLayout == null || !ActiveAnimation.parentLayout.PaneLookup.ContainsKey(ActiveGroup.Name))
                {
                    pane = new BasePane();
                }
                else
                {
                    pane = ActiveAnimation.parentLayout.PaneLookup[ActiveGroup.Name];
                }

                paneSRTPanel.SetSRT(frame, startFrame, pane, ActiveGroup.SubAnimGroups);
                paneVisPanel.SetPane(frame, startFrame, pane, ActiveGroup.SubAnimGroups);

                if (pane is IPicturePane || pane is IWindowPane)
                {
                    if (vtxcPanel == null || vtxcPanel.IsDisposed || vtxcPanel.Disposing)
                    {
                        vtxcPanel = new LytKeyVtxColorPanel();
                        AddDropPanel(vtxcPanel, "Vertex Colors");
                    }


                    Color[] colors = new Color[4];
                    colors[0] = Color.White;
                    colors[1] = Color.White;
                    colors[2] = Color.White;
                    colors[3] = Color.White;

                    if (pane is IPicturePane)
                    {
                        colors[0] = ((IPicturePane)pane).ColorTopRight.Color;
                        colors[1] = ((IPicturePane)pane).ColorTopLeft.Color;
                        colors[2] = ((IPicturePane)pane).ColorBottomRight.Color;
                        colors[3] = ((IPicturePane)pane).ColorBottomLeft.Color;
                    }
                    if (pane is IWindowPane)
                    {
                        colors = ((IWindowPane)pane).GetVertexColors();
                    }

                    vtxcPanel.SetColors(colors, startFrame, frame, ActiveGroup);
                }
                else
                {
                    if (stFlowLayoutPanel1.Controls.ContainsKey("Vertex Colors"))
                    {
                        stFlowLayoutPanel1.Controls.RemoveByKey("Vertex Colors");
                    }
                    vtxcPanel?.Dispose();
                    vtxcPanel = null;
                }
            }
            else if (entry.Target == AnimationTarget.Material)
            {
            }
            else
            {
            }
        }
Exemplo n.º 5
0
        public void SetColors(Color[] colors, float frame, float startFrame, LytAnimGroup group)
        {
            activeGroup = group;

            SetValue(TLRUD, colors[0].R, false);
            SetValue(TLGUD, colors[0].G, false);
            SetValue(TLBUD, colors[0].B, false);
            SetValue(TLAUD, colors[0].A, false);

            SetValue(TRRUD, colors[1].R, false);
            SetValue(TRGUD, colors[1].G, false);
            SetValue(TRBUD, colors[1].B, false);
            SetValue(TRAUD, colors[1].A, false);

            SetValue(BLRUD, colors[2].R, false);
            SetValue(BLGUD, colors[2].G, false);
            SetValue(BLBUD, colors[2].B, false);
            SetValue(BLAUD, colors[2].A, false);

            SetValue(BRRUD, colors[3].R, false);
            SetValue(BRGUD, colors[3].G, false);
            SetValue(BRBUD, colors[3].B, false);
            SetValue(BRAUD, colors[3].A, false);

            foreach (var grp in group.SubAnimGroups)
            {
                if (grp is LytVertexColorGroup)
                {
                    for (int i = 0; i < 16; i++)
                    {
                        var track = ((LytVertexColorGroup)grp).GetTrack(i);
                        if (track.HasKeys)
                        {
                            float value = track.GetFrameValue(frame, startFrame);
                            bool  keyed = track.IsKeyed(frame - startFrame);
                            switch ((LVCTarget)i)
                            {
                            case LVCTarget.LeftTopRed: SetValue(TLRUD, value, keyed); break;

                            case LVCTarget.LeftTopGreen: SetValue(TLGUD, value, keyed); break;

                            case LVCTarget.LeftTopBlue: SetValue(TLBUD, value, keyed); break;

                            case LVCTarget.LeftTopAlpha: SetValue(TLAUD, value, keyed); break;

                            case LVCTarget.RightTopRed: SetValue(TRRUD, value, keyed); break;

                            case LVCTarget.RightTopGreen: SetValue(TRGUD, value, keyed); break;

                            case LVCTarget.RightTopBlue: SetValue(TRBUD, value, keyed); break;

                            case LVCTarget.RightTopAlpha: SetValue(TRAUD, value, keyed); break;

                            case LVCTarget.LeftBottomRed: SetValue(BLRUD, value, keyed); break;

                            case LVCTarget.LeftBottomGreen: SetValue(BLGUD, value, keyed); break;

                            case LVCTarget.LeftBottomBlue: SetValue(BLBUD, value, keyed); break;

                            case LVCTarget.LeftBottomAlpha: SetValue(BLAUD, value, keyed); break;

                            case LVCTarget.RightBottomRed: SetValue(BRRUD, value, keyed); break;

                            case LVCTarget.RightBottomGreen: SetValue(BRGUD, value, keyed); break;

                            case LVCTarget.RightBottomBlue: SetValue(BRBUD, value, keyed); break;

                            case LVCTarget.RightBottomAlpha: SetValue(BRAUD, value, keyed); break;
                            }
                        }
                    }
                }
            }

            UpdateColors();
        }