コード例 #1
0
        internal void DrawNodeGUI(NodeGUIEditor nodeGUIEditor)
        {
            //JudgeName();
            EditorGUI.BeginChangeCheck();
            if (nodeDataDrawer != null)
            {
                nodeDataDrawer.OnInspectorGUI(this);
            }
            if (EditorGUI.EndChangeCheck())
            {
                if (Controller != null)
                {
                    Controller.Validate(this);
                    Controller.Perform();
                }

                EditorUtility.SetDirty(Data.Object);

                NodeGUIUtility.NodeEventHandler(new NodeEvent(NodeEvent.EventType.EVENT_NODE_UPDATED, this, Event.current.mousePosition, null));

                if (ParentGraph)
                {
                    EditorUtility.SetDirty(ParentGraph);
                }
            }
        }
コード例 #2
0
 internal void DrawNodeGUI(NodeGUIEditor nodeGUIEditor)
 {
     //JudgeName();
     EditorGUI.BeginChangeCheck();
     if (nodeDataDrawer != null)
     {
         nodeDataDrawer.OnInspectorGUI(this);
     }
     if (EditorGUI.EndChangeCheck())
     {
         Controller.Validate(this);
         EditorUtility.SetDirty(Data.Object);
         EditorUtility.SetDirty(ParentGraph);
     }
 }
コード例 #3
0
ファイル: Loader.cs プロジェクト: Avatarchik/BridgeUI
        public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged)
        {
            if (m_loadPath == null)
            {
                return;
            }

            EditorGUILayout.HelpBox("Load From Directory: Load assets from given directory path.", 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_loadPath.ContainsValueOf(editor.CurrentEditingGroup), (bool b) => {
                    using (new RecordUndoScope("Remove Target Load Path Settings", node, true)) {
                        if (b)
                        {
                            m_loadPath[editor.CurrentEditingGroup] = m_loadPath.DefaultValue;
                        }
                        else
                        {
                            m_loadPath.Remove(editor.CurrentEditingGroup);
                        }
                        onValueChanged();
                    }
                });
                #region DisableGroup
                EditorGUI.BeginDisabledGroup(disabledScope);
                var path = m_loadPath[editor.CurrentEditingGroup];
                EditorGUILayout.LabelField("Load Path:");

                string newLoadPath = null;

                newLoadPath = editor.DrawFolderSelector(Model.Settings.Path.ASSETS_PATH, "Select Asset Folder",
                                                        path,
                                                        FileUtility.PathCombine(Model.Settings.Path.ASSETS_PATH, path),
                                                        (string folderSelected) => { return(NormalizeLoadPath(folderSelected)); }
                                                        );
                if (newLoadPath != path)
                {
                    using (new RecordUndoScope("Load Path Changed", node, true)){
                        m_loadPath[editor.CurrentEditingGroup] = newLoadPath;
                        onValueChanged();
                    }
                }

                var  dirPath   = Path.Combine(Model.Settings.Path.ASSETS_PATH, newLoadPath);
                bool dirExists = Directory.Exists(dirPath);

                GUILayout.Space(10f);

                using (new EditorGUILayout.HorizontalScope()) {
                    EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(newLoadPath) || !dirExists);
                    //using(new EditorGUI.DisabledScope())
                    {
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button("Highlight in Project Window", GUILayout.Width(180f)))
                        {
                            // trailing is "/" not good for LoadMainAssetAtPath
                            if (dirPath[dirPath.Length - 1] == '/')
                            {
                                dirPath = dirPath.Substring(0, dirPath.Length - 1);
                            }
                            var obj = AssetDatabase.LoadMainAssetAtPath(dirPath);
                            EditorGUIUtility.PingObject(obj);
                        }
                    }
                    EditorGUI.EndDisabledGroup();
                }

                if (!dirExists)
                {
                    var  parentDirPath   = Path.GetDirectoryName(dirPath);
                    bool parentDirExists = Directory.Exists(parentDirPath);
                    if (parentDirExists)
                    {
                        EditorGUILayout.LabelField("Available Directories:");
                        string[] dirs = Directory.GetDirectories(parentDirPath);
                        foreach (string s in dirs)
                        {
                            EditorGUILayout.LabelField(s);
                        }
                    }
                }

                #endregion
                EditorGUI.EndDisabledGroup();
            }
        }
コード例 #4
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();
            }
        }
コード例 #5
0
ファイル: Grouping.cs プロジェクト: Avatarchik/BridgeUI
        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();
        }
コード例 #6
0
        public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged)
        {
            if (m_bundleNameTemplate == null)
            {
                return;
            }

            EditorGUILayout.HelpBox("Configure Bundle From Group: Create asset bundle settings from incoming group of assets.", MessageType.Info);
            editor.UpdateNodeName(node);

            GUILayout.Space(10f);

            using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                var newUseGroupAsVariantValue = GUILayout.Toggle(m_useGroupAsVariants, "Use input group as variants");
                if (newUseGroupAsVariantValue != m_useGroupAsVariants)
                {
                    using (new RecordUndoScope("Change Bundle Config", node, true)){
                        m_useGroupAsVariants = newUseGroupAsVariantValue;

                        List <Variant> rv = new List <Variant>(m_variants);
                        foreach (var v in rv)
                        {
                            NodeGUIUtility.NodeEventHandler(
                                new NodeEvent(NodeEvent.EventType.EVENT_CONNECTIONPOINT_DELETED, node, Vector2.zero, GetConnectionPoint(node.Data, v)));
                            RemoveVariant(node.Data, v);
                        }
                        onValueChanged();
                    }
                }
                EditorGUI.BeginDisabledGroup(newUseGroupAsVariantValue);
                #region DisableGroup
                //using (new EditorGUI.DisabledScope(newUseGroupAsVariantValue)) {
                GUILayout.Label("Variants:");
                var     variantNames = m_variants.Select(v => v.Name).ToList();
                Variant removing     = null;
                foreach (var v in m_variants)
                {
                    using (new GUILayout.HorizontalScope()) {
                        if (GUILayout.Button("-", GUILayout.Width(30)))
                        {
                            removing = v;
                        }
                        else
                        {
                            GUIStyle s             = new GUIStyle((GUIStyle)"TextFieldDropDownText");
                            Action   makeStyleBold = () => {
                                s.fontStyle = FontStyle.Bold;
                                s.fontSize  = 12;
                            };

                            ValidateVariantName(v.Name, variantNames,
                                                makeStyleBold,
                                                makeStyleBold,
                                                makeStyleBold);

                            var variantName = EditorGUILayout.TextField(v.Name, s);

                            if (variantName != v.Name)
                            {
                                using (new RecordUndoScope("Change Variant Name", node, true)){
                                    v.Name = variantName;
                                    UpdateVariant(node.Data, v);
                                    onValueChanged();
                                }
                            }
                        }
                    }
                }
                if (GUILayout.Button("+"))
                {
                    using (new RecordUndoScope("Add Variant", node, true)){
                        if (m_variants.Count == 0)
                        {
                            NodeGUIUtility.NodeEventHandler(new NodeEvent(NodeEvent.EventType.EVENT_DELETE_ALL_CONNECTIONS_TO_POINT, node, Vector2.zero, node.Data.InputPoints[0]));
                        }
                        AddVariant(node.Data, Model.Settings.BUNDLECONFIG_VARIANTNAME_DEFAULT);
                        onValueChanged();
                    }
                }
                if (removing != null)
                {
                    using (new RecordUndoScope("Remove Variant", node, true)){
                        // event must raise to remove connection associated with point
                        NodeGUIUtility.NodeEventHandler(new NodeEvent(NodeEvent.EventType.EVENT_CONNECTIONPOINT_DELETED, node, Vector2.zero, GetConnectionPoint(node.Data, removing)));
                        RemoveVariant(node.Data, removing);
                        onValueChanged();
                    }
                }
                #endregion
                EditorGUI.EndDisabledGroup();
            }

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

                EditorGUI.BeginDisabledGroup(disabledScope);
                //using (disabledScope) {
                var bundleNameTemplate = EditorGUILayout.TextField("Bundle Name Template", m_bundleNameTemplate[editor.CurrentEditingGroup]).ToLower();

                if (bundleNameTemplate != m_bundleNameTemplate[editor.CurrentEditingGroup])
                {
                    using (new RecordUndoScope("Change Bundle Name Template", node, true)){
                        m_bundleNameTemplate[editor.CurrentEditingGroup] = bundleNameTemplate;
                        onValueChanged();
                    }
                }
                //}
                EditorGUI.EndDisabledGroup();
            }
        }
コード例 #7
0
ファイル: ImportSetting.cs プロジェクト: Avatarchik/BridgeUI
        //public override bool OnAssetsReimported(
        //	Model.NodeData nodeData,
        //	AssetReferenceStreamManager streamManager,
        //	BuildTarget target,
        //	string[] importedAssets,
        //	string[] deletedAssets,
        //	string[] movedAssets,
        //	string[] movedFromAssetPaths)
        //{
        //          var samplingDirectoryPath = FileUtility.PathCombine(Model.Settings.Path.ImporterSettingsPath, nodeData.Id);

        //	foreach(var imported in importedAssets) {
        //		if(imported.StartsWith(samplingDirectoryPath)) {
        //			return true;
        //		}
        //	}

        //	return false;
        //}

        public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged)
        {
            EditorGUILayout.HelpBox("Overwrite Import Setting: Overwrite import settings of incoming assets.", MessageType.Info);
            editor.UpdateNodeName(node);

            GUILayout.Space(10f);

            // prevent inspector flicking by new Editor changing active selction
            node.SetActive(true);

            /*
             *      importer node has no platform key.
             *      platform key is contained by Unity's importer inspector itself.
             */
            using (new EditorGUILayout.VerticalScope()) {
                Type incomingType = TypeUtility.FindFirstIncomingAssetType(streamManager, node.Data.InputPoints[0]);
                ImportSetting.ConfigStatus status =
                    ImportSetting.GetConfigStatus(node.Data);

                if (incomingType == null)
                {
                    // try to retrieve incoming type from configuration
                    if (status == ImportSetting.ConfigStatus.GoodSampleFound)
                    {
                        incomingType = GetReferenceAssetImporter(node.Data, false).GetType();
                    }
                    else
                    {
                        using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                            EditorGUILayout.HelpBox("Import setting type can be set by incoming asset, or you can specify by selecting.", MessageType.Info);
                            using (new EditorGUILayout.HorizontalScope()) {
                                EditorGUILayout.LabelField("Importer Type");
                                if (GUILayout.Button("", "Popup", GUILayout.MinWidth(150f)))
                                {
                                    var menu = new GenericMenu();

                                    for (var i = 0; i < s_importerTypeList.Length; i++)
                                    {
                                        var index = i;
                                        menu.AddItem(
                                            new GUIContent(s_importerTypeList [i]),
                                            false,
                                            () => {
                                            ResetConfig(node.Data);
                                            var configFilePath = FileUtility.GetImportSettingTemplateFilePath(s_importerTypeList [index]);
                                            SaveSampleFile(node.Data, configFilePath);
                                        }
                                            );
                                    }
                                    menu.ShowAsContext();
                                }
                            }
                        }
                        return;
                    }
                }

                switch (status)
                {
                case ImportSetting.ConfigStatus.NoSampleFound:
                    // ImportSetting.Setup() must run to grab another sample to configure.
                    EditorGUILayout.HelpBox("Press Refresh to configure.", MessageType.Info);
                    node.Data.NeedsRevisit = true;
                    break;

                case ImportSetting.ConfigStatus.GoodSampleFound:
                    if (m_importerEditor == null)
                    {
                        var importer = GetReferenceAssetImporter(node.Data, true);
                        if (importer != null)
                        {
                            m_importerEditor = Editor.CreateEditor(importer);
                        }
                    }

                    // Custom Sprite Packing Tag
                    if (incomingType == typeof(UnityEditor.TextureImporter))
                    {
                        using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                            m_overwritePackingTag = EditorGUILayout.ToggleLeft("Configure Sprite Packing Tag", m_overwritePackingTag);

                            if (m_overwritePackingTag)
                            {
                                var val = m_spritePackingTagNameTemplate [editor.CurrentEditingGroup];

                                var newValue = EditorGUILayout.TextField("Packing Tag", val);
                                if (newValue != val)
                                {
                                    using (new RecordUndoScope("Change Packing Tag", node, true)) {
                                        m_spritePackingTagNameTemplate [editor.CurrentEditingGroup] = newValue;
                                        onValueChanged();
                                    }
                                }
                            }
                            EditorGUILayout.HelpBox(
                                "You can configure packing tag name with \"*\" to include group name in your sprite tag.",
                                MessageType.Info);
                        }
                        GUILayout.Space(10);
                    }

                    // Custom Sample Asset
                    using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                        var newUseCustomAsset = EditorGUILayout.ToggleLeft("Use Custom Setting Asset", m_useCustomSettingAsset);
                        if (newUseCustomAsset != m_useCustomSettingAsset)
                        {
                            using (new RecordUndoScope("Change Custom Setting Asset", node, true)) {
                                m_useCustomSettingAsset = newUseCustomAsset;
                                onValueChanged();

                                if (m_importerEditor != null)
                                {
                                    UnityEngine.Object.DestroyImmediate(m_importerEditor);
                                    m_importerEditor = null;
                                }
                            }
                        }

                        if (m_useCustomSettingAsset)
                        {
                            var assetType = GetAssetTypeFromImporterType(incomingType);
                            if (assetType != null)
                            {
                                var newObject = EditorGUILayout.ObjectField("Asset", CustomSettingAsset, assetType, false);
                                if (incomingType == typeof(ModelImporter))
                                {
                                    // disallow selecting non-model prefab
                                    if (PrefabUtility.GetPrefabType(newObject) != PrefabType.ModelPrefab)
                                    {
                                        newObject = CustomSettingAsset;
                                    }
                                }

                                if (newObject != CustomSettingAsset)
                                {
                                    using (new RecordUndoScope("Change Custom Setting Asset", node, true)) {
                                        CustomSettingAsset = newObject;
                                        onValueChanged();

                                        if (m_importerEditor != null)
                                        {
                                            UnityEngine.Object.DestroyImmediate(m_importerEditor);
                                            m_importerEditor = null;
                                        }
                                    }
                                }
                                if (CustomSettingAsset != null)
                                {
                                    using (new EditorGUILayout.HorizontalScope()) {
                                        GUILayout.FlexibleSpace();
                                        if (GUILayout.Button("Highlight in Project Window", GUILayout.Width(180f)))
                                        {
                                            EditorGUIUtility.PingObject(CustomSettingAsset);
                                        }
                                    }
                                }
                            }
                            else
                            {
                                EditorGUILayout.HelpBox(
                                    "Incoming asset type is not supported. Please fix issue first or clear the saved import setting.",
                                    MessageType.Error);
                                if (m_importerEditor != null)
                                {
                                    UnityEngine.Object.DestroyImmediate(m_importerEditor);
                                    m_importerEditor = null;
                                }
                            }
                        }
                        EditorGUILayout.HelpBox(
                            "Custom setting asset is useful when you need specific needs for setting asset; i.e. when configuring with multiple sprite mode.",
                            MessageType.Info);
                    }
                    GUILayout.Space(10);

                    if (m_importerEditor != null)
                    {
                        GUILayout.Label(string.Format("Import Setting ({0})", incomingType.Name));
                        m_importerEditor.OnInspectorGUI();
                        GUILayout.Space(40);
                    }

                    using (new EditorGUILayout.HorizontalScope(GUI.skin.box)) {
                        GUILayout.Space(4);
                        EditorGUILayout.LabelField("Clear Saved Import Setting");

                        if (GUILayout.Button("Clear"))
                        {
                            if (EditorUtility.DisplayDialog("Clear Saved Import Setting",
                                                            string.Format("Do you want to reset saved import setting for \"{0}\"? This operation is not undoable.", node.Name), "OK", "Cancel"))
                            {
                                ResetConfig(node.Data);
                            }
                        }
                    }
                    break;

                case ImportSetting.ConfigStatus.TooManySamplesFound:
                    if (GUILayout.Button("Reset Import Setting"))
                    {
                        ResetConfig(node.Data);
                    }
                    break;
                }
            }
            return;
        }
コード例 #8
0
        //public override bool OnAssetsReimported(
        //	Model.NodeData nodeData,
        //	AssetReferenceStreamManager streamManager,
        //	BuildTarget target,
        //	string[] importedAssets,
        //	string[] deletedAssets,
        //	string[] movedAssets,
        //	string[] movedFromAssetPaths)
        //{
        //	if (m_lastImportedAssetPaths == null) {
        //		m_lastImportedAssetPaths = new List<string> ();
        //	}

        //          var imported = importedAssets.Where (path => !TypeUtility.IsGraphToolSystemAsset (path));
        //          var moved = movedAssets.Where (path => !TypeUtility.IsGraphToolSystemAsset (path));

        //	if (imported.Any () || moved.Any ()) {
        //		m_lastImportedAssetPaths.Clear ();
        //		m_lastImportedAssetPaths.AddRange (imported);
        //		m_lastImportedAssetPaths.AddRange (moved);
        //	}

        //			var assetsFolderPath = Application.dataPath + Model.Settings.UNITY_FOLDER_SEPARATOR;
        //
        //			foreach (var path in importedAssets) {
        //				if (path.StartsWith (assetsFolderPath)) {
        //					m_lastImportedAssetPaths.Add( path.Replace (assetsFolderPath, Model.Settings.ASSETS_PATH) );
        //				}
        //			}
        //
        //			foreach (var path in movedAssets) {
        //				if (path.StartsWith (assetsFolderPath)) {
        //					m_lastImportedAssetPaths.Add( path.Replace (assetsFolderPath, Model.Settings.ASSETS_PATH) );
        //				}
        //			}

        //	return true;
        //}

        public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged)
        {
            EditorGUILayout.HelpBox("Last Imported Items: Load assets just imported.", MessageType.Info);
            editor.UpdateNodeName(node);
        }
コード例 #9
0
        //public override bool OnAssetsReimported(
        //	Model.NodeData nodeData,
        //	AssetReferenceStreamManager streamManager,
        //	BuildTarget target,
        //	string[] importedAssets,
        //	string[] deletedAssets,
        //	string[] movedAssets,
        //	string[] movedFromAssetPaths)
        //{
        //	return true;
        //}


        public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged)
        {
            EditorGUILayout.HelpBox("Assert Unwanted Assets In Bundle: Checks if unwanted assets are included in bundle configurations.", MessageType.Info);
            editor.UpdateNodeName(node);

            GUILayout.Space(10f);

            var newValue = (AssertionStyle)EditorGUILayout.EnumPopup("Assertion Style", m_style);

            if (newValue != m_style)
            {
                using (new RecordUndoScope("Change Assertion Style", node, true))
                {
                    m_style = newValue;
                    onValueChanged();
                }
            }

            GUILayout.Space(4f);

            //Show target configuration tab
            editor.DrawPlatformSelector(node);
            using (new EditorGUILayout.VerticalScope(GUI.skin.box))
            {
                var disabledScope = editor.DrawOverrideTargetToggle(node, m_path.ContainsValueOf(editor.CurrentEditingGroup), (bool b) =>
                {
                    using (new RecordUndoScope("Remove Target Load Path Settings", node, true))
                    {
                        if (b)
                        {
                            m_path[editor.CurrentEditingGroup] = m_path.DefaultValue;
                        }
                        else
                        {
                            m_path.Remove(editor.CurrentEditingGroup);
                        }
                        onValueChanged();
                    }
                });

                EditorGUI.BeginDisabledGroup(disabledScope);
                #region DisableScope
                //using (disabledScope) {
                var path = m_path[editor.CurrentEditingGroup];
                EditorGUILayout.LabelField("Assertion Path:");

                string newLoadPath = null;

                newLoadPath = editor.DrawFolderSelector(Model.Settings.Path.ASSETS_PATH, "Select Asset Folder",
                                                        path,
                                                        FileUtility.PathCombine(Model.Settings.Path.ASSETS_PATH, path),
                                                        (string folderSelected) =>
                {
                    var dataPath = Application.dataPath;
                    if (dataPath == folderSelected)
                    {
                        folderSelected = string.Empty;
                    }
                    else
                    {
                        var index = folderSelected.IndexOf(dataPath);
                        if (index >= 0)
                        {
                            folderSelected = folderSelected.Substring(dataPath.Length + index);
                            if (folderSelected.IndexOf('/') == 0)
                            {
                                folderSelected = folderSelected.Substring(1);
                            }
                        }
                    }
                    return(folderSelected);
                }
                                                        );

                if (newLoadPath != path)
                {
                    using (new RecordUndoScope("Path Change", node, true))
                    {
                        m_path[editor.CurrentEditingGroup] = newLoadPath;
                        onValueChanged();
                    }
                }

                var  dirPath   = Path.Combine(Model.Settings.Path.ASSETS_PATH, newLoadPath);
                bool dirExists = Directory.Exists(dirPath);

                GUILayout.Space(10f);

                using (new EditorGUILayout.HorizontalScope())
                {
                    EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(newLoadPath) || !dirExists);
                    {
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button("Highlight in Project Window", GUILayout.Width(180f)))
                        {
                            // trailing is "/" not good for LoadMainAssetAtPath
                            if (dirPath[dirPath.Length - 1] == '/')
                            {
                                dirPath = dirPath.Substring(0, dirPath.Length - 1);
                            }
                            var obj = AssetDatabase.LoadMainAssetAtPath(dirPath);
                            EditorGUIUtility.PingObject(obj);
                        }
                    }
                    EditorGUI.EndDisabledGroup();
                }
                #endregion
                EditorGUI.EndDisabledGroup();
            }
        }
コード例 #10
0
ファイル: GroupingByFile.cs プロジェクト: Avatarchik/BridgeUI
 public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged)
 {
     EditorGUILayout.HelpBox("Group By File: Create group per individual asset.", MessageType.Info);
     editor.UpdateNodeName(node);
 }
コード例 #11
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();
            }
        }
コード例 #12
0
ファイル: Label.cs プロジェクト: Avatarchik/BridgeUI
        public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged)
        {
            EditorGUILayout.HelpBox("Label Assets: Add Label to incoming assets.", MessageType.Info);
            editor.UpdateNodeName(node);

            GUILayout.Space(10f);
            using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                bool newOverwriteLabels = EditorGUILayout.ToggleLeft("Overwrite", m_overwriteLabels);
                GUILayout.Space(4f);
                if (newOverwriteLabels != m_overwriteLabels)
                {
                    using (new RecordUndoScope("Change Overwrite Label", node, true)){
                        m_overwriteLabels = newOverwriteLabels;
                        onValueChanged();
                    }
                }

                var newLabel = EditorGUILayout.TextField("Label", m_label);
                EditorGUILayout.HelpBox("You can use \",\" to specify multiple labels. You can also use \"*\" to include group name for label.", MessageType.Info);

                if (newLabel != m_label)
                {
                    using (new RecordUndoScope("Change Label", node, true)){
                        m_label = newLabel;
                        onValueChanged();
                    }
                }
            }
        }