diff --git a/Fushigi/course/CourseLink.cs b/Fushigi/course/CourseLink.cs index 765ad35a..0224e917 100644 --- a/Fushigi/course/CourseLink.cs +++ b/Fushigi/course/CourseLink.cs @@ -98,6 +98,11 @@ public void DeleteLinkWithDest(ulong hash) } } + if (idx == -1) + { + return; + } + mLinks.RemoveAt(idx); } diff --git a/Fushigi/ui/widgets/CourseScene.cs b/Fushigi/ui/widgets/CourseScene.cs index 3fb14577..412c789c 100644 --- a/Fushigi/ui/widgets/CourseScene.cs +++ b/Fushigi/ui/widgets/CourseScene.cs @@ -265,6 +265,12 @@ private void LinkDeletionCheck() } } + if (msgStr == "") + { + activeViewport.mEditorState = LevelViewport.EditorState.DeletingActor; + return; + } + bool status = ImGui.Begin("Link Warning"); ImGui.Text($"The actor you are about to delete is a destination link for the following actors.\n {msgStr} Do you wish to continue?"); @@ -286,40 +292,6 @@ private void LinkDeletionCheck() } } - private void CourseErrorList() - { - bool status = ImGui.Begin("Course Saving Errors"); - ImGui.Text($"Error(s) occured in: {mErroringArea}"); - CourseArea? area = course.GetArea(mErroringArea); - - List badLinks = area.mLinkHolder.DoSanityCheck(area.mActorHolder); - - if (badLinks.Count > 0) - { - for (int i = 0; i < badLinks.Count; i++) - { - ImGui.Text($"Link at idx {badLinks[i]} points to an actor that doesn't exist."); - ImGui.NewLine(); - CourseLink link = area.mLinkHolder.GetLinks()[badLinks[i]]; - CourseActor src = area.mActorHolder[link.GetSrcHash()]; - ImGui.Text($"Source actor: {src.mActorName} [{src.mName}]"); - ImGui.NewLine(); - } - } - - List badActors = area.mGroups.DoSanityCheck(area.mActorHolder); - - if (badActors.Count > 0) - { - - } - - if (status) - { - ImGui.End(); - } - } - private void ActorsPanel() { ImGui.Begin("Actors"); @@ -329,9 +301,11 @@ private void ActorsPanel() mShowAddActor = true; } + ImGui.SameLine(); + if (ImGui.Button("Delete Actor")) { - activeViewport.mEditorState = LevelViewport.EditorState.DeletingActor; + activeViewport.mEditorState = LevelViewport.EditorState.DeleteActorLinkCheck; } // actors are in an array diff --git a/Fushigi/ui/widgets/LevelViewport.cs b/Fushigi/ui/widgets/LevelViewport.cs index c8fc6593..fac97468 100644 --- a/Fushigi/ui/widgets/LevelViewport.cs +++ b/Fushigi/ui/widgets/LevelViewport.cs @@ -332,6 +332,11 @@ public void Draw(Vector2 size, IDictionary layersVisibility) } else if (isFocused && mEditorState == EditorState.DeletingActor) { + if (!isFocused) + { + ImGui.SetWindowFocus(); + } + if (mEditContext.IsAnySelected()) { mEditContext.DeleteSelectedActors();