public void Replace(string FileName, ResFile resFile)
        {
            ShaderParamAnim = new ShaderParamAnim();

            string ext = Utils.GetExtension(FileName);

            if (ext == ".bfshu")
            {
                ShaderParamAnim.Import(FileName, resFile, ShaderParamAnimType.ShaderParameter);
                ShaderParamAnim.Name = Text;
                LoadAnim(ShaderParamAnim, AnimationType.ShaderParam);
            }
            if (ext == ".bfcsh")
            {
                ShaderParamAnim.Import(FileName, resFile, ShaderParamAnimType.Color);
                ShaderParamAnim.Name = Text;
                LoadAnim(ShaderParamAnim, AnimationType.Color);
            }
            if (ext == ".bftsh")
            {
                ShaderParamAnim.Import(FileName, resFile, ShaderParamAnimType.TextureSRT);
                ShaderParamAnim.Name = Text;
                LoadAnim(ShaderParamAnim, AnimationType.TexturePattern);
            }
            if (ext == ".clr0")
            {
                ShaderParamAnim      = BrawlboxHelper.FSHUConverter.Clr02Fshu(FileName);
                ShaderParamAnim.Name = Text;
                LoadAnim(ShaderParamAnim, AnimationType.Color);
            }
        }
Exemple #2
0
        public void LoadAnim(ShaderParamAnim anim, AnimationType type)
        {
            Initialize();

            Text = anim.Name;

            AnimType = type;

            FrameCount      = anim.FrameCount;
            ShaderParamAnim = anim;
            foreach (ShaderParamMatAnim matAnim in anim.ShaderParamMatAnims)
            {
                MaterialAnimEntry matNode = new MaterialAnimEntry(matAnim.Name);
                matNode.materialAnimData = matAnim;
                Materials.Add(matNode);

                //Param info determines which curves to use for each param
                //Add the curves and keys for left/right for interpolating after
                foreach (var param in matAnim.ParamAnimInfos)
                {
                    BfresParamAnim paramInfo = new BfresParamAnim(param.Name);
                    paramInfo.Type = type;
                    matNode.Params.Add(paramInfo);

                    //Get constant anims
                    for (int constant = 0; constant < param.ConstantCount; constant++)
                    {
                        Animation.KeyGroup keyGroup = new Animation.KeyGroup();
                        keyGroup.Keys.Add(new Animation.KeyFrame()
                        {
                            InterType = InterpolationType.CONSTANT,
                            Frame     = 0,
                            Value     = matAnim.Constants[constant].Value,
                        });

                        paramInfo.Values.Add(new Animation.KeyGroup()
                        {
                            AnimDataOffset = matAnim.Constants[constant].AnimDataOffset,
                            Keys           = keyGroup.Keys,
                        });
                    }

                    for (int curve = 0; curve < param.FloatCurveCount + param.IntCurveCount; curve++)
                    {
                        int index = curve + param.BeginCurve;

                        Animation.KeyGroup keyGroup = CurveHelper.CreateTrackWiiU(matAnim.Curves[index]);
                        keyGroup.AnimDataOffset = matAnim.Curves[index].AnimDataOffset;
                        paramInfo.Values.Add(new Animation.KeyGroup()
                        {
                            AnimDataOffset = keyGroup.AnimDataOffset,
                            Keys           = keyGroup.Keys,
                        });
                    }
                }
            }
        }
Exemple #3
0
        public void Replace(string FileName, ResFile resFile)
        {
            ShaderParamAnim = new ShaderParamAnim();

            string ext = Utils.GetExtension(FileName);

            if (ext == ".bfshu")
            {
                ShaderParamAnim.Import(FileName, resFile, ShaderParamAnimType.ShaderParameter);
                ShaderParamAnim.Name = Text;
                LoadAnim(ShaderParamAnim, AnimType);
            }
            else if (ext == ".bfcsh")
            {
                ShaderParamAnim.Import(FileName, resFile, ShaderParamAnimType.Color);
                ShaderParamAnim.Name = Text;
                LoadAnim(ShaderParamAnim, AnimType);
            }
            else if (ext == ".bftsh")
            {
                ShaderParamAnim.Import(FileName, resFile, ShaderParamAnimType.TextureSRT);
                ShaderParamAnim.Name = Text;
                LoadAnim(ShaderParamAnim, AnimType);
            }
            else if (ext == ".bfmaa")
            {
                var fmaa = new Syroot.NintenTools.NSW.Bfres.MaterialAnim();;
                fmaa.Import(FileName);
                ShaderParamAnim      = BfresPlatformConverter.FSHUConvertSwitchToWiiU(fmaa);
                ShaderParamAnim.Name = Text;
                LoadAnim(ShaderParamAnim, AnimType);
            }
            else if (ext == ".yaml")
            {
                var fmaa = new Syroot.NintenTools.NSW.Bfres.MaterialAnim();
                fmaa                 = YamlFmaa.FromYaml(FileName);
                ShaderParamAnim      = BfresPlatformConverter.FSHUConvertSwitchToWiiU(fmaa);
                ShaderParamAnim.Name = Text;
                LoadAnim(ShaderParamAnim, AnimType);
            }
            else if (ext == ".clr0")
            {
                ShaderParamAnim      = BrawlboxHelper.FSHUConverter.Clr02Fshu(FileName);
                ShaderParamAnim.Name = Text;
                LoadAnim(ShaderParamAnim, AnimType);
            }

            UpdateEditor();
        }
Exemple #4
0
        public void Replace(string FileName, ResFile resFile)
        {
            ShaderParamAnim = new ShaderParamAnim();

            string ext = Utils.GetExtension(FileName);

            if (ext == ".bfshu")
            {
                ShaderParamAnim.Import(FileName, resFile, ShaderParamAnimType.ShaderParameter);
                LoadAnim(ShaderParamAnim, AnimationType.ShaderParam);
            }
            if (ext == ".bfcsh")
            {
                ShaderParamAnim.Import(FileName, resFile, ShaderParamAnimType.Color);
                LoadAnim(ShaderParamAnim, AnimationType.Color);
            }
            if (ext == ".bftxp")
            {
                ShaderParamAnim.Import(FileName, resFile, ShaderParamAnimType.TextureSRT);
                LoadAnim(ShaderParamAnim, AnimationType.TexturePattern);
            }

            ShaderParamAnim.Name = Text;
        }
 public FSHU(ShaderParamAnim anim, AnimationType type)
 {
     LoadAnim(anim, type);
 }
Exemple #6
0
            public BFRES_FSHU(MTA mta, ShaderParamAnim fshu, ResFile b)
            {
                mta.Text = fshu.Name;

                mta.FrameCount = (uint)fshu.FrameCount;

                foreach (ShaderParamMatAnim matanim in fshu.ShaderParamMatAnims)
                {
                    MatAnimEntry mat = new MatAnimEntry();

                    mat.Text = matanim.Name;
                    Console.WriteLine($"MatAnim = {mat.Text}");
                    Console.WriteLine($"Curve Count = {matanim.Curves.Count}");

                    if (matanim.Curves.Count == 0)
                    {
                    }

                    //First set the data then iterpolate
                    foreach (AnimCurve cr in matanim.Curves)
                    {
                        mat.InterpolateWU(cr);
                    }
                    mta.matEntries.Add(mat);



                    for (int Frame = 0; Frame < fshu.FrameCount; Frame++)
                    {
                        foreach (MatAnimData track in mat.matCurves)
                        {
                            AnimKey left  = track.GetLeft(Frame);
                            AnimKey right = track.GetRight(Frame);

                            track.Value = Animation.Hermite(Frame, left.frame, right.frame, 0, 0, left.unk1, right.unk1);
                        }
                    }

                    int CurCurve = 0;
                    for (int Frame = 0; Frame < fshu.FrameCount; Frame++)
                    {
                        foreach (MatAnimData track in mat.matCurves)
                        {
                            //This works like this
                            //Each param has their own info. While this loop through each curve determine which data is which
                            //Set the param name. Then detemine the data in between begin curve and total count
                            //Example. Begin curve starts at 0. Count may be 3 for RGB values
                            //Then for next curve would start at 3 and so on
                            //For color I simply use the values starting from RGBA
                            //Then for the next param i subtract the start value to reset the index back to 0
                            foreach (ParamAnimInfo inf in matanim.ParamAnimInfos)
                            {
                                track.shaderParamName = inf.Name;

                                if (inf.BeginCurve >= CurCurve)
                                {
                                    if (inf.FloatCurveCount >= CurCurve)
                                    {
                                        int ColorIndex = CurCurve - inf.BeginCurve;

                                        track.AnimColorType = (MatAnimData.ColorType)ColorIndex;
                                    }
                                }
                            }
                        }
                        CurCurve++;
                    }

                    mta.matEntries.Add(mat);
                }
            }