Skip to content

[Editor] Allow drag and drop of EntityComponent #1921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 11, 2023

Conversation

Eideren
Copy link
Collaborator

@Eideren Eideren commented Oct 10, 2023

PR Details

Also includes a fix to avoid crashing the editor when a file which previously had a script now doesn't anymore but is still drag and dropped onto an entity.

Related Issue

None

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.

Copy link
Member

@manio143 manio143 left a comment

Choose a reason for hiding this comment

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

Looks good. Just two small comments.

@@ -72,35 +72,40 @@ public async Task AnalyzeProject(SessionViewModel session, Project project, Canc

var assemblyFullName = gameProjectCompilation.Assembly.Name;

var strideScriptType = typeof(ScriptComponent);
var strideScriptType = typeof(EntityComponent);
Copy link
Member

Choose a reason for hiding this comment

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

nit: maybe rename variable to strideComponentType?

{
/// <inheritdoc />
protected override bool CanAddOrInsert(EntityHierarchyItemViewModel parent, ScriptSourceFileAssetViewModel asset, AddChildModifiers modifiers, int index, out string message, params object[] messageArgs)
{
var scriptType = FindScriptType(asset.ServiceProvider, asset.AssetItem)?.FirstOrDefault();
if (scriptType == null)
{
message = $"No scripts inheriting from {nameof(ScriptComponent)} found in asset {asset.Url}";
message = $"No scripts inheriting from {nameof(EntityComponent)} found in asset {asset.Url}";
Copy link
Member

Choose a reason for hiding this comment

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

nit: "No components inheriting..."

@Eideren Eideren force-pushed the entitycomponent_fix branch from 3d0b5bb to 643c987 Compare October 11, 2023 10:25
@Eideren
Copy link
Collaborator Author

Eideren commented Oct 11, 2023

Rebased to fix merge issue

@Eideren Eideren merged commit 5870713 into stride3d:master Oct 11, 2023
@Eideren Eideren deleted the entitycomponent_fix branch October 11, 2023 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants