예제 #1
0
        protected override void CustomOnGUI()
        {
            EditorUIHelper.Button("搜索 Project", FindAllAssets);

            EditorUIHelper.Space();
            EditorUIHelper.Button("搜索当前场景", FindCurrentScene);
        }
예제 #2
0
 protected override void CustomOnGUI()
 {
     EditorUIHelper.Button("显示内置资源", () =>
     {
         SelectingEditorWindow.Show(EditorAssetHelper.BuiltinAssets);
     });
 }
예제 #3
0
        protected override void CustomOnGUI()
        {
            EditorUIHelper.Space();
            _srcTrans = EditorUIHelper.ObjectField <Transform>(_srcTrans, "来源对象", true);
            _dstTrans = EditorUIHelper.ObjectField <Transform>(_dstTrans, "目标对象", true);

            EditorUIHelper.Space();
            EditorUIHelper.Button("替换Components", ReplaceComponents);
        }
예제 #4
0
 protected override void CustomOnGUI()
 {
     foreach (var monoScript in ScriptList)
     {
         EditorUIHelper.BeginHorizontal();
         EditorUIHelper.ObjectField(monoScript);
         EditorUIHelper.Button("创建", () => CreateScriptObject(monoScript));
         EditorUIHelper.EndHorizontal();
         EditorUIHelper.Space();
     }
 }
예제 #5
0
        protected override void CustomOnGUI()
        {
            EditorUIHelper.TextArea("还有一种方式就是创建一个Reflection Probe,然后利用Lighting Bake出来一个Cubemap");

            EditorUIHelper.Space();
            _camera  = EditorUIHelper.ObjectField <Camera>(_camera, "摄像机", true);
            _cubemap = EditorUIHelper.ObjectField <Cubemap>(_cubemap, "Cubemap", true);
            _probe   = EditorUIHelper.ObjectField <ReflectionProbe>(_probe, "ReflectionProbe", true);

            EditorUIHelper.Space();
            EditorUIHelper.Button("生成Legacy", GenerateLegacyCubemap);
            EditorUIHelper.Button("生成", GenerateCubemap);
        }
예제 #6
0
        protected override void CustomOnGUI()
        {
            EditorUIHelper.Space();
            EditorUIHelper.LabelField("只有代码相关的会重新序列化,材质球不会,但是材质球也会更新serializedVersion!");

            EditorUIHelper.Space();
            EditorUIHelper.Button("更新被依赖的资源", UpdateSelectionsDependencies);

            EditorUIHelper.Space();
            EditorUIHelper.Button("更新依赖的资源", UpdateSelectionsRevertDependencies);

            EditorUIHelper.Space();
            EditorUIHelper.Button("更新选中的文件夹", UpdateSelectionsFolder);
        }
예제 #7
0
        protected override void CustomOnGUI()
        {
            EditorUIHelper.BeginHorizontal();
            {
                _curModelType = EditorUIHelper.EnumPopup <ModelType>(_curModelType);
                if (GUI.changed)
                {
                    Refresh();
                }

                EditorUIHelper.Button("刷新", Refresh);
            }
            EditorUIHelper.EndHorizontal();

            EditorUIHelper.Space();
            _search = EditorUIHelper.SearchCancelTextField(_search);

            EditorUIHelper.Space();
            _scroll = EditorUIHelper.BeginScrollView(_scroll);
            {
                for (int i = 0; i < _models.Count; i++)
                {
                    var importer = _modelImporters[i];
                    var model    = _models[i];

                    if (!string.IsNullOrEmpty(_search))
                    {
                        if (!model.name.Contains(_search))
                        {
                            continue;
                        }
                    }

                    EditorUIHelper.DrawLine();
                    EditorUIHelper.BeginHorizontal();
                    {
                        EditorUIHelper.ObjectField(model);
                        EditorUIHelper.Toggle("绑点优化状态",
                                              importer.animationType == ModelImporterAnimationType.Generic &&
                                              importer.optimizeGameObjects);
                        EditorUIHelper.Button("优化绑点", () => EditorHelper.Run(() => ModelOptimizeHelper.OptimizeGameObject(importer)));
                        EditorUIHelper.Button("还原绑点", () => EditorHelper.Run(() => ModelOptimizeHelper.RevertOptimizeGameObject(importer)));
                    }
                    EditorUIHelper.EndHorizontal();
                }
            }
            EditorUIHelper.EndScrollView();
        }
예제 #8
0
 public virtual void ShowResult()
 {
     foreach (var sickAsset in _sickAssets)
     {
         EditorUIHelper.BeginHorizontal();
         {
             EditorUIHelper.ObjectField(sickAsset);
             EditorUIHelper.Space();
             EditorUIHelper.Button("修正", () =>
             {
                 IsSickAsset(sickAsset, true);
             });
         }
         EditorUIHelper.EndHorizontal();
     }
 }
예제 #9
0
        protected override void CustomOnGUI()
        {
            if (_msg != null)
            {
                EditorUIHelper.TitleField(_msg);
                EditorUIHelper.Space();
            }

            _search       = EditorUIHelper.SearchCancelTextField(_search);
            _searchFilter = EditorUIHelper.EnumPopup <EditorAssetHelper.SearchFilter>(_searchFilter, "SearchFilter");
            EditorUIHelper.TitleField("数量:", (_goList != null ? _goList.Count : 0).ToString());

            EditorUIHelper.Space();
            _ListScroll = EditorUIHelper.BeginScrollView(_ListScroll);
            {
                var count      = _goList != null ? _goList.Count : 0;
                var needSearch = !string.IsNullOrEmpty(_search);
                for (int i = 0; i < count; i++)
                {
                    var go = _goList[i];
                    if (needSearch && !go.name.Contains(_search))
                    {
                        continue;
                    }

                    if (!EditorAssetHelper.IsMatch(go, _searchFilter))
                    {
                        continue;
                    }

                    EditorUIHelper.DrawLine();
                    EditorUIHelper.BeginHorizontal();
                    {
                        EditorUIHelper.ObjectField(go, null, string.Empty, true);
                        EditorUIHelper.Button("选中", () => EditorAssetHelper.SelectObject(go));
                        var index = i;
                        EditorUIHelper.Button("移除", () => RemoveGo(index));
                    }
                    EditorUIHelper.EndHorizontal();
                }
            }
            EditorUIHelper.EndScrollView();
        }
예제 #10
0
        protected override void CustomOnGUI()
        {
            _searchObject = EditorUIHelper.ObjectField(_searchObject, typeof(Object), "搜索:", true);

            EditorUIHelper.Space();
            EditorUIHelper.Button("获取引用(非内置)", ShowDependences);

            EditorUIHelper.Space();
            EditorUIHelper.Button("反向引用(非内置)", ShowReverseDependences);

            EditorUIHelper.Space();
            EditorUIHelper.Button("获取引用", CollectDependences);

            EditorUIHelper.Space();
            EditorUIHelper.Button("反向引用", CollectReverseDependences);

            EditorUIHelper.Space();
            EditorUIHelper.Button("内置引用", ShowBuiltinDependences);
        }
예제 #11
0
        protected override void CustomOnGUI()
        {
            _mat         = EditorUIHelper.ObjectField <Material>(_mat, "替换材质球");
            _addMat      = EditorUIHelper.ObjectField <Material>(_addMat, "替换材质球");
            _lod         = EditorUIHelper.IntSlider("LOD", _lod, 0, 5);
            _splitCount  = EditorUIHelper.IntSlider("分割块数,4^n", _splitCount, 0, 5);
            _indexFormat = EditorUIHelper.EnumPopup <IndexFormat>(_indexFormat);

            EditorUIHelper.Space();
            EditorUIHelper.LabelField("使用 UInt16,1025的高度图设置,得分割3次才能满足顶点数限制");

            EditorUIHelper.Space();
            EditorUIHelper.Button("ExportSplatmaps", ExportSplatmaps);

            EditorUIHelper.Space();
            EditorUIHelper.Button("Terrain2Mesh", ConvertTerrain2Mesh);

            EditorUIHelper.Space();
            EditorUIHelper.Button("SaveMeshes", SaveMeshes);
        }
예제 #12
0
        protected override void CustomOnGUI()
        {
            _searchText = EditorUIHelper.SearchCancelTextField(_searchText);

            EditorUIHelper.Space();
            EditorUIHelper.Button("InstanceID", () =>
            {
                int id;
                if (int.TryParse(_searchText, out id))
                {
                    EditorAssetHelper.SelectObject(EditorUtility.InstanceIDToObject(id));
                }
            });


            EditorUIHelper.Space();
            EditorUIHelper.Button("GUID", () =>
            {
                EditorAssetHelper.SelectObject(EditorAssetHelper.GUIDToObject(_searchText));
            });
        }
예제 #13
0
        private void ShowAssets()
        {
            if (_assetPaths == null)
            {
                _assetPaths = Operator.GetAssetPaths();
                if (!string.IsNullOrEmpty(_searchText))
                {
                    _assetPaths = _assetPaths.Where(s => s.Contains(_searchText)).ToList();
                }
            }

            var count = _assetPaths.Count;

            for (int i = 0; i < count; i++)
            {
                EditorUIHelper.Space(0.1f);
                EditorUIHelper.BeginSelectdColor(_selectedObjIndex == i);
                {
                    EditorUIHelper.BeginHorizontal(EditorUIHelper.TextAreaStyle);
                    {
                        var path = _assetPaths[i];

                        var i1 = i;
                        EditorUIHelper.Button(path, () =>
                        {
                            EditorAssetHelper.SelectObject(AssetDatabase.LoadMainAssetAtPath(path));
                            _selectedObjIndex = i1;
                        }, EditorUIHelper.TextFieldStyle);
                    }
                    EditorUIHelper.EndHorizontal();
                }
                EditorUIHelper.EndSelectedColor();
            }

            if (_selectedObjIndex >= 0)
            {
                ShowSettingPanel(Operator.GetImporterSetting(_assetPaths[_selectedObjIndex]));
            }
        }
예제 #14
0
        private static void PreferenceOnGUI()
        {
            EditorUIHelper.BeginHorizontal();
            {
                EditorUIHelper.Button("读取", () =>
                {
                    _externalSo = null;
                });

                EditorUIHelper.Button("保存", SaveScriptableObject);

                EditorUIHelper.Button("增加", () =>
                {
                    ExternalSo.ToolList.Add(new ExternalScriptableObject.ExternalTool());
                });
            }
            EditorUIHelper.EndHorizontal();

            _scroll = EditorUIHelper.BeginScrollView(_scroll);
            {
                foreach (var externalTool in ExternalSo.ToolList)
                {
                    EditorUIHelper.Space();
                    externalTool.ToolPath = EditorUIHelper.TextField("路径:", externalTool.ToolPath);

                    externalTool.Extension = EditorUIHelper.TextField("后缀:", externalTool.Extension);

                    var tool = externalTool;
                    EditorUIHelper.Button("删", () =>
                    {
                        EditorApplication.delayCall += () =>
                        {
                            ExternalSo.ToolList.Remove(tool);
                        };
                    });
                }
            }
            EditorUIHelper.EndScrollView();
        }
예제 #15
0
        protected override void CustomOnGUI()
        {
            _curAnalyzerIndex = EditorUIHelper.Popup("选择分析器:", _curAnalyzerIndex, AssetAnalyzerStrs);

            EditorUIHelper.Space();
            EditorUIHelper.Button("搜索", () =>
            {
                CurAnalyzer.Analyse(Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.DeepAssets));
            });

            EditorUIHelper.Space();
            EditorUIHelper.Button("修正全部", () =>
            {
                CurAnalyzer.CorrectAll();
            });

            EditorUIHelper.Space();
            _analyzerScroll = EditorUIHelper.BeginScrollView(_analyzerScroll);
            {
                CurAnalyzer.ShowResult();
            }
            EditorUIHelper.EndScrollView();
        }
예제 #16
0
        protected override void CustomOnGUI()
        {
            EditorUIHelper.BeginHorizontal();
            {
                _searchType = EditorUIHelper.SearchCancelTextField(_searchType);
                EditorUIHelper.Button("Caculate", Calculate);
                EditorUIHelper.Button("CaculateAll", CaulateAll);
            }
            EditorUIHelper.EndHorizontal();

            _scroll = EditorUIHelper.BeginScrollView(_scroll);
            {
                foreach (var keyValue in _monoFieldDict)
                {
                    EditorUIHelper.DrawLine();
                    EditorUIHelper.TextField("Type:", keyValue.Key);

                    foreach (var method in keyValue.Value)
                    {
                        EditorUIHelper.TextField("Field:", method);
                    }
                }

                EditorUIHelper.Space();
                foreach (var keyValue in _monoMethodDict)
                {
                    EditorUIHelper.DrawLine();
                    EditorUIHelper.TextField("Type:", keyValue.Key);

                    foreach (var method in keyValue.Value)
                    {
                        EditorUIHelper.TextField("Method:", method);
                    }
                }
            }
            EditorUIHelper.EndScrollView();
        }
예제 #17
0
        protected override void CustomOnGUI()
        {
            _maxHits           = EditorUIHelper.IntSlider("射线最多碰撞次数(检测叠层的时候才需要)", _maxHits, MinHitNums, MaxHitNums);
            _checkLayerMask    = EditorUIHelper.LayerMask(_checkLayerMask, "检测层(涉及层)");
            _generateLayerMask = EditorUIHelper.LayerMask(_generateLayerMask, "生成层(某些层的内外围)");

            EditorUIHelper.Space();
            _calculateType = EditorUIHelper.EnumPopup <SceneInfoCalculation.CalculateType>(_calculateType, "筛选条件(如内外围)");
            _minRange      = EditorUIHelper.IntSlider("边界最近距离(-1代表全部)", _minRange, MinRange, MaxRange);
            _maxRange      = EditorUIHelper.IntSlider("影响最远距离(-1代表全部)", _maxRange, MinRange, MaxRange);

            EditorUIHelper.Space();
            EditorUIHelper.Button("刷新", Refresh);

            EditorUIHelper.Space();
            EditorUIHelper.ObjectField <Texture>(_previewTexture, "预览");

            EditorUIHelper.Space();
            _noise          = EditorUIHelper.Vector4Field("noise偏移及缩放", _noise);
            _noiseThreshold = EditorUIHelper.Slider("noise阈值", _noiseThreshold, 0, 1);
            EditorUIHelper.Button("叠加噪声图", CompositionNoise);

            EditorUIHelper.Space();
            EditorUIHelper.ObjectField <Texture>(_finalTexture, "叠加噪声图之后");

            EditorUIHelper.Space();
            _parent      = EditorUIHelper.ObjectField <Transform>(_parent, "父节点", true);
            _clearParent = EditorUIHelper.Toggle("清理父节点", _clearParent);
            _space       = EditorUIHelper.IntSlider("间隔(密度)", _space, MinSpace, MaxSpace);

            EditorUIHelper.Space();
            EditorUIHelper.BeginScrollView(_scenePrefabScrollPos);

            var deletePrefabIndex = -1;

            for (int i = 0; i < _scenePrefabs.Count; i++)
            {
                var scenePrefab = _scenePrefabs[i];

                EditorUIHelper.BeginHorizontal();
                scenePrefab.Prefab = EditorUIHelper.ObjectField <GameObject>(scenePrefab.Prefab);
                scenePrefab.Weight = EditorUIHelper.IntSlider("权重", scenePrefab.Weight, MinWeight, MaxWeight);

                var i1 = i;
                EditorUIHelper.Button("删除", () =>
                {
                    deletePrefabIndex = i1;
                });
                EditorUIHelper.EndHorizontal();

                EditorUIHelper.BeginHorizontal();
                scenePrefab.MinScale = EditorUIHelper.Slider("缩放随机最小值", scenePrefab.MinScale, MinScale, MaxScale);
                scenePrefab.MaxScale = EditorUIHelper.Slider("缩放随机最大值", scenePrefab.MaxScale, MinScale, MaxScale);
                EditorUIHelper.EndHorizontal();

                EditorUIHelper.Space();
            }
            if (deletePrefabIndex >= 0)
            {
                _scenePrefabs.RemoveAt(deletePrefabIndex);
            }

            EditorUIHelper.Button("添加", () => _scenePrefabs.Add(new ScenePrefab()));

            EditorUIHelper.EndScrollView();

            EditorUIHelper.Space();
            EditorUIHelper.Button("生成", Generate);
        }
예제 #18
0
        public override void OnInspectorGUI()
        {
            if (_grid.HexMat == null)
            {
                LoadMaterial();
            }
            _grid.HexMat = EditorUIHelper.ObjectField <Material>(_grid.HexMat, "材质球");

            _grid.Data = EditorUIHelper.ObjectField <HexGridData>(_grid.Data, "数据");
            var gridData = _grid.Data;

            if (gridData == null)
            {
                EditorUIHelper.Space();
                EditorUIHelper.Button("创建数据", CreateHexGridData);
            }
            else
            {
                gridData.width  = EditorUIHelper.Slider("宽度", gridData.width, 0, 1000);
                gridData.height = EditorUIHelper.Slider("高度", gridData.height, 0, 1000);
                gridData.size   = EditorUIHelper.Slider("六边形边长", gridData.size, 0, 10);
                EditorUIHelper.Button("更新HexGrid", UpdateHexGrid);

                _grid.BorderColor = EditorUIHelper.ColorField(_grid.BorderColor, "边界颜色");
                EditorUIHelper.PropertyField(serializedObject, "Renderer", "网格颜色");
                _grid.ShowScope = EditorUIHelper.Toggle("显示边界", _grid.ShowScope);
                _grid.ShowGrid  = EditorUIHelper.Toggle("显示网格", _grid.ShowGrid);
            }

            EditorUIHelper.Space();
            _grid.BrushData = EditorUIHelper.ObjectField <BrushData>(_grid.BrushData, "笔刷");
            var brushData = _grid.BrushData;

            if (brushData == null)
            {
                EditorUIHelper.Space();
                EditorUIHelper.Button("创建笔刷", CreateBrushData);
            }
            else
            {
                EditorUIHelper.Button("编辑笔刷", () => BrushDataEditorWindow.Open(brushData));

                EditorUIHelper.Space();
                _brushType = EditorUIHelper.EnumPopup <BrushData.BrushType>(_brushType, "笔刷类型");

                if (_brushType != BrushData.BrushType.None)
                {
                    if (brushData.pathBrushes.Count > 0)
                    {
                        _curBrush = EditorUIHelper.Popup("刷路", _curBrush,
                                                         brushData.pathBrushes.Select(brush => brush.name).ToArray());
                    }

                    _brushFeature.brushOptionType = EditorUIHelper.EnumPopup <BrushFeature.BrushOptionType>(_brushFeature.brushOptionType);
                    _brushFeature.brushRange      = EditorUIHelper.IntSlider("笔刷大小", _brushFeature.brushRange, 0, 10);
                }
            }

            if (EditorUIHelper.Changed)
            {
                serializedObject.ApplyModifiedProperties();
                EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
                if (gridData != null)
                {
                    EditorUtility.SetDirty(gridData);
                }
            }
        }