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

Add grid placement tool #26313

Merged
merged 52 commits into from
Oct 8, 2024
Merged

Add grid placement tool #26313

merged 52 commits into from
Oct 8, 2024

Conversation

OliBomby
Copy link
Contributor

@OliBomby OliBomby commented Jan 1, 2024

Part of #26303

Requires

Adds the 'Change grid' placement tool to the left tool box.

Mappers might want to align their grid with some hit objects they have already placed, so I also added a 'Grid from points' feature which allows the mapper to select two points on the playfield and then the grid aligns itself with those points. The origin is centered on the first point and then the spacing and rotation is determined by the difference between the two points. The two points will be on two neighbouring grid lines in the resulting grid.
This point selection has snapping to nearby objects so its easy to align it exactly with hit objects.
Also clicking with right click will end the point selection immediately so you can select just one point allowing you to change just the grid origin.

I repurposed the initial PR #26303 to add the remaining keybinds for cycling grid type.

osu._k6UmTIJN2n.mp4

This caused issues in rendering the outline of the grid because the outline was getting masked at some resolutions.
@bdach
Copy link
Collaborator

bdach commented Sep 20, 2024

Feature seems useful but as usual I have UX concerns.

2024-09-20.10-29-06.mp4

There is no guidance on how to use this feature. There is a button with no tooltip. You click on it and nothing visually happens. You click on it five times and maybe move it over the playfield and notice the grid starts moving. Only at that point you can probably figure out that you need to click the playfield twice to have it work. I'd still say both points should be visually indicated somehow rather than just relying on the grid but maybe that's optional.

The main problem is no indication on what you're supposed to do with the feature at all.

Also there is no way to cancel a grid change if you decide you don't want to change the grid anymore. Esc doesn't work.

Also I don't get what the criteria for the grid spacing subdividing is. It appears that it will decrease when the cursor moved too much between clicks 1 & 2, but I have no idea why it's doing what it's doing in particular.

There's also whatever this is:

2024-09-20.10-34-27.mp4

You can be in the "change grid" mode and still have things like object placement appear to work but they actually will not work and instead the grid change thing will take priority. At that point I'd start thinking if this shouldn't be a tool in the toolbox on the left.

@OliBomby OliBomby changed the title Add 'Grid from points' button Add grid changing placement tool Sep 23, 2024
@OliBomby
Copy link
Contributor Author

OliBomby commented Sep 23, 2024

I changed the 'grid from points' button into a placement tool like @bdach suggested. I think the UX is really nice now.

The diffstat became pretty big but most of it is from 1a81e12 which is mostly just refactoring name change. It should be pretty easy to review as that commit should not change any behaviours.

I'll need an icon for the new placement tool so that's still TODO

@peppy
Copy link
Member

peppy commented Oct 7, 2024

No idea about the tooltip changes I just wangs some shit to make it compile so I could comment on the UX.

  • I don't think the right-click method needs to exist. You can just left-click twice to get the same behaviour right?
  • I preferred this being on the left, as it clears the user's selection and behaves like a modal operation but now has no indication that it will do that. Can we move it back?
  • It seems to maintain a spacing under 64 while the limit is 128, is there a reason for that?

Copy link
Member

@peppy peppy left a comment

Choose a reason for hiding this comment

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

Updated UX feedback.

@peppy peppy removed the next release Pull requests which are almost there. We'll aim to get them in the next release, but no guarantees! label Oct 7, 2024
@OliBomby
Copy link
Contributor Author

OliBomby commented Oct 7, 2024

  • I don't think the right-click method needs to exist. You can just left-click twice to get the same behaviour right?

Yes left-click twice has the same behaviour, but I prefer to use a single right-click instead. It doesn't hurt to have a little redundancy to make it a bit easier to use right?

  • I preferred this being on the left, as it clears the user's selection and behaves like a modal operation but now has no indication that it will do that. Can we move it back?

It already clears the user's selection, but if you prefer it being on the left I'll move it there.

  • It seems to maintain a spacing under 64 while the limit is 128, is there a reason for that?

There's a good reason for that. I made the spacing match the range of the grid spacing cycle hotkey which is [4,64), so you can always cycle the spacing value back to the original value you got from the grid placement tool. I think these are all reasonable spacing values, beyond that there are so few snappable points on the screen that it is barely of any utility. The limit on the spacing slider is intentionally bigger for the off-chance you want to use a big spacing, so you can set that manually.

The grid placement tool and the spacing cycling hotkey are tools that set the spacing automatically so I think it makes sense to restrict them to a range of more reasonable values.

I hope to get this in the next release, so I'll be available to reply to any feedback ASAP

@peppy
Copy link
Member

peppy commented Oct 7, 2024

It already clears the user's selection, but if you prefer it being on the left I'll move it there.

Let me rephrase: because it clears the selection, I think it should be on the left. Users are understanding that their selection will be lost when changing tools here. A button on the right randomly nuking a selection is unexpected.

@OliBomby
Copy link
Contributor Author

OliBomby commented Oct 7, 2024

Let me rephrase: because it clears the selection, I think it should be on the left. Users are understanding that their selection will be lost when changing tools here. A button on the right randomly nuking a selection is unexpected.

That makes sense. I've moved it back to the left toolbox.

@peppy peppy self-requested a review October 7, 2024 15:44
@peppy
Copy link
Member

peppy commented Oct 7, 2024

I'd either call the toolbox item "Grid" or "Place grid". The first may fit better with the other tools? @bdach thoughts?

Also I think the FA icon looks nicer:

diff --git a/osu.Game.Rulesets.Osu/Edit/GridFromPointsTool.cs b/osu.Game.Rulesets.Osu/Edit/GridFromPointsTool.cs
index bc143886ce..11c97d78d9 100644
--- a/osu.Game.Rulesets.Osu/Edit/GridFromPointsTool.cs
+++ b/osu.Game.Rulesets.Osu/Edit/GridFromPointsTool.cs
@@ -3,7 +3,6 @@
 
 using osu.Framework.Graphics;
 using osu.Framework.Graphics.Sprites;
-using osu.Game.Graphics;
 using osu.Game.Rulesets.Edit;
 using osu.Game.Rulesets.Edit.Tools;
 using osu.Game.Rulesets.Osu.Edit.Blueprints;
@@ -13,7 +12,7 @@ namespace osu.Game.Rulesets.Osu.Edit
     public partial class GridFromPointsTool : CompositionTool
     {
         public GridFromPointsTool()
-            : base("Change grid")
+            : base("Place grid")
         {
             TooltipText = """
                           Left click to set the origin.
@@ -23,7 +22,7 @@ Right click to only set the origin.
                           """;
         }
 
-        public override Drawable CreateIcon() => new SpriteIcon { Icon = OsuIcon.EditorPlaceGrid };
+        public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.Solid.DraftingCompass };
 
         public override PlacementBlueprint CreatePlacementBlueprint() => new GridPlacementBlueprint();
     }

Copy link
Member

@peppy peppy left a comment

Choose a reason for hiding this comment

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

As above

@OliBomby
Copy link
Contributor Author

OliBomby commented Oct 7, 2024

I'd either call the toolbox item "Grid" or "Place grid". The first may fit better with the other tools? @bdach thoughts?

Also I think the FA icon looks nicer:

I agree. "Grid" fits better in the theme of the other placement tools.

@bdach
Copy link
Collaborator

bdach commented Oct 8, 2024

I'd either call the toolbox item "Grid" or "Place grid". The first may fit better with the other tools? @bdach thoughts?

Either's fine, would weakly prefer first.

@peppy peppy self-requested a review October 8, 2024 07:26
@peppy peppy merged commit bfad281 into ppy:master Oct 8, 2024
10 of 13 checks passed
@OliBomby OliBomby deleted the grids-4 branch October 8, 2024 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants