Пример #1
0
        static void MakeSeamForm(ref SeamEditor seam)
        {
            seam = new SeamEditor();

            seam.DataBindings.Add(new System.Windows.Forms.Binding("Location",
                                                                   Settings.Default, "SeamEditorFormPos", true,
                                                                   System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

            seam.DataBindings.Add(new System.Windows.Forms.Binding("Size",
                                                                   Settings.Default, "SeamEditorFormSize", true,
                                                                   System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
        }
Пример #2
0
        static AnimForm SetUpForms(Device gd, MatLib matLib, StuffKeeper sk, CommonPrims ep)
        {
            MeshLib.AnimLib animLib = new MeshLib.AnimLib();
            AnimForm        af      = new AnimForm(gd, matLib, animLib);
            StripElements   se      = new StripElements();
            SkeletonEditor  skel    = new SkeletonEditor();

            SharedForms.MaterialForm matForm = new SharedForms.MaterialForm(matLib, sk);
            SharedForms.CelTweakForm celForm = new SharedForms.CelTweakForm(gd, matLib);
            SharedForms.Output       outForm = new SharedForms.Output();

            //save positions
            matForm.DataBindings.Add(new System.Windows.Forms.Binding("Location",
                                                                      Settings.Default, "MaterialFormPos", true,
                                                                      System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

            matForm.DataBindings.Add(new System.Windows.Forms.Binding("Size",
                                                                      Settings.Default, "MaterialFormSize", true,
                                                                      System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

            af.DataBindings.Add(new System.Windows.Forms.Binding("Location",
                                                                 Settings.Default, "AnimFormPos", true,
                                                                 System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

            skel.DataBindings.Add(new System.Windows.Forms.Binding("Location",
                                                                   Settings.Default, "SkeletonEditorFormPos", true,
                                                                   System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

            skel.DataBindings.Add(new System.Windows.Forms.Binding("Size",
                                                                   Settings.Default, "SkeletonEditorFormSize", true,
                                                                   System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

            celForm.DataBindings.Add(new System.Windows.Forms.Binding("Location",
                                                                      Settings.Default, "CelTweakFormPos", true,
                                                                      System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

            outForm.DataBindings.Add(new System.Windows.Forms.Binding("Location",
                                                                      Settings.Default, "OutputFormPos", true,
                                                                      System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

            outForm.DataBindings.Add(new System.Windows.Forms.Binding("Size",
                                                                      Settings.Default, "OutputFormSize", true,
                                                                      System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

            SeamEditor seam = null;

            MakeSeamForm(ref seam);

            af.eMeshChanged        += (sender, args) => matForm.SetMesh(sender);
            af.ePrint              += (sender, args) => outForm.Print(sender as string);
            matForm.eNukedMeshPart += (sender, args) => af.NukeMeshPart(sender as List <int>);
            matForm.eStripElements += (sender, args) =>
            { if (se.Visible)
              {
                  return;
              }
              se.Populate(args as ArchEventArgs); };
            matForm.eGenTangents += (sender, args) =>
            { ArchEventArgs aea = args as ArchEventArgs;
              if (aea != null)
              {
                  aea.mArch.GenTangents(gd, aea.mIndexes, matForm.GetTexCoordSet());
              }
            };
            matForm.eFoundSeams += (sender, args) =>
            { if (seam.IsDisposed)
              {
                  MakeSeamForm(ref seam);
              }
              seam.Initialize(gd);
              seam.AddSeams(sender as List <EditorMesh.WeightSeam>);
              seam.SizeColumns();
              seam.Visible = true; };
            se.eDeleteElement += (sender, args) =>
            { List <int> elements = sender as List <int>;
              af.NukeVertexElement(se.GetIndexes(), elements);
              se.Populate(null);      se.Visible = false;
              matForm.RefreshMeshPartList(); };
            se.eEscape += (sender, args) =>
            { se.Populate(null);      se.Visible = false; };
            af.eSkeletonChanged += (sender, args) => skel.Initialize(sender as MeshLib.Skeleton);
            af.eBoundsChanged   += (sender, args) => ep.ReBuildBoundsDrawData(gd, sender);

            skel.eSelectUnUsedBones += (sender, args) => af.GetBoneNamesInUseByDraw(sender as List <string>);
            skel.eBonesChanged      += (sender, args) => af.BonesChanged();

            af.Visible      = true;
            matForm.Visible = true;
            skel.Visible    = true;
            celForm.Visible = true;
            outForm.Visible = true;

            return(af);
        }