Skip to content

Commit

Permalink
Merge branch 'release/1.02'
Browse files Browse the repository at this point in the history
nicloay committed Jun 14, 2016
2 parents 3c5f118 + f48cd3f commit 926ab98
Showing 3 changed files with 24 additions and 16 deletions.
14 changes: 6 additions & 8 deletions Assets/NodeInspector/Scripts/Editor/Joint.cs
Original file line number Diff line number Diff line change
@@ -96,9 +96,9 @@ void SetupGUIVariables(Vector2 parentWindowGlobalPosition)
{
switch(JointType){
case JointType.OneWay_IN:
KnobButtonInternalRect = new Rect(Node.KnobSize * 2, 0, Node.KnobSize, Node.KnobSize);
BezierSidePoint = parentWindowGlobalPosition + new Vector2(Node.KnobSize*2.5f, 0.0f);
BezierTangent = Vector2.down;
KnobButtonInternalRect = new Rect(0, 0, Node.KnobSize, Node.KnobSize);
BezierSidePoint = parentWindowGlobalPosition + new Vector2(0.0f, Node.KnobSize* 0.5f);
BezierTangent = Vector2.left;
BezierBackTangent = Vector2.right;
break;
case JointType.ManyToMany_IN:
@@ -120,10 +120,10 @@ void SetupGUIVariables(Vector2 parentWindowGlobalPosition)

switch(JointType){
case JointType.OneWay_IN:
KnobButtonCaption = "o";
KnobButtonCaption = ">";
break;
case JointType.OneWay_OUT:
KnobButtonCaption = "o";
KnobButtonCaption = ">";
break;
case JointType.ManyToMany_IN:
case JointType.ManyToOne_IN:
@@ -137,9 +137,7 @@ void SetupGUIVariables(Vector2 parentWindowGlobalPosition)
}

switch(JointType){
case JointType.OneWay_IN:
KnobButtonStyle = EditorStyles.miniButton;
break;
case JointType.OneWay_IN:
case JointType.ManyToMany_IN:
case JointType.ManyToOne_IN:
case JointType.OneToMany_IN:
12 changes: 6 additions & 6 deletions Assets/NodeInspector/Scripts/Editor/Node.cs
Original file line number Diff line number Diff line change
@@ -34,11 +34,11 @@ static GUIStyle WindowStyle{
_windowStyle = new GUIStyle(GUI.skin.window);
_windowStyle.overflow.left -= KnobSize;
_windowStyle.overflow.right -= KnobSize;
_windowStyle.overflow.top -= KnobSize;
// _windowStyle.overflow.top -= KnobSize;
OriginalRightPatdding = _windowStyle.padding.right;
_windowStyle.padding.left += KnobSize;
_windowStyle.padding.right += KnobSize;
_windowStyle.padding.top += KnobSize;
// _windowStyle.padding.top += KnobSize;
}
return _windowStyle;
}
@@ -116,7 +116,7 @@ void DoWindow(int id)
}

if (ParentWindow.CurrentGraph.StartNode != null && ParentWindow.CurrentGraph.StartNode.objectReferenceValue == scriptableObject){
Rect selectBox = new Rect(0,0, WindowRect.width - KnobSize, KnobSize);
Rect selectBox = new Rect(0,WindowRect.height - KnobSize, WindowRect.width - KnobSize, KnobSize);
GUIStyle style = new GUIStyle(EditorStyles.miniLabel);
style.alignment = TextAnchor.MiddleRight;
GUI.Label(selectBox, " Start Node", style);
@@ -126,13 +126,13 @@ void DoWindow(int id)
serializedObject.ApplyModifiedProperties();
EditorGUI.EndChangeCheck();

GUI.DragWindow(new Rect(KnobSize, KnobSize, scriptableObject.EditorWindowRect.width - KnobSize*2, GUI.skin.window.border.top));
GUI.DragWindow(new Rect(KnobSize, 0, scriptableObject.EditorWindowRect.width - KnobSize*2, GUI.skin.window.border.top));
}


void ShowWindowMenu(){
GUIStyle style = GUI.skin.GetStyle("PaneOptions");
Rect rect = new Rect(WindowRect.width - KnobSize - 20, 20, 20,20);
Rect rect = new Rect(WindowRect.width - KnobSize - 20, 5, 20,20);

if (GUI.Button(rect , "", style)){
ShowNodeContext();
@@ -200,7 +200,7 @@ void ShowNodeContext()
GenericMenu menu = new GenericMenu();
if (ParentWindow.CurrentGraph.StartNode != null)
{
menu.AddItem(new GUIContent("Make Default"), false, obj =>
menu.AddItem(new GUIContent("StartNode"), false, obj =>
{
ParentWindow.CurrentGraph.StartNode.objectReferenceValue = (UnityEngine.Object)obj;
ParentWindow.CurrentGraph.StartNode.serializedObject.ApplyModifiedProperties();
14 changes: 12 additions & 2 deletions Assets/NodeInspector/Scripts/Editor/NodeInspector.cs
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@ void OnGUI(){
return;
}

bool firsDrawCallOnThisGraph = CurrentGraph != lastUsedGraph;
JointHighlight = (JointHighlightHolder) GUIUtility.GetStateObject(typeof(JointHighlightHolder)
,GUIUtility.GetControlID(FocusType.Passive));

@@ -69,6 +70,10 @@ void OnGUI(){
HandleDraggConnections(nodes, connectionCollection.LastDraggedConnection);
EditorGUILayout.EndScrollView();
UpdateContentSize(nodes);
if (firsDrawCallOnThisGraph ){
Repaint();
}
lastUsedGraph = CurrentGraph;
}


@@ -129,15 +134,20 @@ void UpdateContentSize(List<Node> nodes){
}
}


GraphData lastUsedGraph;
Dictionary<string, GraphData> graphList;
int currentGraphId;
public GraphData CurrentGraph{
get{
return graphList.Values.ElementAt(currentGraphId);
}
}


void OnSelectionChange()
{
Repaint();
}

bool CheckSelectedObject(){
if (Selection.activeObject == null || !(Selection.activeObject is ScriptableObject)){
return false;

0 comments on commit 926ab98

Please sign in to comment.