Пример #1
0
        /// <summary>
        ///     Create pmx from pmx list
        /// </summary>
        private void CreatePmx()
        {
            var       model_agent = new ModelAgent(Statement.PmxFiles[Statement.CurrentPmx]);
            PMXFormat pmx_format;

            try
            {
                //PMX読み込みを試みる
                pmx_format = PMXLoaderScript.Import(model_agent.file_path_);
            }
            catch
            {
                //PMXとして読み込めなかったら
                //PMDとして読み込む
                var pmd_format = PMDLoaderScript.Import(model_agent.file_path_);
                pmx_format = PMXLoaderScript.PMD2PMX(pmd_format);
            }

            fbxGameObject = PMXConverter.CreateGameObject(pmx_format, false, PMXConverter.AnimationType.LegacyAnimation,
                                                          false, 1f);

            fbxGameObject.transform.SetParent(GameObject.Find("Parent").transform);
            fbxGameObject.transform.localScale    = new Vector3(0.085f, 0.085f, 0.085f);
            fbxGameObject.transform.localRotation = new Quaternion(0f, 0f, 0f, 0f);
        }
Пример #2
0
        public static void LoadT()
        {
            CleanAssetDatabase();
            var path = EditorUtility.OpenFilePanel("Overwrite with png", "", "*");

            Debug.Log(path);
            var model_agent = new ModelAgent(path);

            PMXFormat pmx_format;

            try
            {
                //PMX読み込みを試みる
                pmx_format = PMXLoaderScript.Import(model_agent.file_path_);
            }
            catch (Exception e)
            {
                Debug.Log(e.Message);
                //PMXとして読み込めなかったら
                //PMDとして読み込む
                var pmd_format = PMDLoaderScript.Import(model_agent.file_path_);
                pmx_format = PMXLoaderScript.PMD2PMX(pmd_format);
            }

            var fbxGameObject = PMXConverter.CreateGameObject(pmx_format, false,
                                                              PMXConverter.AnimationType.LegacyAnimation, false, 1f);

            fbxGameObject.transform.SetParent(GameObject.Find("Parent").transform);
            fbxGameObject.transform.localScale    = new Vector3(0.085f, 0.085f, 0.085f);
            fbxGameObject.transform.localRotation = new Quaternion(0f, 0f, 0f, 0f);
        }
Пример #3
0
        /// <summary>
        /// Create pmx from pmx list
        /// </summary>
        private void CreatePmx()
        {
            var       modelAgent = new ModelAgent(CurrentMmdObject.FilePath);
            PMXFormat pmxFormat;

            try
            {
                pmxFormat = PMXLoaderScript.Import(modelAgent.file_path_);
            }
            catch
            {
                var pmdFormat = PMDLoaderScript.Import(modelAgent.file_path_);
                pmxFormat = PMXLoaderScript.PMD2PMX(pmdFormat);
            }

            _fbxGameObject = PMXConverter.CreateGameObject(pmxFormat, false, PMXConverter.AnimationType.LegacyAnimation,
                                                           false, 1f);

            _fbxGameObject.transform.SetParent(parent.transform);
            _fbxGameObject.transform.localScale    = new Vector3(0.085f, 0.085f, 0.085f);
            _fbxGameObject.transform.localRotation = new Quaternion(0f, 0f, 0f, 0f);
        }