Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions TombEditor/Controls/TriggerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ obj is Editor.EventSetsChangedEvent ||
BeginInvoke((Action)(() =>
{
_nodeListRefreshPending = false;

if (IsDisposed || !IsHandleCreated || nodeEditor.IsDisposed)
return;

nodeEditor.PopulateCachedNodeLists(_editor.Level);
nodeEditor.RefreshArgumentUI();
}));
Expand Down
23 changes: 16 additions & 7 deletions TombLib/TombLib.Forms/Controls/VisualScripting/VisibleNodeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,25 @@ public void SelectFirstFunction(ArgumentType type, string luaName)

public void SpawnUIElements()
{
if (IsDisposed || Disposing || Node == null)
return;

var editor = Editor;
var func = cbFunction.SelectedItem as NodeFunction;

if (func == null)
if (func == null || editor == null || editor.IsDisposed)
return;

Visible = false;
Editor.LockNodeChanges = true;
editor.LockNodeChanges = true;
SuspendLayout();
DisposeUI();

var scale = 1.0f;
using (var gfx = FindForm().CreateGraphics())
scale = (float)gfx.DpiX / 96.0f;
var form = FindForm();
if (form != null && !form.IsDisposed)
using (var gfx = form.CreateGraphics())
scale = (float)gfx.DpiX / 96.0f;

Size = new Size((int)(Node.Size * scale), Size.Height);

Expand Down Expand Up @@ -279,10 +285,10 @@ public void SpawnUIElements()

RefreshLock();
ResumeLayout();
Editor.LockNodeChanges = false;
editor.LockNodeChanges = false;
Visible = true;
Invalidate();
Editor?.Invalidate();
editor.Invalidate();
}

private void Ctrl_LocatedItemFound(object sender, EventArgs e)
Expand Down Expand Up @@ -683,6 +689,9 @@ private void cbFunction_SelectedIndexChanged(object sender, EventArgs e)
return;

var funcSetup = cbFunction.SelectedItem as NodeFunction;
if (funcSetup == null || Node == null || IsDisposed || Disposing)
return;

Node.Function = funcSetup.Signature;

if ((_lastSelectedIndex != -1 && cbFunction.SelectedIndex != -1) || (funcSetup.Arguments.Count != Node.Arguments.Count))
Expand All @@ -700,4 +709,4 @@ private void cbFunction_MouseDown(object sender, MouseEventArgs e)
Ctrl_RightClick(sender, e);
}
}
}
}