mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-29 18:32:55 +08:00
Multi-selection, move, undo/redo
This commit is contained in:
parent
1a2af6af9e
commit
bac531208c
29
Forms/ModelForm.Designer.cs
generated
29
Forms/ModelForm.Designer.cs
generated
@ -46,6 +46,7 @@
|
||||
this.ToolsDetailsTabPage = new System.Windows.Forms.TabPage();
|
||||
this.DetailsPropertyGrid = new CodeWalker.WinForms.ReadOnlyPropertyGrid();
|
||||
this.ToolsOptionsTabPage = new System.Windows.Forms.TabPage();
|
||||
this.SkeletonsCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.TimeOfDayLabel = new System.Windows.Forms.Label();
|
||||
this.label19 = new System.Windows.Forms.Label();
|
||||
this.TimeOfDayTrackBar = new System.Windows.Forms.TrackBar();
|
||||
@ -72,7 +73,6 @@
|
||||
this.ToolsPanelHideButton = new System.Windows.Forms.Button();
|
||||
this.ToolsDragPanel = new System.Windows.Forms.Panel();
|
||||
this.ToolsPanelShowButton = new System.Windows.Forms.Button();
|
||||
this.SkeletonsCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.StatusStrip.SuspendLayout();
|
||||
this.ConsolePanel.SuspendLayout();
|
||||
this.ToolsPanel.SuspendLayout();
|
||||
@ -284,6 +284,19 @@
|
||||
this.ToolsOptionsTabPage.Text = "Options";
|
||||
this.ToolsOptionsTabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// SkeletonsCheckBox
|
||||
//
|
||||
this.SkeletonsCheckBox.AutoSize = true;
|
||||
this.SkeletonsCheckBox.Checked = true;
|
||||
this.SkeletonsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.SkeletonsCheckBox.Location = new System.Drawing.Point(19, 444);
|
||||
this.SkeletonsCheckBox.Name = "SkeletonsCheckBox";
|
||||
this.SkeletonsCheckBox.Size = new System.Drawing.Size(103, 17);
|
||||
this.SkeletonsCheckBox.TabIndex = 21;
|
||||
this.SkeletonsCheckBox.Text = "Show Skeletons";
|
||||
this.SkeletonsCheckBox.UseVisualStyleBackColor = true;
|
||||
this.SkeletonsCheckBox.CheckedChanged += new System.EventHandler(this.SkeletonsCheckBox_CheckedChanged);
|
||||
//
|
||||
// TimeOfDayLabel
|
||||
//
|
||||
this.TimeOfDayLabel.AutoSize = true;
|
||||
@ -591,19 +604,6 @@
|
||||
this.ToolsPanelShowButton.UseVisualStyleBackColor = true;
|
||||
this.ToolsPanelShowButton.Click += new System.EventHandler(this.ToolsPanelShowButton_Click);
|
||||
//
|
||||
// SkeletonsCheckBox
|
||||
//
|
||||
this.SkeletonsCheckBox.AutoSize = true;
|
||||
this.SkeletonsCheckBox.Checked = true;
|
||||
this.SkeletonsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.SkeletonsCheckBox.Location = new System.Drawing.Point(19, 444);
|
||||
this.SkeletonsCheckBox.Name = "SkeletonsCheckBox";
|
||||
this.SkeletonsCheckBox.Size = new System.Drawing.Size(103, 17);
|
||||
this.SkeletonsCheckBox.TabIndex = 21;
|
||||
this.SkeletonsCheckBox.Text = "Show Skeletons";
|
||||
this.SkeletonsCheckBox.UseVisualStyleBackColor = true;
|
||||
this.SkeletonsCheckBox.CheckedChanged += new System.EventHandler(this.SkeletonsCheckBox_CheckedChanged);
|
||||
//
|
||||
// ModelForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -618,6 +618,7 @@
|
||||
this.KeyPreview = true;
|
||||
this.Name = "ModelForm";
|
||||
this.Text = "View Model - CodeWalker by dexyfex";
|
||||
this.Deactivate += new System.EventHandler(this.ModelForm_Deactivate);
|
||||
this.Load += new System.EventHandler(this.ModelForm_Load);
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ModelForm_KeyDown);
|
||||
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.ModelForm_KeyUp);
|
||||
|
@ -2277,28 +2277,6 @@ namespace CodeWalker.Forms
|
||||
|
||||
}
|
||||
|
||||
private void StatsUpdateTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
int rgc = (shaders != null) ? shaders.RenderedGeometries : 0;
|
||||
int crc = renderableCache.LoadedRenderableCount;
|
||||
int ctc = renderableCache.LoadedTextureCount;
|
||||
int tcrc = renderableCache.MemCachedRenderableCount;
|
||||
int tctc = renderableCache.MemCachedTextureCount;
|
||||
long vr = renderableCache.TotalGraphicsMemoryUse + (shaders != null ? shaders.TotalGraphicsMemoryUse : 0);
|
||||
string vram = TextUtil.GetBytesReadable(vr);
|
||||
//StatsLabel.Text = string.Format("Drawn: {0} geom, Loaded: {1}/{5} dr, {2}/{6} tx, Vram: {3}, Fps: {4}", rgc, crc, ctc, vram, fps, tcrc, tctc);
|
||||
StatsLabel.Text = string.Format("Drawn: {0} geom, Loaded: {1} dr, {2} tx, Vram: {3}, Fps: {4}", rgc, crc, ctc, vram, fps);
|
||||
|
||||
if (timerunning)
|
||||
{
|
||||
float fv = timeofday * 60.0f;
|
||||
//TimeOfDayTrackBar.Value = (int)fv;
|
||||
UpdateTimeOfDayLabel();
|
||||
}
|
||||
|
||||
//CameraPositionTextBox.Text = FloatUtil.GetVector3String(camera.Position, "0.##");
|
||||
}
|
||||
|
||||
private void ModelForm_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (ActiveControl is TextBox)
|
||||
@ -2470,6 +2448,40 @@ namespace CodeWalker.Forms
|
||||
//}
|
||||
}
|
||||
|
||||
private void ModelForm_Deactivate(object sender, EventArgs e)
|
||||
{
|
||||
//try not to lock keyboard movement if the form loses focus.
|
||||
kbmovefwd = false;
|
||||
kbmovebck = false;
|
||||
kbmovelft = false;
|
||||
kbmovergt = false;
|
||||
kbmoveup = false;
|
||||
kbmovedn = false;
|
||||
kbjump = false;
|
||||
}
|
||||
|
||||
private void StatsUpdateTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
int rgc = (shaders != null) ? shaders.RenderedGeometries : 0;
|
||||
int crc = renderableCache.LoadedRenderableCount;
|
||||
int ctc = renderableCache.LoadedTextureCount;
|
||||
int tcrc = renderableCache.MemCachedRenderableCount;
|
||||
int tctc = renderableCache.MemCachedTextureCount;
|
||||
long vr = renderableCache.TotalGraphicsMemoryUse + (shaders != null ? shaders.TotalGraphicsMemoryUse : 0);
|
||||
string vram = TextUtil.GetBytesReadable(vr);
|
||||
//StatsLabel.Text = string.Format("Drawn: {0} geom, Loaded: {1}/{5} dr, {2}/{6} tx, Vram: {3}, Fps: {4}", rgc, crc, ctc, vram, fps, tcrc, tctc);
|
||||
StatsLabel.Text = string.Format("Drawn: {0} geom, Loaded: {1} dr, {2} tx, Vram: {3}, Fps: {4}", rgc, crc, ctc, vram, fps);
|
||||
|
||||
if (timerunning)
|
||||
{
|
||||
float fv = timeofday * 60.0f;
|
||||
//TimeOfDayTrackBar.Value = (int)fv;
|
||||
UpdateTimeOfDayLabel();
|
||||
}
|
||||
|
||||
//CameraPositionTextBox.Text = FloatUtil.GetVector3String(camera.Position, "0.##");
|
||||
}
|
||||
|
||||
private void ToolsPanelShowButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
ToolsPanel.Visible = true;
|
||||
|
@ -13,14 +13,64 @@ namespace CodeWalker.Project
|
||||
{
|
||||
|
||||
//revert the object to the state marked at the start of this step
|
||||
public abstract void Undo(WorldForm wf, ProjectForm pf, ref MapSelection sel);
|
||||
public abstract void Undo(WorldForm wf, ref MapSelection sel);
|
||||
|
||||
//revert the object to the state marked at the end of this step
|
||||
public abstract void Redo(WorldForm wf, ProjectForm pf, ref MapSelection sel);
|
||||
public abstract void Redo(WorldForm wf, ref MapSelection sel);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class MultiPositionUndoStep : UndoStep
|
||||
{
|
||||
private MapSelection Selection;
|
||||
private MapSelection[] Items;
|
||||
public Vector3 StartPosition { get; set; }
|
||||
public Vector3 EndPosition { get; set; }
|
||||
|
||||
public MultiPositionUndoStep(MapSelection multiSel, MapSelection[] items, Vector3 startpos)
|
||||
{
|
||||
Selection = multiSel;
|
||||
Items = items;
|
||||
StartPosition = startpos;
|
||||
EndPosition = multiSel.WidgetPosition;
|
||||
}
|
||||
|
||||
private void Update(WorldForm wf, ref MapSelection sel, Vector3 p, Vector3 o)
|
||||
{
|
||||
//update selection items positions for new widget position p
|
||||
|
||||
Vector3 dp = p - o;
|
||||
for (int i = 0; i < Items.Length; i++)
|
||||
{
|
||||
var refpos = Items[i].WidgetPosition;
|
||||
Items[i].SetPosition(refpos + dp, refpos, false);
|
||||
}
|
||||
sel.MultipleSelectionCenter = p; //center used for widget pos...
|
||||
|
||||
wf.SelectMulti(Items);
|
||||
wf.SetWidgetPosition(p);
|
||||
}
|
||||
|
||||
public override void Undo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, ref sel, StartPosition, EndPosition);
|
||||
}
|
||||
|
||||
public override void Redo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, ref sel, EndPosition, StartPosition);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return (Items?.Length ?? 0).ToString() + " items: Position";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class EntityPositionUndoStep : UndoStep
|
||||
{
|
||||
public YmapEntityDef Entity { get; set; }
|
||||
@ -34,26 +84,22 @@ namespace CodeWalker.Project
|
||||
EndPosition = ent?.WidgetPosition ?? Vector3.Zero;
|
||||
}
|
||||
|
||||
private void Update(WorldForm wf, ProjectForm pf, ref MapSelection sel, Vector3 p)
|
||||
private void Update(WorldForm wf, ref MapSelection sel, Vector3 p)
|
||||
{
|
||||
Entity?.SetPositionFromWidget(p);
|
||||
|
||||
if (Entity != sel.EntityDef) wf.SelectEntity(Entity);
|
||||
wf.SetWidgetPosition(Entity.WidgetPosition);
|
||||
if ((Entity != null) && (pf != null))
|
||||
{
|
||||
pf.OnWorldEntityModified(Entity);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Undo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Undo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, StartPosition);
|
||||
Update(wf, ref sel, StartPosition);
|
||||
}
|
||||
|
||||
public override void Redo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Redo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, EndPosition);
|
||||
Update(wf, ref sel, EndPosition);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@ -76,27 +122,23 @@ namespace CodeWalker.Project
|
||||
}
|
||||
|
||||
|
||||
private void Update(WorldForm wf, ProjectForm pf, ref MapSelection sel, Quaternion q)
|
||||
private void Update(WorldForm wf, ref MapSelection sel, Quaternion q)
|
||||
{
|
||||
Entity?.SetOrientationFromWidget(q);
|
||||
|
||||
if (Entity != sel.EntityDef) wf.SelectEntity(Entity);
|
||||
wf.SetWidgetRotation(q);
|
||||
if ((Entity != null) && (pf != null))
|
||||
{
|
||||
pf.OnWorldEntityModified(Entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void Undo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Undo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, StartRotation);
|
||||
Update(wf, ref sel, StartRotation);
|
||||
}
|
||||
|
||||
public override void Redo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Redo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, EndRotation);
|
||||
Update(wf, ref sel, EndRotation);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@ -119,27 +161,23 @@ namespace CodeWalker.Project
|
||||
}
|
||||
|
||||
|
||||
private void Update(WorldForm wf, ProjectForm pf, ref MapSelection sel, Vector3 s)
|
||||
private void Update(WorldForm wf, ref MapSelection sel, Vector3 s)
|
||||
{
|
||||
Entity?.SetScale(s);
|
||||
|
||||
if (Entity != sel.EntityDef) wf.SelectEntity(Entity);
|
||||
wf.SetWidgetScale(s);
|
||||
if ((Entity != null) && (pf != null))
|
||||
{
|
||||
pf.OnWorldEntityModified(Entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void Undo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Undo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, StartScale);
|
||||
Update(wf, ref sel, StartScale);
|
||||
}
|
||||
|
||||
public override void Redo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Redo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, EndScale);
|
||||
Update(wf, ref sel, EndScale);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@ -162,26 +200,22 @@ namespace CodeWalker.Project
|
||||
EndPosition = ent?.WidgetPosition ?? Vector3.Zero;
|
||||
}
|
||||
|
||||
private void Update(WorldForm wf, ProjectForm pf, ref MapSelection sel, Vector3 p)
|
||||
private void Update(WorldForm wf, ref MapSelection sel, Vector3 p)
|
||||
{
|
||||
Entity?.SetPivotPositionFromWidget(p);
|
||||
|
||||
if (Entity != sel.EntityDef) wf.SelectEntity(Entity);
|
||||
wf.SetWidgetPosition(p);
|
||||
if ((Entity != null) && (pf != null))
|
||||
{
|
||||
pf.OnWorldEntityModified(Entity);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Undo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Undo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, StartPosition);
|
||||
Update(wf, ref sel, StartPosition);
|
||||
}
|
||||
|
||||
public override void Redo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Redo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, EndPosition);
|
||||
Update(wf, ref sel, EndPosition);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@ -204,27 +238,23 @@ namespace CodeWalker.Project
|
||||
}
|
||||
|
||||
|
||||
private void Update(WorldForm wf, ProjectForm pf, ref MapSelection sel, Quaternion q)
|
||||
private void Update(WorldForm wf, ref MapSelection sel, Quaternion q)
|
||||
{
|
||||
Entity?.SetPivotOrientationFromWidget(q);
|
||||
|
||||
if (Entity != sel.EntityDef) wf.SelectEntity(Entity);
|
||||
wf.SetWidgetRotation(q);
|
||||
if ((Entity != null) && (pf != null))
|
||||
{
|
||||
pf.OnWorldEntityModified(Entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void Undo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Undo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, StartRotation);
|
||||
Update(wf, ref sel, StartRotation);
|
||||
}
|
||||
|
||||
public override void Redo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Redo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, EndRotation);
|
||||
Update(wf, ref sel, EndRotation);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@ -248,26 +278,22 @@ namespace CodeWalker.Project
|
||||
EndPosition = cargen?.Position ?? Vector3.Zero;
|
||||
}
|
||||
|
||||
private void Update(WorldForm wf, ProjectForm pf, ref MapSelection sel, Vector3 p)
|
||||
private void Update(WorldForm wf, ref MapSelection sel, Vector3 p)
|
||||
{
|
||||
CarGen?.SetPosition(p);
|
||||
|
||||
if (CarGen != sel.CarGenerator) wf.SelectCarGen(CarGen);
|
||||
wf.SetWidgetPosition(p);
|
||||
if ((CarGen != null) && (pf != null))
|
||||
{
|
||||
pf.OnWorldCarGenModified(CarGen);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Undo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Undo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, StartPosition);
|
||||
Update(wf, ref sel, StartPosition);
|
||||
}
|
||||
|
||||
public override void Redo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Redo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, EndPosition);
|
||||
Update(wf, ref sel, EndPosition);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@ -290,26 +316,22 @@ namespace CodeWalker.Project
|
||||
}
|
||||
|
||||
|
||||
private void Update(WorldForm wf, ProjectForm pf, ref MapSelection sel, Quaternion q)
|
||||
private void Update(WorldForm wf, ref MapSelection sel, Quaternion q)
|
||||
{
|
||||
CarGen?.SetOrientation(q);
|
||||
|
||||
if (CarGen != sel.CarGenerator) wf.SelectCarGen(CarGen);
|
||||
wf.SetWidgetRotation(q);
|
||||
if ((CarGen != null) && (pf != null))
|
||||
{
|
||||
pf.OnWorldCarGenModified(CarGen);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Undo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Undo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, StartRotation);
|
||||
Update(wf, ref sel, StartRotation);
|
||||
}
|
||||
|
||||
public override void Redo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Redo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, EndRotation);
|
||||
Update(wf, ref sel, EndRotation);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@ -331,27 +353,23 @@ namespace CodeWalker.Project
|
||||
EndScale = new Vector3(cargen?._CCarGen.perpendicularLength ?? 1.0f);
|
||||
}
|
||||
|
||||
private void Update(WorldForm wf, ProjectForm pf, ref MapSelection sel, Vector3 s)
|
||||
private void Update(WorldForm wf, ref MapSelection sel, Vector3 s)
|
||||
{
|
||||
CarGen?.SetScale(s);
|
||||
|
||||
if (CarGen != sel.CarGenerator) wf.SelectCarGen(CarGen);
|
||||
wf.SetWidgetScale(s);
|
||||
if ((CarGen != null) && (pf != null))
|
||||
{
|
||||
pf.OnWorldCarGenModified(CarGen);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void Undo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Undo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, StartScale);
|
||||
Update(wf, ref sel, StartScale);
|
||||
}
|
||||
|
||||
public override void Redo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Redo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, EndScale);
|
||||
Update(wf, ref sel, EndScale);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@ -368,16 +386,16 @@ namespace CodeWalker.Project
|
||||
public Vector3 StartPosition { get; set; }
|
||||
public Vector3 EndPosition { get; set; }
|
||||
|
||||
public PathNodePositionUndoStep(YndNode pathnode, Vector3 startpos, WorldForm wf, ProjectForm pf)
|
||||
public PathNodePositionUndoStep(YndNode pathnode, Vector3 startpos, WorldForm wf)
|
||||
{
|
||||
PathNode = pathnode;
|
||||
StartPosition = startpos;
|
||||
EndPosition = pathnode?.Position ?? Vector3.Zero;
|
||||
|
||||
UpdateGraphics(wf, pf); //forces the update of the path graphics when it's moved...
|
||||
UpdateGraphics(wf); //forces the update of the path graphics when it's moved...
|
||||
}
|
||||
|
||||
private void Update(WorldForm wf, ProjectForm pf, ref MapSelection sel, Vector3 p)
|
||||
private void Update(WorldForm wf, ref MapSelection sel, Vector3 p)
|
||||
{
|
||||
PathNode?.SetPosition(p);
|
||||
|
||||
@ -395,31 +413,27 @@ namespace CodeWalker.Project
|
||||
wf.SetWidgetPosition(p);
|
||||
|
||||
|
||||
UpdateGraphics(wf, pf);
|
||||
UpdateGraphics(wf);
|
||||
}
|
||||
|
||||
private void UpdateGraphics(WorldForm wf, ProjectForm pf)
|
||||
private void UpdateGraphics(WorldForm wf)
|
||||
{
|
||||
if (PathNode != null)
|
||||
{
|
||||
//Ynd graphics needs to be updated.....
|
||||
wf.UpdatePathNodeGraphics(PathNode, false);
|
||||
if (pf != null) //make sure to update the project form UI..
|
||||
{
|
||||
pf.OnWorldPathNodeModified(PathNode, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void Undo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Undo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, StartPosition);
|
||||
Update(wf, ref sel, StartPosition);
|
||||
}
|
||||
|
||||
public override void Redo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Redo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, EndPosition);
|
||||
Update(wf, ref sel, EndPosition);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@ -435,16 +449,16 @@ namespace CodeWalker.Project
|
||||
public Vector3 StartPosition { get; set; }
|
||||
public Vector3 EndPosition { get; set; }
|
||||
|
||||
public TrainTrackNodePositionUndoStep(TrainTrackNode node, Vector3 startpos, WorldForm wf, ProjectForm pf)
|
||||
public TrainTrackNodePositionUndoStep(TrainTrackNode node, Vector3 startpos, WorldForm wf)
|
||||
{
|
||||
Node = node;
|
||||
StartPosition = startpos;
|
||||
EndPosition = node?.Position ?? Vector3.Zero;
|
||||
|
||||
UpdateGraphics(wf, pf); //forces the update of the path graphics when it's moved...
|
||||
UpdateGraphics(wf); //forces the update of the path graphics when it's moved...
|
||||
}
|
||||
|
||||
private void Update(WorldForm wf, ProjectForm pf, ref MapSelection sel, Vector3 p)
|
||||
private void Update(WorldForm wf, ref MapSelection sel, Vector3 p)
|
||||
{
|
||||
Node?.SetPosition(p);
|
||||
|
||||
@ -455,31 +469,27 @@ namespace CodeWalker.Project
|
||||
wf.SetWidgetPosition(p);
|
||||
|
||||
|
||||
UpdateGraphics(wf, pf);
|
||||
UpdateGraphics(wf);
|
||||
}
|
||||
|
||||
private void UpdateGraphics(WorldForm wf, ProjectForm pf)
|
||||
private void UpdateGraphics(WorldForm wf)
|
||||
{
|
||||
if (Node != null)
|
||||
{
|
||||
//Ynd graphics needs to be updated.....
|
||||
wf.UpdateTrainTrackNodeGraphics(Node, false);
|
||||
if (pf != null) //make sure to update the project form UI..
|
||||
{
|
||||
pf.OnWorldTrainNodeModified(Node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void Undo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Undo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, StartPosition);
|
||||
Update(wf, ref sel, StartPosition);
|
||||
}
|
||||
|
||||
public override void Redo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Redo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, EndPosition);
|
||||
Update(wf, ref sel, EndPosition);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@ -497,46 +507,42 @@ namespace CodeWalker.Project
|
||||
public Vector3 StartPosition { get; set; }
|
||||
public Vector3 EndPosition { get; set; }
|
||||
|
||||
public ScenarioNodePositionUndoStep(ScenarioNode node, Vector3 startpos, WorldForm wf, ProjectForm pf)
|
||||
public ScenarioNodePositionUndoStep(ScenarioNode node, Vector3 startpos, WorldForm wf)
|
||||
{
|
||||
ScenarioNode = node;
|
||||
StartPosition = startpos;
|
||||
EndPosition = node?.Position ?? Vector3.Zero;
|
||||
|
||||
UpdateGraphics(wf, pf); //forces the update of the path graphics when it's moved...
|
||||
UpdateGraphics(wf); //forces the update of the path graphics when it's moved...
|
||||
}
|
||||
|
||||
private void Update(WorldForm wf, ProjectForm pf, ref MapSelection sel, Vector3 p)
|
||||
private void Update(WorldForm wf, ref MapSelection sel, Vector3 p)
|
||||
{
|
||||
ScenarioNode?.SetPosition(p);
|
||||
|
||||
if (ScenarioNode != sel.ScenarioNode) wf.SelectScenarioNode(ScenarioNode);
|
||||
wf.SetWidgetPosition(p);
|
||||
|
||||
UpdateGraphics(wf, pf);
|
||||
UpdateGraphics(wf);
|
||||
}
|
||||
|
||||
private void UpdateGraphics(WorldForm wf, ProjectForm pf)
|
||||
private void UpdateGraphics(WorldForm wf)
|
||||
{
|
||||
if (ScenarioNode != null)
|
||||
{
|
||||
//Ymt graphics needs to be updated.....
|
||||
wf.UpdateScenarioGraphics(ScenarioNode.Ymt, false);
|
||||
if (pf != null) //make sure to update the project form UI..
|
||||
{
|
||||
pf.OnWorldScenarioNodeModified(ScenarioNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Undo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Undo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, StartPosition);
|
||||
Update(wf, ref sel, StartPosition);
|
||||
}
|
||||
|
||||
public override void Redo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Redo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, EndPosition);
|
||||
Update(wf, ref sel, EndPosition);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@ -551,48 +557,44 @@ namespace CodeWalker.Project
|
||||
public Quaternion StartRotation { get; set; }
|
||||
public Quaternion EndRotation { get; set; }
|
||||
|
||||
public ScenarioNodeRotationUndoStep(ScenarioNode node, Quaternion startrot, WorldForm wf, ProjectForm pf)
|
||||
public ScenarioNodeRotationUndoStep(ScenarioNode node, Quaternion startrot, WorldForm wf)
|
||||
{
|
||||
ScenarioNode = node;
|
||||
StartRotation = startrot;
|
||||
EndRotation = node?.Orientation ?? Quaternion.Identity;
|
||||
|
||||
//UpdateGraphics(wf, pf);
|
||||
//UpdateGraphics(wf);
|
||||
}
|
||||
|
||||
|
||||
private void Update(WorldForm wf, ProjectForm pf, ref MapSelection sel, Quaternion q)
|
||||
private void Update(WorldForm wf, ref MapSelection sel, Quaternion q)
|
||||
{
|
||||
ScenarioNode?.SetOrientation(q);
|
||||
|
||||
if (ScenarioNode != sel.ScenarioNode) wf.SelectScenarioNode(ScenarioNode);
|
||||
wf.SetWidgetRotation(q);
|
||||
|
||||
//UpdateGraphics(wf, pf);
|
||||
//UpdateGraphics(wf);
|
||||
}
|
||||
|
||||
private void UpdateGraphics(WorldForm wf, ProjectForm pf)
|
||||
private void UpdateGraphics(WorldForm wf)
|
||||
{
|
||||
////this function shouldn't actually be needed for rotating...
|
||||
//if (ScenarioNode != null)
|
||||
//{
|
||||
// //Ymt graphics needs to be updated.....
|
||||
// wf.UpdateScenarioGraphics(ScenarioNode.Ymt, false);
|
||||
// if (pf != null) //make sure to update the project form UI..
|
||||
// {
|
||||
// pf.OnWorldScenarioNodeModified(ScenarioNode);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
public override void Undo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Undo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, StartRotation);
|
||||
Update(wf, ref sel, StartRotation);
|
||||
}
|
||||
|
||||
public override void Redo(WorldForm wf, ProjectForm pf, ref MapSelection sel)
|
||||
public override void Redo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, pf, ref sel, EndRotation);
|
||||
Update(wf, ref sel, EndRotation);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
@ -744,7 +744,7 @@ namespace CodeWalker
|
||||
|
||||
if (WorldForm != null)
|
||||
{
|
||||
WorldForm.SelectItem(null, null, null);//make sure current selected item isn't still selected...
|
||||
WorldForm.SelectItem(null);//make sure current selected item isn't still selected...
|
||||
}
|
||||
}
|
||||
|
||||
@ -1909,7 +1909,7 @@ namespace CodeWalker
|
||||
|
||||
if (WorldForm != null)
|
||||
{
|
||||
WorldForm.SelectItem(CurrentEntity, CurrentEntity.Archetype, null); //hopefully the drawable is already loaded - this will try get from cache
|
||||
WorldForm.SelectEntity(CurrentEntity); //hopefully the drawable is already loaded - this will try get from cache
|
||||
}
|
||||
|
||||
////struct CEntityDef:
|
||||
@ -5033,7 +5033,7 @@ namespace CodeWalker
|
||||
WorldForm.UpdateScenarioGraphics(cs, false);
|
||||
if (delpoints)
|
||||
{
|
||||
WorldForm.SelectItem(null, null, null);
|
||||
WorldForm.SelectItem(null);
|
||||
}
|
||||
}
|
||||
else if (cs?.ScenarioRegion != null)
|
||||
@ -5222,7 +5222,7 @@ namespace CodeWalker
|
||||
WorldForm.UpdateScenarioGraphics(cs, false);
|
||||
if (delpoints || ((cn != null) && (cn.MyPoint == null)))
|
||||
{
|
||||
WorldForm.SelectItem(null, null, null);
|
||||
WorldForm.SelectItem(null);
|
||||
}
|
||||
}
|
||||
else if (cs?.ScenarioRegion != null)
|
||||
@ -5441,7 +5441,7 @@ namespace CodeWalker
|
||||
if (WorldForm != null)
|
||||
{
|
||||
WorldForm.UpdateScenarioGraphics(cs, false);
|
||||
WorldForm.SelectItem(null, null, null);
|
||||
WorldForm.SelectItem(null);
|
||||
}
|
||||
else if (cs?.ScenarioRegion != null)
|
||||
{
|
||||
@ -5621,7 +5621,7 @@ namespace CodeWalker
|
||||
cent.rotation = placement.Rotation;
|
||||
cent.scaleXY = 1.0f;
|
||||
cent.scaleZ = 1.0f;
|
||||
cent.flags = placement.Dynamic ? 32u : 0; //1572872; //?
|
||||
cent.flags = placement.Dynamic ? 32u : 0;// 1572872; //?
|
||||
cent.parentIndex = -1;
|
||||
cent.lodDist = placement.LodDistance;
|
||||
cent.lodLevel = Unk_1264241711.LODTYPES_DEPTH_ORPHANHD;
|
||||
@ -5993,7 +5993,39 @@ namespace CodeWalker
|
||||
catch { }
|
||||
}
|
||||
|
||||
public void OnWorldEntityModified(YmapEntityDef ent)
|
||||
public void OnWorldSelectionModified(MapSelection sel, List<MapSelection> items)
|
||||
{
|
||||
if (sel.MultipleSelection)
|
||||
{
|
||||
}
|
||||
else if (sel.EntityDef != null)
|
||||
{
|
||||
OnWorldEntityModified(sel.EntityDef);
|
||||
}
|
||||
else if (sel.CarGenerator != null)
|
||||
{
|
||||
OnWorldCarGenModified(sel.CarGenerator);
|
||||
}
|
||||
else if (sel.PathNode != null)
|
||||
{
|
||||
OnWorldPathNodeModified(sel.PathNode, sel.PathLink);
|
||||
}
|
||||
else if (sel.NavPoly != null)
|
||||
{
|
||||
OnWorldNavPolyModified(sel.NavPoly);
|
||||
}
|
||||
else if (sel.TrainTrackNode != null)
|
||||
{
|
||||
OnWorldTrainNodeModified(sel.TrainTrackNode);
|
||||
}
|
||||
else if (sel.ScenarioNode != null)
|
||||
{
|
||||
OnWorldScenarioNodeModified(sel.ScenarioNode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OnWorldEntityModified(YmapEntityDef ent)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -6040,7 +6072,7 @@ namespace CodeWalker
|
||||
catch { }
|
||||
}
|
||||
|
||||
public void OnWorldCarGenModified(YmapCarGen cargen)
|
||||
private void OnWorldCarGenModified(YmapCarGen cargen)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -6087,7 +6119,7 @@ namespace CodeWalker
|
||||
catch { }
|
||||
}
|
||||
|
||||
public void OnWorldPathNodeModified(YndNode node, YndLink link)
|
||||
private void OnWorldPathNodeModified(YndNode node, YndLink link)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -6141,7 +6173,7 @@ namespace CodeWalker
|
||||
catch { }
|
||||
}
|
||||
|
||||
public void OnWorldNavPolyModified(YnvPoly poly)
|
||||
private void OnWorldNavPolyModified(YnvPoly poly)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -6188,7 +6220,7 @@ namespace CodeWalker
|
||||
catch { }
|
||||
}
|
||||
|
||||
public void OnWorldTrainNodeModified(TrainTrackNode node)
|
||||
private void OnWorldTrainNodeModified(TrainTrackNode node)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -6232,7 +6264,7 @@ namespace CodeWalker
|
||||
catch { }
|
||||
}
|
||||
|
||||
public void OnWorldScenarioNodeModified(ScenarioNode node)
|
||||
private void OnWorldScenarioNodeModified(ScenarioNode node)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
25
WorldForm.Designer.cs
generated
25
WorldForm.Designer.cs
generated
@ -145,6 +145,7 @@ namespace CodeWalker
|
||||
this.WaitForChildrenCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.label14 = new System.Windows.Forms.Label();
|
||||
this.tabPage9 = new System.Windows.Forms.TabPage();
|
||||
this.PopZonesCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.NavMeshesCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.TrainPathsCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.PathsDepthClipCheckBox = new System.Windows.Forms.CheckBox();
|
||||
@ -274,7 +275,6 @@ namespace CodeWalker
|
||||
this.ToolbarCameraMapViewButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ToolbarCameraOrthographicButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ToolbarPanel = new System.Windows.Forms.Panel();
|
||||
this.PopZonesCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.StatusStrip.SuspendLayout();
|
||||
this.ToolsPanel.SuspendLayout();
|
||||
this.ToolsTabControl.SuspendLayout();
|
||||
@ -1769,6 +1769,17 @@ namespace CodeWalker
|
||||
this.tabPage9.Text = "Helpers";
|
||||
this.tabPage9.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// PopZonesCheckBox
|
||||
//
|
||||
this.PopZonesCheckBox.AutoSize = true;
|
||||
this.PopZonesCheckBox.Location = new System.Drawing.Point(10, 388);
|
||||
this.PopZonesCheckBox.Name = "PopZonesCheckBox";
|
||||
this.PopZonesCheckBox.Size = new System.Drawing.Size(136, 17);
|
||||
this.PopZonesCheckBox.TabIndex = 52;
|
||||
this.PopZonesCheckBox.Text = "Show population zones";
|
||||
this.PopZonesCheckBox.UseVisualStyleBackColor = true;
|
||||
this.PopZonesCheckBox.CheckedChanged += new System.EventHandler(this.PopZonesCheckBox_CheckedChanged);
|
||||
//
|
||||
// NavMeshesCheckBox
|
||||
//
|
||||
this.NavMeshesCheckBox.AutoSize = true;
|
||||
@ -3104,17 +3115,6 @@ namespace CodeWalker
|
||||
this.ToolbarPanel.TabIndex = 7;
|
||||
this.ToolbarPanel.Visible = false;
|
||||
//
|
||||
// PopZonesCheckBox
|
||||
//
|
||||
this.PopZonesCheckBox.AutoSize = true;
|
||||
this.PopZonesCheckBox.Location = new System.Drawing.Point(10, 388);
|
||||
this.PopZonesCheckBox.Name = "PopZonesCheckBox";
|
||||
this.PopZonesCheckBox.Size = new System.Drawing.Size(136, 17);
|
||||
this.PopZonesCheckBox.TabIndex = 52;
|
||||
this.PopZonesCheckBox.Text = "Show population zones";
|
||||
this.PopZonesCheckBox.UseVisualStyleBackColor = true;
|
||||
this.PopZonesCheckBox.CheckedChanged += new System.EventHandler(this.PopZonesCheckBox_CheckedChanged);
|
||||
//
|
||||
// WorldForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -3131,6 +3131,7 @@ namespace CodeWalker
|
||||
this.KeyPreview = true;
|
||||
this.Name = "WorldForm";
|
||||
this.Text = "CodeWalker";
|
||||
this.Deactivate += new System.EventHandler(this.WorldForm_Deactivate);
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.WorldForm_FormClosing);
|
||||
this.Load += new System.EventHandler(this.WorldForm_Load);
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.WorldForm_KeyDown);
|
||||
|
922
WorldForm.cs
922
WorldForm.cs
File diff suppressed because it is too large
Load Diff
@ -22,6 +22,7 @@ namespace CodeWalker
|
||||
{
|
||||
WorldForm WorldForm;
|
||||
MapSelection Selection;
|
||||
List<MapSelection> SelectionItems;
|
||||
string SelectionMode = "";
|
||||
bool MouseSelectEnable = false;
|
||||
|
||||
@ -59,9 +60,10 @@ namespace CodeWalker
|
||||
MouseSelectCheckBox.Checked = enable;
|
||||
}
|
||||
|
||||
public void SetSelection(MapSelection item)
|
||||
public void SetSelection(MapSelection item, List<MapSelection> multiItems)
|
||||
{
|
||||
Selection = item;
|
||||
SelectionItems = multiItems;
|
||||
|
||||
SelectionNameTextBox.Text = item.GetNameString("Nothing selected");
|
||||
//SelEntityPropertyGrid.SelectedObject = item.EntityDef;
|
||||
@ -87,8 +89,12 @@ namespace CodeWalker
|
||||
AddSelectionEntityHierarchyNodes(item.EntityDef);
|
||||
}
|
||||
|
||||
|
||||
if (item.TimeCycleModifier != null)
|
||||
if (item.MultipleSelection)
|
||||
{
|
||||
SelectionEntityTabPage.Text = "Multiple items";
|
||||
SelEntityPropertyGrid.SelectedObject = multiItems.ToArray();
|
||||
}
|
||||
else if (item.TimeCycleModifier != null)
|
||||
{
|
||||
SelectionEntityTabPage.Text = "Time Cycle Modifier";
|
||||
SelEntityPropertyGrid.SelectedObject = item.TimeCycleModifier;
|
||||
@ -414,7 +420,7 @@ namespace CodeWalker
|
||||
|
||||
private void WorldInfoForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
SetSelection(Selection);
|
||||
SetSelection(Selection, SelectionItems);
|
||||
}
|
||||
|
||||
private void WorldInfoForm_FormClosed(object sender, FormClosedEventArgs e)
|
||||
|
Loading…
Reference in New Issue
Block a user