private bool ResetResource(string confirmTxt)
        {
            if (m_resAnimMesh != null &&
                confirmTxt.Length > 0)
            {
                if (DialogResult.OK !=
                    MessageBox.Show(this, confirmTxt, "Please Confirm", MessageBoxButtons.OKCancel))
                {
                    return(false);
                }
            }

            //--
            m_preview.Reset();

            if (m_resAnimMesh != null)
            {
                m_resAnimMesh.Dispose();
                m_resAnimMesh = null;
            }
            m_prop = null;
            this.propertyGridMtl.SelectedObject = null;
            this.propertyGridRes.SelectedObject = null;
            this.comboBoxLOD.Items.Clear();
            this.comboBoxSection.Items.Clear();
            this.listBoxAnim.Items.Clear();
            this.propertyGridSeq.SelectedObject = null;

            return(true);
        }
Esempio n. 2
0
 public AnimedMeshMaterialProperty(NResourceAnimMesh res, int lod, int sec)
 {
     m_Res = res; m_Lod = lod; m_Section = sec;
     if (m_Res != null)
     {
         NMtlBase mtl = m_Res.GetMaterial(m_Lod, m_Section);
         if (mtl != null)
         {
             m_Loc = new NResourceLoc(mtl.Name);
         }
     }
 }
        private void CreateResource()
        {
            ResetResource("");
            // 产生一个不重复的名称
            string resName = "NewAnimMesh";

            resName += DateTime.Now.ToFileTime();

            // 创建空白资源和内部数据
            m_resAnimMesh = NResourceManager.Instance.NewAnimMesh(resName);
            m_prop        = new ResAnimMeshProperty(m_resAnimMesh);

            // 更新界面
            RefreshLOD();
        }
        public void LoadAnimMesh(string pkg, string file)
        {
            try
            {
                using (NexusEngineExtension.NWaitCursor wc = new NexusEngineExtension.NWaitCursor(this))
                {
                    NResourceLoc resLoc = new NResourceLoc(pkg, file);
                    m_resAnimMesh = NResourceManager.Instance.LoadAnimMesh(
                        resLoc,
                        EResourceIOMode.Block,
                        EResourceIOPriority.Normal
                        );
                    m_prop = new ResAnimMeshProperty(m_resAnimMesh);

                    this.propertyGridRes.SelectedObject = m_prop;
                    RefreshLOD();
                }
            }
            catch (System.Exception ex)
            {
                Program.ShowException(ex, "Load Anim Mesh FAILED!");
            }
        }
        internal void ResetAnimMeshResource(NResourceAnimMesh mesh)
        {
            // 重新创建可预览Actor
            CreateAnimMeshPreview();

            NAnimMeshComponent previewMC = AnimMeshPreviewComponent;

            if (previewMC == null)
            {
                NLogger.Instance.WriteString(LogType.Debug, "没有创建可预览对象...");
                return;
            }

            try
            {
                previewMC.ResetResource(mesh);
                m_actorBox = previewMC.GetBoundingBox();
            }
            catch (System.Exception e)
            {
                NexusEditor.Program.ShowException(e, "Anim Mesh Preview Open FAILED!");
            }
        }
 public ResAnimMeshProperty(NResourceAnimMesh res)
     : base(res)
 {
 }