public WorldRoot(String worldName, MultiSelectTreeView tree, WorldEditor worldEditor) { instance = this; name = worldName; treeView = tree; app = worldEditor; worldTerrain = new WorldTerrain(app); ocean = new Ocean(this, app); skybox = new Skybox(this, app); fog = new GlobalFog(this, app); ambientLight = new GlobalAmbientLight(this, app); directionalLight = new GlobalDirectionalLight(this, app); worldCollections = new List <WorldObjectCollection>(); pathObjectTypes = new PathObjectTypeContainer(this, app); }
public WorldRoot(XmlReader r, String worldFilename, MultiSelectTreeView tree, WorldEditor worldEditor, bool loadCollections) { instance = this; treeView = tree; app = worldEditor; worldFilePath = worldFilename; this.loadCollections = loadCollections; worldCollections = new List <WorldObjectCollection>(); if (loadCollections) { FromXml(r); } else { FromXml(r, loadCollections); } // if the XML doesn't have ocean in it, then add it here if (ocean == null) { ocean = new Ocean(this, app); } if (skybox == null) { skybox = new Skybox(this, app); } if (fog == null) { fog = new GlobalFog(this, app); } if (ambientLight == null) { ambientLight = new GlobalAmbientLight(this, app); } if (directionalLight == null) { directionalLight = new GlobalDirectionalLight(this, app); } if (pathObjectTypes == null) { pathObjectTypes = new PathObjectTypeContainer(this, app); } }
protected void MaybeGeneratePathData() { PathObjectTypeContainer pathObjectTypes = WorldRoot.Instance.PathObjectTypes; if (pathObjectTypes.Count == 0) { PathData = null; } else if (WorldRoot.Instance.PathObjectTypes.AllObjectsDirty || locationDirty) { List <CollisionShape> meshShapes = WorldEditor.Instance.FindMeshCollisionShapes(meshName, displayObject.Entity); if (meshShapes.Count == 0) { PathData = null; } else { PathData = new PathData(); float terrainHeight = WorldEditor.Instance.GetTerrainHeight(location.x, location.z) - location.y; for (int i = 0; i < pathObjectTypes.Count; i++) { PathObjectType type = pathObjectTypes.GetType(i); try { PathData.AddModelPathObject(WorldEditor.Instance.LogPathGeneration, type, name, location, displayObject.SceneNode.FullTransform, meshShapes, terrainHeight); } catch (Exception e) { MessageBox.Show(string.Format("An exception was raised when generating pathing information for " + "model {0}, for path object type {1}. The exception message was '{2}'. Please run the World " + "Editor again, with the command-line option --log_paths, save the world file to generate " + "pathing information, and zip up the generated file " + "PathGenerationLog.txt, found in the World Editor's bin directory, and send it to Multiverse, " + "along with the {3} file so the problem can be identified and fixed.", name, type.name, e.Message, meshName), "Error Generating Path Information For Model " + name + "!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } }
public PathObjectTypeNode(WorldEditor app, PathObjectTypeContainer parent, XmlReader r) { this.app = app; this.parent = parent; this.pathObjectType = new PathObjectType(r); }
public PathObjectTypeNode(WorldEditor app, PathObjectTypeContainer parent, PathObjectType pathObjectType) { this.app = app; this.pathObjectType = pathObjectType; this.parent = parent; }
public DeletePathObjectTypeCommandFactory(WorldEditor app, PathObjectTypeContainer parent, PathObjectTypeNode pathObjectType) { this.app = app; this.parent = parent; this.pathObjectType = pathObjectType; }
public DeletePathObjectTypeCommand(WorldEditor worldEditor, PathObjectTypeContainer parent, PathObjectTypeNode pathObjectTypeNode) { this.app = worldEditor; this.parent = parent; this.pathObjectTypeNode = pathObjectTypeNode; }
public AddPathObjectTypeCommandFactory(WorldEditor app, PathObjectTypeContainer parent) { this.app = app; this.parent = parent; }
protected void FromXml(XmlReader r, bool loadCollections) { string filename = ""; string baseName = worldFilePath.Substring(0, worldFilePath.LastIndexOf('\\')); bool loadColl = loadCollections; for (int i = 0; i < r.AttributeCount; i++) { r.MoveToAttribute(i); switch (r.Name) { case "Name": name = r.Value; break; } } r.MoveToElement(); while (r.Read()) { // look for the start of an element if (r.NodeType == XmlNodeType.Whitespace) { continue; } if (r.NodeType == XmlNodeType.EndElement) { break; } if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "CameraPosition": cameraPosition = XmlHelperClass.ParseVectorAttributes(r); break; case "CameraOrientation": cameraOrientation = XmlHelperClass.ParseQuaternion(r); break; case "Terrain": worldTerrain = new WorldTerrain(app, r); break; case "TerrainDisplay": worldTerrain.DisplayParamsFromXml(r); break; case "Ocean": ocean = new Ocean(this, app, r); break; case "Skybox": skybox = new Skybox(this, app, r); break; case "GlobalFog": fog = new GlobalFog(this, app, r); break; case "GlobalAmbientLight": ambientLight = new GlobalAmbientLight(this, app, app.Scene, r); break; case "GlobalDirectionalLight": directionalLight = new GlobalDirectionalLight(this, app, r); break; case "PathObjectTypes": pathObjectTypes = new PathObjectTypeContainer(app, this, r); break; case "WorldCollection": string collectionName = null; filename = ""; for (int i = 0; i < r.AttributeCount; i++) { r.MoveToAttribute(i); switch (r.Name) { case "Name": collectionName = r.Value; break; case "Filename": filename = r.Value; break; } } string filepath = String.Format("{0}\\{1}", baseName, filename); if (filename != "") { if (filename.EndsWith("~.mwc")) { string autofilepath = String.Format("{0}\\{1}", baseName, filename); string normalfilepath = String.Format("{0}\\{1}", baseName, filename.Remove(filename.LastIndexOf("~"), 1)); if ((File.Exists(autofilepath) && File.Exists(normalfilepath) && (new FileInfo(autofilepath)).LastWriteTime < (new FileInfo(normalfilepath).LastWriteTime)) || (!File.Exists(autofilepath) && File.Exists(normalfilepath))) { filename = filename.Remove(filename.LastIndexOf("~"), 1); filepath = normalfilepath; } else { filepath = autofilepath; } } XmlReader childReader = XmlReader.Create(filepath, app.XMLReaderSettings); WorldObjectCollection collection = new WorldObjectCollection(childReader, collectionName, this, app, baseName, loadColl); collection.Filename = filename; while (collection.Filename.Contains("~")) { collection.Filename = collection.Filename.Remove(collection.Filename.LastIndexOf("~"), 1); } Add(collection); childReader.Close(); } else { XmlReader childReader = XmlReader.Create(String.Format("{0}\\{1}.mwc", baseName, collectionName), app.XMLReaderSettings); WorldObjectCollection collection = new WorldObjectCollection(childReader, collectionName, this, app, baseName, loadColl); collection.Filename = filename; Add(collection); while (collection.Filename.Contains("~")) { collection.Filename = collection.Filename.Remove(collection.Filename.LastIndexOf("~"), 1); } childReader.Close(); } r.MoveToElement(); break; } } } }
public AddPathObjectTypeCommand(WorldEditor worldEditor, PathObjectTypeContainer parent, PathObjectType pathObjectType) { this.app = worldEditor; this.parent = parent; this.pathObjectType = pathObjectType; }
public WorldRoot(String worldName, MultiSelectTreeView tree, WorldEditor worldEditor) { instance = this; name = worldName; treeView = tree; app = worldEditor; worldTerrain = new WorldTerrain(app); ocean = new Ocean(this, app); skybox = new Skybox(this, app); fog = new GlobalFog(this, app); ambientLight = new GlobalAmbientLight(this, app); directionalLight = new GlobalDirectionalLight(this, app); worldCollections = new List<WorldObjectCollection>(); pathObjectTypes = new PathObjectTypeContainer(this, app); }
public WorldRoot(XmlReader r, String worldFilename, MultiSelectTreeView tree, WorldEditor worldEditor, bool loadCollections) { instance = this; treeView = tree; app = worldEditor; worldFilePath = worldFilename; this.loadCollections = loadCollections; worldCollections = new List<WorldObjectCollection>(); if (loadCollections) { FromXml(r); } else { FromXml(r, loadCollections); } // if the XML doesn't have ocean in it, then add it here if (ocean == null) { ocean = new Ocean(this, app); } if (skybox == null) { skybox = new Skybox(this, app); } if (fog == null) { fog = new GlobalFog(this, app); } if (ambientLight == null) { ambientLight = new GlobalAmbientLight(this, app); } if (directionalLight == null) { directionalLight = new GlobalDirectionalLight(this, app); } if (pathObjectTypes == null) { pathObjectTypes = new PathObjectTypeContainer(this, app); } }