/// <summary> /// Returns a List of all objects that Refer to the passed GMND /// </summary> /// <param name="gmnd">a GMND</param> /// <returns>List of SHPEs</returns> protected SimPe.Plugin.Rcol[] GetReferingShape(SimPe.Plugin.Rcol gmnd) { ArrayList list = new ArrayList(); Interfaces.Files.IPackedFileDescriptor[] pfds = this.package.FindFiles(0xFC6EB1F7); foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds) { SimPe.Plugin.Rcol shpe = new GenericRcol(null, false); shpe.ProcessData(pfd, package); SimPe.Plugin.Shape sh = (SimPe.Plugin.Shape)shpe.Blocks[0]; foreach (SimPe.Plugin.ShapeItem item in sh.Items) { if (item.FileName.Trim().ToLower() == gmnd.FileName.Trim().ToLower()) { list.Add(shpe); break; } } } SimPe.Plugin.Rcol[] rcols = new Rcol[list.Count]; list.CopyTo(rcols); return(rcols); }
private void UpdateLists() { try { SimPe.Plugin.Shape shape = (SimPe.Plugin.Shape) this.Tag; ShapePart[] parts = new ShapePart[lbpart.Items.Count]; for (int i = 0; i < parts.Length; i++) { parts[i] = (ShapePart)lbpart.Items[i]; } shape.Parts = parts; } catch (Exception) {} }
private void UpdateLists() { try { SimPe.Plugin.Shape shape = (SimPe.Plugin.Shape) this.Tag; ShapeItem[] items = new ShapeItem[lbitem.Items.Count]; for (int i = 0; i < items.Length; i++) { items[i] = (ShapeItem)lbitem.Items[i]; } shape.Items = items; } catch (Exception) {} }
private void UpdateLists() { try { SimPe.Plugin.Shape shape = (SimPe.Plugin.Shape) this.Tag; uint[] unknown = new uint[lbunk.Items.Count]; for (int i = 0; i < unknown.Length; i++) { unknown[i] = (uint)lbunk.Items[i]; } shape.Unknwon = unknown; } catch (Exception) {} }
//internal Shpe wrapper; private void UpdateLists() { try { SimPe.Plugin.Shape shape = (SimPe.Plugin.Shape) this.Tag; ObjectGraphNodeItem[] ogni = new ObjectGraphNodeItem[lbnode.Items.Count]; for (int i = 0; i < ogni.Length; i++) { ogni[i] = (ObjectGraphNodeItem)lbnode.Items[i]; } shape.GraphNode.Items = ogni; } catch (Exception) {} }
private void linkLabel8_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) { try { //Shpe wrp = (Shpe)wrapper; SimPe.Plugin.Shape shape = (SimPe.Plugin.Shape) this.Tag; ShapePart val = new ShapePart(); val.Subset = tbparttype.Text; val.FileName = tbpartdsc.Text; val.Data = Helper.SetLength(Helper.HexListToBytes(tbpartdata.Text), 9); lbpart.Items.Add(val); UpdateLists(); } catch (Exception) {} }
private void linkLabel6_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) { try { //Shpe wrp = (Shpe)wrapper; SimPe.Plugin.Shape shape = (SimPe.Plugin.Shape) this.Tag; ShapeItem val = new ShapeItem(shape); val.FileName = tbitemflname.Text; val.Unknown1 = Convert.ToInt32(tbitemunk1.Text, 16); val.Unknown2 = Convert.ToByte(tbitemunk2.Text, 16); val.Unknown3 = Convert.ToInt32(tbitemunk3.Text, 16); val.Unknown4 = Convert.ToByte(tbitemunk4.Text, 16); lbitem.Items.Add(val); UpdateLists(); } catch (Exception) {} }
/// <summary> /// adds the subsets to the tsDesignMode.. Block and returns a List of all added Subsets /// </summary> /// <param name="shpes"></param> /// <param name="gmnd"></param> /// <param name="subsets"></param> protected void GetSubsets(SimPe.Plugin.Rcol[] shpes, SimPe.Plugin.Rcol gmnd, ArrayList subsets) { ArrayList list = new ArrayList(); ArrayList localsubsets = new ArrayList(); DataListExtension dle = new DataListExtension(gmnd); uint index = (uint)(gm_pkg.FindFiles(0x4C697E5A).Length + 1); foreach (SimPe.Plugin.Rcol shpe in shpes) { SimPe.Plugin.Shape sh = (SimPe.Plugin.Shape)shpe.Blocks[0]; SimPe.Plugin.Rcol cres = FindResourceNode(shpe); foreach (SimPe.Plugin.ShapePart part in sh.Parts) { if (subsets.Contains(part.Subset)) { continue; } if (localsubsets.Contains(part.Subset)) { continue; } //Read the MATD Interfaces.Files.IPackedFileDescriptor[] pfds = package.FindFile(part.FileName + "_txmt", 0x49596978); foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds) { SimPe.Plugin.Rcol matd = new GenericRcol(null, false); matd.ProcessData(pfd, package); SimPe.Plugin.MaterialDefinition md = (SimPe.Plugin.MaterialDefinition)matd.Blocks[0]; //check that the Material is not transparent if (md.GetProperty("stdMatAlphaBlendMode").Value == "none") { //check that the Material references a texture if (package.FindFile(md.GetProperty("stdMatBaseTextureName").Value + "_txtr", 0x1C4A276C).Length > 0) { localsubsets.Add(part.Subset); SimPe.Plugin.ExtensionItem ei = new ExtensionItem(); ei.Name = part.Subset; ei.Typecode = ExtensionItem.ItemTypes.Array; WorkshopMMAT i = new WorkshopMMAT(part.Subset); object[] tag = new object[3]; tag[0] = matd; tag[1] = cres.FileName; tag[2] = ei; i.Tag = tag; //if (md.GetProperty("stdMatAlphaBlendMode").Value!="none") i.AddObjectStateIndex(1); list.Add(i); //dle.Extension.Items = (ExtensionItem[])Helper.Add(dle.Extension.Items, ei); //AddMMAT(matd, part.Type, cres.FileName, index++); } } } } } WorkshopMMAT[] mmats = new WorkshopMMAT[list.Count]; list.CopyTo(mmats); Listing li = new Listing(); if (mmats.Length > 0) { mmats = li.Execute(mmats); } foreach (WorkshopMMAT mmat in mmats) { subsets.Add(mmat.Subset); dle.Extension.Items = (ExtensionItem[])Helper.Add(dle.Extension.Items, (ExtensionItem)mmat.Tag[2]); AddMMAT((SimPe.Plugin.Rcol)mmat.Tag[0], mmat.Subset, (string)mmat.Tag[1], index++, false); } if (dle.Extension.Items.Length > 0) { AddDesignModeBlock(gmnd, dle); gmnd.SynchronizeUserData(); dn_pkg.Add(gmnd.FileDescriptor); } }