public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged)
    {
        if (_enabledOptions == null)
        {
            return;
        }

        EditorGUILayout.HelpBox("Удаляет папку и все файлы в ней", MessageType.Info);
        editor.UpdateNodeName(node);

        GUILayout.Space(10f);

        //Show target configuration tab
        editor.DrawPlatformSelector(node);
        using (new EditorGUILayout.VerticalScope(GUI.skin.box))
        {
            var disabledScope = editor.DrawOverrideTargetToggle(node, _enabledOptions.ContainsValueOf(editor.CurrentEditingGroup), (bool enabled) =>
            {
                using (new RecordUndoScope("Remove Target Bundle Options", node, true))
                {
                    if (enabled)
                    {
                        _enabledOptions[editor.CurrentEditingGroup] = _enabledOptions.DefaultValue;
                        _outputDir[editor.CurrentEditingGroup]      = _outputDir.DefaultValue;
                        _outputOption[editor.CurrentEditingGroup]   = _outputOption.DefaultValue;
                    }
                    else
                    {
                        _enabledOptions.Remove(editor.CurrentEditingGroup);
                        _outputDir.Remove(editor.CurrentEditingGroup);
                        _outputOption.Remove(editor.CurrentEditingGroup);
                    }

                    onValueChanged();
                }
            });

            using (disabledScope)
            {
                OutputOption opt       = (OutputOption)_outputOption[editor.CurrentEditingGroup];
                var          newOption = (OutputOption)EditorGUILayout.EnumPopup("Output Option", opt);
                if (newOption != opt)
                {
                    using (new RecordUndoScope("Change Output Option", node, true))
                    {
                        _outputOption[editor.CurrentEditingGroup] = (int)newOption;
                        onValueChanged();
                    }
                }

                using (new EditorGUI.DisabledScope(opt == OutputOption.BuildInCacheDirectory || opt == OutputOption.BuildInBundlesCacheDirectory))
                {
                    var newDirPath = editor.DrawFolderSelector("Output Directory", "Select Output Folder",
                                                               _outputDir[editor.CurrentEditingGroup],
                                                               Application.dataPath + "/../",
                                                               (string folderSelected) =>
                    {
                        var projectPath = Directory.GetParent(Application.dataPath).ToString();

                        if (projectPath == folderSelected)
                        {
                            folderSelected = string.Empty;
                        }
                        else
                        {
                            var index = folderSelected.IndexOf(projectPath);
                            if (index >= 0)
                            {
                                folderSelected = folderSelected.Substring(projectPath.Length + index);
                                if (folderSelected.IndexOf('/') == 0)
                                {
                                    folderSelected = folderSelected.Substring(1);
                                }
                            }
                        }

                        return(folderSelected);
                    }
                                                               );

                    if (newDirPath != _outputDir[editor.CurrentEditingGroup])
                    {
                        using (new RecordUndoScope("Change Output Directory", node, true))
                        {
                            _outputDir[editor.CurrentEditingGroup] = newDirPath;



                            onValueChanged();
                        }
                    }

                    var outputDir = PrepareOutputDirectory(BuildTargetUtility.GroupToTarget(editor.CurrentEditingGroup), node.Data);

                    using (new EditorGUI.DisabledScope(!Directory.Exists(outputDir)))
                    {
                        using (new EditorGUILayout.HorizontalScope())
                        {
                            GUILayout.FlexibleSpace();
#if UNITY_EDITOR_OSX
                            string buttonName = "Reveal in Finder";
#else
                            string buttonName = "Show in Explorer";
#endif
                            if (GUILayout.Button(buttonName))
                            {
                                EditorUtility.RevealInFinder(outputDir);
                            }
                        }
                    }

                    EditorGUILayout.HelpBox("You can use '{Platform}' variable for Output Directory path to include platform name.", MessageType.Info);
                }
            }
        }
    }
Example #2
0
        public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged)
        {
            if (m_exportPath == null)
            {
                return;
            }

            var currentEditingGroup = editor.CurrentEditingGroup;

            EditorGUILayout.HelpBox("Export To Directory: Export given files to output directory.", MessageType.Info);
            editor.UpdateNodeName(node);

            GUILayout.Space(10f);

            //Show target configuration tab
            editor.DrawPlatformSelector(node);
            using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                var disabledScope = editor.DrawOverrideTargetToggle(node, m_exportPath.ContainsValueOf(currentEditingGroup), (bool enabled) => {
                    using (new RecordUndoScope("Remove Target Export Settings", node, true)){
                        if (enabled)
                        {
                            m_exportPath[currentEditingGroup]   = m_exportPath.DefaultValue;
                            m_exportOption[currentEditingGroup] = m_exportOption.DefaultValue;
                            m_flattenDir[currentEditingGroup]   = m_flattenDir.DefaultValue;
                        }
                        else
                        {
                            m_exportPath.Remove(currentEditingGroup);
                            m_exportOption.Remove(currentEditingGroup);
                            m_flattenDir.Remove(currentEditingGroup);
                        }
                        onValueChanged();
                    }
                });
                EditorGUI.BeginDisabledGroup(disabledScope);
                #region DisableGroup
                //using (disabledScope) {
                ExportOption opt       = (ExportOption)m_exportOption[currentEditingGroup];
                var          newOption = (ExportOption)EditorGUILayout.EnumPopup("Export Option", opt);
                if (newOption != opt)
                {
                    using (new RecordUndoScope("Change Export Option", node, true)){
                        m_exportOption[currentEditingGroup] = (int)newOption;
                        onValueChanged();
                    }
                }

                EditorGUILayout.LabelField("Export Path:");

                string newExportPath = null;

                newExportPath = editor.DrawFolderSelector("", "Select Export Folder",
                                                          m_exportPath[currentEditingGroup],
                                                          GetExportPath(m_exportPath[currentEditingGroup]),
                                                          (string folderSelected) => {
                    var projectPath = Directory.GetParent(Application.dataPath).ToString();

                    if (projectPath == folderSelected)
                    {
                        folderSelected = string.Empty;
                    }
                    else
                    {
                        var index = folderSelected.IndexOf(projectPath);
                        if (index >= 0)
                        {
                            folderSelected = folderSelected.Substring(projectPath.Length + index);
                            if (folderSelected.IndexOf('/') == 0)
                            {
                                folderSelected = folderSelected.Substring(1);
                            }
                        }
                    }
                    return(folderSelected);
                }
                                                          );
                if (newExportPath != m_exportPath[currentEditingGroup])
                {
                    using (new RecordUndoScope("Change Export Path", node, true)){
                        m_exportPath[currentEditingGroup] = newExportPath;
                        onValueChanged();
                    }
                }

                int flat    = m_flattenDir[currentEditingGroup];
                var newFlat = EditorGUILayout.ToggleLeft("Flatten Directory", flat == 1) ? 1:0;
                if (newFlat != flat)
                {
                    using (new RecordUndoScope("Change Flatten Directory", node, true)){
                        m_flattenDir[currentEditingGroup] = newFlat;
                        onValueChanged();
                    }
                }

                var exporterNodePath = GetExportPath(newExportPath);
                if (ValidateExportPath(
                        newExportPath,
                        exporterNodePath,
                        () => {
                },
                        () => {
                    using (new EditorGUILayout.HorizontalScope()) {
                        EditorGUILayout.LabelField(exporterNodePath + " does not exist.");
                        if (GUILayout.Button("Create directory"))
                        {
                            Directory.CreateDirectory(exporterNodePath);
                        }
                        onValueChanged();
                    }
                    EditorGUILayout.Space();

                    string parentDir = Path.GetDirectoryName(exporterNodePath);
                    if (Directory.Exists(parentDir))
                    {
                        EditorGUILayout.LabelField("Available Directories:");
                        string[] dirs = Directory.GetDirectories(parentDir);
                        foreach (string s in dirs)
                        {
                            EditorGUILayout.LabelField(s);
                        }
                    }
                }
                        ))
                {
                    GUILayout.Space(10f);

                    using (new EditorGUILayout.HorizontalScope()) {
                        GUILayout.FlexibleSpace();
                                                        #if UNITY_EDITOR_OSX
                        string buttonName = "Reveal in Finder";
                                                        #else
                        string buttonName = "Show in Explorer";
                                                        #endif
                        if (GUILayout.Button(buttonName))
                        {
                            EditorUtility.RevealInFinder(exporterNodePath);
                        }
                    }
                }
                #endregion
                EditorGUI.EndDisabledGroup();
            }
        }
Example #3
0
        public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged)
        {
            if (m_groupingKeyword == null)
            {
                return;
            }

            EditorGUILayout.HelpBox("Group By File Path: Create group of assets from asset's file path.", MessageType.Info);
            editor.UpdateNodeName(node);

            GUILayout.Space(10f);
            var newSlash = EditorGUILayout.ToggleLeft("Allow directory separator ('/') in group name", m_allowSlash);

            if (newSlash != m_allowSlash)
            {
                using (new RecordUndoScope("Change Allow Slash Setting", node, true)){
                    m_allowSlash = newSlash;
                    onValueChanged();
                }
            }
            if (m_allowSlash)
            {
                EditorGUILayout.HelpBox("Allowing directory separator for group name may create incompatible group name with other nodes. Please use this option carefully.", MessageType.Info);
            }
            GUILayout.Space(4f);

            //Show target configuration tab
            editor.DrawPlatformSelector(node);
            using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                var disabledScope = editor.DrawOverrideTargetToggle(node, m_groupingKeyword.ContainsValueOf(editor.CurrentEditingGroup), (bool enabled) => {
                    using (new RecordUndoScope("Remove Target Grouping Keyword Settings", node, true)){
                        if (enabled)
                        {
                            m_groupingKeyword[editor.CurrentEditingGroup] = m_groupingKeyword.DefaultValue;
                            m_patternType[editor.CurrentEditingGroup]     = m_patternType.DefaultValue;
                        }
                        else
                        {
                            m_groupingKeyword.Remove(editor.CurrentEditingGroup);
                            m_patternType.Remove(editor.CurrentEditingGroup);
                        }
                        onValueChanged();
                    }
                });
                EditorGUI.BeginDisabledGroup(disabledScope);
                //using (disabledScope) {
                var newType = (GroupingPatternType)EditorGUILayout.EnumPopup("Pattern Type", (GroupingPatternType)m_patternType[editor.CurrentEditingGroup]);
                if (newType != (GroupingPatternType)m_patternType[editor.CurrentEditingGroup])
                {
                    using (new RecordUndoScope("Change Grouping Pattern Type", node, true)){
                        m_patternType[editor.CurrentEditingGroup] = (int)newType;
                        onValueChanged();
                    }
                }

                var    newGroupingKeyword = EditorGUILayout.TextField("Grouping Keyword", m_groupingKeyword[editor.CurrentEditingGroup]);
                string helpText           = null;
                switch ((GroupingPatternType)m_patternType[editor.CurrentEditingGroup])
                {
                case GroupingPatternType.WildCard:
                    helpText = "Grouping Keyword requires \"*\" in itself. It assumes there is a pattern such as \"ID_0\" in incoming paths when configured as \"ID_*\" ";
                    break;

                case GroupingPatternType.RegularExpression:
                    helpText = "Grouping Keyword requires pattern definition with \"()\" in Regular Expression manner.";
                    break;
                }
                EditorGUILayout.HelpBox(helpText, MessageType.Info);

                if (newGroupingKeyword != m_groupingKeyword[editor.CurrentEditingGroup])
                {
                    using (new RecordUndoScope("Change Grouping Keywords", node, true)){
                        m_groupingKeyword[editor.CurrentEditingGroup] = newGroupingKeyword;
                        onValueChanged();
                    }
                }
            }
            EditorGUI.EndDisabledGroup();
        }
    public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged)
    {
        EditorGUILayout.HelpBox("Will delete all files, specified by bundles manifest and passed node condition." + Environment.NewLine +
                                " \"OnlyInBatchMode\" means node work only if unity run in batch mode", MessageType.Info);

        editor.UpdateNodeName(node);

        GUILayout.Space(10f);

        //Show target configuration tab
        editor.DrawPlatformSelector(node);
        using (new EditorGUILayout.VerticalScope(GUI.skin.box))
        {
            var disabledScope = editor.DrawOverrideTargetToggle(node, _enabledPerPlatformOptions.ContainsValueOf(editor.CurrentEditingGroup), (bool enabled) =>
            {
                using (new RecordUndoScope("Remove Target Bundle Options", node, true))
                {
                    if (enabled)
                    {
                        _enabledPerPlatformOptions[editor.CurrentEditingGroup] = _enabledPerPlatformOptions.DefaultValue;
                        _workingOption[editor.CurrentEditingGroup]             = _workingOption.DefaultValue;
                        _filterString[editor.CurrentEditingGroup] = _filterString.DefaultValue;
                    }
                    else
                    {
                        _enabledPerPlatformOptions.Remove(editor.CurrentEditingGroup);
                        _workingOption.Remove(editor.CurrentEditingGroup);
                        _filterString.Remove(editor.CurrentEditingGroup);
                    }

                    onValueChanged();
                }
            });

            using (disabledScope)
            {
                WorkOption opt       = (WorkOption)_workingOption[editor.CurrentEditingGroup];
                var        newOption = (WorkOption)EditorGUILayout.EnumPopup("Mode:", opt);
                if (newOption != opt)
                {
                    using (new RecordUndoScope("Change node mode", node, true))
                    {
                        _workingOption[editor.CurrentEditingGroup] = (int)newOption;
                        onValueChanged();
                    }
                }

                if (opt == WorkOption.RemoveByAssetPathContains ||
                    opt == WorkOption.RemoveByAssetPathStarts ||
                    opt == WorkOption.RemoveByAssetNameContains ||
                    opt == WorkOption.RemoveByAssetNameStarts)
                {
                    GUILayout.Space(8f);

                    var curRegexValue = _filterString[editor.CurrentEditingGroup];
                    EditorGUILayout.LabelField("Conditions, separated by new line:");

                    var newRegexValue = EditorGUILayout.TextArea(curRegexValue);

                    if (newRegexValue != curRegexValue)
                    {
                        using (new RecordUndoScope("Change Regex", node, true))
                        {
                            _filterString[editor.CurrentEditingGroup] = newRegexValue;
                            onValueChanged();
                        }
                    }
                }
            }
        }
    }
Example #5
0
    public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged)
    {
        if (_enabledOptions == null)
        {
            return;
        }

        EditorGUILayout.HelpBox("Сохраняет конфигурацию бандлей в json", MessageType.Info);
        editor.UpdateNodeName(node);

        GUILayout.Space(10f);

        //Show target configuration tab
        editor.DrawPlatformSelector(node);
        using (new EditorGUILayout.VerticalScope(GUI.skin.box))
        {
            var disabledScope = editor.DrawOverrideTargetToggle(node, _enabledOptions.ContainsValueOf(editor.CurrentEditingGroup), (bool enabled) =>
            {
                using (new RecordUndoScope("Remove Target Bundle Options", node, true))
                {
                    if (enabled)
                    {
                        _enabledOptions[editor.CurrentEditingGroup] = _enabledOptions.DefaultValue;
                        _inputDir[editor.CurrentEditingGroup]       = _inputDir.DefaultValue;
                        _inputOption[editor.CurrentEditingGroup]    = _inputOption.DefaultValue;
                        _fileName[editor.CurrentEditingGroup]       = _fileName.DefaultValue;
                    }
                    else
                    {
                        _enabledOptions.Remove(editor.CurrentEditingGroup);
                        _inputDir.Remove(editor.CurrentEditingGroup);
                        _inputOption.Remove(editor.CurrentEditingGroup);
                        _fileName.Remove(editor.CurrentEditingGroup);
                    }

                    onValueChanged();
                }
            });

            using (disabledScope)
            {
                SaveBundlesConfigurationNode.OutputOption opt = (SaveBundlesConfigurationNode.OutputOption)_inputOption[editor.CurrentEditingGroup];
                var newOption = (SaveBundlesConfigurationNode.OutputOption)EditorGUILayout.EnumPopup("Output Option", opt);
                if (newOption != opt)
                {
                    using (new RecordUndoScope("Change Output Option", node, true))
                    {
                        _inputOption[editor.CurrentEditingGroup] = (int)newOption;
                        onValueChanged();
                    }
                }

                using (new EditorGUI.DisabledScope(opt == SaveBundlesConfigurationNode.OutputOption.BuildInCacheDirectory))
                {
                    var newDirPath = editor.DrawFolderSelector("Output Directory", "Select Output Folder",
                                                               _inputDir[editor.CurrentEditingGroup],
                                                               Application.dataPath + "/../",
                                                               (string folderSelected) =>
                    {
                        var projectPath = Directory.GetParent(Application.dataPath).ToString();

                        if (projectPath == folderSelected)
                        {
                            folderSelected = string.Empty;
                        }
                        else
                        {
                            var index = folderSelected.IndexOf(projectPath);
                            if (index >= 0)
                            {
                                folderSelected = folderSelected.Substring(projectPath.Length + index);
                                if (folderSelected.IndexOf('/') == 0)
                                {
                                    folderSelected = folderSelected.Substring(1);
                                }
                            }
                        }

                        return(folderSelected);
                    }
                                                               );
                    if (newDirPath != _inputDir[editor.CurrentEditingGroup])
                    {
                        using (new RecordUndoScope("Change Output Directory", node, true))
                        {
                            _inputDir[editor.CurrentEditingGroup] = newDirPath;
                            onValueChanged();
                        }
                    }

                    var outputDir = PrepareOutputDirectory(BuildTargetUtility.GroupToTarget(editor.CurrentEditingGroup), node.Data, false);

                    if (opt == SaveBundlesConfigurationNode.OutputOption.ErrorIfNoOutputDirectoryFound &&
                        editor.CurrentEditingGroup != BuildTargetGroup.Unknown &&
                        !string.IsNullOrEmpty(_inputDir[editor.CurrentEditingGroup]) &&
                        !Directory.Exists(outputDir))
                    {
                        using (new EditorGUILayout.HorizontalScope())
                        {
                            EditorGUILayout.LabelField(outputDir + " does not exist.");
                            if (GUILayout.Button("Create directory"))
                            {
                                Directory.CreateDirectory(outputDir);
                            }
                        }

                        EditorGUILayout.Space();

                        string parentDir = Path.GetDirectoryName(_inputDir[editor.CurrentEditingGroup]);
                        if (Directory.Exists(parentDir))
                        {
                            EditorGUILayout.LabelField("Available Directories:");
                            string[] dirs = Directory.GetDirectories(parentDir);
                            foreach (string s in dirs)
                            {
                                EditorGUILayout.LabelField(s);
                            }
                        }

                        EditorGUILayout.Space();
                    }

                    using (new EditorGUI.DisabledScope(!Directory.Exists(outputDir)))
                    {
                        using (new EditorGUILayout.HorizontalScope())
                        {
                            GUILayout.FlexibleSpace();
#if UNITY_EDITOR_OSX
                            string buttonName = "Reveal in Finder";
#else
                            string buttonName = "Show in Explorer";
#endif
                            if (GUILayout.Button(buttonName))
                            {
                                EditorUtility.RevealInFinder(outputDir);
                            }
                        }
                    }

                    EditorGUILayout.HelpBox("You can use '{Platform}' variable for Output Directory path to include platform name.", MessageType.Info);
                }

                GUILayout.Space(8f);

                var fileName    = _fileName[editor.CurrentEditingGroup];
                var newFileName = EditorGUILayout.TextField("File Name", fileName);
                if (newFileName != fileName)
                {
                    using (new RecordUndoScope("Change File Name", node, true))
                    {
                        _fileName[editor.CurrentEditingGroup] = newFileName;
                        onValueChanged();
                    }
                }
            }
        }
    }
Example #6
0
        public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged)
        {
            if (m_groupSizeByte == null)
            {
                return;
            }

            EditorGUILayout.HelpBox("Grouping by size: Create group of assets by size.", MessageType.Info);
            editor.UpdateNodeName(node);

            GUILayout.Space(10f);

            //Show target configuration tab
            editor.DrawPlatformSelector(node);
            using (new EditorGUILayout.VerticalScope(GUI.skin.box))
            {
                var disabledScope = editor.DrawOverrideTargetToggle(node, m_groupSizeByte.ContainsValueOf(editor.CurrentEditingGroup), (bool enabled) =>
                {
                    using (new RecordUndoScope("Remove Target Grouping Size Settings", node, true))
                    {
                        if (enabled)
                        {
                            m_groupSizeByte[editor.CurrentEditingGroup] = m_groupSizeByte.DefaultValue;
                            m_groupingType[editor.CurrentEditingGroup]  = m_groupingType.DefaultValue;
                        }
                        else
                        {
                            m_groupSizeByte.Remove(editor.CurrentEditingGroup);
                            m_groupingType.Remove(editor.CurrentEditingGroup);
                        }
                        onValueChanged();
                    }
                });
                EditorGUI.BeginDisabledGroup(disabledScope);
                #region DisableGroup
                var newType = (GroupingType)EditorGUILayout.EnumPopup("Grouping Type", (GroupingType)m_groupingType[editor.CurrentEditingGroup]);
                if (newType != (GroupingType)m_groupingType[editor.CurrentEditingGroup])
                {
                    using (new RecordUndoScope("Change Grouping Type", node, true))
                    {
                        m_groupingType[editor.CurrentEditingGroup] = (int)newType;
                        onValueChanged();
                    }
                }

                var newSizeText = EditorGUILayout.TextField("Size(KB)", m_groupSizeByte[editor.CurrentEditingGroup].ToString());
                int newSize     = 0;
                Int32.TryParse(newSizeText, out newSize);

                if (newSize != m_groupSizeByte[editor.CurrentEditingGroup])
                {
                    using (new RecordUndoScope("Change Grouping Size", node, true))
                    {
                        m_groupSizeByte[editor.CurrentEditingGroup] = newSize;
                        onValueChanged();
                    }
                }
                #endregion
                EditorGUI.EndDisabledGroup();
            }
        }