private static Material CreateStep_Material(Shader shader) { string path = ""; if (edit.newCopy || string.IsNullOrEmpty(edit.data.materialGUID) || string.IsNullOrEmpty(AssetDatabase.GUIDToAssetPath(edit.data.materialGUID))) { path = string.Format("{0}{1}.mat", edit.folderPath, edit.data.title); } else { path = SWCommon.AssetDBPath2Path(AssetDatabase.GUIDToAssetPath(edit.data.materialGUID)); } Material m = AssetDatabase.LoadAssetAtPath <Material> (SWCommon.Path2AssetDBPath(path)); if (m == null) { m = new Material(shader); SetMaterialProp(m, edit); m = SWCommon.SaveReload <Material> (m, path); } else { m.shader = shader; SetMaterialProp(m, edit); } edit.data.materialGUID = SWEditorTools.ObjectToGUID(m); return(m); }
/// <summary> /// For GUILayout /// </summary> public static void Rec(string tip, float yoff = 5) { Rect last = GUILayoutUtility.GetLastRect(); Rect newRect = SWCommon.GetRect(last.center, last.size); Rec(tip, newRect, yoff); }
void DrawSpBase() { var sp = (Sprite)EditorGUI.ObjectField(rectArea, sprite, typeof(Sprite), true); if (sprite != sp) { //step 1 :record for undo Object[] objs = { this, SWWindowMain.Instance }; SWUndo.Record(objs); if (sp != null) { sprite = sp; InitForSp(); Texture2D t2d = SWCommon.SpriteGetTexture2D(sprite); float x = sprite.rect.x / (float)t2d.width; float y = sprite.rect.y / (float)t2d.height; float width = sprite.rect.width / t2d.width; float height = sprite.rect.height / t2d.height; SWWindowMain.Instance.data.spriteRect = new Rect(x, y, width, height); } else { sprite = sp; SWWindowMain.Instance.data.spriteRect = new Rect(0, 0, 1, 1); } } }
protected void ApplyWand_Dropper() { if (SWCommon.GetMouseDown(0, false) && al_rectMain.Contains(mousePosOut + new Vector2(0, al_startY))) { CalUV(); var firstNode = LayerMask_WandDropperNode(node); if (firstNode.texture == null) { return; } // SWTexture2DEx _tex = SWTextureProcess.TextureResize (firstNode.texture, texWidth, texHeight); SWTexture2DEx _tex = SWTextureProcess.TextureResizeTRS(firstNode.texture, texWidth, texHeight, firstNode.data.effectData); if (brush.mode == SWBrushMode.wand) { SWTextureProcess.ProcessMask_Wand(node.texMask, _tex, uv, brush, tolerance); } else if (brush.mode == SWBrushMode.dropper) { SWTextureProcess.ProcessMask_Dropper(node.texMask, _tex, uv, brush, tolerance); } lastUV = uv; node.data.dirty = true; hasFirstPoint = false; } }
protected virtual void DrawNodeWindow(int id) { if ((this is SWNodeRoot) || !titleEditing) { GUI.Label(rectTop, data.name, SWEditorUI.Style_Get(SWCustomStyle.eNodeTitle)); if (Event.current.type == EventType.mouseUp && rectTop.Contains(Event.current.mousePosition)) { titleEditing = true; nameEditing = data.name; } } else { if (Event.current.type == EventType.KeyUp && Event.current.keyCode == KeyCode.Return) { titleEditing = false; nameEditing = SWCommon.NameLegal(nameEditing); if (NameUnique(nameEditing)) { data.name = SWCommon.NameLegal(nameEditing); } } nameEditing = EditorGUI.TextField(rectTop, nameEditing, SWEditorUI.Style_Get(SWCustomStyle.eNodeTitle)); } GUILayout.Space(headerHeight); }
public void Set_MaterialTextureSheet(Material mat, SWNodeEffector node) { var data = node.data; if (data.effectData.animationSheetUse) { Vector4 rect = AnimationSheet_Rect( data.effectData.animationSheetCountX, data.effectData.animationSheetCountY, data.effectData.animationSheetLoop, data.effectData.animationSheetSingleRow, data.effectData.animationSheetSingleRowIndex, data.effectData.animationSheetStartFrame, Time.realtimeSinceStartup); mat.SetVector("rectAnimationSheet", rect); } else if (node.sprite != null) { Rect r = SWCommon.SpriteRect01(node.sprite); mat.SetVector("rectAnimationSheet", new Vector4(r.x, r.y, r.width, r.height)); } else { mat.SetVector("rectAnimationSheet", new Vector4(0, 0, 1, 1)); } }
public override void OnGUITool(SWBaseInfo info, bool isSelected) { center = info.imageRect.center + offset; base.OnGUITool(info, isSelected); rect = SWCommon.GetRect(center + ArrowOff, new Vector2(boxSize, boxSize)); mat.SetFloat("r", -SWCommon.Vector2Angle(ArrowOff)); if (ArrowOff.magnitude > 8f) { Graphics.DrawTexture(rect, SWEditorUI.Texture(SWUITex.effectArrow), mat); } Graphics.DrawTexture(SWCommon.GetRect(center, new Vector2(centerSize, centerSize)), SWEditorUI.Texture(SWUITex.effectCenter), mat); mat.SetFloat("r", 0f); mat.SetTexture("_MainTex", SWEditorUI.Texture(SWUITex.effectLine)); SWDraw.DrawLine(center, rect.center, Color.white, lineWidth, mat); float dis = ArrowOff.magnitude; dis = dis - 3; dis = Mathf.Clamp(dis, 0, float.MaxValue); Vector2 v = center + ArrowOff.normalized * dis; v = center; GUI.color = Color.black; GUI.Label(SWCommon.GetRect(v, new Vector2(15, 15)), title); GUI.color = Color.white; }
void DrawPoints() { for (int i = 0; i < node.lineInfo.pts.Count; i++) { if (i < node.lineInfo.pts.Count - 1 || rData.l.st) { Vector2 v1 = node.lineInfo.pts [i].mousePos; Vector2 v2 = node.lineInfo.pts [(i + 1) % node.lineInfo.pts.Count].mousePos; Vector2 dir = (v2 - v1); float dis = dir.magnitude; dir.Normalize(); float angle = SWCommon.Vector2Angle(v2 - v1); Set_Material(node.lineInfo.pts [i].matArrow, Vector2.zero, -angle, Vector2.one); var item = new Material(SWEditorUI.GetShader("Rect")); Set_Material(item); Vector2 mid = (v2 + v1) * 0.5f; Graphics.DrawTexture(SWCommon.GetRect(mid, new Vector2(IconSize_Arrow, IconSize_Arrow)), SWEditorUI.Texture(SWUITex.effectArrow), node.lineInfo.pts [i].matArrow); SWDraw.DrawLine(v1, v2, Color.white, 1, item); } GUI.DrawTexture(new Rect(node.lineInfo.pts [i].mousePos.x - brushSize * 1f, node.lineInfo.pts [i].mousePos.y - brushSize * 1f, brushSize * 2f, brushSize * 2f), SWEditorUI.Texture(SWUITex.cursor)); } if (LineEditMode()) { LineEdit_Draw(); } }
public override void OnGUITool(SWBaseInfo info, bool isSelected) { base.OnGUITool(info, isSelected); float roundRad = Mathf.Max(info.imageRect.size.x, info.imageRect.size.y) * 0.6f; startPos = info.imageRect.center + new Vector2(0, -roundRad + 5); rect = SWCommon.GetRect(startPos + offset, new Vector2(boxSize, boxSize)); //bg circle var c = mat.GetColor("_Color"); mat.SetColor("_Color", new Color32(128, 128, 128, 255)); Rect roundRect = SWCommon.GetRect(info.imageRect.center, new Vector2(roundRad * 2, roundRad * 2)); Graphics.DrawTexture(roundRect, SWEditorUI.Texture(SWUITex.effectRound), mat); mat.SetColor("_Color", c); mat.SetFloat("r", -SWCommon.Vector2Angle(offset)); if (offset.magnitude > 8f) { Graphics.DrawTexture(rect, SWEditorUI.Texture(SWUITex.effectArrow), mat); } Graphics.DrawTexture(SWCommon.GetRect(startPos, new Vector2(centerSize, centerSize)), SWEditorUI.Texture(SWUITex.effectCenter), mat); mat.SetFloat("r", 0f); mat.SetTexture("_MainTex", SWEditorUI.Texture(SWUITex.effectLine)); SWDraw.DrawLine(startPos, startPos + offset, Color.white, lineWidth, mat); }
public override void OnGUITool(SWBaseInfo info, bool isSelected) { base.OnGUITool(info, isSelected); var item = GUI.matrix; rect = SWCommon.GetRect(info.imageRect.center, new Vector2(centerSize, centerSize)); Graphics.DrawTexture(rect, SWEditorUI.Texture(SWUITex.effectPos), mat); }
protected void ThreadMission_Pixel2(int i, int j) { base.ThreadMission_Pixel(i, j); Vector2 uv = SWTextureProcess.TexUV(texWidth, texHeight, i, j); for (int k = 0; k < info.pts.Count; k++) { var p0 = info.pts [SWTextureProcess.LoopID(k - 1, info.pts.Count)]; var p1 = info.pts [SWTextureProcess.LoopID(k, info.pts.Count)]; var p2 = info.pts [SWTextureProcess.LoopID(k + 1, info.pts.Count)]; float pcg = SWTextureProcess.PointOnSegPcgSign(uv, p1.uv, p2.uv); pcg = p1.pcg + (p2.pcg - p1.pcg) * pcg; // float innerDis = 0; // bool seg = SWTextureProcess.Point2SegOnlyDisSign (uv, p1.after, p2.pre,ref innerDis); if (texColorBuffer [(texHeight - j - 1) * texWidth + i].b <= 0.5) { float dis1 = SWTextureProcess.Point2SegDis(uv, p0.uv, p1.uv); float dis2 = SWTextureProcess.Point2SegDis(uv, p1.uv, p2.uv); bool e1 = Vector2.Dot(uv - p1.pre, p0.uv - p1.pre) < 0; bool e2 = Vector2.Dot(uv - p1.after, p2.uv - p1.after) < 0; if (e1 && e2 && (dis1 <= size || dis2 <= size)) { Vector2 v1 = p1.pre - p1.center; Vector2 v2 = uv - p1.center; Vector2 v3 = p1.after - p1.center; float angle1 = Vector2.Angle(v2, v1); float angleAll = Vector2.Angle(v1, v3); pcg = p1.prePcg + (p1.afterPcg - p1.prePcg) * angle1 / angleAll; // float disSigned1 = -SWTextureProcess.Point2LineDisSign (uv, p0.uv, p1.uv); // float disSigned2 = -SWTextureProcess.Point2LineDisSign (uv, p1.uv, p2.uv); // float disSigned = disSigned1 + (disSigned2 - disSigned1) * angle1 /angleAll; //float g = ( disSigned / size+1)*0.5f; float g = 0; if (SWCommon.AngleSigned(v3, v1, new Vector3(0, 0, 1)) < 0) { g = Vector2.Distance(uv, p1.center) / (size * 2); } else { g = 1 - Vector2.Distance(uv, p1.center) / (size * 2); } float b = (pcg > 0.995f || pcg < 0.005f)? 1:0; float a = GreenToAlpha(g); texColorBuffer [(texHeight - j - 1) * texWidth + i] = new Color(pcg, g, b, a); } } } }
void LineEdit_Draw() { for (int i = 0; i < node.lineInfo.pts.Count; i++) { var pt = node.lineInfo.pts [i]; var rect = SWCommon.GetRect(pt.mousePos, new Vector2(IconSize_Center, IconSize_Center)); GUI.DrawTexture(rect, SWEditorUI.Texture(SWUITex.effectPos)); } }
public override void OnGUITool(SWBaseInfo info, bool isSelected) { base.OnGUITool(info, isSelected); roundRad = Mathf.Max(info.imageRect.size.x, info.imageRect.size.y) * 0.6f; rect = SWCommon.GetRect(info.imageRect.center + new Vector2(-roundRad, 0), new Vector2(boxSize, boxSize)); Rect roundRect = SWCommon.GetRect(info.imageRect.center, new Vector2(roundRad * 2.04f, roundRad * 2.04f)); Graphics.DrawTexture(roundRect, SWEditorUI.Texture(SWUITex.effectRound), mat); }
public static SWTexture2DEx TextureResize(Texture2D tex, int newWidth, int newHeight) { SWTexture2DEx newTex = SWCommon.TextureCreate(newWidth, newHeight, TextureFormat.ARGB32); var colors = TextureResizeBase(tex.GetPixels(), tex.width, tex.height, newWidth, newHeight); newTex.SetPixels(colors); newTex.Apply(); return(newTex); }
void InitForSp() { if (sprite != null) { SWWindowMain.Instance.data.pixelPerUnit = SWCommon.TextureReImportSprite(sprite); texture = SWCommon.Sprite2Texture2D(sprite); texForSprite = texture; } }
public void Process(RemapLineInfo _info, float _size) { info = _info; size = _size; info.pts [0].pcg = 0; info.pts [info.pts.Count - 1].pcg = 1; float len = 0; //step 1:Cal Point Pcg for (int i = 0; i < info.pts.Count - 1; i++) { len += Vector2.Distance(info.pts[i].uv, info.pts[i + 1].uv); } for (int i = 1; i < info.pts.Count - 1; i++) { float dis = Vector2.Distance(info.pts[i].uv, info.pts[i - 1].uv); info.pts [i].pcg = info.pts [i - 1].pcg + dis / len; } //step 2:before after pcg center for (int k = 0; k < info.pts.Count; k++) { var p0 = info.pts [SWTextureProcess.LoopID(k - 1, info.pts.Count)].uv; var p1 = info.pts [SWTextureProcess.LoopID(k, info.pts.Count)].uv; var p2 = info.pts [SWTextureProcess.LoopID(k + 1, info.pts.Count)].uv; float angle = Vector2.Angle(p2 - p1, p0 - p1); float x = 90 - angle * 0.5f; float width = size * Mathf.Tan(x * Mathf.Deg2Rad); info.pts[k].pre = p1 + (p0 - p1).normalized * width; info.pts[k].after = p1 + (p2 - p1).normalized * width; var me = info.pts [SWTextureProcess.LoopID(k, info.pts.Count)]; var item = info.pts [SWTextureProcess.LoopID(k - 1, info.pts.Count)]; float dis = Vector2.Distance(me.uv, item.uv); info.pts [k].prePcg = me.pcg + (item.pcg - me.pcg) * width / dis; item = info.pts [SWTextureProcess.LoopID(k + 1, info.pts.Count)]; dis = Vector2.Distance(me.uv, item.uv); info.pts [k].afterPcg = me.pcg + (item.pcg - me.pcg) * width / dis; float angleSigned = SWCommon.AngleSigned(p2 - p1, p1 - p0, new Vector3(0, 0, 1)); Vector2 vv = p1 - p0; Matrix4x4 m = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0, 0, Mathf.Sign(angleSigned) * -90), Vector3.one); vv = m.MultiplyVector(vv); info.pts[k].center = info.pts[k].pre + vv.normalized * size; } Process(); }
public virtual string TextureShaderName() { if (this is SWNodeRoot || (SWWindowMain.Instance.nRoot.texture != null && texture == SWWindowMain.Instance.nRoot.texture)) { return("MainTex"); } string name = textureDuplicatedSuffix == 0 ? SWCommon.NameLegal(Texture.name) : SWCommon.NameLegal(Texture.name) + "_" + textureDuplicatedSuffix; return(name); }
private static Shader CreateShader(SWWindowMain edit,string txt) { string path = string.Format ("{0}{1}.shader", edit.folderPath, edit.data.title); string fullPath = SWCommon.Path2FullPath (path); string adbPath = SWCommon.Path2AssetDBPath (path); // string guid = AssetDatabase.AssetPathToGUID (adbPath); File.WriteAllText(fullPath, txt ); AssetDatabase.ImportAsset(adbPath, ImportAssetOptions.ForceUpdate); Shader currentShader = AssetDatabase.LoadAssetAtPath<Shader> ( adbPath); return currentShader; }
private static Shader CreateShaderFile(string path, string txt) { string fullPath = SWCommon.Path2FullPath(path); string adbPath = SWCommon.Path2AssetDBPath(path); // string guid = AssetDatabase.AssetPathToGUID (adbPath); File.WriteAllText(fullPath, txt); AssetDatabase.ImportAsset(adbPath, ImportAssetOptions.ForceUpdate); Shader currentShader = AssetDatabase.LoadAssetAtPath <Shader> (adbPath); return(currentShader); }
public override void OnGUITool(SWBaseInfo info, bool isSelected) { base.OnGUITool(info, isSelected); rect = SWCommon.GetRect(info.imageRect.center + new Vector2(0, -info.imageRect.height * 0.5f), new Vector2(boxSize, boxSize)); mat.SetFloat("r", Mathf.PI * 0.5f); Graphics.DrawTexture(rect, SWEditorUI.Texture(SWUITex.effectArrow), mat); mat.SetFloat("r", 0); mat.SetTexture("_MainTex", SWEditorUI.Texture(SWUITex.effectLine)); SWDraw.DrawLine(info.imageRect.center, rect.center, Color.white, lineWidth, mat); }
public override void Init(SWDataNode _data, SWWindowMain _window) { styleID = 2; base.Init(_data, _window); data.outputType.Add(SWDataType._UV); data.inputType.Add(SWDataType._Color); if (textureEx.IsNull) { textureEx = SWCommon.TextureCreate(512, 512, TextureFormat.ARGB32); } }
void DrawLine() { //Add Point if (SWCommon.GetMouseDown(0) && al_rectMain.Contains(mousePosOut + new Vector2(0, al_startY))) { if (!al_rectMain.Contains(mousePosOut + new Vector2(0, al_startY))) { return; } if (!drawRect.Contains(mousePos)) { return; } SWUndo.Record(info); Vector2 m = Event.current.mousePosition; m = m - drawRect.position; m = SWTextureProcess.TexUV(size, size, (int)m.x, (int)m.y); RemapWayPoint pt = new RemapWayPoint(); pt.uv = m; pt.mousePos = mousePos; pt.matArrow = new Material(SWEditorUI.GetShader("RectTRS")); info.pts.Add(pt); } DrawPoints(); //Draw Cursor if (focusedWindow == this) { if (al_rectMain.Contains(mousePosOut + new Vector2(0, al_startY)) && drawRect.Contains(mousePos)) { GUI.DrawTexture(new Rect(mousePos.x - brushSize * 1f, mousePos.y - brushSize * 1f, brushSize * 2f, brushSize * 2f), SWEditorUI.Texture(SWUITex.cursor)); GUI.DrawTexture(new Rect(mousePos.x - 8, mousePos.y - 8, 16, 16), SWEditorUI.Texture(SWUITex.cursorCenter)); Cursor.visible = false; } else { Cursor.visible = true; } } //Key Command if (Event.current.type == EventType.keyDown) { if (Event.current.keyCode == KeyCode.Return) { node.data.dirty = true; SWTextureProcess.ProcessRemap_Line(node.textureEx, info, brushSizeUV); } } }
protected override void DrawNodeWindow(int id) { base.DrawNodeWindow(id); GUILayout.Space(7); GUILayout.BeginHorizontal(); GUILayout.Space(7); GUILayout.BeginVertical(); float labelWith = 42; EffectDataColor _data = data.effectDataColor; string name = _data.hdr ? "[HDR]" : "Color"; GUILayout.BeginHorizontal(); GUILayout.Label(name, SWEditorUI.Style_Get(SWCustomStyle.eTxtSmallLight), GUILayout.Width(labelWith)); var rect = GUILayoutUtility.GetLastRect(); if (SWCommon.GetMouseDown(1)) { if (rect.Contains(Event.current.mousePosition)) { data.effectDataColor.hdr = !data.effectDataColor.hdr; } } _data.color = EditorGUILayout.ColorField(new GUIContent(""), _data.color, true, true, _data.hdr, null, GUILayout.Width(128 - labelWith)); GUILayout.EndHorizontal(); GUILayout.Space(2); GUILayout.BeginHorizontal(); GUILayout.Label("Op", SWEditorUI.Style_Get(SWCustomStyle.eTxtSmallLight), GUILayout.Width(labelWith)); _data.op = (SWOutputOP)EditorGUILayout.EnumPopup(_data.op, GUILayout.Width(128 - labelWith)); GUILayout.EndHorizontal(); GUILayout.Space(2); SWWindowMain.Instance.Factor_Pick(ref _data.param, PickParamType.node, "Factor", null, 128); GUILayout.Space(2); GUILayout.BeginHorizontal(); GUILayout.Label("Depth", SWEditorUI.Style_Get(SWCustomStyle.eTxtSmallLight), GUILayout.Width(labelWith)); var dep = EditorGUILayout.IntField(data.depth, GUILayout.Width(128 - labelWith)); if (dep != 0 && dep != data.depth) { SWUndo.Record(this); data.depth = dep; } GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); DrawNodeWindowEnd(); }
public void KeyCommands() { mousePos = Event.current.mousePosition; if (Event.current.type == EventType.keyDown) { KeyCmd_HotkeyDown(Event.current.keyCode); if (Event.current.keyCode == KeyCode.Delete || Event.current.keyCode == KeyCode.Backspace) { KeyCmd_Delete(); } } if (Event.current.type == EventType.keyUp) { KeyCmd_HotkeyUp(Event.current.keyCode); KeyCmd_CopyPaste(); } if (Event.current.alt) { if (Event.current.type == EventType.ScrollWheel) { KeyCmd_Scroll(Event.current.delta); } //1 drag map else if (SWCommon.GetMouse(0)) { Vector2 move = Event.current.mousePosition - mousePosLast; KeyCmd_Dragmove(move); } } else { KeyCmd_Select(); } if (SWCommon.GetMouseDown(0)) { mousePosDown = Event.current.mousePosition; mousePosLast = Event.current.mousePosition; mousePressing = true; } if (SWCommon.GetMouse(0)) { mousePosLast = Event.current.mousePosition; } if (SWCommon.GetMouseUp(0)) { mousePressing = false; } }
protected virtual void DrawHead() { SetRectsAll(); rectBig = SWCommon.GetRect(data.rect.center, data.rect.size * 1.25f); if (LeftAvailable()) { for (int i = 0; i < rectLefts.Count; i++) { if (!SWWindowMain.Instance.lineStartNodeFromLeft && SWWindowMain.Instance.lineStartNode != null && PortMatch(i, SWWindowMain.Instance.lineStartNode, SWWindowMain.Instance.lineStartNodePort)) { GUI.color = SWEditorUI.ColorPalette(SWColorPl.green); } else { GUI.color = SWEditorUI.ColorPalette(SWColorPl.light); } GUI.DrawTexture(rectLefts[i], EditorGUIUtility.whiteTexture); } GUI.color = Color.white; } if (RightAvailable()) { for (int i = 0; i < rectRights.Count; i++) { if (SWWindowMain.Instance.lineStartNodeFromLeft && SWWindowMain.Instance.lineStartNode != null && SWWindowMain.Instance.lineStartNode.PortMatch(SWWindowMain.Instance.lineStartNodePort, this, i)) { GUI.color = SWEditorUI.ColorPalette(SWColorPl.green); } else { GUI.color = SWEditorUI.ColorPalette(SWColorPl.light); } GUI.DrawTexture(rectRights[i], EditorGUIUtility.whiteTexture); } GUI.color = Color.white; } for (int i = 0; i < rectLefts.Count; i++) { DrawLeftRect(i, rectLefts[i]); } for (int i = 0; i < rectRights.Count; i++) { DrawRightRect(i, rectRights[i]); } }
public static Texture2D Texture(SWUITex e) { if (!texDic.ContainsKey(e)) { string path = SWCommon.ProductFolder() + "/UI/"; var item = AssetDatabase.LoadAssetAtPath <Texture2D> (path + texPathDic[e]); if (item != null) { texDic.Add(e, item); } } return(texDic[e]); }
void UpdateXX() { if (position.size != pBRLast) { Vector2 v = position.size - al_rectMain.position; Vector2 vl = pBRLast - al_rectMain.position; Vector2 _scale = SWCommon.VectorDivide(v, vl); al_rectMain.size = SWCommon.VectorMul(al_rectMain.size, _scale); al_rectMainZoom.size = SWCommon.VectorMul(al_rectMainZoom.size, _scale); al_rectMainInsideZoom.size = SWCommon.VectorMul(al_rectMainInsideZoom.size, _scale); } pBRLast = position.size; }
public static Material GetMaterial(string name) { if (!matDic.ContainsKey(name)) { string path = SWCommon.ProductFolder() + "/Materials/"; var item = AssetDatabase.LoadAssetAtPath <Material> (path + name + ".mat"); if (item != null) { matDic.Add(name, item); } } return(matDic[name]); }
public static Shader GetShader(string name) { if (!shaderDic.ContainsKey(name)) { string path = SWCommon.ProductFolder() + "/Shaders/"; var item = AssetDatabase.LoadAssetAtPath <Shader> (path + name + ".shader"); if (item != null) { shaderDic.Add(name, item); } } return(shaderDic[name]); }
public static void HRDColor_Switch(SWWindowBase window, ref bool hdr) { var rect = GUILayoutUtility.GetLastRect(); if (SWCommon.GetMouseDown(1)) { if (rect.Contains(Event.current.mousePosition)) { hdr = !hdr; window.RepaintGetDirty(); } } }