示例#1
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (m_resStaticMesh != null)
            {
                using (VirtualFileDialog dlg = new VirtualFileDialog(false, "", "nmdl"))
                {
                    dlg.SetResourceLocation(NLevelEditorEngine.Instance.CurrentFolder);
                    dlg.Text = "保存模型 ...";
                    int i = m_resStaticMesh.Name.LastIndexOf('\\');
                    if (i == -1)
                    {
                        i = m_resStaticMesh.Name.LastIndexOf('/');
                    }
                    if (i >= 0)
                    {
                        dlg.SetFileName(m_resStaticMesh.Name.Substring(i + 1, m_resStaticMesh.Name.Length - i - 1));
                    }
                    else
                    {
                        dlg.SetFileName(m_resStaticMesh.Name);
                    }

                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {
                        NResourceLoc loc = dlg.GetResourceLocation();
                        using (NexusEngineExtension.NWaitCursor wc = new NexusEngineExtension.NWaitCursor(this))
                            m_resStaticMesh.SaveToFile(loc, this.toolBtnXML.Checked);
                    }
                }
            }// end of if
            else
            {
                NexusEditor.Program.ShowError("Static Mesh Resource Save FAILED!");
            }
        }
示例#2
0
 private void saveSToolStripMenuItem_Click(object sender, EventArgs e)
 {
     //保存特效
     using (VirtualFileDialog dlg = new VirtualFileDialog())
     {
         dlg.Text = "保存特效 ...";
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             NResourceLoc loc = dlg.GetResourceLocation();
             m_res.SaveToFile(loc, true);
         }
     }
 }
示例#3
0
 private void toolStripButton2_Click(object sender, EventArgs e)
 {
     //打开现有的材质文件
     using (VirtualFileDialog dlg = new VirtualFileDialog(true, "", "mtl"))
     {
         dlg.Text = "Load Material ...";
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             m_Location = dlg.GetResourceLocation();
             LoadMaterial(m_Location.PackageName, m_Location.FileName);
         }
     }
 }
示例#4
0
 private void toolStripButtonSave_Click(object sender, EventArgs e)
 {
     //另存材质
     if (m_Material == null)
     {
         return;
     }
     using (VirtualFileDialog dlg = new VirtualFileDialog(false, "", "mtl"))
     {
         dlg.Text = "Save Material ...";
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             m_Location = dlg.GetResourceLocation();
             m_Material.SaveToFile(m_Location);
         }
     }
 }
示例#5
0
 private void openOToolStripMenuItem_Click(object sender, EventArgs e)
 {
     //打开特效
     using (VirtualFileDialog dlg = new VirtualFileDialog())
     {
         dlg.Text = "加载特效 ...";
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             NResourceLoc loc = dlg.GetResourceLocation();
             m_res.Clear();
             m_elementsCtrl.Clear();
             m_Timeline.Clear();
             this.splitContainerV.Panel2.Controls.Clear();
             m_res.LoadFromFile(loc);
             //更新控制器
             for (int i = 0; i < m_res.ElementCount(); ++i)
             {
                 NEffectElement elem    = m_res.GetElement(i);
                 int            numCtrl = m_elementsCtrl.Count;
                 SFXElement     newCtrl = new SFXElement(elem);
                 this.splitContainerV.Panel2.Controls.Add(newCtrl);
                 newCtrl.Location = new Point(2 + numCtrl * (newCtrl.Width + 2), 2);
                 int h = this.splitContainerV.Panel2.Height - 20;
                 newCtrl.Height = h;
                 m_elementsCtrl.Add(newCtrl);
                 newCtrl.SetActive(true);
                 newCtrl.RemoveElement    += new EventHandler(OnRemoveElement);
                 newCtrl.PropertySelected += new EventHandler(OnElementPropertySelected);
                 newCtrl.PostPropertyEdit += new EventHandler(OnElementPostPropertyEdit);
                 newCtrl.ActiveElement    += new EventHandler(OnActiveElement);
                 newCtrl.RestartInstance  += new EventHandler(OnRestartInstance);
             }
             NActorComponent        comp    = m_preview.ResourceActorComponent;
             NSpecialEffectInstance sfxComp = comp as NSpecialEffectInstance;
             if (sfxComp != null)
             {
                 sfxComp.ResetResource(m_res);
             }
             m_preview.Refresh();
         }
     }
 }
示例#6
0
        /// <summary>
        /// 是否创建新的项目
        /// </summary>
        /// <param name="newProject"></param>
        private void OpenFromFile()
        {
            try
            {
                string defalultFileName = Path.GetFileNameWithoutExtension(lastFileName);
                using (VirtualFileDialog dlg = new VirtualFileDialog(true, defalultFileName, DefaultExt))
                {
                    dlg.Text = "Open GUI file...";
                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {
                        NResourceLoc loc = dlg.GetResourceLocation();

                        ReloadResource(GUISystem.Instance.RootWindow, loc.PackageName, loc.FileName, false);
                    }
                }
            }
            catch (System.Exception e)
            {
                NexusEditor.Program.ShowException(e, "Open GUI file faild!");
            }
        }
示例#7
0
        private void SaveCurrentSkeletalMesh()
        {
            //-- 检测资源是否可用
            if (SkeletalMeshPreview == null)
            {
                NexusEditor.Program.ShowError("Skeletal Mesh 资源尚未创建!");
                return;
            }

            using (VirtualFileDialog dlg = new VirtualFileDialog(false, "", "skm"))
            {
                //-- 设置dialogue属性
                dlg.SetResourceLocation(NLevelEditorEngine.Instance.CurrentFolder);
                dlg.Text = "保存Skeletal Mesh ...";
                int i = skeletalMeshProperty.Name.LastIndexOf('\\');
                if (i == -1)
                {
                    i = skeletalMeshProperty.Name.LastIndexOf('/');
                }
                if (i >= 0)
                {
                    dlg.SetFileName(skeletalMeshProperty.Name.Substring(i + 1, skeletalMeshProperty.Name.Length - i - 1));
                }
                else
                {
                    dlg.SetFileName(skeletalMeshProperty.Name);
                }

                //-- 请用户确认
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    NResourceLoc loc = dlg.GetResourceLocation();

                    using (NexusEngineExtension.NWaitCursor wc = new NexusEngineExtension.NWaitCursor(this))
                        SkeletalMeshPreview.SaveToFile(loc, this.toolBtnXML.Checked);
                }
            }// end of using(dg)
        }
示例#8
0
        private void SaveCurrentAnimSet()
        {
            if (AnimSetPreview == null)
            {
                NexusEditor.Program.ShowError("Anim Set 资源尚未创建!");
            }

            using (VirtualFileDialog dlg = new VirtualFileDialog(false, "", "animset"))
            {
                //-- 设置dialogue属性
                dlg.SetResourceLocation(NLevelEditorEngine.Instance.CurrentFolder);
                dlg.Text = "保存Anim Set ...";

                //-- 请用户确认
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    NResourceLoc loc = dlg.GetResourceLocation();

                    using (NexusEngineExtension.NWaitCursor wc = new NexusEngineExtension.NWaitCursor(this))
                        AnimSetPreview.SaveToFile(loc, this.toolBtnXML.Checked);
                }
            }
        }
示例#9
0
        private void SaveToFile(Window wndToFile)
        {
            try
            {
                string defalultFileName = Path.GetFileNameWithoutExtension(lastFileName);
                using (VirtualFileDialog dlg = new VirtualFileDialog(false, defalultFileName, DefaultExt))
                {
                    dlg.Text = "Save GUI file...";
                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {
                        NResourceLoc loc = dlg.GetResourceLocation();

                        // 序列化到文件
                        WindowManager.Instance.Serialize(loc.PackageName, loc.FileName, wndToFile);

                        this.Text = "GUI Editor - " + loc.PackageName + ":" + loc.FileName;
                    }
                }
            }
            catch (System.Exception ex)
            {
                NexusEditor.Program.ShowException(ex, "Generate ui project faild!");
            }
        }