/// <summary> /// Creates a new Instance and a new Package /// </summary> public ObjectCloner() { package = GeneratableFile.LoadFromStream((System.IO.BinaryReader)null); setup = new CloneSettings(); }
/// <summary> /// Create a new Instance and build the CRES chain /// </summary> /// <param name="modelnames">Name of all Models</param> /// <param name="ex">List of all ReferenceNames that should be excluded from the chain</param> public Scenegraph(string[] modelnames, ArrayList ex, CloneSettings setup) { this.setup = setup; Init(modelnames, ex); }
/// <summary> /// Creates a new Isntance based on an existing Package /// </summary> /// <param name="package">The Package that should receive the Clone</param> public ObjectCloner(IPackageFile package) { this.package = package; setup = new CloneSettings(); }
/// <summary> /// Load all File referenced by the passed rcol File /// </summary> /// <param name="modelnames">The Modulenames</param> /// <param name="exclude">The Exclude List</param> /// <param name="list">A List containing all Rcol Files</param> /// <param name="itemlist">A List of all FileIndexItems already added</param> /// <param name="rcol">The Rcol File (Scenegraph Resource)</param> /// <param name="item">The Item that was used to load the rcol</param> /// <param name="recursive">true if you want to add all sub Rcols</param> protected static void LoadReferenced(ArrayList modelnames, ArrayList exclude, ArrayList list, ArrayList itemlist, SimPe.Plugin.GenericRcol rcol, SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem item, bool recursive, CloneSettings setup) { //if we load a CRES, we also have to add the Modelname! if (rcol.FileDescriptor.Type == Data.MetaData.CRES) { modelnames.Add(rcol.FileName.Trim().ToLower()); } list.Add(rcol); itemlist.Add(item); Hashtable map = rcol.ReferenceChains; foreach (string s in map.Keys) { if (exclude.Contains(s)) { continue; } ArrayList descs = (ArrayList)map[s]; foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in descs) { if (setup != null) { if (setup.KeepOriginalMesh) { if (pfd.Type == Data.MetaData.GMND) { continue; } if (pfd.Type == Data.MetaData.GMDC) { continue; } } } SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem subitem = FileTable.FileIndex.FindSingleFile(pfd, null, true); if (subitem != null) { if (!itemlist.Contains(subitem)) { try { SimPe.Plugin.GenericRcol sub = new GenericRcol(null, false); sub.ProcessData(subitem.FileDescriptor, subitem.Package, false); if (Scenegraph.excludefiles.Contains(sub.FileName.Trim().ToLower())) { continue; } if (recursive) { LoadReferenced(modelnames, exclude, list, itemlist, sub, subitem, true, setup); } } catch (Exception ex) { Helper.ExceptionMessage("", new CorruptedFileException(subitem, ex)); } } } } } }