Skip to content

Commit

Permalink
Added title to curve editor, pathfinding editor now hides tools not r…
Browse files Browse the repository at this point in the history
…elevant, can open spline component in curve editor from pathfinding editor
  • Loading branch information
Mgamerz committed Apr 14, 2018
1 parent 32f166b commit 06c5ed3
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 44 deletions.
1 change: 1 addition & 0 deletions ME3Explorer/CurveEd/CurveEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public CurveEditor(IExportEntry exp)
expEntry = exp;
LoadMEPackage(expEntry.FileRef.FileName);
Load();
Title = "Curve Editor | " + expEntry.FileRef.FileName + " | " + exp.Index + ": " + exp.ClassName;
}

private void Load()
Expand Down
22 changes: 16 additions & 6 deletions ME3Explorer/Pathfinding Editor/PathfindingEditor.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

85 changes: 50 additions & 35 deletions ME3Explorer/Pathfinding Editor/PathfindingEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,17 @@ private bool LoadPathingNodesFromLevel()
{
CurrentObjects.Add(exportEntry.Index);
activeExportsListbox.Items.Add("#" + (exportEntry.Index) + " " + exportEntry.ObjectName + " - Class: " + exportEntry.ClassName);
ArrayProperty<StructProperty> connectionsProp = exportEntry.GetProperty<ArrayProperty<StructProperty>>("Connections");
if (connectionsProp != null)
{
foreach (StructProperty connectionProp in connectionsProp)
{
ObjectProperty splinecomponentprop = connectionProp.GetProp<ObjectProperty>("SplineComponent");
IExportEntry splineComponentExport = pcc.getExport(splinecomponentprop.Value - 1);
CurrentObjects.Add(splinecomponentprop.Value - 1);
activeExportsListbox.Items.Add("#" + (splineComponentExport.Index) + " " + splineComponentExport.ObjectName + " - Class: " + splineComponentExport.ClassName);
}
}
}
}

Expand Down Expand Up @@ -941,7 +952,7 @@ public void LoadObject(int index)
{
ObjectProperty splinecomponentprop = connectionProp.GetProp<ObjectProperty>("SplineComponent");
IExportEntry splineComponentExport = pcc.getExport(splinecomponentprop.Value - 1);
Debug.WriteLine(splineComponentExport.GetFullPath + " " + splinecomponentprop.Value);
//Debug.WriteLine(splineComponentExport.GetFullPath + " " + splinecomponentprop.Value);
StructProperty splineInfo = splineComponentExport.GetProperty<StructProperty>("SplineInfo");
if (splineInfo != null)
{
Expand Down Expand Up @@ -1125,39 +1136,40 @@ protected void node_MouseDown(object sender, PInputEventArgs e)
{
pfm.Deselect();
}
if (!(node is SplinePoint0Node) && !(node is SplinePoint1Node))
{
int selected = CurrentObjects.IndexOf(n);
if (selected == -1)
return;
activeExportsListbox.SelectedIndex = selected;
}
else
int selected = CurrentObjects.IndexOf(n);
if (selected == -1)
return;
activeExportsListbox.SelectedIndex = selected;
if ((node is SplinePoint0Node) || (node is SplinePoint1Node))
{
GetProperties(node.export);
graphEditor.Refresh();
splitContainer2.Panel2Collapsed = false;
node.Select();
activeExportsListbox.SelectedIndex = -1;
}
CurrentlySelectedSplinePoint = null;
selectedByNode = true;
addToSFXCombatZoneToolStripMenuItem.Enabled = false;
if (e.Button == MouseButtons.Right)
{
addToSFXCombatZoneToolStripMenuItem.DropDownItems.Clear();
breakLinksToolStripMenuItem.DropDownItems.Clear();
breakLinksToolStripMenuItem.Visible = false;
setGraphPositionAsNodeLocationToolStripMenuItem.Visible = true;
setGraphPositionAsSplineLocationXYToolStripMenuItem.Visible = false;

openInCurveEditorToolStripMenuItem.Visible = false;
cloneToolStripMenuItem.Visible = false;
changeNodeTypeToolStripMenuItem.Visible = false;
createReachSpecToolStripMenuItem.Visible = false;
generateNewRandomGUIDToolStripMenuItem.Visible = false;
addToSFXCombatZoneToolStripMenuItem.Visible = false;
IExportEntry nodeExp = pcc.Exports[n];
var properties = nodeExp.GetProperties();

if (node is PathfindingNode)
{
changeNodeTypeToolStripMenuItem.Enabled = true;
createReachSpecToolStripMenuItem.Enabled = true;
generateNewRandomGUIDToolStripMenuItem.Enabled = true;
breakLinksToolStripMenuItem.Visible = true;

cloneToolStripMenuItem.Visible = true;
changeNodeTypeToolStripMenuItem.Visible = true;
createReachSpecToolStripMenuItem.Visible = true;
generateNewRandomGUIDToolStripMenuItem.Visible = true;
if (node.export.ClassName == "CoverSlotMarker")
{
ToolStripDropDown combatZonesDropdown = new ToolStripDropDown();
Expand All @@ -1174,15 +1186,15 @@ protected void node_MouseDown(object sender, PInputEventArgs e)
};
combatZonesDropdown.Items.Add(combatZoneItem);
}
addToSFXCombatZoneToolStripMenuItem.Enabled = true;
addToSFXCombatZoneToolStripMenuItem.Visible = true;
addToSFXCombatZoneToolStripMenuItem.DropDown = combatZonesDropdown;
}

rightMouseButtonMenu.Show(MousePosition);
//open in InterpEditor
string className = pcc.getExport(((PathfindingNodes.PathfindingNode)sender).Index).ClassName;
//break links
breakLinksToolStripMenuItem.Enabled = false;
breakLinksToolStripMenuItem.Visible = false;
breakLinksToolStripMenuItem.DropDown = null;
ToolStripMenuItem breaklLinkItem;
ToolStripDropDown submenu = new ToolStripDropDown();
Expand All @@ -1204,34 +1216,24 @@ protected void node_MouseDown(object sender, PInputEventArgs e)
submenu.Items.Add(breaklLinkItem);
}

breakLinksToolStripMenuItem.Enabled = true;
breakLinksToolStripMenuItem.Visible = true;
breakLinksToolStripMenuItem.DropDown = submenu;
}
}
else if (node is ActorNode)
{
changeNodeTypeToolStripMenuItem.Enabled = false;
generateNewRandomGUIDToolStripMenuItem.Enabled = false;
createReachSpecToolStripMenuItem.Enabled = false;
addToSFXCombatZoneToolStripMenuItem.Enabled = false;
cloneToolStripMenuItem.Visible = true;
addToSFXCombatZoneToolStripMenuItem.DropDown = null;
breakLinksToolStripMenuItem.Enabled = false;
breakLinksToolStripMenuItem.DropDown = null;

rightMouseButtonMenu.Show(MousePosition);

}
else if (node is SplinePoint0Node || node is SplinePoint1Node)
{
setGraphPositionAsNodeLocationToolStripMenuItem.Visible = false;
setGraphPositionAsSplineLocationXYToolStripMenuItem.Visible = true;
openInCurveEditorToolStripMenuItem.Visible = true;
CurrentlySelectedSplinePoint = node;
changeNodeTypeToolStripMenuItem.Enabled = false;
generateNewRandomGUIDToolStripMenuItem.Enabled = false;
createReachSpecToolStripMenuItem.Enabled = false;
addToSFXCombatZoneToolStripMenuItem.Enabled = false;
addToSFXCombatZoneToolStripMenuItem.DropDown = null;
breakLinksToolStripMenuItem.Enabled = false;
breakLinksToolStripMenuItem.DropDown = null;
rightMouseButtonMenu.Show(MousePosition);
}
Expand Down Expand Up @@ -1260,7 +1262,7 @@ private void addCombatZoneRef(IExportEntry nodeExp, IExportEntry combatZoneExp)
volumes = nodeExp.GetProperty<ArrayProperty<StructProperty>>("Volumes");
}
byte[] actorRef = new byte[20]; //5 ints
//GUID of combat zone
//GUID of combat zone
StructProperty guid = combatZoneExp.GetProperty<StructProperty>("CombatZoneGUID");
int a = guid.GetProp<IntProperty>("A");
int b = guid.GetProp<IntProperty>("D");
Expand Down Expand Up @@ -3221,7 +3223,7 @@ private float[] getReparamPoints(float[] outvals, Vector3 startPoint, Vector3 ou
// Calculate value at this point and the next, and then compute the change
// - USED FOR SAME AS SOURCE DISTRIBUTION
Vector3 startValue = evaluateBezier3D(startPoint, b, c, endPoint, outvals[i]);
Vector3 endValue = evaluateBezier3D(startPoint, b, c, endPoint, outvals[i+1]);
Vector3 endValue = evaluateBezier3D(startPoint, b, c, endPoint, outvals[i + 1]);
Vector3 dValue = endValue - startValue; // Change in value over 1/9th units, more operator overloading! Woo!

// Calculate, accumulate, and record the distance
Expand All @@ -3232,6 +3234,19 @@ private float[] getReparamPoints(float[] outvals, Vector3 startPoint, Vector3 ou
return table;
}
#endregion

private void openInCurveEditorToolStripMenuItem_Click(object sender, EventArgs e)
{
if (activeExportsListbox.SelectedIndex < 0)
{
return;
}
int l = CurrentObjects[activeExportsListbox.SelectedIndex];
if (l == -1)
return;
CurveEd.CurveEditor c = new CurveEd.CurveEditor(pcc.getExport(l));
c.Show();
}
}

public class PathingZoomController
Expand Down
6 changes: 3 additions & 3 deletions ME3Explorer/Pathfinding Editor/SplineNodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public class SplineActorNode : SplineNode
private SText val;
public string Value { get { return val.Text; } set { val.Text = value; } }
private static Color color = Color.FromArgb(255, 30, 30);
PointF[] edgeShape = new PointF[] { new PointF(0, 0), new PointF(50, 0), new PointF(30, 50), new PointF(0, 50) };
PointF[] edgeShape = new PointF[] { new PointF(0, 50), new PointF(0, 25), new PointF(10, 15), new PointF(15, 10), new PointF(30, 5), new PointF(40, 0), new PointF(50, 0), new PointF(40,5), new PointF(30, 10), new PointF(15, 15), new PointF(5, 25) };
public SplineActorNode(int idx, float x, float y, IMEPackage p, PathingGraphEditor grapheditor)
: base(idx, p, grapheditor)
{
Expand Down Expand Up @@ -261,7 +261,7 @@ public SplinePoint0Node(int idx, float x, float y, IMEPackage p, PathingGraphEdi
shape.Pickable = false;
this.AddChild(shape);
this.Bounds = new RectangleF(0, 0, w, h);
val = new SText("Spline Start");
val = new SText(export.Index+"\nSpline Start");
val.Pickable = false;
val.TextAlignment = StringAlignment.Center;
val.X = w / 2 - val.Width / 2;
Expand Down Expand Up @@ -322,7 +322,7 @@ public SplinePoint1Node(int idx, float x, float y, IMEPackage p, PathingGraphEdi
shape.Pickable = false;
this.AddChild(shape);
this.Bounds = new RectangleF(0, 0, w, h);
val = new SText("Spline End");
val = new SText(export.Index + "\nSpline End");
val.Pickable = false;
val.TextAlignment = StringAlignment.Center;
val.X = w / 2 - val.Width / 2;
Expand Down

0 comments on commit 06c5ed3

Please sign in to comment.