Tim Cooper
8 年前
当前提交
3093c701
共有 106 个文件被更改,包括 1653 次插入 和 812 次删除
-
68MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/AbstractGraphDataSource.cs
-
9MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/DrawData/NodeDrawData.cs
-
4MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/NodeDrawer.cs
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/SerializableGraphView.cs
-
3MaterialGraphProject/Assets/NewUI/Editor/Capabilities.cs
-
73MaterialGraphProject/Assets/NewUI/Editor/Demo/Decorators/GridBackground.cs
-
3MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/Circle.cs
-
6MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/Data/CircleData.cs
-
8MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/Data/MiniMapData.cs
-
12MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/Data/SimpleElementData.cs
-
12MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/Graph/CustomEdge.cs
-
81MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/Graph/Data/NodeAnchorData.cs
-
25MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/Graph/Data/NodeData.cs
-
12MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/Graph/Node.cs
-
149MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/Graph/NodeAnchor.cs
-
12MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/Graph/VerticalNode.cs
-
13MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/IMGUIElement.cs
-
30MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/InvisibleBorderContainer.cs
-
5MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/MiniMap.cs
-
10MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/SimpleElement.cs
-
10MaterialGraphProject/Assets/NewUI/Editor/Demo/Elements/WWWImage.cs
-
32MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/Data/IMGUISampleViewData.cs
-
10MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/Data/NodesContentViewData.cs
-
6MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/Data/SimpleContentViewData.cs
-
91MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/NodalView.uss
-
190MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/SimpleContentView.cs
-
48MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/SimpleContentView.uss
-
3MaterialGraphProject/Assets/NewUI/Editor/Direction.cs
-
41MaterialGraphProject/Assets/NewUI/Editor/Elements/Data/EdgeData.cs
-
18MaterialGraphProject/Assets/NewUI/Editor/Elements/Data/GraphElementData.cs
-
106MaterialGraphProject/Assets/NewUI/Editor/Elements/Edge.cs
-
17MaterialGraphProject/Assets/NewUI/Editor/Elements/GraphElement.cs
-
8MaterialGraphProject/Assets/NewUI/Editor/Manipulators/ClickSelector.cs
-
19MaterialGraphProject/Assets/NewUI/Editor/Manipulators/ContentDragger.cs
-
16MaterialGraphProject/Assets/NewUI/Editor/Manipulators/Dragger.cs
-
86MaterialGraphProject/Assets/NewUI/Editor/Manipulators/EdgeConnector.cs
-
27MaterialGraphProject/Assets/NewUI/Editor/Manipulators/RectangleSelector.cs
-
36MaterialGraphProject/Assets/NewUI/Editor/Manipulators/Resizer.cs
-
34MaterialGraphProject/Assets/NewUI/Editor/Manipulators/SelectionDragger.cs
-
4MaterialGraphProject/Assets/NewUI/Editor/Manipulators/Zoomer.cs
-
2MaterialGraphProject/Assets/NewUI/Editor/Utils/PainterExtensions.cs
-
12MaterialGraphProject/Assets/NewUI/Editor/Utils/RectUtils.cs
-
4MaterialGraphProject/Assets/NewUI/Editor/Utils/UIHelpers.cs
-
42MaterialGraphProject/Assets/NewUI/Editor/Views/Data/GraphViewDataSource.cs
-
213MaterialGraphProject/Assets/NewUI/Editor/Views/GraphView.cs
-
13MaterialGraphProject/Assets/NewUI/Editor/Views/GraphView.uss
-
4MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/NodePreviewDrawer.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphView.cs
-
2MaterialGraphProject/MaterialGraphProject.sln.DotSettings.user
-
4MaterialGraphProject/Assets/NewUI/Editor/Demo/IMGUISampleViewWindow.cs
-
9MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Manipulators.meta
-
21MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Styles/SerializableGraph.uss.imported.asset
-
8MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Styles/SerializableGraph.uss.imported.asset.meta
-
9MaterialGraphProject/Assets/NewUI/Editor/Demo/GraphElements.meta
-
12MaterialGraphProject/Assets/NewUI/Editor/Demo/IMGUISampleViewWindow.cs.meta
-
30MaterialGraphProject/Assets/NewUI/Editor/Demo/NodalViewWindow.cs
-
12MaterialGraphProject/Assets/NewUI/Editor/Demo/NodalViewWindow.cs.meta
-
30MaterialGraphProject/Assets/NewUI/Editor/Demo/SimpleGraphViewWindow.cs
-
12MaterialGraphProject/Assets/NewUI/Editor/Demo/SimpleGraphViewWindow.cs.meta
-
12MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/Data/NodesContentViewData.cs.meta
-
12MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/Data/SimpleContentViewData.cs.meta
-
21MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/NodalView.uss.imported.asset
-
8MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/NodalView.uss.imported.asset.meta
-
45MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/NodesContentView.cs
-
12MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/NodesContentView.cs.meta
-
21MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/SimpleContentView.uss.imported.asset
-
8MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/SimpleContentView.uss.imported.asset.meta
-
9MaterialGraphProject/Assets/NewUI/Editor/Graph.meta
-
9MaterialGraphProject/Assets/NewUI/Editor/GraphElements.meta
-
9MaterialGraphProject/Assets/NewUI/Editor/GraphElementsData.meta
-
8MaterialGraphProject/Assets/NewUI/Editor/IConnection.cs
-
12MaterialGraphProject/Assets/NewUI/Editor/IConnection.cs.meta
-
28MaterialGraphProject/Assets/NewUI/Editor/IConnector.cs
-
10MaterialGraphProject/Assets/NewUI/Editor/IConnectorCollection.cs
-
12MaterialGraphProject/Assets/NewUI/Editor/IConnectorCollection.cs.meta
-
15MaterialGraphProject/Assets/NewUI/Editor/Manipulators/KeyModifiers.cs
-
12MaterialGraphProject/Assets/NewUI/Editor/Manipulators/KeyModifiers.cs.meta
-
50MaterialGraphProject/Assets/NewUI/Editor/Manipulators/MouseManipulator.cs
-
12MaterialGraphProject/Assets/NewUI/Editor/Manipulators/MouseManipulator.cs.meta
-
21MaterialGraphProject/Assets/NewUI/Editor/Views/GraphView.uss.imported.asset
-
8MaterialGraphProject/Assets/NewUI/Editor/Views/GraphView.uss.imported.asset.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/DrawData/PropertyNodeDrawData.cs.meta
-
21MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Styles/MaterialGraph.uss.imported.asset
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Styles/MaterialGraph.uss.imported.asset.meta
-
150MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Manipulators/EdgeConnector.cs
-
12MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Manipulators/EdgeConnector.cs.meta
-
9MaterialGraphProject/Assets/NewUI/Editor/Demo/GraphElements/Graph.meta
-
9MaterialGraphProject/Assets/NewUI/Editor/Demo/GraphElements/Nodes.meta
-
9MaterialGraphProject/Assets/NewUI/Editor/Graph/GraphElements.meta
-
9MaterialGraphProject/Assets/NewUI/Editor/GraphElements/Graph.meta
-
12MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/Data/NodalViewData.cs.meta
-
12MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/Data/SimpleGraphViewData.cs.meta
-
12MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/IMGUISampleView.cs.meta
-
12MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/NodalView.cs.meta
-
31MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/SimpleGraphView.cs
-
12MaterialGraphProject/Assets/NewUI/Editor/Demo/Views/SimpleGraphView.cs.meta
|
|||
VerticalNode #top { |
|||
flex: 1; |
|||
align-items: flex-start; |
|||
Node #input { |
|||
flex:1; |
|||
} |
|||
|
|||
Node #output { |
|||
flex:1; |
|||
justify-content: flex-end; |
|||
} |
|||
|
|||
NodeAnchor { |
|||
margin-top:5; |
|||
margin-bottom:5; |
|||
} |
|||
|
|||
NodeAnchor #connector { |
|||
background-color:#FF0; |
|||
border-color:#FF0; |
|||
/* width is currently hard-coded */ |
|||
border-width: 4; |
|||
} |
|||
|
|||
NodeAnchor #connector.anchorHighlight { |
|||
background-color:#00F; |
|||
} |
|||
|
|||
NodeAnchor #type { |
|||
text-color:#FFF; |
|||
flex:1; |
|||
} |
|||
|
|||
Node.horizontal #output NodeAnchor #type { |
|||
text-alignment:middle-right; |
|||
} |
|||
|
|||
Node.horizontal NodeAnchor #connector { |
|||
margin-left: 5; |
|||
margin-right: 5; |
|||
} |
|||
|
|||
Node.horizontal { |
|||
VerticalNode #bottom { |
|||
flex: 1; |
|||
align-items: flex-start; |
|||
Node.horizontal #input, Node.horizontal #output { |
|||
margin-top: 15; |
|||
background-color:#444; |
|||
} |
|||
|
|||
Node.horizontal #input NodeAnchor { |
|||
VerticalNode NodeAnchor { |
|||
height: 50; |
|||
flex:1; |
|||
Node.horizontal #output NodeAnchor { |
|||
flex-direction: row-reverse; |
|||
Node { |
|||
Node.vertical #input, Node.vertical #output { |
|||
flex: 1; |
|||
justify-content: center; |
|||
Node #input { |
|||
flex:1; |
|||
Node.vertical NodeAnchor { |
|||
align-items: center; |
|||
} |
|||
|
|||
/* there is currently an issue with text size evaluation |
|||
which causes layout to "shake", so this is a just to avoid the visual glitch */ |
|||
Node.vertical NodeAnchor #type { |
|||
text-alignment:middle-center; |
|||
Node #output { |
|||
flex:1; |
|||
justify-content: flex-end; |
|||
Node.vertical #input NodeAnchor { |
|||
flex-direction: column; |
|||
NodeAnchor { |
|||
height: 26; |
|||
Node.vertical #output NodeAnchor { |
|||
flex-direction: column-reverse; |
|||
Node.vertical { |
|||
border-width: 1; |
|||
border-color:#CCC; |
|||
background-color:rgba(100, 100, 100, 0.5); |
|||
} |
|||
#contentViewContainer { |
|||
background-color:#404749; |
|||
NodesContentView { |
|||
grid-background-color:#404749; |
|||
spacing:50.0; |
|||
spacing:75.0; |
|||
thick-lines:10; |
|||
} |
|
|||
/* this class is added to all graphElement instances*/ |
|||
.graphElement { |
|||
text-alignment:upper-center; |
|||
text-color:#FFF; |
|||
/* currently border-XXX is only used for layout |
|||
where border-width is used to paint text and border. |
|||
They must keep in sync until we support variable border |
|||
thickness per edge */ |
|||
border-width: 2; |
|||
border-radius: 5; |
|||
background-color: #333; |
|||
|
|||
.graphElement.selected { |
|||
border-color: #FF0; |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 49d342e281c5c0842a37adc523aca716 |
|||
folderAsset: yes |
|||
timeCreated: 1477989669 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 1 |
|||
m_Script: {fileID: 11997, guid: 0000000000000000e000000000000000, type: 0} |
|||
m_Name: SerializableGraph.uss.imported |
|||
m_EditorClassIdentifier: |
|||
matchers: [] |
|||
rules: [] |
|||
floats: [] |
|||
ints: |
|||
bools: |
|||
colors: [] |
|||
strings: [] |
|||
assets: [] |
|
|||
fileFormatVersion: 2 |
|||
guid: 710b4b6fb4db58f47aeb6fec7fd76bb4 |
|||
timeCreated: 1477986144 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 0cabc6d3555773b46ac210aaf8eefae6 |
|||
folderAsset: yes |
|||
timeCreated: 1475167728 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 5e9dcbce78a4af54c9c6fcf17f7df043 |
|||
timeCreated: 1476306591 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEditor; |
|||
using UnityEngine.RMGUI; |
|||
|
|||
namespace RMGUI.GraphView.Demo |
|||
{ |
|||
class NodalViewWindow : EditorWindow |
|||
{ |
|||
[MenuItem("Window/GraphView Demo/Nodal UI")] |
|||
public static void ShowWindow() |
|||
{ |
|||
GetWindow<NodalViewWindow>(); |
|||
} |
|||
|
|||
void OnEnable() |
|||
{ |
|||
var view = new NodesContentView |
|||
{ |
|||
name = "theView", |
|||
dataSource = CreateInstance<NodesContentViewData>() |
|||
}; |
|||
view.StretchToParentSize(); |
|||
windowRoot.AddChild(view); |
|||
} |
|||
|
|||
void OnDisable() |
|||
{ |
|||
windowRoot.ClearChildren(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: c8ac803e6ded75a4da20fc93645785fe |
|||
timeCreated: 1476306235 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEditor; |
|||
using UnityEngine.RMGUI; |
|||
|
|||
namespace RMGUI.GraphView.Demo |
|||
{ |
|||
public class SimpleGraphViewWindow : EditorWindow |
|||
{ |
|||
[MenuItem("Window/GraphView Demo/SimpleGraphView")] |
|||
public static void ShowWindow() |
|||
{ |
|||
GetWindow<SimpleGraphViewWindow>(); |
|||
} |
|||
|
|||
void OnEnable() |
|||
{ |
|||
var view = new SimpleContentView |
|||
{ |
|||
name = "theView", |
|||
dataSource = CreateInstance<SimpleContentViewData>() |
|||
}; |
|||
view.StretchToParentSize(); |
|||
windowRoot.AddChild(view); |
|||
} |
|||
|
|||
void OnDisable() |
|||
{ |
|||
windowRoot.ClearChildren(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 379573e86758eed46a980eb015c1170a |
|||
timeCreated: 1476305948 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: eb4c913a7ca37cc4789fb8d87a1eee96 |
|||
timeCreated: 1476306362 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 7e0d569658b0b934d9cd393bd4a1dfcb |
|||
timeCreated: 1476306071 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 1 |
|||
m_Script: {fileID: 11997, guid: 0000000000000000e000000000000000, type: 0} |
|||
m_Name: NodalView.uss.imported |
|||
m_EditorClassIdentifier: |
|||
matchers: [] |
|||
rules: [] |
|||
floats: [] |
|||
ints: |
|||
bools: |
|||
colors: [] |
|||
strings: [] |
|||
assets: [] |
|
|||
fileFormatVersion: 2 |
|||
guid: ae904e6b00e321143b960221024f7fc3 |
|||
timeCreated: 1477985626 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using UnityEditor; |
|||
using UnityEngine; |
|||
using UnityEngine.RMGUI; |
|||
|
|||
namespace RMGUI.GraphView.Demo |
|||
{ |
|||
[StyleSheet("Assets/Editor/Demo/Views/NodalView.uss")] |
|||
class NodesContentView : SimpleContentView |
|||
{ |
|||
private readonly System.Random rnd = new System.Random(); |
|||
|
|||
public NodesContentView() |
|||
{ |
|||
// Contextual menu to create new nodes
|
|||
AddManipulator(new ContextualMenu((evt, customData) => |
|||
{ |
|||
var menu = new GenericMenu(); |
|||
menu.AddItem(new GUIContent("Create Operator"), false, |
|||
contentView => CreateOperator(), |
|||
this); |
|||
menu.ShowAsContext(); |
|||
return EventPropagation.Continue; |
|||
})); |
|||
|
|||
dataMapper[typeof(CustomEdgeData)] = typeof(CustomEdge); |
|||
dataMapper[typeof(NodeAnchorData)] = typeof(NodeAnchor); |
|||
dataMapper[typeof(NodeData)] = typeof(Node); |
|||
dataMapper[typeof(VerticalNodeData)] = typeof(Node); |
|||
} |
|||
|
|||
public void CreateOperator() |
|||
{ |
|||
var nodalViewData = dataSource as NodesContentViewData; |
|||
if (nodalViewData != null) |
|||
{ |
|||
var x = rnd.Next(0, 600); |
|||
var y = rnd.Next(0, 300); |
|||
|
|||
nodalViewData.CreateOperator(typeof(Vector3), new Rect(x, y, 200, 176), "Shiny New Operator"); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 1a2310fa1650dda408c99ce9fbc96823 |
|||
timeCreated: 1476306442 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 1 |
|||
m_Script: {fileID: 11997, guid: 0000000000000000e000000000000000, type: 0} |
|||
m_Name: SimpleContentView.uss.imported |
|||
m_EditorClassIdentifier: |
|||
matchers: [] |
|||
rules: [] |
|||
floats: [] |
|||
ints: |
|||
bools: |
|||
colors: [] |
|||
strings: [] |
|||
assets: [] |
|
|||
fileFormatVersion: 2 |
|||
guid: fbe164d03ec59254eafe10baa5a9c5ba |
|||
timeCreated: 1477985626 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: b72798efa4aa8574ca0cbdfa63df0b7a |
|||
folderAsset: yes |
|||
timeCreated: 1475177616 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: ebb7c69d632722145a1f9d838e7fe6ef |
|||
folderAsset: yes |
|||
timeCreated: 1475161005 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 3b224150c99d250429c73b1eefe3dd83 |
|||
folderAsset: yes |
|||
timeCreated: 1475161005 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace RMGUI.GraphView |
|||
{ |
|||
public interface IConnection |
|||
{ |
|||
IConnector output { get; set; } |
|||
IConnector input { get; set; } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 04174a63fbb784b41b463d460c7f6646 |
|||
timeCreated: 1476901947 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
|
|||
namespace RMGUI.GraphView |
|||
{ |
|||
public interface IConnector |
|||
{ |
|||
Direction direction { get; } |
|||
Orientation orientation { get; } |
|||
bool highlight { get; set; } |
|||
object source { get; } |
|||
bool connected { get; } |
|||
IEnumerable<IConnection> connections { get; } |
|||
|
|||
void Connect(IConnection connection); |
|||
void Disconnect(IConnection connection); |
|||
|
|||
// TODO YAGNI?
|
|||
// void DisconnectAll();
|
|||
} |
|||
|
|||
public static class ConnectableExtensions |
|||
{ |
|||
public static bool IsConnectable(this IConnector connector) |
|||
{ |
|||
return connector.direction == Direction.Output || !connector.connected; |
|||
} |
|||
} |
|||
} |
|
|||
using System.Collections.Generic; |
|||
|
|||
namespace RMGUI.GraphView |
|||
{ |
|||
interface IConnectorCollection |
|||
{ |
|||
IEnumerable<IConnector> inputConnectors { get; } |
|||
IEnumerable<IConnector> outputConnectors { get; } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b6d217dbc1a50fb42acaf0953390d89b |
|||
timeCreated: 1477331007 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
|
|||
namespace RMGUI.GraphView |
|||
{ |
|||
// TODO We could move that higher in RMGUI.
|
|||
[Flags] |
|||
public enum KeyModifiers |
|||
{ |
|||
None = 0, |
|||
Alt = 1 << 0, |
|||
Ctrl = 1 << 1, |
|||
Shift = 1 << 2, |
|||
Command = 1 << 3 |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 393dfbb2f04c7a743b1ca4214b60bda4 |
|||
timeCreated: 1476929682 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
using UnityEngine.RMGUI; |
|||
|
|||
namespace RMGUI.GraphView |
|||
{ |
|||
public class MouseManipulator : Manipulator |
|||
{ |
|||
public MouseButton activateButton { get; set; } |
|||
public KeyModifiers activateModifiers { get; set; } |
|||
|
|||
public bool CanStartManipulation(Event evt) |
|||
{ |
|||
if (evt.button != (int) activateButton) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
if (((activateModifiers & KeyModifiers.Alt) != 0 && !evt.alt) || |
|||
((activateModifiers & KeyModifiers.Alt) == 0 && evt.alt)) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
if (((activateModifiers & KeyModifiers.Ctrl) != 0 && !evt.control) || |
|||
((activateModifiers & KeyModifiers.Ctrl) == 0 && evt.control)) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
if (((activateModifiers & KeyModifiers.Shift) != 0 && !evt.shift) || |
|||
((activateModifiers & KeyModifiers.Shift) == 0 && evt.shift)) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
if (((activateModifiers & KeyModifiers.Command) != 0 && !evt.command) || |
|||
((activateModifiers & KeyModifiers.Command) == 0 && evt.command)) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
|
|||
public bool CanStopManipulation(Event evt) |
|||
{ |
|||
return (evt.button == (int)activateButton && this.HasCapture()); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 33e273b33871e6e4180c7a94739c79e2 |
|||
timeCreated: 1476901948 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 1 |
|||
m_Script: {fileID: 11997, guid: 0000000000000000e000000000000000, type: 0} |
|||
m_Name: GraphView.uss.imported |
|||
m_EditorClassIdentifier: |
|||
matchers: [] |
|||
rules: [] |
|||
floats: [] |
|||
ints: |
|||
bools: |
|||
colors: [] |
|||
strings: [] |
|||
assets: [] |
|
|||
fileFormatVersion: 2 |
|||
guid: 1655c36f61ec5a5499f7dc1f3abea03c |
|||
timeCreated: 1477985626 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: eaa1f14b82a26aa49b8a51ce08653c87 |
|||
timeCreated: 1477985625 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 1 |
|||
m_Script: {fileID: 11997, guid: 0000000000000000e000000000000000, type: 0} |
|||
m_Name: MaterialGraph.uss.imported |
|||
m_EditorClassIdentifier: |
|||
matchers: [] |
|||
rules: [] |
|||
floats: [] |
|||
ints: |
|||
bools: |
|||
colors: [] |
|||
strings: [] |
|||
assets: [] |
|
|||
fileFormatVersion: 2 |
|||
guid: 13814e9314253674e8d4966bba14d963 |
|||
timeCreated: 1477986144 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using UnityEngine; |
|||
using RMGUI.GraphView; |
|||
using UnityEngine.RMGUI; |
|||
|
|||
namespace UnityEditor.Graphing.Drawing |
|||
{ |
|||
public class EdgeConnector<TEdgeData> : MouseManipulator where TEdgeData : EdgeData |
|||
{ |
|||
private readonly List<IConnector> m_CompatibleAnchors = new List<IConnector>(); |
|||
private TEdgeData m_EdgeDataCandidate; |
|||
|
|||
private AbstractGraphDataSource m_DataSource; |
|||
private SerializableGraphView m_GraphView; |
|||
|
|||
public EdgeConnector() |
|||
{ |
|||
activateButton = MouseButton.LeftMouse; |
|||
} |
|||
|
|||
public override EventPropagation HandleEvent(Event evt, VisualElement finalTarget) |
|||
{ |
|||
switch (evt.type) |
|||
{ |
|||
case EventType.MouseDown: |
|||
{ |
|||
if (!CanStartManipulation(evt)) |
|||
break; |
|||
|
|||
IConnector cnx = null; |
|||
var graphElement = finalTarget as GraphElement; |
|||
if (graphElement != null && graphElement.dataProvider != null) |
|||
{ |
|||
GraphElementData data = graphElement.dataProvider; |
|||
cnx = (IConnector) data; |
|||
m_GraphView = graphElement.GetFirstAncestorOfType<SerializableGraphView>(); |
|||
} |
|||
|
|||
if (cnx == null || m_GraphView == null) |
|||
break; |
|||
|
|||
m_DataSource = m_GraphView.dataSource as AbstractGraphDataSource; |
|||
if (m_DataSource == null) |
|||
break; |
|||
|
|||
this.TakeCapture(); |
|||
|
|||
m_CompatibleAnchors.Clear(); |
|||
|
|||
var nodeAdapter = new NodeAdapter(); |
|||
|
|||
// get all available connectors
|
|||
foreach (var toCnx in m_GraphView.allChildren.OfType<GraphElement>() |
|||
.Select(e => e.dataProvider) |
|||
.OfType<IConnector>() |
|||
.Where(c => c.IsConnectable() && |
|||
c.orientation == cnx.orientation && |
|||
c.direction != cnx.direction && |
|||
nodeAdapter.GetAdapter(c.source, cnx.source) != null)) |
|||
{ |
|||
toCnx.highlight = true; |
|||
m_CompatibleAnchors.Add(toCnx); |
|||
} |
|||
|
|||
m_EdgeDataCandidate = ScriptableObject.CreateInstance<TEdgeData>(); |
|||
|
|||
m_EdgeDataCandidate.position = new Rect(0, 0, 1, 1); |
|||
|
|||
bool startFromOutput = (cnx.direction == Direction.Output); |
|||
if (startFromOutput) |
|||
{ |
|||
m_EdgeDataCandidate.output = graphElement.dataProvider as IConnector; |
|||
m_EdgeDataCandidate.input = null; |
|||
} |
|||
else |
|||
{ |
|||
m_EdgeDataCandidate.output = null; |
|||
m_EdgeDataCandidate.input = graphElement.dataProvider as IConnector; |
|||
} |
|||
m_EdgeDataCandidate.candidate = true; |
|||
m_EdgeDataCandidate.candidatePosition = target.LocalToGlobal(evt.mousePosition); |
|||
|
|||
m_DataSource.AddTempElement(m_EdgeDataCandidate); |
|||
|
|||
return EventPropagation.Stop; |
|||
} |
|||
|
|||
case EventType.MouseDrag: |
|||
{ |
|||
if (this.HasCapture()) |
|||
{ |
|||
m_EdgeDataCandidate.candidatePosition = target.LocalToGlobal(evt.mousePosition); |
|||
return EventPropagation.Stop; |
|||
} |
|||
break; |
|||
} |
|||
case EventType.MouseUp: |
|||
{ |
|||
if (CanStopManipulation(evt)) |
|||
{ |
|||
this.ReleaseCapture(); |
|||
IConnector endConnector = null; |
|||
|
|||
foreach (var compatibleAnchor in m_CompatibleAnchors) |
|||
{ |
|||
compatibleAnchor.highlight = false; |
|||
|
|||
if (m_GraphView != null) |
|||
{ |
|||
GraphElement anchorElement = m_GraphView.allElements.OfType<GraphElement>().First(e => e.dataProvider == (Object) compatibleAnchor); |
|||
if (anchorElement != null) |
|||
{ |
|||
if (anchorElement.globalBound.Contains(target.LocalToGlobal(evt.mousePosition))) |
|||
endConnector = compatibleAnchor; |
|||
} |
|||
} |
|||
} |
|||
m_CompatibleAnchors.Clear(); |
|||
|
|||
|
|||
m_DataSource.RemoveElement(m_EdgeDataCandidate); |
|||
|
|||
if (m_EdgeDataCandidate != null && m_DataSource != null && endConnector != null) |
|||
{ |
|||
if (m_EdgeDataCandidate.output == null) |
|||
m_EdgeDataCandidate.output = endConnector; |
|||
else |
|||
m_EdgeDataCandidate.input = endConnector; |
|||
|
|||
m_EdgeDataCandidate.output.Connect(m_EdgeDataCandidate); |
|||
m_EdgeDataCandidate.input.Connect(m_EdgeDataCandidate); |
|||
|
|||
m_EdgeDataCandidate.candidate = false; |
|||
m_DataSource.Connect(m_EdgeDataCandidate.output as AnchorDrawData, m_EdgeDataCandidate.input as AnchorDrawData); |
|||
} |
|||
|
|||
m_EdgeDataCandidate = null; |
|||
m_DataSource = null; |
|||
|
|||
return EventPropagation.Stop; |
|||
} |
|||
break; |
|||
} |
|||
} |
|||
|
|||
return this.HasCapture() ? EventPropagation.Stop : EventPropagation.Continue; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 83cddc79cb2953340bedd94abe783859 |
|||
timeCreated: 1477989690 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: f22bdd0720b76fb49a1a7d2461de982b |
|||
folderAsset: yes |
|||
timeCreated: 1475171334 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 6f374239aa4eb8e46a84b48479605054 |
|||
folderAsset: yes |
|||
timeCreated: 1475168121 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: ea648af0e8d33db40905fd11df263507 |
|||
folderAsset: yes |
|||
timeCreated: 1475177616 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 0fc31b1e188fa674d9c15b26b2598692 |
|||
folderAsset: yes |
|||
timeCreated: 1475161005 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 6c7c91c667833a44d9d99a3c770415a5 |
|||
timeCreated: 1475574874 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: b612cdd5d670cb04584099036d9a406d |
|||
timeCreated: 1476281662 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: c02b6a0dca1c1944f88627c5f42a7224 |
|||
timeCreated: 1475574875 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: d9a9a164bccdbe24590cfb3ae713eb7f |
|||
timeCreated: 1475574876 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEditor; |
|||
using UnityEngine.RMGUI; |
|||
|
|||
namespace RMGUI.GraphView.Demo |
|||
{ |
|||
public class SimpleGraphView : EditorWindow |
|||
{ |
|||
[MenuItem("Window/GraphView Demo/SimpleGraphView")] |
|||
public static void ShowWindow() |
|||
{ |
|||
GetWindow<SimpleGraphView>(); |
|||
} |
|||
|
|||
void OnEnable() |
|||
{ |
|||
var view = new SimpleContentView |
|||
{ |
|||
name = "theView", |
|||
dataSource = CreateInstance<SimpleGraphViewData>() |
|||
}; |
|||
view.StretchToParentSize(); |
|||
|
|||
windowRoot.AddChild(view); |
|||
} |
|||
|
|||
void OnDisable() |
|||
{ |
|||
windowRoot.ClearChildren(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: fd46fb73aba17cf4984eec066df288e2 |
|||
timeCreated: 1475574876 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
部分文件因为文件数量过多而无法显示
撰写
预览
正在加载...
取消
保存
Reference in new issue