// Look up the path set associated with a particular mesh public static InteriorPathSet FindPathsForMesh(WorldEditor app, string meshName) { InteriorPathSetLookup result; if (pathSetDictionary.TryGetValue(meshName, out result)) { return(result.paths); } else { string meshNameWithoutExtension = Path.GetFileNameWithoutExtension(meshName); string modelPathFile = meshNameWithoutExtension + ".modelpaths"; try { Stream stream = ResourceManager.FindCommonResourceData(modelPathFile); InteriorPathSet pathset = new InteriorPathSet(stream, app, meshNameWithoutExtension); return(pathset); } catch (Exception e) { LogManager.Instance.Write("Could not read '{0}'; error was '{1}'", modelPathFile, e.Message); pathSetDictionary[meshNameWithoutExtension] = new InteriorPathSetLookup(false, null); return(null); } } }
public void Execute() { saveDialog.FileName = RepositoryClass.Instance.RepositoryPath + "\\Physics\\" + Path.GetFileNameWithoutExtension(meshName) + ".modelpaths"; if (saveDialog.ShowDialog() == DialogResult.OK) { StaticObject so = (StaticObject)parent; InteriorPathSet pathset = so.WriteModelInteriorPaths(app, saveDialog.FileName); so.PathsPerInstance = false; foreach (WorldObjectCollection collection in app.WorldRoot.WorldObjectCollections) { foreach (IWorldObject obj in collection) { if (obj is StaticObject) { StaticObject aso = (StaticObject)obj; if (aso != so && !aso.PathsPerInstance && aso.MeshName == so.MeshName) { aso.AddChildPaths(pathset); } } } } } }
// Look up the path set associated with a particular mesh public static InteriorPathSet FindPathsForMesh(WorldEditor app, string meshName) { InteriorPathSetLookup result; if (pathSetDictionary.TryGetValue(meshName, out result)) return result.paths; else { string meshNameWithoutExtension = Path.GetFileNameWithoutExtension(meshName); string modelPathFile = meshNameWithoutExtension + ".modelpaths"; try { Stream stream = ResourceManager.FindCommonResourceData(modelPathFile); InteriorPathSet pathset = new InteriorPathSet(stream, app, meshNameWithoutExtension); return pathset; } catch (Exception e) { LogManager.Instance.Write("Could not read '{0}'; error was '{1}'", modelPathFile, e.Message); pathSetDictionary[meshNameWithoutExtension] = new InteriorPathSetLookup(false, null); return null; } } }
internal InteriorPathSetLookup(bool found, InteriorPathSet paths) { this.found = found; this.paths = paths; }
internal InteriorPathSetLookup(bool found, InteriorPathSet paths) { this.found = found; this.paths = paths; }