Skip to content
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

feat: Allow Reset Grid Properties for Layout in UI Editor (#1619) #2400

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

dloe
Copy link
Contributor

@dloe dloe commented Jul 29, 2024

PR Details

Allowing UI grid properties to be reset to base value in UI editor. 'Reset to base value' button by right clicking on properties doesn't allow to be reset.

Related Issue

Issue: #1619

Types of changes

Just a note: May need a recommendation on where the custom delegate function goes, for now I kept them in UIAssetNodeUpdater file, it may need to be moved elsewhere. I can remove those TODO comments as needed. Thank you!

  • 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.

@Eideren
Copy link
Collaborator

Eideren commented Aug 11, 2024

Thanks a bunch for the PR, this one doesn't look as straightforward so I'll pass it to @Kryptos-FR, hopefully he has time to get back to us

@Kryptos-FR
Copy link
Member

I'll look into it.

@Kryptos-FR Kryptos-FR self-assigned this Sep 10, 2024
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 of the code with some small remarks. I will need to do a second in-depth review when I have more time.

There might be a better place indeed to put the delegate (maybe implemented as a command). If it's a blocking issue, I'm ok to merge it (once my remarks are resolved) and do the refactoring later (in which case, please create a new issue for tracking it).

@@ -13,6 +13,9 @@
using Stride.Core.Quantum;
using Stride.Assets.Presentation.ViewModel;
using Stride.UI;
using System;
Copy link
Member

Choose a reason for hiding this comment

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

Nit: using should be sorted with System.* first

var virtualNode = node.Factory.CreateVirtualNodePresenter(propertyNodeParent, property.Name, propertyType, order,
() => Getter(propertyContainerNode, propertyIndex),
o => Setter(undoRedoService, propertyContainerNode, propertyIndex, o));
() => Getter(propertyContainerNode, propertyIndex),
Copy link
Member

Choose a reason for hiding this comment

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

Nit: formatting, the previous spacing was correct.


return virtualNode;
}

/// <summary>
/// Some virutal nodes dont have a specific AssociatedNode that is applicable.
Copy link
Member

@Kryptos-FR Kryptos-FR Sep 13, 2024

Choose a reason for hiding this comment

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

Nit: typo virtual.

Comment on lines +81 to +82
if (customOverride != null)
customOverride(this);
Copy link
Member

Choose a reason for hiding this comment

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

Prefer to use the ?.Invoke() pattern, as it's slightly faster.

customOverride?.Invoke(this);

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.

3 participants