public MainEditor() { //Initialize the WinForm InitializeComponent(); KeyPreview = true; _mruMenu = new MruStripMenu(mruList, OnMruClickedHandler, _mruRegKey + "\\MRU", 6); _loadedWorldspaceProject = null; // Register a handler for WorldspaceProjectLoaded that sets the Window's title. WorldspaceProjectLoaded += OnWorldSpaceProjectLoaded; glControl.KeyDown += HandleEventKeyDown; glControl.KeyUp += HandleEventKeyUp; glControl.MouseDown += HandleEventMouseDown; glControl.MouseMove += HandleEventMouseMove; glControl.MouseUp += HandleEventMouseUp; glControl.Resize += Display.Internal_EventResize; glControl.Load += (sender, args) => { // Hook Application Idle to force rendering while no events are happening. Application.Idle += HandleApplicationIdle; Console.WriteLine("glContro loaded!"); // Initialize our core once the glControl has been created as initalization // requires a glContext. _editorCore = new EditorCore(); }; // Hook the glControl's Paint function (which is called every frame thanks to above) glControl.Paint += (sender, args) => RenderFrame(); }
public void OpenFileFromWorkingDir(string workDir, bool surpressMRU = false) { //Iterate through the sub folders (dzb, dzr, bdl, etc.) and construct an appropriate data //structure for each one out of it. Then stick them all in a WorldspaceProject and save that //into our list of open projects. Then we can operate out of the WorldspaceProject references //and save and stuff. //Scan loaded projects to make sure we haven't already loaded it. if (_loadedWorldspaceProject != null) { Console.WriteLine("Trying to open new worldspacedir while one is open. Unloading!"); UnloadLoadedWorldspaceProject(); } toolStripStatusLabel1.Text = "Loading Worldspace Project..."; saveAllToolStripMenuItem.Enabled = true; exportArchivesToolStripMenuItem.Enabled = true; unloadWorldspaceProjectToolStripMenuItem.Enabled = true; _loadedWorldspaceProject = new WorldspaceProject(); _loadedWorldspaceProject.LoadFromDirectory(workDir); UpdateProjectFolderTreeview(); if (!surpressMRU) { _mruMenu.AddFile(_loadedWorldspaceProject.ProjectFilePath); } if (WorldspaceProjectLoaded != null) { WorldspaceProjectLoaded(_loadedWorldspaceProject); } }
public void UnloadLoadedWorldspaceProject() { _loadedWorldspaceProject = null; _selectedEntityFile = null; _selectedEntityLayer = EditorHelpers.EntityLayer.DefaultLayer; _renderer.OnSceneUnload(); UpdateProjectFolderTreeview(); UpdateEntityTreeview(); UpdateLayersView(); }
private void MainEditor_Load(object sender, EventArgs e) { _loadedWorldspaceProject = null; _camera = new Camera(); //Add our renderers to the list _renderer = new J3DRenderer(); _renderer.Initialize(); _debugRenderer = new DebugRenderer(); _debugRenderer.Initialize(); DebugRenderer.DrawWireCube(Vector3.Zero, Color.Snow, Quaternion.Identity, Vector3.One); _glControlInitalized = true; }
private void PerformTestsForWorldspaceProject(WorldspaceProject project) { Console.WriteLine("Performing tests on {0}", project.Name); foreach (ZArchive archive in project.GetAllArchives()) { WindWakerEntityData data = archive.GetFileByType <WindWakerEntityData>(); if (data == null) { continue; } foreach (List <WindWakerEntityData.BaseChunk> chunkList in data.GetAllChunks().Values) { int chunkId = 0; foreach (WindWakerEntityData.BaseChunk chunk in chunkList) { foreach (FieldInfo field in chunk.GetType().GetFields()) { UnitTestValue attribute = (UnitTestValue)Attribute.GetCustomAttribute(field, typeof(UnitTestValue)); if (attribute != null) { object testValue = field.GetValue(chunk); object attribValue = attribute.Value; bool bEquals = attribValue.Equals(testValue); if (bEquals) { continue; } //If they're not equals, we're going to want to print them to disk. string failureText = string.Format("{0}|{1} #{2} failed. Field \"{5}\" Expected: {3} Got: {4}", project.Name, chunk.ChunkName, chunkId, attribValue, testValue, field.Name); File.AppendAllText(_outputDir + "//results.txt", failureText + Environment.NewLine); } } chunkId++; } } } }
private void OnWorldSpaceProjectLoaded(WorldspaceProject worldspaceProject) { this.Text = string.Format("Wind Editor ({0} - {1})", worldspaceProject.Name, worldspaceProject.ProjectFilePath); }
private void OnWorldspaceProjectLoaded(WorldspaceProject project) { PerformTestsForWorldspaceProject(project); _mainEditor.UnloadLoadedWorldspaceProject(); }
private void OnWorldSpaceProjectLoaded(WorldspaceProject worldspaceProject) { // Modify the title of the WinForm UI to reflect the currently loaded Worldspace Project. Text = string.Format("Wind Editor ({0} - {1})", worldspaceProject.Name, worldspaceProject.ProjectFilePath); }
private void PerformTestsForWorldspaceProject(WorldspaceProject project) { Console.WriteLine("Performing tests on {0}", project.Name); foreach (ZArchive archive in project.GetAllArchives()) { WindWakerEntityData data = archive.GetFileByType<WindWakerEntityData>(); if (data == null) continue; foreach (List<WindWakerEntityData.BaseChunk> chunkList in data.GetAllChunks().Values) { int chunkId = 0; foreach (WindWakerEntityData.BaseChunk chunk in chunkList) { foreach (FieldInfo field in chunk.GetType().GetFields()) { UnitTestValue attribute = (UnitTestValue)Attribute.GetCustomAttribute(field, typeof(UnitTestValue)); if (attribute != null) { object testValue = field.GetValue(chunk); object attribValue = attribute.Value; bool bEquals = attribValue.Equals(testValue); if (bEquals) continue; //If they're not equals, we're going to want to print them to disk. string failureText = string.Format("{0}|{1} #{2} failed. Field \"{5}\" Expected: {3} Got: {4}", project.Name, chunk.ChunkName, chunkId, attribValue, testValue, field.Name); File.AppendAllText(_outputDir + "//results.txt", failureText + Environment.NewLine); } } chunkId++; } } } }
public void UnloadLoadedWorldspaceProject() { _loadedWorldspaceProject = null; _selectedEntityFile = null; _selectedEntityLayer = EditorHelpers.EntityLayer.DefaultLayer; //_renderer.OnSceneUnload(); UpdateProjectFolderTreeview(); UpdateEntityTreeview(); UpdateLayersView(); }
public void OpenFileFromWorkingDir(string workDir, bool surpressMRU = false) { //Iterate through the sub folders (dzb, dzr, bdl, etc.) and construct an appropriate data //structure for each one out of it. Then stick them all in a WorldspaceProject and save that //into our list of open projects. Then we can operate out of the WorldspaceProject references //and save and stuff. //Scan loaded projects to make sure we haven't already loaded it. if (_loadedWorldspaceProject != null) { Console.WriteLine("Trying to open new worldspacedir while one is open. Unloading!"); UnloadLoadedWorldspaceProject(); } toolStripStatusLabel1.Text = "Loading Worldspace Project..."; saveAllToolStripMenuItem.Enabled = true; exportArchivesToolStripMenuItem.Enabled = true; unloadWorldspaceProjectToolStripMenuItem.Enabled = true; _loadedWorldspaceProject = new WorldspaceProject(); _loadedWorldspaceProject.LoadFromDirectory(workDir); UpdateProjectFolderTreeview(); if (!surpressMRU) _mruMenu.AddFile(_loadedWorldspaceProject.ProjectFilePath); if (WorldspaceProjectLoaded != null) WorldspaceProjectLoaded(_loadedWorldspaceProject); }