Esempio n. 1
0
 /// <summary>
 /// Create a new Instance
 /// </summary>
 /// <param name="afb">The <see cref="AnimationFrameBlock"/> that was Imported</param>
 public ImportedFrameBlock(AnimationFrameBlock afb)
 {
     dz       = false;
     ruf      = true;
     this.afb = afb;
     action   = AnimImporterAction.Nothing;
 }
Esempio n. 2
0
        public AnimationData(SimPe.Plugin.Anim.AnimationFrameBlock afb, Ambertation.Graphics.MeshBox mb, int framecount)
        {
            //Console.WriteLine(mb.ToString());
            this.afb = afb;
            this.mb  = mb;
            this.fct = framecount;
            frames   = new SimPe.Geometry.Vectors3f();

            SimPe.Plugin.Anim.AnimationFrame[] iframes = afb.Frames;

            /*scale = new SimPe.Geometry.Vector3f();
             * scale.X = nb.Transform.TranslationVector.X / (float)iframes[0].X;
             * scale.Y = nb.Transform.TranslationVector.Y / (float)iframes[0].Y;
             * scale.Z = nb.Transform.TranslationVector.Z / (float)iframes[0].Z;*/

            SimPe.Plugin.Anim.AnimationFrameBlock afb2 = new AnimationFrameBlock(afb.Parent);
            for (int i = 0; i <= framecount; i++)
            {
                frames.Add(new SimPe.Geometry.Vector3f());
            }

            InterpolateFrames(iframes, 0);             //X-Axis
            InterpolateFrames(iframes, 1);             //Y-Axis
            InterpolateFrames(iframes, 2);             //Z-Axis
        }
Esempio n. 3
0
        public AnimationAxisTransformBlock(AnimationFrameBlock parent)
        {
            items       = new ArrayList();
            datai       = new uint[2];
            this.parent = parent;

            this.Type         = AnimationTokenType.SixByte;
            this.Unknown1Bits = 0;
        }
Esempio n. 4
0
 /// <summary>
 /// Unserializes a BinaryStream into the Attributes of this Instance
 /// </summary>
 /// <param name="reader">The Stream that contains the FileData</param>
 internal void UnserializePart2Data(System.IO.BinaryReader reader)
 {
     ab2 = new AnimationFrameBlock[GetPart2Count()];
     for (int i = 0; i < ab2.Length; i++)
     {
         ab2[i] = new AnimationFrameBlock(this);
         ab2[i].UnserializeData(reader);
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Tries to find a <see cref="AnimationFrameBlock"/>  with the same Name in the passed <see cref="AnimationMeshBlock" />.
 /// </summary>
 public void FindTarget(AnimationMeshBlock amb)
 {
     action = AnimImporterAction.Nothing;
     foreach (AnimationFrameBlock afb in amb.Part2)
     {
         if (afb.Name == ImportedName)
         {
             action = AnimImporterAction.Replace;
             target = afb;
             break;
         }
     }
 }
Esempio n. 6
0
        public AnimationFrameBlock CloneBase(bool fullclone)
        {
            AnimationFrameBlock ab = new AnimationFrameBlock(this.parent);

            ab.datai = (uint[])this.datai.Clone();
            ab.name  = this.name;
            if (fullclone)
            {
                ab.ab3 = new AnimationAxisTransformBlock[this.AxisCount];
                for (int i = 0; i < ab.AxisCount; i++)
                {
                    ab.AxisSet[i] = this.AxisSet[i].CloneBase();
                }
            }

            return(ab);
        }
Esempio n. 7
0
        private void miRem_Click(object sender, System.EventArgs e)
        {
            AnimationMeshBlock  ab1 = (AnimationMeshBlock)cbSubMesh.SelectedItem;
            AnimationFrameBlock afb = (AnimationFrameBlock)cbJoint.SelectedItem;

            if (ab1 != null && afb != null)
            {
                ab1.Part2 = (AnimationFrameBlock[])Helper.Delete(ab1.Part2, afb);
                int sel = cbJoint.SelectedIndex + 1;
                if (sel >= cbJoint.Items.Count)
                {
                    sel = cbJoint.Items.Count - 1;
                }
                cbJoint.Items.Remove(afb);
                cbJoint.SelectedIndex = sel;
            }
        }
Esempio n. 8
0
        private void miAdd_Click(object sender, System.EventArgs e)
        {
            AnimationMeshBlock ab1 = (AnimationMeshBlock)cbSubMesh.SelectedItem;

            if (ab1 != null)
            {
                AnimationFrameBlock afb = new AnimationFrameBlock(ab1);
                afb.Name = "SimPE Dummy";
                afb.TransformationType = FrameType.Rotation;
                afb.CreateBaseAxisSet();

                ab1.Part2 = (AnimationFrameBlock[])Helper.Add(ab1.Part2, afb);

                cbJoint.SelectedIndex = -1;
                cbJoint.Items.Add(afb);
                cbJoint.SelectedIndex = cbJoint.Items.Count - 1;
            }
        }
Esempio n. 9
0
        /// <summary>
        /// A Bone was selected
        /// </summary>
        void SelectJoint()
        {
            gbgroups.Enabled = true;
            this.Tag         = true;
            try
            {
                ImportedFrameBlock a = (ImportedFrameBlock)lv.SelectedItems[0].Tag;

                this.cbDiscard.Checked = a.DiscardZeroFrame;
                this.cbRemove.Checked  = a.RemoveUnneeded;

                cbaction.SelectedIndex = 0;
                for (int i = 0; i < cbaction.Items.Count; i++)
                {
                    AnimImporterAction ea = (AnimImporterAction)cbaction.Items[i];
                    if (ea == a.Action)
                    {
                        cbaction.SelectedIndex = i;
                        break;
                    }
                }
                lbname.Text = a.ImportedName;


                cbnames.SelectedIndex = -1;
                if (a.Target != null)
                {
                    for (int i = 0; i < cbnames.Items.Count; i++)
                    {
                        AnimationFrameBlock afb = (AnimationFrameBlock)cbnames.Items[i];
                        if (afb == a.Target)
                        {
                            cbnames.SelectedIndex = i;
                            break;
                        }
                    }
                }
            }
            finally
            {
                this.Tag = null;
            }
        }
Esempio n. 10
0
        private void llClear_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            AnimationFrameBlock ab2 = null;

            if (tv.SelectedNode.Tag is AnimationFrameBlock)
            {
                ab2 = (AnimationFrameBlock)tv.SelectedNode.Tag;
            }
            else
            {
                ab2 = (AnimationFrameBlock)tv.SelectedNode.Parent.Tag;
            }

            ab2.ClearFrames();

            AnimResourceConst arc = (AnimResourceConst)tAnimResourceConst.Tag;

            arc.Refresh();
        }
Esempio n. 11
0
        private void llAdd_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            AnimationFrameBlock ab2 = null;

            if (tv.SelectedNode.Tag is AnimationFrameBlock)
            {
                ab2 = (AnimationFrameBlock)tv.SelectedNode.Tag;
            }
            else
            {
                ab2 = (AnimationFrameBlock)tv.SelectedNode.Parent.Tag;
            }

            if (ab2.AxisCount != 3)
            {
                return;
            }

            ab2.AddFrame((short)(ab2.GetDuration() + 1), 0, 0, 0, false);

            AnimResourceConst arc = (AnimResourceConst)tAnimResourceConst.Tag;

            arc.Refresh();
        }
Esempio n. 12
0
        void ReadJointDescription(ImportedBone b)
        {
            string[] linetoks = GetNonEmptyTokens();
            if (linetoks.Length < 1)
            {
                lineerror = "Unable to read Joint Description.";
                return;
            }
            linetoks[0]    = linetoks[0].Replace("\"", "");
            b.ImportedName = linetoks[0];

            linetoks = GetNonEmptyTokens();
            if (linetoks.Length < 1)
            {
                lineerror = "Unable to read Joint Description.";
                return;
            }
            linetoks[0]  = linetoks[0].Replace("\"", "");
            b.ParentName = linetoks[0];

            //Animations
            if (this.AnimationBlocks != null && Gmdc.LinkedAnimation != null)
            {
                curtransblock = null; currotblock = null;

                ImportedFrameBlock ifb = new ImportedFrameBlock(new AnimationFrameBlock(Gmdc.LinkedAnimation));


                ifb.FrameBlock.Name = b.ImportedName;
                ifb.FindTarget(Gmdc.LinkedAnimation);
                if (ifb.Target != null)
                {
                    ifb.FrameBlock.TransformationType = ifb.Target.TransformationType;

                    if (ifb.FrameBlock.TransformationType == FrameType.Translation)
                    {
                        curtransblock = ifb.FrameBlock;
                    }
                    else
                    {
                        currotblock = ifb.FrameBlock;
                    }
                }
                else
                {
                    ifb.FrameBlock.TransformationType = FrameType.Rotation;
                    if (b.ImportedName.EndsWith("_rot"))
                    {
                        ifb.FrameBlock.TransformationType = FrameType.Rotation;
                        currotblock = ifb.FrameBlock;
                    }
                    else if (b.ImportedName.EndsWith("_trans"))
                    {
                        ifb.FrameBlock.TransformationType = FrameType.Translation;
                        curtransblock = ifb.FrameBlock;
                    }
                    else
                    {
                        currotblock = ifb.FrameBlock;
                        ifb.FrameBlock.CreateBaseAxisSet(AnimationTokenType.SixByte);
                        this.AnimationBlocks.Add(ifb);

                        ifb = new ImportedFrameBlock(new AnimationFrameBlock(Gmdc.LinkedAnimation));
                        ifb.FrameBlock.TransformationType = FrameType.Translation;
                        ifb.FrameBlock.Name = b.ImportedName;
                        curtransblock       = ifb.FrameBlock;
                    }
                }

                ifb.FrameBlock.CreateBaseAxisSet(AnimationTokenType.SixByte);



                this.AnimationBlocks.Add(ifb);
            }

            //if (curanimblock==null) curanimblock = new SimPe.Plugin.AnimBlock2();
        }