Attempted fixes for crashing/freezing while dragging the widget

This commit is contained in:
dexy 2021-11-12 21:07:06 +11:00
parent 1c31bd4a4f
commit 6b26eb16de
3 changed files with 18 additions and 12 deletions

View File

@ -156,7 +156,11 @@ namespace CodeWalker.Project.Panels
UpdateTabVisibility(); UpdateTabVisibility();
var ms = ProjectForm.WorldForm?.CurrentMapSelection;
if ((ms?.EntityDef != CurrentEntity) && (ms?.MloEntityDef != CurrentEntity))
{
ProjectForm.WorldForm?.SelectObject(CurrentEntity); //hopefully the drawable is already loaded - this will try get from cache ProjectForm.WorldForm?.SelectObject(CurrentEntity); //hopefully the drawable is already loaded - this will try get from cache
}
////struct CEntityDef: ////struct CEntityDef:
//MetaHash archetypeName { get; set; } //8 8: Hash: 0: archetypeName //MetaHash archetypeName { get; set; } //8 8: Hash: 0: archetypeName

View File

@ -8374,16 +8374,16 @@ namespace CodeWalker.Project
{ {
if (CurrentYmapFile == null) return; if (CurrentYmapFile == null) return;
bool changechange = changed != CurrentYmapFile.HasChanged;
if (!changechange) return;
CurrentYmapFile.HasChanged = changed; CurrentYmapFile.HasChanged = changed;
ProjectExplorer?.SetYmapHasChanged(CurrentYmapFile, changed); ProjectExplorer?.SetYmapHasChanged(CurrentYmapFile, changed);
RefreshUI();
bool changechange = changed != CurrentYmapFile.HasChanged;
if (!changechange) return;
PromoteIfPreviewPanelActive(); PromoteIfPreviewPanelActive();
RefreshUI();
} }
public void SetYtypHasChanged(bool changed) public void SetYtypHasChanged(bool changed)
{ {

View File

@ -169,6 +169,7 @@ namespace CodeWalker
MapSelection SelectedItem; MapSelection SelectedItem;
MapSelection CopiedItem; MapSelection CopiedItem;
WorldInfoForm InfoForm = null; WorldInfoForm InfoForm = null;
public MapSelection CurrentMapSelection { get { return SelectedItem; } }
TransformWidget Widget = new TransformWidget(); TransformWidget Widget = new TransformWidget();
@ -5864,7 +5865,7 @@ namespace CodeWalker
} }
else else
{ {
if (ShowWidget && Widget.IsUnderMouse) if (ShowWidget && Widget.IsUnderMouse && !Input.kbmoving)
{ {
GrabbedWidget = Widget; GrabbedWidget = Widget;
GrabbedWidget.IsDragging = true; GrabbedWidget.IsDragging = true;
@ -6157,7 +6158,7 @@ namespace CodeWalker
} }
if (!Input.kbmoving) //don't trigger further actions if moving. if (!Input.kbmoving && !Widget.IsDragging) //don't trigger further actions if camera moving or widget dragging
{ {
if (!ctrl) if (!ctrl)
{ {
@ -6230,11 +6231,12 @@ namespace CodeWalker
break; break;
} }
} }
}
if (k == Keys.Escape) //temporary? panic get cursor back when in first person mode if (k == Keys.Escape) //temporary? panic get cursor back when in first person mode
{ {
if (ControlMode != WorldControlMode.Free) SetControlMode(WorldControlMode.Free); if (ControlMode != WorldControlMode.Free) SetControlMode(WorldControlMode.Free);
} }
}
if (ControlMode != WorldControlMode.Free || ControlBrushEnabled) if (ControlMode != WorldControlMode.Free || ControlBrushEnabled)
{ {