Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
 public void UnloadLoadedWorldspaceProject()
 {
     _loadedWorldspaceProject = null;
     _selectedEntityFile      = null;
     _selectedEntityLayer     = EditorHelpers.EntityLayer.DefaultLayer;
     _renderer.OnSceneUnload();
     UpdateProjectFolderTreeview();
     UpdateEntityTreeview();
     UpdateLayersView();
 }
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 6
0
        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++;
                    }
                }
            }
        }
Ejemplo n.º 7
0
 private void OnWorldSpaceProjectLoaded(WorldspaceProject worldspaceProject)
 {
     this.Text = string.Format("Wind Editor ({0} - {1})", worldspaceProject.Name, worldspaceProject.ProjectFilePath);
 }
Ejemplo n.º 8
0
        private void OnWorldspaceProjectLoaded(WorldspaceProject project)
        {
            PerformTestsForWorldspaceProject(project);

            _mainEditor.UnloadLoadedWorldspaceProject();
        }
Ejemplo n.º 9
0
 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);
 }
Ejemplo n.º 10
0
        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++;
                    }
                    
                }

            }
        }
Ejemplo n.º 11
0
        private void OnWorldspaceProjectLoaded(WorldspaceProject project)
        {
            PerformTestsForWorldspaceProject(project);

            _mainEditor.UnloadLoadedWorldspaceProject();
        }
Ejemplo n.º 12
0
 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);
 }
Ejemplo n.º 13
0
 public void UnloadLoadedWorldspaceProject()
 {
     _loadedWorldspaceProject = null;
     _selectedEntityFile = null;
     _selectedEntityLayer = EditorHelpers.EntityLayer.DefaultLayer;
     //_renderer.OnSceneUnload();
     UpdateProjectFolderTreeview();
     UpdateEntityTreeview();
     UpdateLayersView();
 }
Ejemplo n.º 14
0
        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);
        }