static void MenuCreatePerfTestGraph(MenuCommand menuCommand) { ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance <TmpCallbackRecieverBig>(), "PefrfTest Graph.asset", TexturesCache.LoadTextureAtPath("MapMagic/Icons/AssetBig"), null); }
/*[MenuItem("Assets/Create/MapMagic/PerfTest Graph", priority = 102)] * static void MenuCreatePerfTestGraph(MenuCommand menuCommand) * { * ProjectWindowUtil.StartNameEditingIfProjectWindowExists( * 0, * ScriptableObject.CreateInstance<TmpCallbackRecieverBig>(), * "PefrfTest Graph.asset", * TexturesCache.LoadTextureAtPath("MapMagic/Icons/AssetBig"), * null); * } * * class TmpCallbackRecieverBig : UnityEditor.ProjectWindowCallback.EndNameEditAction * { * public override void Action(int instanceId, string pathName, string resourceFile) * { * Graph graph = CreateBig(); * graph.name = System.IO.Path.GetFileName(pathName); * AssetDatabase.CreateAsset(graph, pathName); * * ProjectWindowUtil.ShowCreatedAsset(graph); * * allGraphsGuids = new HashSet<string>(AssetDatabase.FindAssets("t:Graph")); * } * } * * public static Graph CreateBig () * { * Graph graph = CreateInstance<Graph>(); * * for (int j=0; j<10; j++) * { * MatrixGenerators.Noise200 noise = (MatrixGenerators.Noise200)Generator.Create(typeof(MatrixGenerators.Noise200), graph); * graph.Add(noise); * noise.guiPosition = new Vector2(-270,-100 + j*200); * * MatrixGenerators.Terrace200 terrace = null; * for (int i=0; i<98; i++) * { * MatrixGenerators.Terrace200 newTerrace = (MatrixGenerators.Terrace200)Generator.Create(typeof(MatrixGenerators.Terrace200), graph); * graph.Add(newTerrace); * newTerrace.guiPosition = new Vector2(-70 + 200*i,-100 + j*200); * if (i==0) graph.Link(newTerrace, noise); * else graph.Link(newTerrace, (IOutlet<object>)terrace); * terrace = newTerrace; * } * * MatrixGenerators.HeightOutput200 output = (MatrixGenerators.HeightOutput200)Generator.Create(typeof(MatrixGenerators.HeightOutput200), graph); * graph.Add(output); * output.guiPosition = new Vector2(130 + 200*98, -100 + j*200); * graph.Link(output, terrace); * } * * return graph; * }*/ #endregion public static void DrawListIcon(Rect iconRect, string guid, bool isListMode) { if (!allGraphsGuids.Contains(guid)) { return; } Texture2D icon = TexturesCache.LoadTextureAtPath("MapMagic/Icons/AssetBig"); UnityEngine.GUI.DrawTexture(iconRect, icon, ScaleMode.ScaleToFit); }
public static void ShowWindow() { DocScreensWindow window = (DocScreensWindow)GetWindow(typeof(DocScreensWindow)); Texture2D icon = TexturesCache.LoadTextureAtPath("MapMagic/Icons/Window"); window.titleContent = new GUIContent("MapMagic DocScreens", icon); window.position = new Rect(100, 100, 300, 200); }
public Texture2D LoadAndCacheTexture(int index, GraphicsDevice device, string basepath) { if (TexturesCache.ContainsKey(index) == false) { var dataFilepath = TexturesPaths[index]; var filepath = Path.Combine(basepath, dataFilepath); TexturesCache[index] = ImageExtensions.FromFile(filepath, device); } return(TexturesCache[index]); }
private static void ShowWindow (GraphWindow window, bool inTab=false) /// Opens the graph window. But it should be created and graph assigned first. { Texture2D icon = TexturesCache.LoadTextureAtPath("MapMagic/Icons/Window"); window.titleContent = new GUIContent("MapMagic Graph", icon); if (inTab) window.ShowTab(); else window.Show(); window.Focus(); window.Repaint(); window.ScrollZoomOnOpen(); //focusing after window has shown (since it needs window size) }
public static void DrawTreeIcon(Rect iconRect, string guid) { if (!allGraphsGuids.Contains(guid)) { return; } if (!BuildPipeline.isBuildingPlayer) //otherwise will log an error during build that cannot find AssetSmall icon in built resources { Texture2D icon = TexturesCache.LoadTextureAtPath("MapMagic/Icons/AssetSmall"); UnityEngine.GUI.DrawTexture(iconRect, icon, ScaleMode.ScaleToFit); } }
private static Item GetGroupColorSelectorItem(Group group, string name, Color color, int priority) { TexturesCache texturesCache = UI.current.textures; return(new Item() { onDraw = DrawGroupColorSelectorItem, color = color, name = name, onClick = () => group.color = color, priority = priority }); }
public void OnEnable () { EditorHacks.SetIconForObject(target, TexturesCache.LoadTextureAtPath("MapMagic/Icons/Window")); }