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); }
internal BSPBuilder(GraphicsDevice gd, string gameRootDir) { mGD = gd; mGameRootDir = gameRootDir; mGD.eDeviceLost += OnDeviceLost; mSKeeper = new StuffKeeper(); mSKeeper.eCompileNeeded += SharedForms.ShaderCompileHelper.CompileNeededHandler; mSKeeper.eCompileDone += SharedForms.ShaderCompileHelper.CompileDoneHandler; LoadStuff(); int resx = gd.RendForm.ClientRectangle.Width; int resy = gd.RendForm.ClientRectangle.Height; mMatForm = new SharedForms.MaterialForm(mMatLib, mSKeeper); mCTForm = new SharedForms.CelTweakForm(gd.GD, mMatLib); SetFormPos(mBSPForm, "BSPFormPos"); SetFormPos(mVisForm, "VisFormPos"); SetFormPos(mZoneForm, "ZoneFormPos"); SetFormPos(mOutForm, "OutputFormPos"); SetFormPos(mMatForm, "MaterialFormPos"); SetFormPos(mCTForm, "CelTweakFormPos"); SetFormSize(mMatForm, "MaterialFormSize"); //show forms mBSPForm.Visible = true; mVisForm.Visible = true; mZoneForm.Visible = true; mOutForm.Visible = true; mMatForm.Visible = true; mCTForm.Visible = true; //form events mZoneForm.eMaterialVis += OnMaterialVis; mZoneForm.eSaveZone += OnSaveZone; mZoneForm.eZoneGBSP += OnZoneGBSP; mZoneForm.eLoadDebug += OnLoadDebug; mZoneForm.eDumpTextures += OnDumpTextures; mBSPForm.eBuild += OnBuild; mBSPForm.eLight += OnLight; mBSPForm.eOpenMap += OnOpenMap; mBSPForm.eStaticToMap += OnOpenStatic; mBSPForm.eMapToStatic += OnMapToStatic; mBSPForm.eSave += OnSaveGBSP; mBSPForm.eFullBuild += OnFullBuild; mBSPForm.eUpdateEntities += OnUpdateEntities; mVisForm.eResumeVis += OnResumeVis; mVisForm.eStopVis += OnStopVis; mVisForm.eVis += OnVis; mMatForm.eMatLibNotReadyToSave += OnMatLibNotReadyToSave; mMatForm.eMatTechniqueChanged += OnMatTechChanged; //core events CoreEvents.eBuildDone += OnBuildDone; CoreEvents.eLightDone += OnLightDone; CoreEvents.eGBSPSaveDone += OnGBSPSaveDone; CoreEvents.eVisDone += OnVisDone; CoreEvents.ePrint += OnPrint; //stats CoreEvents.eNumPortalsChanged += OnNumPortalsChanged; CoreEvents.eNumClustersChanged += OnNumClustersChanged; CoreEvents.eNumPlanesChanged += OnNumPlanesChanged; CoreEvents.eNumVertsChanged += OnNumVertsChanged; ProgressWatcher.eProgressUpdated += OnProgress; SetUpCommonIgnores(); }