Ejemplo n.º 1
0
 static void SaveSelected()
 {
     foreach (GameObject obj in Selection.gameObjects)
     {
         SuperCombiner sc = obj.GetComponent <SuperCombiner> ();
         if (sc != null)
         {
             if (sc._combiningState != SuperCombiner.CombineStatesList.Uncombined)
             {
                 sc.Save();
             }
         }
     }
 }
Ejemplo n.º 2
0
        static void Save(MenuCommand command)
        {
            SuperCombiner sc = (SuperCombiner)command.context;

            sc.Save();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Display the save section.
        /// </summary>
        private void DisplaySaveSection()
        {
            // Saving settings
            _showSaveOptions = EditorGUILayout.Foldout(_showSaveOptions, "Saving settings");
            if (_showSaveOptions)
            {
                _superCombiner._saveMaterials = EditorGUILayout.Toggle("Save materials", _superCombiner._saveMaterials);
                _superCombiner._saveTextures  = EditorGUILayout.Toggle("Save textures", _superCombiner._saveTextures);
                if (_superCombiner._combiningState == SuperCombiner.CombineStatesList.CombinedMaterials)
                {
                    GUI.enabled = false;
                }
                _superCombiner._savePrefabs = EditorGUILayout.Toggle("Save prefabs", _superCombiner._savePrefabs);
                _superCombiner._saveMeshObj = EditorGUILayout.Toggle("Save meshes as Obj", _superCombiner._saveMeshObj);
                GUI.enabled = true;


                //this.SuperCombiner._saveMeshFbx = EditorGUILayout.Toggle ("Save meshes as Fbx", this.SuperCombiner._saveMeshFbx);

                if (GUILayout.Button("Save in: " + _superCombiner._folderDestination + " ...", GUILayout.MinHeight(20)))
                {
                    //this.SuperCombiner._folderDestination = EditorUtility.OpenFolderPanel("Destination Directory", "", "");
                    string folderPath = EditorUtility.SaveFolderPanel("Destination Directory", "", "combined");
                    if (folderPath != null)
                    {
                        int    startIndex   = folderPath.IndexOf("Assets/");
                        string relativePath = "Assets/";
                        if (startIndex > 0)
                        {
                            relativePath = folderPath.Substring(startIndex);
                        }
                        else
                        {
                            Logger.Instance.AddLog("SuperCombiner", "Please, specify a folder under Assets/", Logger.LogLevel.LOG_ERROR);
                        }
                        _superCombiner._folderDestination = relativePath;
                    }
                }
            }
            EditorGUILayout.Space();

            if (GUILayout.Button("Save", GUILayout.MinHeight(30)))
            {
                _superCombiner.Save();
            }


            if (AssetDatabase.IsValidFolder(_superCombiner._folderDestination))
            {
                EditorGUILayout.Space();
                _showPackageOptions = EditorGUILayout.Foldout(_showPackageOptions, "Unity Package Options:");

                if (_showPackageOptions)
                {
                    _include_dependencies = EditorGUILayout.Toggle("Include Dependencies: ", _include_dependencies);
                }

                if (GUILayout.Button("Generate Unity Package", GUILayout.MinHeight(30)))
                {
                    if (_include_dependencies)
                    {
                        AssetDatabase.ExportPackage(_superCombiner._folderDestination, _superCombiner._sessionName + ".unitypackage", ExportPackageOptions.Interactive | ExportPackageOptions.Recurse | ExportPackageOptions.IncludeDependencies);
                    }
                    else
                    {
                        AssetDatabase.ExportPackage(_superCombiner._folderDestination, _superCombiner._sessionName + ".unitypackage", ExportPackageOptions.Interactive | ExportPackageOptions.Recurse);
                    }
                }
            }
        }