Exemplo n.º 1
0
        private void Init()
        {
            if (this.m_PreviewUtility == null)
            {
                this.m_PreviewUtility = new PreviewRenderUtility();
            }
            if (SubstanceImporterInspector.s_Meshes[0] == null)
            {
                GameObject gameObject = (GameObject)EditorGUIUtility.LoadRequired("Previews/PreviewMaterials.fbx");
                gameObject.SetActive(false);
                IEnumerator enumerator = gameObject.transform.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        Transform  transform = (Transform)enumerator.Current;
                        MeshFilter component = transform.GetComponent <MeshFilter>();
                        string     name      = transform.name;
                        if (name == null)
                        {
                            goto IL_107;
                        }
                        if (!(name == "sphere"))
                        {
                            if (!(name == "cube"))
                            {
                                if (!(name == "cylinder"))
                                {
                                    if (!(name == "torus"))
                                    {
                                        goto IL_107;
                                    }
                                    SubstanceImporterInspector.s_Meshes[3] = component.sharedMesh;
                                }
                                else
                                {
                                    SubstanceImporterInspector.s_Meshes[2] = component.sharedMesh;
                                }
                            }
                            else
                            {
                                SubstanceImporterInspector.s_Meshes[1] = component.sharedMesh;
                            }
                        }
                        else
                        {
                            SubstanceImporterInspector.s_Meshes[0] = component.sharedMesh;
                        }
                        continue;
IL_107:
                        Debug.Log("Something is wrong, weird object found: " + transform.name);
                    }
                }
                finally
                {
                    IDisposable disposable;
                    if ((disposable = (enumerator as IDisposable)) != null)
                    {
                        disposable.Dispose();
                    }
                }
                SubstanceImporterInspector.s_MeshIcons[0]  = EditorGUIUtility.IconContent("PreMatSphere");
                SubstanceImporterInspector.s_MeshIcons[1]  = EditorGUIUtility.IconContent("PreMatCube");
                SubstanceImporterInspector.s_MeshIcons[2]  = EditorGUIUtility.IconContent("PreMatCylinder");
                SubstanceImporterInspector.s_MeshIcons[3]  = EditorGUIUtility.IconContent("PreMatTorus");
                SubstanceImporterInspector.s_LightIcons[0] = EditorGUIUtility.IconContent("PreMatLight0");
                SubstanceImporterInspector.s_LightIcons[1] = EditorGUIUtility.IconContent("PreMatLight1");
            }
        }
Exemplo n.º 2
0
            private static GUIStyle GetStyle(string name)
            {
                GUISkin gUISkin = (GUISkin)EditorGUIUtility.LoadRequired("GradientEditor.GUISkin");

                return(gUISkin.GetStyle(name));
            }
        private void Init()
        {
            if (this.m_PreviewUtility == null)
            {
                this.m_PreviewUtility = new PreviewRenderUtility();
            }
            if (!((UnityEngine.Object)SubstanceImporterInspector.s_Meshes[0] == (UnityEngine.Object)null))
            {
                return;
            }
            GameObject gameObject = (GameObject)EditorGUIUtility.LoadRequired("Previews/PreviewMaterials.fbx");

            gameObject.SetActive(false);
            foreach (Transform transform in gameObject.transform)
            {
                MeshFilter component = transform.GetComponent <MeshFilter>();
                string     name      = transform.name;
                if (name != null)
                {
                    // ISSUE: reference to a compiler-generated field
                    if (SubstanceImporterInspector.\u003C\u003Ef__switch\u0024map1A == null)
                    {
                        // ISSUE: reference to a compiler-generated field
                        SubstanceImporterInspector.\u003C\u003Ef__switch\u0024map1A = new Dictionary <string, int>(4)
                        {
                            {
                                "sphere",
                                0
                            },
                            {
                                "cube",
                                1
                            },
                            {
                                "cylinder",
                                2
                            },
                            {
                                "torus",
                                3
                            }
                        };
                    }
                    int num;
                    // ISSUE: reference to a compiler-generated field
                    if (SubstanceImporterInspector.\u003C\u003Ef__switch\u0024map1A.TryGetValue(name, out num))
                    {
                        switch (num)
                        {
                        case 0:
                            SubstanceImporterInspector.s_Meshes[0] = component.sharedMesh;
                            continue;

                        case 1:
                            SubstanceImporterInspector.s_Meshes[1] = component.sharedMesh;
                            continue;

                        case 2:
                            SubstanceImporterInspector.s_Meshes[2] = component.sharedMesh;
                            continue;

                        case 3:
                            SubstanceImporterInspector.s_Meshes[3] = component.sharedMesh;
                            continue;
                        }
                    }
                }
                Debug.Log((object)("Something is wrong, weird object found: " + transform.name));
            }
            SubstanceImporterInspector.s_MeshIcons[0]  = EditorGUIUtility.IconContent("PreMatSphere");
            SubstanceImporterInspector.s_MeshIcons[1]  = EditorGUIUtility.IconContent("PreMatCube");
            SubstanceImporterInspector.s_MeshIcons[2]  = EditorGUIUtility.IconContent("PreMatCylinder");
            SubstanceImporterInspector.s_MeshIcons[3]  = EditorGUIUtility.IconContent("PreMatTorus");
            SubstanceImporterInspector.s_LightIcons[0] = EditorGUIUtility.IconContent("PreMatLight0");
            SubstanceImporterInspector.s_LightIcons[1] = EditorGUIUtility.IconContent("PreMatLight1");
        }
Exemplo n.º 4
0
 public static void Initialize()
 {
     LookDevResources.m_ZeroAmbientProbe.Clear();
     if (LookDevResources.m_SkyboxMaterial == null)
     {
         LookDevResources.m_SkyboxMaterial = new Material(Shader.Find("Skybox/Cubemap"));
     }
     if (LookDevResources.m_ScreenQuadMesh == null)
     {
         LookDevResources.m_ScreenQuadMesh          = new Mesh();
         LookDevResources.m_ScreenQuadMesh.vertices = new Vector3[]
         {
             new Vector3(-1f, -1f, 0f),
             new Vector3(1f, 1f, 0f),
             new Vector3(1f, -1f, 0f),
             new Vector3(-1f, 1f, 0f)
         };
         LookDevResources.m_ScreenQuadMesh.triangles = new int[]
         {
             0,
             1,
             2,
             1,
             0,
             3
         };
     }
     if (LookDevResources.m_GBufferPatchMaterial == null)
     {
         LookDevResources.m_GBufferPatchMaterial = new Material(EditorGUIUtility.LoadRequired("LookDevView/GBufferWhitePatch.shader") as Shader);
         LookDevResources.m_DrawBallsMaterial    = new Material(EditorGUIUtility.LoadRequired("LookDevView/GBufferBalls.shader") as Shader);
     }
     if (LookDevResources.m_LookDevCompositing == null)
     {
         LookDevResources.m_LookDevCompositing = new Material(EditorGUIUtility.LoadRequired("LookDevView/LookDevCompositing.shader") as Shader);
     }
     if (LookDevResources.m_DeferredOverlayMaterial == null)
     {
         LookDevResources.m_DeferredOverlayMaterial = (EditorGUIUtility.LoadRequired("SceneView/SceneViewDeferredMaterial.mat") as Material);
     }
     if (LookDevResources.m_DefaultHDRI == null)
     {
         LookDevResources.m_DefaultHDRI = (EditorGUIUtility.Load("LookDevView/DefaultHDRI.exr") as Cubemap);
         if (LookDevResources.m_DefaultHDRI == null)
         {
             LookDevResources.m_DefaultHDRI = (EditorGUIUtility.Load("LookDevView/DefaultHDRI.asset") as Cubemap);
         }
     }
     if (LookDevResources.m_LookDevCubeToLatlong == null)
     {
         LookDevResources.m_LookDevCubeToLatlong = new Material(EditorGUIUtility.LoadRequired("LookDevView/LookDevCubeToLatlong.shader") as Shader);
     }
     if (LookDevResources.m_SelectionTexture == null)
     {
         LookDevResources.m_SelectionTexture = new RenderTexture(250, 125, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default);
     }
     if (LookDevResources.m_BrightestPointRT == null)
     {
         LookDevResources.m_BrightestPointRT = new RenderTexture(250, 125, 0, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Default);
     }
     if (LookDevResources.m_BrightestPointTexture == null)
     {
         LookDevResources.m_BrightestPointTexture = new Texture2D(250, 125, TextureFormat.RGBAHalf, false);
     }
 }
Exemplo n.º 5
0
 void LoadPreviewMaterials()
 {
     s_MaterialVolume = EditorGUIUtility.LoadRequired("Previews/Preview3DVolume.mat") as Material;
     s_MaterialSliced = EditorGUIUtility.LoadRequired("Previews/Preview3DSliced.mat") as Material;
     s_MaterialSDF    = EditorGUIUtility.LoadRequired("Previews/Preview3DSDF.mat") as Material;
 }
Exemplo n.º 6
0
            static Styles()
            {
                GridPaintPaletteWindow.Styles.toolContents = new GUIContent[]
                {
                    EditorGUIUtility.IconContent("Grid.Default", "|Select an area of the grid (S)"),
                    EditorGUIUtility.IconContent("Grid.MoveTool", "|Move selection with active brush (M)"),
                    EditorGUIUtility.IconContent("Grid.PaintTool", "|Paint with active brush (B)"),
                    EditorGUIUtility.IconContent("Grid.BoxTool", "|Paint a filled box with active brush (U)"),
                    EditorGUIUtility.IconContent("Grid.PickingTool", "|Pick or marquee select new brush (Ctrl/CMD)."),
                    EditorGUIUtility.IconContent("Grid.EraserTool", "|Erase with active brush (Shift)"),
                    EditorGUIUtility.IconContent("Grid.FillTool", "|Flood fill with active brush (G)")
                };
                GridPaintPaletteWindow.Styles.sceneViewEditModes = new EditMode.SceneViewEditMode[]
                {
                    EditMode.SceneViewEditMode.GridSelect,
                    EditMode.SceneViewEditMode.GridMove,
                    EditMode.SceneViewEditMode.GridPainting,
                    EditMode.SceneViewEditMode.GridBox,
                    EditMode.SceneViewEditMode.GridPicking,
                    EditMode.SceneViewEditMode.GridEraser,
                    EditMode.SceneViewEditMode.GridFloodFill
                };
                GridPaintPaletteWindow.Styles.mouseCursorOSPath = new string[]
                {
                    "",
                    "Cursors/macOS",
                    "Cursors/Windows",
                    "Cursors/Linux"
                };
                GridPaintPaletteWindow.Styles.mouseCursorOSHotspot = new Vector2[]
                {
                    Vector2.zero,
                    new Vector2(6f, 4f),
                    new Vector2(6f, 4f),
                    new Vector2(6f, 4f)
                };
                GridPaintPaletteWindow.Styles.mouseCursorTexturePaths = new string[]
                {
                    "",
                    "Grid.MoveTool.png",
                    "Grid.PaintTool.png",
                    "Grid.BoxTool.png",
                    "Grid.PickingTool.png",
                    "Grid.EraserTool.png",
                    "Grid.FillTool.png"
                };
                GridPaintPaletteWindow.Styles.emptyProjectInfo          = EditorGUIUtility.TrTextContent("Create a new palette in the dropdown above.", null, null);
                GridPaintPaletteWindow.Styles.emptyClipboardInfo        = EditorGUIUtility.TrTextContent("Drag Tile, Sprite or Sprite Texture assets here.", null, null);
                GridPaintPaletteWindow.Styles.invalidClipboardInfo      = EditorGUIUtility.TrTextContent("This is an invalid clipboard. Did you delete the clipboard asset?", null, null);
                GridPaintPaletteWindow.Styles.selectPaintTarget         = EditorGUIUtility.TrTextContent("Select Paint Target", null, null);
                GridPaintPaletteWindow.Styles.selectPalettePrefab       = EditorGUIUtility.TrTextContent("Select Palette Prefab", null, null);
                GridPaintPaletteWindow.Styles.selectTileAsset           = EditorGUIUtility.TrTextContent("Select Tile Asset", null, null);
                GridPaintPaletteWindow.Styles.unlockPaletteEditing      = EditorGUIUtility.TrTextContent("Unlock Palette Editing", null, null);
                GridPaintPaletteWindow.Styles.lockPaletteEditing        = EditorGUIUtility.TrTextContent("Lock Palette Editing", null, null);
                GridPaintPaletteWindow.Styles.createNewPalette          = EditorGUIUtility.TrTextContent("Create New Palette", null, null);
                GridPaintPaletteWindow.Styles.focusLabel                = EditorGUIUtility.TrTextContent("Focus On", null, null);
                GridPaintPaletteWindow.Styles.rendererOverlayTitleLabel = EditorGUIUtility.TrTextContent("Tilemap", null, null);
                GridPaintPaletteWindow.Styles.activeTargetLabel         = EditorGUIUtility.TrTextContent("Active Tilemap", "Specifies the currently active Tilemap used for painting in the Scene View.", null);
                GridPaintPaletteWindow.Styles.edit                = EditorGUIUtility.TrTextContent("Edit", null, null);
                GridPaintPaletteWindow.Styles.editModified        = EditorGUIUtility.TextContent("Edit*");
                GridPaintPaletteWindow.Styles.ToolbarStyle        = "preToolbar";
                GridPaintPaletteWindow.Styles.ToolbarTitleStyle   = "preToolbar";
                GridPaintPaletteWindow.Styles.mouseCursorTextures = new Texture2D[GridPaintPaletteWindow.Styles.mouseCursorTexturePaths.Length];
                int operatingSystemFamily = (int)SystemInfo.operatingSystemFamily;

                for (int i = 0; i < GridPaintPaletteWindow.Styles.mouseCursorTexturePaths.Length; i++)
                {
                    if (GridPaintPaletteWindow.Styles.mouseCursorOSPath[operatingSystemFamily] != null && GridPaintPaletteWindow.Styles.mouseCursorOSPath[operatingSystemFamily].Length > 0 && GridPaintPaletteWindow.Styles.mouseCursorTexturePaths[i] != null && GridPaintPaletteWindow.Styles.mouseCursorTexturePaths[i].Length > 0)
                    {
                        string path = Paths.Combine(new string[]
                        {
                            GridPaintPaletteWindow.Styles.mouseCursorOSPath[operatingSystemFamily],
                            GridPaintPaletteWindow.Styles.mouseCursorTexturePaths[i]
                        });
                        GridPaintPaletteWindow.Styles.mouseCursorTextures[i] = (EditorGUIUtility.LoadRequired(path) as Texture2D);
                    }
                    else
                    {
                        GridPaintPaletteWindow.Styles.mouseCursorTextures[i] = null;
                    }
                }
                GUIStyle toolbarStyle = "Command";

                GridPaintPaletteWindow.Styles.toolbarWidth = GridPaintPaletteWindow.Styles.toolContents.Sum((GUIContent x) => toolbarStyle.CalcSize(x).x);
            }
 public static void LocalizeEditorFonts()
 {
     LocalizedEditorFontManager.ReadFontSettings();
     LocalizedEditorFontManager.FontDictionary fontDictionary = LocalizedEditorFontManager.GetFontDictionary(LocalizationDatabase.currentEditorLanguage);
     if (fontDictionary != null)
     {
         LocalizedEditorFontManager.ReplaceFontForLocalization(fontDictionary, (Font)EditorGUIUtility.LoadRequired(EditorResourcesUtility.fontsPath + "Lucida Grande.ttf"));
         LocalizedEditorFontManager.ReplaceFontForLocalization(fontDictionary, (Font)EditorGUIUtility.LoadRequired(EditorResourcesUtility.fontsPath + "Lucida Grande Bold.ttf"));
         LocalizedEditorFontManager.ReplaceFontForLocalization(fontDictionary, (Font)EditorGUIUtility.LoadRequired(EditorResourcesUtility.fontsPath + "Lucida Grande Small.ttf"));
         LocalizedEditorFontManager.ReplaceFontForLocalization(fontDictionary, (Font)EditorGUIUtility.LoadRequired(EditorResourcesUtility.fontsPath + "Lucida Grande Small Bold.ttf"));
         LocalizedEditorFontManager.ReplaceFontForLocalization(fontDictionary, (Font)EditorGUIUtility.LoadRequired(EditorResourcesUtility.fontsPath + "Lucida Grande Big.ttf"));
     }
 }