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

[gui/quickfort] implement interactive controls for repetitions and transformations #392

Merged
merged 8 commits into from Jun 8, 2022

Conversation

myk002
Copy link
Member

@myk002 myk002 commented May 29, 2022

Fixes DFHack/dfhack#2018

Depends on DFHack/dfhack#2147

UI for controlling repetitions and transformations in quickfort blueprints.

There is some UI behavior that is unique to this script that could use some feedback about whether it works. The repetitions counter can be modified by multiple hotkeys or edited directly. Is that obvious from the presentation?

Separate hotkey labels for each transformation type crowded the UI a little too much, so I collapsed them into just a generic "Ctrl+Arrow" label. Does that work?

The transformations get "auto-reduced" so the transformation list doesn't get too long. Longer transformation sequences will get automatically replaced with shorter equivalent sequences. Is that confusing?

Finally, the repetition and transformation settings get saved between script invocations. Should it be? The thinking here is that if you are applying a sequence of blueprints, they are likely to all need to be transformed the same way.

Screenshot:
image

@myk002 myk002 added this to In progress in 0.47.05-r6 via automation May 29, 2022
@myk002 myk002 changed the title [gui/quickfort] implement controls for interactive repetitions and transformations [gui/quickfort] implement interactive controls for repetitions and transformations May 29, 2022
@myk002
Copy link
Member Author

myk002 commented May 31, 2022

needs unit tests.

edit: done

@lethosor
Copy link
Member

lethosor commented Jun 2, 2022

My only slight concern about Ctrl-Arrow is that it's bound to workspace switching on macOS by default. People can change that and/or DF, but I'm not sure how best to represent that in DF. I think your way is fine.

@lethosor
Copy link
Member

lethosor commented Jun 2, 2022

I guess an alternative could be to have t "activate" the transformation option in the sidebar, and when that is active, the normal arrow keys could change what transformation is selected. Then Enter could finalize it. Not super important now, but if you ever add more options to the UI, you might run out of keys and need to think about making the UI more modal like this.

@lethosor
Copy link
Member

lethosor commented Jun 2, 2022

A couple more things:

  • I think maintaining the transformation makes a lot of sense, especially if people are running multiple blueprints in series that come from the same "set". So I agree with your reasoning.
  • Simplifying the transformation list also makes sense to me.
  • I saw your point about R, then didn't really notice it in the UI until I came back and re-read your post again. Maybe a space separating it from the +- controls would help?
  • Replacing ENTER with a green Enter would help it stand out a bit (unrelated to this change, I know)
  • Is there no way to repeat along the x/y axes? I was expecting "up" and "down" to mean along the y-axis, but eventually figured out what was going on. I guess repeating along the z-axis is probably more common.
  • Ctrl-Down always toggling hflip feels counterintuitive to me. However, I also like Ctrl-Left and Right always rotating, so I'm not sure what to suggest. I figured it out eventually, but I was scratching my head for a while trying to figure out why I could only vflip.

@myk002
Copy link
Member Author

myk002 commented Jun 3, 2022

  • I saw your point about R, then didn't really notice it in the UI until I came back and re-read your post again. Maybe a space separating it from the +- controls would help?

I'll try a space. I originally had a comma to separate it, but since commas are rendered as ground rubble, it didn't really help.

  • Replacing ENTER with a green Enter would help it stand out a bit (unrelated to this change, I know)

This is a good idea, but WrappedLabel needs to be extended to support text attributes. (Option 2, I could go back to my pre-autowrapping version of the help text, which was just a list of Labels with text carefully measured on each line to limit length. Option 3, I could create a Label with the word "Enter" and render it over the wrapped text.)

  • Is there no way to repeat along the x/y axes? I was expecting "up" and "down" to mean along the y-axis, but eventually figured out what was going on. I guess repeating along the z-axis is probably more common.

I kept the nomenclature set by Python quickfort: https://github.com/joelpt/quickfort#transformations-simple-repetition
However, looking at the docs I just linked, Joel introduces the up/down pair as up-z and down-z. That might be clearer on the UI instead of Up/Down. I'll have to make the commandline accept that naming as well. Right now it recognizes up or < as above and down or > as below.

There is currently no way to repeat North/South/East/West. I considered implementing it, but I didn't see a strong use case. The "repetition patterns" that python quickfort offers is nifty, but seems to me to be too niche. I can, of course, implement a similar feature if our users request it.

  • Ctrl-Down always toggling hflip feels counterintuitive to me. However, I also like Ctrl-Left and Right always rotating, so I'm not sure what to suggest. I figured it out eventually, but I was scratching my head for a while trying to figure out why I could only vflip.

I can add documentation to gui/quickfort's help text so at least it is explained somewhere.

Also, I could potentially draw arrow characters instead of the word "Arrows" for the hotkey hint. Would that make it clearer that ctrl-down is an option that you can try?

@myk002
Copy link
Member Author

myk002 commented Jun 3, 2022

Updated. After looking into how hard it would be to update WrappedLabel, I went with a variation of option 3 above and dynamically repositioned a HotkeyLabel instead. It's not as bad as overlaying just the word "Enter" on the screen. The entire last part of the help text (which conveniently is the same across all the variations) is now a HotkeyLabel.
image
WDYT?

@myk002 myk002 merged commit 3ebcad7 into DFHack:master Jun 8, 2022
0.47.05-r6 automation moved this from In progress to Done Jun 8, 2022
@myk002 myk002 deleted the myk_quickfort branch June 8, 2022 04:48
@lethosor
Copy link
Member

lethosor commented Jun 8, 2022

Forgot to get back to you on this. I like the arrow keys... wonder why DF doesn't do that. Looks good!

@myk002
Copy link
Member Author

myk002 commented Jun 17, 2022

screenshot for the record:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
2 participants