Fix crash on login/logout?

This commit is contained in:
RisaDev
2025-07-25 02:19:48 +03:00
parent 8c59e1b3ad
commit 8b3220cba6
3 changed files with 5 additions and 3 deletions

View File

@@ -138,7 +138,7 @@ public class TemplateEditorManager : IDisposable
};
if (!Character.IsValid) //safeguard
ChangeEditorCharacterInternal(_gameObjectService.GetCurrentPlayerActorIdentifier()); //will set EditorProfile.Character
ChangeEditorCharacterInternal(_gameObjectService.GetCurrentPlayerActorIdentifier().CreatePermanent()); //will set EditorProfile.Character
EditorProfile.Templates.Clear(); //safeguard
EditorProfile.Templates.Add(CurrentlyEditedTemplate);
@@ -335,6 +335,8 @@ public class TemplateEditorManager : IDisposable
return;
}
localPlayer = localPlayer.CreatePermanent();
if (_configuration.EditorConfiguration.PreviewCharacter != localPlayer)
{
_logger.Debug("Resetting editor character because automatic condition triggered in OnLogin");

View File

@@ -276,7 +276,7 @@ public class ProfilePanel
if (ImGuiUtil.DrawDisabledButton("Apply to mannequin", buttonWidth, string.Empty, !_actorAssignmentUi.CanSetMannequin))
_manager.AddCharacter(_selector.Selected!, _actorAssignmentUi.MannequinIdentifier);
var currentPlayer = _actorManager.GetCurrentPlayer();
var currentPlayer = _actorManager.GetCurrentPlayer().CreatePermanent();
if (ImGuiUtil.DrawDisabledButton("Apply to current character", buttonWidth, string.Empty, !currentPlayer.IsValid))
_manager.AddCharacter(_selector.Selected!, currentPlayer);

View File

@@ -144,7 +144,7 @@ public class BoneEditorPanel
if (ImGuiUtil.DrawDisabledButton("Apply to mannequin", buttonWidth, string.Empty, !_actorAssignmentUi.CanSetMannequin))
_editorManager.ChangeEditorCharacter(_actorAssignmentUi.MannequinIdentifier);
var currentPlayer = _gameObjectService.GetCurrentPlayerActorIdentifier();
var currentPlayer = _gameObjectService.GetCurrentPlayerActorIdentifier().CreatePermanent();
if (ImGuiUtil.DrawDisabledButton("Apply to current character", buttonWidth, string.Empty, !currentPlayer.IsValid))
_editorManager.ChangeEditorCharacter(currentPlayer);