Skip to content

Conversation

ourabigdev
Copy link
Contributor

PR Details

This PR adds the ability to build the game project from within the new Avalonia-based editor. While the editor UI doesn't yet include a button for this feature, the F5 shortcut can be used to trigger the build.

Currently, this functionality only works on Windows due to the limitations of the Stride AssetCompiler, which is platform-specific. I have started laying the groundwork for supporting other platforms in the future, but I am currently unable to test this feature on my Linux machine.

Related Issue

Fixes or relates to issue: #2742

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

Copy link
Member

@Kryptos-FR Kryptos-FR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial review. I'll have a second look at it later. I'm busy this weekend.

<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" PrivateAssets="all" />
</ItemGroup>
</Project>
</Project>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah those things where made automatically by vs I didn't touch that

Copy link
Member

@Kryptos-FR Kryptos-FR May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't be done by VS unless you have some non-standard config that overrides the .editorconfig that we have at the root of the repo. It has this line which forces each file to have a blank line at the end:

stride/.editorconfig

Lines 6 to 8 in f99bde2

[*]
end_of_line = crlf
insert_final_newline = true

</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not wrong but it's not needed as it is implied by the other package references. I tend to keep the smallest list of dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was added on it's own I thought I was already there

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's this one that is not necessary.

using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Data.Core.Plugins;
using Avalonia.Input;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem required.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i forgot about that but should port the input checking function to this file




private async void RunCurrentProject()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use async void, always return a Task.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok will look into that

OpenCommand = new AnonymousTaskCommand<UFile?>(serviceProvider, OnOpen);
OpenDebugWindowCommand = new AnonymousTaskCommand(serviceProvider, OnOpenDebugWindow, () => DialogService.HasMainWindow);
OpenWebPageCommand = new AnonymousTaskCommand<string>(serviceProvider, OnOpenWebPage);
RunCurrentProjectCommand = new AnonymousCommand(serviceProvider, RunCurrentProject);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use AnonymousTaskCommand for async methods.

process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
process.WaitForExit();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to use the async version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ourabigdev ourabigdev closed this May 26, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in Avalonia Editor Rewrite May 26, 2025
@ourabigdev ourabigdev reopened this May 26, 2025
@ourabigdev
Copy link
Contributor Author

i reopened this one sorry for the other one I don't work with github a lot so I forget sometimes

<AvaloniaBehaviorVersion>11.2.7.3</AvaloniaBehaviorVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be removed here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i did that i keeped this one now and the other has been removed in past commit but it's still there idk why

</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's this one that is not necessary.

</DrawingImage>

<DrawingImage x:Key="ImageStart">
<DrawingImage.Drawing>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 spaces instead of tabs for indentation in XAML files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to still be a mix of spaces and tabs.

If you are using Visual Studio, you can use Ctrl+E,D to format the current document. Or In Visual Studio code Ctrl+Shift+i.

@Kryptos-FR Kryptos-FR moved this from Done to Review in Avalonia Editor Rewrite May 26, 2025
@Kryptos-FR Kryptos-FR marked this pull request as draft June 23, 2025 13:57
@Kryptos-FR
Copy link
Member

@ourabigdev I have fixed the conflicts and pushed a little cleanup. I also changed the PR to a draft since it might not be complete yet. I will do some testing and I might push new commits later.

Thanks for the contribution in any case.

@Kryptos-FR Kryptos-FR linked an issue Jun 23, 2025 that may be closed by this pull request
@Kryptos-FR Kryptos-FR added the work-estimate-L 2-7 Days of work. Should try to break down into smaller issues label Jun 23, 2025
@ourabigdev
Copy link
Contributor Author

@ourabigdev I have fixed the conflicts and pushed a little cleanup. I also changed the PR to a draft since it might not be complete yet. I will do some testing and I might push new commits later.

Thanks for the contribution in any case.

Thanks for that yeah it's better for it to become a draft since I will not be able to work on it this month so I will be back at the start of July, I did make the run in editor on windows work with shortcut key and the run button but the run button is just put there randomly I still need to learn about the new editor layout and also more about avalonia so that I can make a similar design and positioning like the wpf editor, when I come back to coding in July I will try my best to finish the pr if I find the time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-GameStudio work-estimate-L 2-7 Days of work. Should try to break down into smaller issues
Projects
Development

Successfully merging this pull request may close these issues.

❗🟡𝐌 Build or run from the editor
2 participants