浏览代码
Update to new GraphView
Update to new GraphView
Update includes fix for MiddleMouse / Alt+LeftMouse pan Signed-off-by: joce <joce@unity3d.com>/main
joce
8 年前
当前提交
4aa813fd
共有 29 个文件被更改,包括 675 次插入 和 73 次删除
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Manipulators/Clicker.cs
-
5MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/Circle.cs
-
5MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/InvisibleBorderContainer.cs
-
8MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/MiniMap.cs
-
20MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/NodesContentView.cs
-
18MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/Presenters/NodesContentViewPresenter.cs
-
1MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/SimpleContentView.cs
-
30MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/SimpleContentView.uss
-
4MaterialGraphProject/Assets/NewUI/Editor/Elements/GraphElement.cs
-
2MaterialGraphProject/Assets/NewUI/Editor/Elements/IMGUIElement.cs
-
3MaterialGraphProject/Assets/NewUI/Editor/Elements/Node.cs
-
4MaterialGraphProject/Assets/NewUI/Editor/Manipulators/ClickSelector.cs
-
6MaterialGraphProject/Assets/NewUI/Editor/Manipulators/ContentDragger.cs
-
2MaterialGraphProject/Assets/NewUI/Editor/Manipulators/Dragger.cs
-
2MaterialGraphProject/Assets/NewUI/Editor/Manipulators/EdgeConnector.cs
-
56MaterialGraphProject/Assets/NewUI/Editor/Manipulators/MouseManipulator.cs
-
2MaterialGraphProject/Assets/NewUI/Editor/Manipulators/RectangleSelector.cs
-
17MaterialGraphProject/Assets/NewUI/Editor/Manipulators/Resizer.cs
-
2MaterialGraphProject/Assets/NewUI/Editor/Manipulators/SelectionDragger.cs
-
2MaterialGraphProject/Assets/NewUI/Editor/Views/GraphView.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/Graphs/WithSubGraph.ShaderGraph
-
156MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/Comment.cs
-
12MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/Comment.cs.meta
-
41MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/Presenters/CommentPresenter.cs
-
12MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/Presenters/CommentPresenter.cs.meta
-
44MaterialGraphProject/Assets/NewUI/Editor/Manipulators/ManipActivator.cs
-
12MaterialGraphProject/Assets/NewUI/Editor/Manipulators/ManipActivator.cs.meta
-
259MaterialGraphProject/Assets/Resources/BebasNeue.otf
-
19MaterialGraphProject/Assets/Resources/BebasNeue.otf.meta
|
|||
using System.Security.Cryptography.X509Certificates; |
|||
using UnityEditor; |
|||
using UnityEngine; |
|||
using UnityEngine.RMGUI; |
|||
using UnityEngine.RMGUI.StyleSheets; |
|||
|
|||
namespace RMGUI.GraphView.Demo |
|||
{ |
|||
// TODO: Temporary class to use IMGUI's TextArea instead of RMGUI.TextField (unavailable for now)
|
|||
public class Comment : IMGUIElement |
|||
{ |
|||
int m_MaxTitleLength; |
|||
bool m_ShowBackgroundColor; |
|||
|
|||
// TODO: Get style from USS when switching to RMGUI.TextField
|
|||
GUIStyle m_TitleStyle; |
|||
GUIStyle m_BodyStyle; |
|||
|
|||
public override void OnGUIHandler() |
|||
{ |
|||
var commentPresenter = GetPresenter<CommentPresenter>(); |
|||
if (commentPresenter == null) |
|||
return; |
|||
|
|||
Color oldBackgroundColor = GUI.backgroundColor; |
|||
GUI.backgroundColor = backgroundColor; |
|||
|
|||
EditorGUILayout.BeginVertical(); |
|||
commentPresenter.titleBar = EditorGUILayout.TextArea(commentPresenter.titleBar, /*m_MaxTitleLength,*/ m_TitleStyle); |
|||
if (m_ShowBackgroundColor) |
|||
commentPresenter.color = EditorGUILayout.ColorField(commentPresenter.color); |
|||
commentPresenter.body = EditorGUILayout.TextArea(commentPresenter.body, m_BodyStyle); |
|||
EditorGUILayout.EndVertical(); |
|||
|
|||
GUI.backgroundColor = oldBackgroundColor; |
|||
} |
|||
|
|||
public Comment() |
|||
{ |
|||
clipChildren = true; |
|||
elementTypeColor = new Color(0.8f, 0.8f, 0.8f, 0.5f); |
|||
backgroundColor = elementTypeColor; |
|||
|
|||
m_MaxTitleLength = 64; |
|||
|
|||
m_Container.positionTop = 0; |
|||
|
|||
m_TitleStyle = new GUIStyle(); |
|||
m_TitleStyle.name = "commentTitle"; |
|||
m_TitleStyle.font = EditorGUIUtility.Load("Assets/Resources/BebasNeue.otf") as Font; |
|||
m_TitleStyle.fontSize = 64; |
|||
m_TitleStyle.alignment = TextAnchor.UpperLeft; |
|||
m_TitleStyle.normal.textColor = new Color(0.75f, 0.75f, 0.75f); |
|||
m_TitleStyle.border.left = 3; |
|||
m_TitleStyle.border.top = 3; |
|||
m_TitleStyle.border.right = 3; |
|||
m_TitleStyle.clipping = TextClipping.Clip; |
|||
m_TitleStyle.wordWrap = true; |
|||
m_TitleStyle.padding.top = 8; |
|||
m_TitleStyle.padding.left = 8; |
|||
m_TitleStyle.padding.bottom = 8; |
|||
m_TitleStyle.padding.right = 8; |
|||
m_TitleStyle.margin.top = 8; |
|||
m_TitleStyle.margin.bottom = 8; |
|||
m_TitleStyle.margin.left = 8; |
|||
m_TitleStyle.margin.right = 8; |
|||
|
|||
m_BodyStyle = new GUIStyle(); |
|||
m_BodyStyle.name = "commentBody"; |
|||
m_BodyStyle.font = EditorGUIUtility.Load("Assets/Resources/Roboto/Roboto-Regular.ttf") as Font; |
|||
m_BodyStyle.fontSize = 12; |
|||
m_BodyStyle.alignment = TextAnchor.UpperLeft; |
|||
m_BodyStyle.normal.textColor = new Color(0.75f, 0.75f, 0.75f); |
|||
m_BodyStyle.clipping = TextClipping.Clip; |
|||
m_BodyStyle.wordWrap = true; |
|||
m_BodyStyle.padding.top = 8; |
|||
m_BodyStyle.padding.left = 8; |
|||
m_BodyStyle.padding.bottom = 8; |
|||
m_BodyStyle.padding.right = 8; |
|||
m_BodyStyle.margin.top = 8; |
|||
m_BodyStyle.margin.bottom = 8; |
|||
m_BodyStyle.margin.left = 8; |
|||
m_BodyStyle.margin.right = 8; |
|||
|
|||
AddManipulator(new ContextualMenu((evt, customData) => |
|||
{ |
|||
var menu = new GenericMenu(); |
|||
menu.AddItem(new GUIContent("Toggle Background Color Control"), false, |
|||
contentView => ToggleBackgroundColor(), |
|||
this); |
|||
menu.ShowAsContext(); |
|||
return EventPropagation.Continue; |
|||
})); |
|||
|
|||
} |
|||
|
|||
private void ToggleBackgroundColor() |
|||
{ |
|||
m_ShowBackgroundColor = !m_ShowBackgroundColor; |
|||
} |
|||
|
|||
public override void OnDataChanged() |
|||
{ |
|||
base.OnDataChanged(); |
|||
|
|||
var commentPresenter = GetPresenter<CommentPresenter>(); |
|||
if (commentPresenter == null) |
|||
return; |
|||
|
|||
backgroundColor = new Color(commentPresenter.color.r, commentPresenter.color.g, commentPresenter.color.b, 0.5f); |
|||
|
|||
this.Touch(ChangeType.Layout); |
|||
} |
|||
} |
|||
|
|||
// // Comment is, for the moment, made of a title bar and a comment body (both IMGUI), until we have RMGUI.TextField
|
|||
// public class Comment : IMGUIElement
|
|||
// {
|
|||
// TextField m_TitleBar;
|
|||
// TextField m_Body;
|
|||
//
|
|||
// public Comment()
|
|||
// {
|
|||
// clipChildren = true;
|
|||
// elementTypeColor = new Color(0.8f, 0.8f, 0.8f, 0.5f);
|
|||
//
|
|||
// m_TitleBar = new TextField()
|
|||
// {
|
|||
// name = "commentTitle",
|
|||
// flex = 1
|
|||
// };
|
|||
// AddChild(m_Title);
|
|||
//
|
|||
// m_Body = new TextField()
|
|||
// {
|
|||
// name = "commentBody",
|
|||
// flex = 1
|
|||
// };
|
|||
// AddChild(m_Body);
|
|||
// }
|
|||
//
|
|||
// public override void OnDataChanged()
|
|||
// {
|
|||
// base.OnDataChanged();
|
|||
//
|
|||
// var commentPresenter = GetPresenter<CommentPresenter>();
|
|||
// if (commentPresenter == null)
|
|||
// return;
|
|||
//
|
|||
// m_TitleBar.text = commentPresenter.titleBar;
|
|||
// m_Body.text = commentPresenter.body;
|
|||
//
|
|||
// this.Touch(ChangeType.Layout);
|
|||
// }
|
|||
// }
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 6b18f5bff13f3ec4ea38f9b5ea51c954 |
|||
timeCreated: 1481574401 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEditor; |
|||
using UnityEngine; |
|||
|
|||
namespace RMGUI.GraphView.Demo |
|||
{ |
|||
[Serializable] |
|||
public class CommentPresenter : IMGUIPresenter |
|||
{ |
|||
[SerializeField] |
|||
private string m_TitleBar; |
|||
public string titleBar |
|||
{ |
|||
get { return m_TitleBar; } |
|||
set { m_TitleBar = value; } |
|||
} |
|||
|
|||
[SerializeField] |
|||
private string m_Body; |
|||
public string body |
|||
{ |
|||
get { return m_Body; } |
|||
set { m_Body = value; } |
|||
} |
|||
|
|||
[SerializeField] |
|||
private Color m_Color; |
|||
public Color color |
|||
{ |
|||
get { return m_Color; } |
|||
set { m_Color = value; } |
|||
} |
|||
|
|||
protected new void OnEnable() |
|||
{ |
|||
base.OnEnable(); |
|||
capabilities |= Capabilities.Deletable | Capabilities.Resizable; |
|||
title = string.Empty; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4d4ad776c3cce684bbaa04f340f6c4c8 |
|||
timeCreated: 1481574691 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
|
|||
namespace RMGUI.GraphView |
|||
{ |
|||
public struct ManipActivator |
|||
{ |
|||
public MouseButton button; |
|||
public KeyModifiers modifiers; |
|||
|
|||
public bool Matches(Event evt) |
|||
{ |
|||
return button == (MouseButton) evt.button && HasModifiers(evt); |
|||
} |
|||
|
|||
private bool HasModifiers(Event evt) |
|||
{ |
|||
if (((modifiers & KeyModifiers.Alt) != 0 && !evt.alt) || |
|||
((modifiers & KeyModifiers.Alt) == 0 && evt.alt)) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
if (((modifiers & KeyModifiers.Ctrl) != 0 && !evt.control) || |
|||
((modifiers & KeyModifiers.Ctrl) == 0 && evt.control)) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
if (((modifiers & KeyModifiers.Shift) != 0 && !evt.shift) || |
|||
((modifiers & KeyModifiers.Shift) == 0 && evt.shift)) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
if (((modifiers & KeyModifiers.Command) != 0 && !evt.command) || |
|||
((modifiers & KeyModifiers.Command) == 0 && evt.command)) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4c8126c59be6c26409f23ee8dcdd7ef9 |
|||
timeCreated: 1482524696 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
259
MaterialGraphProject/Assets/Resources/BebasNeue.otf
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 482bf6bc675e4484e840ef865192826d |
|||
timeCreated: 1455620308 |
|||
licenseType: Pro |
|||
TrueTypeFontImporter: |
|||
serializedVersion: 2 |
|||
fontSize: 16 |
|||
forceTextureCase: -2 |
|||
characterSpacing: 1 |
|||
characterPadding: 0 |
|||
includeFontData: 1 |
|||
use2xBehaviour: 0 |
|||
fontNames: [] |
|||
fallbackFontReferences: [] |
|||
customCharacters: |
|||
fontRenderingMode: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue