Exemplo n.º 1
0
	void LoadModel() {
		string file_path = AssetDatabase.GetAssetPath(pmdFile);
		MMD.ModelAgent model_agent = new MMD.ModelAgent(file_path);
		model_agent.CreatePrefab(shader_type, rigidFlag, use_mecanim, use_ik, scale, is_pmx_base_import);
		
		//读完信息
		var window = LoadedWindow.Init();
		window.Text = string.Format(
			"----- model name -----\n{0}\n\n----- comment -----\n{1}",
			model_agent.name,
			model_agent.comment
		);
		window.Show();
	}
Exemplo n.º 2
0
        /// <summary>
        /// Inspector上のGUI描画処理を行います
        /// </summary>
        public override void OnInspectorGUI()
        {
            // GUIの有効化
            GUI.enabled = !EditorApplication.isPlaying;

            // GUI描画
            pmd_config.OnGUIFunction();

            // Convertボタン
            EditorGUILayout.Space();
            if (message.Length != 0)
            {
                GUILayout.Label(message);
            }
            else
            {
                if (GUILayout.Button("Convert to Prefab"))
                {
                    if (null == model_agent)
                    {
                        var obj = (PMDScriptableObject)target;
                        model_agent = new ModelAgent(obj.assetPath);
                    }
                    model_agent.CreatePrefab(pmd_config.shader_type
                                             , pmd_config.rigidFlag
                                             , pmd_config.animation_type
                                             , pmd_config.use_ik
                                             , pmd_config.scale
                                             , pmd_config.is_pmx_base_import
                                             );
                    message = "Loading done.";
                }
            }
            GUILayout.Space(40);

            // モデル情報
            if (model_agent == null)
            {
                return;
            }
            EditorGUILayout.LabelField("Model Name");
            EditorGUILayout.LabelField(model_agent.name, EditorStyles.textField);

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Comment");
            EditorGUILayout.LabelField(model_agent.comment, EditorStyles.textField, GUILayout.Height(300));
        }
Exemplo n.º 3
0
    void LoadModel()
    {
        string file_path = AssetDatabase.GetAssetPath(pmdFile);

        MMD.ModelAgent model_agent = new MMD.ModelAgent(file_path);
        model_agent.CreatePrefab(shader_type, rigidFlag, use_mecanim, use_ik, scale, is_pmx_base_import);

        // 読み込み完了メッセージ
        var window = LoadedWindow.Init();

        window.Text = string.Format(
            "----- model name -----\n{0}\n\n----- comment -----\n{1}",
            model_agent.name,
            model_agent.comment
            );
        window.Show();
    }
Exemplo n.º 4
0
 /// <summary>
 /// 有効化処理
 /// </summary>
 private void OnEnable()
 {
     // デフォルトコンフィグ
     var config = MMD.Config.LoadAndCreate();
     pmd_config = config.pmd_config.Clone();
     
     // モデル情報
     if (config.inspector_config.use_pmd_preload)
     {
         var obj = (PMDScriptableObject)target;
         model_agent = new ModelAgent(obj.assetPath);
     }
     else
     {
         model_agent = null;
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// 有効化処理
        /// </summary>
        private void OnEnable()
        {
            // デフォルトコンフィグ
            var config = MMD.Config.LoadAndCreate();

            pmd_config = config.pmd_config.Clone();

            // モデル情報
            if (config.inspector_config.use_pmd_preload)
            {
                var obj = (PMDScriptableObject)target;
                model_agent = new ModelAgent(obj.assetPath);
            }
            else
            {
                model_agent = null;
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Inspector上のGUI描画処理を行います
        /// </summary>
        public override void OnInspectorGUI()
        {
            // GUIの有効化
            GUI.enabled = !EditorApplication.isPlaying;

            // GUI描画
            pmd_config.OnGUIFunction();

            // Convertボタン
            EditorGUILayout.Space();
            if (message.Length != 0)
            {
                GUILayout.Label(message);
            }
            else
            {
                if (GUILayout.Button("Convert to Prefab"))
                {
                    if (null == model_agent) {
                        var obj = (PMDScriptableObject)target;
                        model_agent = new ModelAgent(obj.assetPath);
                    }
                    model_agent.CreatePrefab(pmd_config.shader_type
                                            , pmd_config.rigidFlag
                                            , pmd_config.animation_type
                                            , pmd_config.use_ik
                                            , pmd_config.scale
                                            , pmd_config.is_pmx_base_import
                                            );
                    message = "Loading done.";
                }
            }
            GUILayout.Space(40);

            // モデル情報
            if (model_agent == null) return;
            EditorGUILayout.LabelField("Model Name");
            EditorGUILayout.LabelField(model_agent.name, EditorStyles.textField);

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Comment");
            EditorGUILayout.LabelField(model_agent.comment, EditorStyles.textField, GUILayout.Height(300));
        }
Exemplo n.º 7
0
	void LoadModel() {
		string file_path = AssetDatabase.GetAssetPath(pmdFile);
		MMD.ModelAgent model_agent = new MMD.ModelAgent(file_path);
		model_agent.CreatePrefab(pmd_config.shader_type
								, pmd_config.rigidFlag
								, pmd_config.animation_type
								, pmd_config.use_ik
								, pmd_config.scale
								, pmd_config.is_pmx_base_import
								);
		
		// 読み込み完了メッセージ
		var window = LoadedWindow.Init();
		window.Text = string.Format(
			"----- model name -----\n{0}\n\n----- comment -----\n{1}",
			model_agent.name,
			model_agent.comment
		);
		window.Show();
	}
Exemplo n.º 8
0
        /// <summary>
        /// pmd_header 默认设置的设定
        /// </summary>
        private void setup()
        {
            // 默认设置
			var config = MMD.Config.LoadAndCreate();
            shader_type = config.pmd_config.shader_type;
            rigidFlag = config.pmd_config.rigidFlag;
            use_mecanim = config.pmd_config.use_mecanim;
            use_ik = config.pmd_config.use_ik;
            scale = config.pmd_config.scale;
            is_pmx_base_import = config.pmd_config.is_pmx_base_import;

            // 型号信息
            if (config.inspector_config.use_pmd_preload)
            {
				var obj = (PMDScriptableObject)target;
				model_agent = new ModelAgent(obj.assetPath);
            }
            else
            {
                model_agent = null;
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// pmd_header 默认设置的设定
        /// </summary>
        private void setup()
        {
            // 默认设置
            var config = MMD.Config.LoadAndCreate();

            shader_type        = config.pmd_config.shader_type;
            rigidFlag          = config.pmd_config.rigidFlag;
            use_mecanim        = config.pmd_config.use_mecanim;
            use_ik             = config.pmd_config.use_ik;
            scale              = config.pmd_config.scale;
            is_pmx_base_import = config.pmd_config.is_pmx_base_import;

            // 型号信息
            if (config.inspector_config.use_pmd_preload)
            {
                var obj = (PMDScriptableObject)target;
                model_agent = new ModelAgent(obj.assetPath);
            }
            else
            {
                model_agent = null;
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// 在Inspector上进行GUI的绘制处理
        /// </summary>
        public override void OnInspectorGUI()
        {
            setup();

            
            GUI.enabled = !EditorApplication.isPlaying;// 激活GUI

            
            shader_type = (PMDConverter.ShaderType)EditorGUILayout.EnumPopup("Shader Type", shader_type);// 着色器类型

           
            rigidFlag = EditorGUILayout.Toggle("Rigidbody", rigidFlag); // 是否加入刚体

            
            GUI.enabled = false;// 是否使用Mecanim
            use_mecanim = EditorGUILayout.Toggle("Use Mecanim", false);
            GUI.enabled = !EditorApplication.isPlaying;

            
            use_ik = EditorGUILayout.Toggle("Use IK", use_ik);// 是否使用IK

           
            scale = EditorGUILayout.Slider("Scale", scale, 0.001f, 1.0f); // 缩放
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.PrefixLabel(" ");
                if (GUILayout.Button("0.085", EditorStyles.miniButtonLeft)) {
                    scale = 0.085f;
                }
                if (GUILayout.Button("1.0", EditorStyles.miniButtonRight)) {
                    scale = 1.0f;
                }
            }
            EditorGUILayout.EndHorizontal();

          
            is_pmx_base_import = EditorGUILayout.Toggle("Use PMX Base Import", is_pmx_base_import);  // 是否使用PMX Base进行导入

           
            EditorGUILayout.Space(); // Convert按钮
            if (message.Length != 0)
            {
                GUILayout.Label(message);
            }
            else
            {
                if (GUILayout.Button("Convert to Prefab"))
                {
                    if (null == model_agent) {
						var obj = (PMDScriptableObject)target;
                        model_agent = new ModelAgent(obj.assetPath);
                    }
                    model_agent.CreatePrefab(shader_type, rigidFlag, use_mecanim, use_ik, scale, is_pmx_base_import);
                    message = "Loading done.";
                }
            }
            GUILayout.Space(40);

           
            if (model_agent == null) return; // info of model
            EditorGUILayout.LabelField("Model Name");
            GUI.enabled = false;
            EditorGUILayout.TextArea(model_agent.name);
            GUI.enabled = true;

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Comment");
            GUI.enabled = false;
            EditorGUILayout.TextArea(model_agent.comment, GUILayout.Height(300));
            GUI.enabled = true;
        }
Exemplo n.º 11
0
        /// <summary>
        /// 在Inspector上进行GUI的绘制处理
        /// </summary>
        public override void OnInspectorGUI()
        {
            setup();


            GUI.enabled = !EditorApplication.isPlaying;// 激活GUI


            shader_type = (PMDConverter.ShaderType)EditorGUILayout.EnumPopup("Shader Type", shader_type);// 着色器类型


            rigidFlag = EditorGUILayout.Toggle("Rigidbody", rigidFlag); // 是否加入刚体


            GUI.enabled = false;// 是否使用Mecanim
            use_mecanim = EditorGUILayout.Toggle("Use Mecanim", false);
            GUI.enabled = !EditorApplication.isPlaying;


            use_ik = EditorGUILayout.Toggle("Use IK", use_ik);// 是否使用IK


            scale = EditorGUILayout.Slider("Scale", scale, 0.001f, 1.0f); // 缩放
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.PrefixLabel(" ");
                if (GUILayout.Button("0.085", EditorStyles.miniButtonLeft))
                {
                    scale = 0.085f;
                }
                if (GUILayout.Button("1.0", EditorStyles.miniButtonRight))
                {
                    scale = 1.0f;
                }
            }
            EditorGUILayout.EndHorizontal();


            is_pmx_base_import = EditorGUILayout.Toggle("Use PMX Base Import", is_pmx_base_import);  // 是否使用PMX Base进行导入


            EditorGUILayout.Space(); // Convert按钮
            if (message.Length != 0)
            {
                GUILayout.Label(message);
            }
            else
            {
                if (GUILayout.Button("Convert to Prefab"))
                {
                    if (null == model_agent)
                    {
                        var obj = (PMDScriptableObject)target;
                        model_agent = new ModelAgent(obj.assetPath);
                    }
                    model_agent.CreatePrefab(shader_type, rigidFlag, use_mecanim, use_ik, scale, is_pmx_base_import);
                    message = "Loading done.";
                }
            }
            GUILayout.Space(40);


            if (model_agent == null)
            {
                return;                      // info of model
            }
            EditorGUILayout.LabelField("Model Name");
            GUI.enabled = false;
            EditorGUILayout.TextArea(model_agent.name);
            GUI.enabled = true;

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Comment");
            GUI.enabled = false;
            EditorGUILayout.TextArea(model_agent.comment, GUILayout.Height(300));
            GUI.enabled = true;
        }
Exemplo n.º 12
0
        /// <summary>
        /// Inspector上のGUI描画処理を行います
        /// </summary>
        public override void OnInspectorGUI()
        {
            setup();

            // GUIの有効化
            GUI.enabled = !EditorApplication.isPlaying;

            // シェーダの種類
            shader_type = (PMDConverter.ShaderType)EditorGUILayout.EnumPopup("Shader Type", shader_type);

            // 剛体を入れるかどうか
            rigidFlag = EditorGUILayout.Toggle("Rigidbody", rigidFlag);

            // Mecanimを使うかどうか
#if UNITY_4_2
            use_mecanim = EditorGUILayout.Toggle("Use Mecanim", use_mecanim);
#else //UNITY_4_2
            GUI.enabled = false;
            use_mecanim = EditorGUILayout.Toggle("Use Mecanim", false);
            GUI.enabled = !EditorApplication.isPlaying;
#endif //UNITY_4_2

            // IKを使うかどうか
            use_ik = EditorGUILayout.Toggle("Use IK", use_ik);

            // スケール
            scale = EditorGUILayout.Slider("Scale", scale, 0.001f, 1.0f);
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.PrefixLabel(" ");
                if (GUILayout.Button("0.085", EditorStyles.miniButtonLeft))
                {
                    scale = 0.085f;
                }
                if (GUILayout.Button("1.0", EditorStyles.miniButtonRight))
                {
                    scale = 1.0f;
                }
            }
            EditorGUILayout.EndHorizontal();

            // PMX Baseでインポートするかどうか
            is_pmx_base_import = EditorGUILayout.Toggle("Use PMX Base Import", is_pmx_base_import);

            // Convertボタン
            EditorGUILayout.Space();
            if (message.Length != 0)
            {
                GUILayout.Label(message);
            }
            else
            {
                if (GUILayout.Button("Convert to Prefab"))
                {
                    if (null == model_agent)
                    {
                        var obj = (PMDScriptableObject)target;
                        model_agent = new ModelAgent(obj.assetPath);
                    }
                    model_agent.CreatePrefab(shader_type, rigidFlag, use_mecanim, use_ik, scale, is_pmx_base_import);
                    message = "Loading done.";
                }
            }
            GUILayout.Space(40);

            // モデル情報
            if (model_agent == null)
            {
                return;
            }
            EditorGUILayout.LabelField("Model Name");
            GUI.enabled = false;
            EditorGUILayout.TextArea(model_agent.name);
            GUI.enabled = true;

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Comment");
            GUI.enabled = false;
            EditorGUILayout.TextArea(model_agent.comment, GUILayout.Height(300));
            GUI.enabled = true;
        }
Exemplo n.º 13
0
        /// <summary>
        /// Inspector上のGUI描画処理を行います
        /// </summary>
        public override void OnInspectorGUI()
        {
            setup();

            // GUIの有効化
            GUI.enabled = !EditorApplication.isPlaying;

            // シェーダの種類
            shader_type = (PMDConverter.ShaderType)EditorGUILayout.EnumPopup("Shader Type", shader_type);

            // 剛体を入れるかどうか
            rigidFlag = EditorGUILayout.Toggle("Rigidbody", rigidFlag);

            // Mecanimを使うかどうか
            #if UNITY_4_2
            use_mecanim = EditorGUILayout.Toggle("Use Mecanim", use_mecanim);
            #else //UNITY_4_2
            GUI.enabled = false;
            use_mecanim = EditorGUILayout.Toggle("Use Mecanim", false);
            GUI.enabled = !EditorApplication.isPlaying;
            #endif //UNITY_4_2

            // IKを使うかどうか
            use_ik = EditorGUILayout.Toggle("Use IK", use_ik);

            // スケール
            scale = EditorGUILayout.Slider("Scale", scale, 0.001f, 1.0f);
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.PrefixLabel(" ");
                if (GUILayout.Button("0.085", EditorStyles.miniButtonLeft)) {
                    scale = 0.085f;
                }
                if (GUILayout.Button("1.0", EditorStyles.miniButtonRight)) {
                    scale = 1.0f;
                }
            }
            EditorGUILayout.EndHorizontal();

            // PMX Baseでインポートするかどうか
            is_pmx_base_import = EditorGUILayout.Toggle("Use PMX Base Import", is_pmx_base_import);

            // Convertボタン
            EditorGUILayout.Space();
            if (message.Length != 0)
            {
                GUILayout.Label(message);
            }
            else
            {
                if (GUILayout.Button("Convert to Prefab"))
                {
                    if (null == model_agent) {
                        var obj = (PMDScriptableObject)target;
                        model_agent = new ModelAgent(obj.assetPath);
                    }
                    model_agent.CreatePrefab(shader_type, rigidFlag, use_mecanim, use_ik, scale, is_pmx_base_import);
                    message = "Loading done.";
                }
            }
            GUILayout.Space(40);

            // モデル情報
            if (model_agent == null) return;
            EditorGUILayout.LabelField("Model Name");
            GUI.enabled = false;
            EditorGUILayout.TextArea(model_agent.name);
            GUI.enabled = true;

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Comment");
            GUI.enabled = false;
            EditorGUILayout.TextArea(model_agent.comment, GUILayout.Height(300));
            GUI.enabled = true;
        }