Enhanced Transparency Window

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

3298
Traffic Manager
Traffic Manager
Posts: 143
Joined: 02 Apr 2011 12:55

Enhanced Transparency Window

Post by 3298 »

Two years ago, Alberth started a discussion about a redesign of the transparency window: http://www.tt-forums.net/viewtopic.php?f=29&t=54262. Several mockups were posted, but nobody actually wrote a patch. Until now.
This patch implements my own mockup (actually, my second one, on page 2 of the discussion topic) and some minor related changes.
How it looks:
Outdated picture, see page 2 for a more current one of the actual window. An overview of the changes in graphical form. The sign list also got an additional button.
Outdated picture, see page 2 for a more current one of the actual window. An overview of the changes in graphical form. The sign list also got an additional button.
enhancedtransparencywindow_screen.png (31.27 KiB) Viewed 6145 times
You can see that the options in the settings dropdown are removed. All are handled by the transparency window now, except for "full animation", which has become a config-only setting. (I doubt anyone really used that option anyway.)
Something that is not shown in this screenshot is the sign list. Previously, the "show competitor signs" option in the settings dropdown controlled the visibility of competitor signs in both the world and the sign list. With this patch, the sign list got its own button for that next to the "match case" button.
The signs I placed for the screenshot tell you about the next enhancement: Transparency for signs, for station names and for waypoint names have been separated. If you use signs as a reminder for yourself, you probably want them to be as visible as possible. But if there are lots of stations or waypoints on the map, it might be handy to make their names transparent, but maybe you don't want them to be completely invisible. That is possible with this patch.
Last item: the actual window.
There are two rows of settings, the X key switches between them. Now you can have transparent objects that turn invisible when you hit X, or objects that are only visible when others are invisible. The numbers in front of the two rows serve two purposes: they show which row is currently active, and they can be clicked to make the corresponding row the active one.
Many of the settings buttons have three states. If they are not pressed down, their corresponding objects are solid. If they are pressed down and the image is the normal one, the objects are transparent. If they are pressed down and the picture is gray, the objects are invisible. Clicking on the button cycles through the options in this order: solid -> transparent -> invisible -> solid.
Compared to the trunk transparency window, I have reordered the buttons a bit (I find it more logical this way). Their meanings are (from left to right): trees, objects ( = transmitter etc. ), houses, industries, company buildings (stations, HQ, ... ), bridges, catenary, fences & lamps / trees at roads in the town center (the former "full detail", only two states), town names (also only two states), signs, station names, waypoint names, competitor signs / station names / waypoint names (another one with only two states), loading indicators (also only two states).
Locking an object transparency is now done by setting the options to the same value in both rows.
Ctrl+Click-ing a settings column swaps the two settings n it. These are now on the Ctrl+Number hotkeys because you can simulate trunk behavior with them much better, the solid<->transparent hotkeys are Shift+Number.
The hotkeys for individual transparency settings are shuffled around to match the new order. Also, three hotkeys affect two transparency settings each. All hotkeys except for the swapping ones affect the currently active row of settings.
Known limitations:
- trunk transparency settings are ignored. The settings are stored in a rather different format in config variables with different names. An import feature would need to read the old variable and convert it to the new format, but if the old variable is not found, the game shouldn't create it. The current config system can't do that.
- the icons are not optimal. "Full detail" does not have an icon at all, some icons are used twice in the transparency window. I suck at pixel art, so I can't fix that. :oops:

Updated, changes are:
Ctr+Click now swaps the settings in the column you clicked on.
This new mechanic got the Ctrl+Number hotkeys.
The new Shift+Number hotkeys toggle between solid and transparent states like Ctrl+Number did in the first version.
Some buttons have been reordered again. I played around with the hotkey assignments (there are three hotkeys affecting two settings each now: catenary/full detail, town names/signs, station names/waypoint names) and I think the button order should be similar to the hotkey order.
The hotkey names have been fixed, and the loading indicators hotkey is back.
The code snippet validating the settings has been moved to the correct place.
You can now grab the version with three separate patches. If you don't want the two rows of settings, just leave the third one out. You will get the sign list button and you will find the options from the settings dropdown in the transparency window.
The language changes except for english.txt and german.txt have been removed. Prepare for a lot of warnings because the patch removes some strings from english.txt, and the other languages keep them. The build system will complain about that.
Based on r25395 now.
... And I probably forgot a couple of changes. ;)

Updated again. The saved settings were messed up, sorry about that. Also applies fine to r25397.

(Jun 18) Yet another update. I think I need version numbers. ;)
frosch asked for the integration of the reserved tracks overlay into the transparency window. It has been added to the right of the other transparency options and removed from the advanced settings window. The icon is the the "build signals" one.
I moved the change from the SDTG_VAR to SDTG_MMANY from part 3 into part 2. For non-coders: SDTG_VAR means that OpenTTD saves the setting as a number, SDTG_MMANY means it saves the settings as a list of strings. The list of strings is obviously easier to edit manually and survives reordering of the transparency options. If you used part 2, but not part 3, your transparency settings will vanish one more (probably last) time.
Bumped to r25424, that was really trivial.
Was that really all I did since Friday? I could have sworn there was more behind the scenes. (Unfortunately I didn't reinvent hotkey handling yet, so the hotkey assignments to multiple options are still a hardcoded thing.)

(Jun 22) Added a size toggle button. The smaller version of the window shows just the currently active row of settings, houses / industries / buildings transparencies are merged into a single button, same for signs / station names / waypoint names. The fences / roadside lamps and trees button and the competitor signs button vanish. For those guys who insist on keeping this window open even on netbook-sized or even smaller screens. ;)
In the zip version the size toggle button comes as separate patch between the one that moves the options out of the settings dropdown and the one that adds the second options row.
Bumped to r25433.

(Jul 12) Hotkey related changes only (in addition to being based on newer trunk (r25591), of course): The Ctrl, Shift and Ctrl+Shift stuff remained unchanged, but there are now separate hotkeys for all options: 1-9 and F,G,H,J,K,L. Additionally, 0 controls signs, station names and waypoint names together because some people apparently want to toggle them simultaneously. I'm not entirely happy with splitting the hotkeys up onto two rows of keys, but I have yet to encounter a keyboard with enough free keys in a single row for that many options, so this will do to make the devs happy - no more hardcoded combinations (except for the signs, but that's in addition to the individual hotkeys for them).
Attachments
etw-r25591_full.diff
Single diff.
(111.37 KiB) Downloaded 154 times
etw-r25591_in-parts.zip
Zip archive containing four diffs. When combined, they do exactly the same as the single diff.
(30.52 KiB) Downloaded 159 times
Last edited by 3298 on 12 Jul 2013 18:49, edited 6 times in total.
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Enhanced Transparency Window

Post by frosch »

I quite like it.

Originally I did not like 3-state buttons because I like toggling a single options easily. But luckily you free up the Ctrl key :)
So, I suggest to make Ctrl+click swap the state of a single option between the two rows.

About the patch:
* You do not need to reorder strings in other langfiles but english. The webtranslator will reorder them once there are changes.
* CheckForInvalidTransparencyOptions is not quite correct in openttd.cpp. You can also reload config files in game. Check "ValidateSettings()" in settings.cpp
* If you are using Mercurial, you might want to take a look at Mercurial queues for how to split/maintain a series of smaller patches, instead of a big one. (separating lang changes and variable renaming from real changes etc.)
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
3298
Traffic Manager
Traffic Manager
Posts: 143
Joined: 02 Apr 2011 12:55

Re: Enhanced Transparency Window

Post by 3298 »

frosch wrote:I quite like it.
Thanks!
frosch wrote:Originally I did not like 3-state buttons because I like toggling a single options easily. But luckily you free up the Ctrl key :)
So, I suggest to make Ctrl+click swap the state of a single option between the two rows.
The Ctrl thing sounds useful and simple enough. Will do that.
Also, the Ctrl+Number and Ctrl+Shift+Number hotkeys still work like in trunk, only the numbers were shuffled around. (Ctrl+Number = toggle between solid and transparent, Ctrl+Shift+Number = toggle between solid and invisible)
frosch wrote:About the patch:
* You do not need to reorder strings in other langfiles but english. The webtranslator will reorder them once there are changes.
Thanks, but will it remove strings I remove from english.txt in other languages as well?
frosch wrote:* CheckForInvalidTransparencyOptions is not quite correct in openttd.cpp. You can also reload config files in game. Check "ValidateSettings()" in settings.cpp
Will do.
frosch wrote:* If you are using Mercurial, you might want to take a look at Mercurial queues for how to split/maintain a series of smaller patches, instead of a big one. (separating lang changes and variable renaming from real changes etc.)
I'm using svn, but I have three patch files floating around on my hard disk. The first adds the "show competitor signs" button in the sign list, the second moves the display options from the settings dropdown into the transparency window, reorders the options there and adds the possibility of independent transparency for signs, station names and waypoint names, and the third contains the modifications for the second row in the transparency window and the changed save format. I just need to clean the patches up a bit. The second and the third are not compatible with the format vanilla saves its transparency options in (the second just messes the order up and ignores _display_opt, the third ignores them completely).
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Enhanced Transparency Window

Post by planetmaker »

3298 wrote:
frosch wrote:I quite like it.
Thanks!
I can second this.
3298 wrote:
frosch wrote:* If you are using Mercurial, you might want to take a look at Mercurial queues for how to split/maintain a series of smaller patches, instead of a big one. (separating lang changes and variable renaming from real changes etc.)
I'm using svn, but I have three patch files floating around on my hard disk.
For patch (queue) development it pays to get used to something properly supporting it :-) Makes it MUCH easier to handle patches which depend on eachother.
3298 wrote:The first adds the "show competitor signs" button in the sign list, the second moves the display options from the settings dropdown into the transparency window, reorders the options there and adds the possibility of independent transparency for signs, station names and waypoint names, and the third contains the modifications for the second row in the transparency window and the changed save format. I just need to clean the patches up a bit. The second and the third are not compatible with the format vanilla saves its transparency options in (the second just messes the order up and ignores _display_opt, the third ignores them completely).
I actually do believe we want 4 new sprites for the sign transparencies... Others might draw that, but using new unique sprites there IMHO should be forseen in this patch (see for instance here).
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Enhanced Transparency Window

Post by Eddi »

3298 wrote:(Ctrl+Number = toggle between solid and transparent, Ctrl+Shift+Number = toggle between solid and invisible)
maybe i have totally misunderstood how this works, but wouldn't it make more sense to have ctrl+number toggle between solid and <whatever was used last>, and ctrl+shift+number switch between transparent and invisible?
3298
Traffic Manager
Traffic Manager
Posts: 143
Joined: 02 Apr 2011 12:55

Re: Enhanced Transparency Window

Post by 3298 »

Eddi wrote:
3298 wrote:(Ctrl+Number = toggle between solid and transparent, Ctrl+Shift+Number = toggle between solid and invisible)
maybe i have totally misunderstood how this works, but wouldn't it make more sense to have ctrl+number toggle between solid and <whatever was used last>, and ctrl+shift+number switch between transparent and invisible?
Oops, I think I got something wrong there. Yes, trunk has a slightly different behavior on Ctrl+Number, but my patch doesn't remember which option was used last. Ctrl+Shift+Number switches between solid and invisible, though, even in trunk.
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Enhanced Transparency Window

Post by Eddi »

that sounds like a step backwards from current behaviour...
3298
Traffic Manager
Traffic Manager
Posts: 143
Joined: 02 Apr 2011 12:55

Re: Enhanced Transparency Window

Post by 3298 »

Eddi wrote:that sounds like a step backwards from current behaviour...
There is a second row of settings instead. I'm currently testing (or rather waiting for the compiler) frosch's Ctrl+Click behavior. Do you want me to add hotkeys (Shift+Number maybe) for that? Then you could get a similar effect by setting one row to transparent or invisible and the other one to solid and using that hotkey.
Edit: it's 1AM here and the compiler still needs some time. Testing will continue tomorrow ...
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Enhanced Transparency Window

Post by adf88 »

I think that all sign/name transparency should be a single option. Sometimes less is better. Semi-transparent town names can look exactly like non-transparent, there is nothing wrong with that.
:] don't worry, be happy and checkout my patches
User avatar
FLHerne
Tycoon
Tycoon
Posts: 1543
Joined: 12 Jul 2011 12:09
Location: St Ives, Cambs, UK

Re: Enhanced Transparency Window

Post by FLHerne »

adf88 wrote:I think that all sign/name transparency should be a single option. Sometimes less is better. Semi-transparent town names can look exactly like non-transparent, there is nothing wrong with that.
I need to have the town-names visible to access the town options, but I really don't like the clutter of a few dozen station-names in each major city. The version in the OP's post would be ideal (I can hide the station-names, but still leave notes to myself on signs and access town information); your proposal would be a substantial step back from even current functionality.
Temporary Permanent signature filling text. Content coming soon delayed indefinitely! Oh, and I have had a screenshot thread.
Linux user (XMonad DWM/KDE, Arch), IRC obsessive and rail enthusiast. No longer building robots; now I ring church bells.
Author of an incredibly boring stickied post about NewGRFs.
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Enhanced Transparency Window

Post by adf88 »

FLHerne wrote:I need to have the town-names visible to access the town options, but I really don't like the clutter of a few dozen station-names in each major city.
That's reasonable and I must agree with with you. Anyway, I think there is too much of these options. Especially station/waypoint separation. Besides, do we really need the option to hide town names? Perhaps there could be just two options: 1. signs 2. station/waypoint names
:] don't worry, be happy and checkout my patches
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Enhanced Transparency Window

Post by michael blunck »

adf88 wrote: Especially station/waypoint separation.
According to OTTD developers, waypoints ARE stations (now).

regards
Michael
Image
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Enhanced Transparency Window

Post by Alberth »

adf88 wrote:Besides, do we really need the option to hide town names? Perhaps there could be just two options: 1. signs 2. station/waypoint names
Town names are clickable, while for stations I always click at the station (no idea whether the name is also clickable).

Edit2: Yes you do want the ability to hide the town name, if you have some signal behind it, you want to be able to create a clear view!


Edit:1:
The problem with this window is that it looks like there are 2 values (transparent yes/no), but due to settings being temporarily changable, you actually have 3 values (or 4, depending on how you count).
When I attempted to improve this window, I could not figure out a nice way to represent all those values. While it is perfectly feasible to make 3 rows of buttons, I found 2 rows too ugly already (toooo much duplication of visual elements) to dare trying 3 rows.


I didn't entirely get what you aim to do with the ctrl-click, but if you use that for temporarily changing a value, I would consider that a step back from the current simple click, which would be unfortunate.


Edit3: (does the edit fun ever stop? :p )
Suggestion: make a vertical list of buttons, and behind 2 green/red button columns. The button columns do what your rows do now, and the vertical list of buttons can be used for changing a settings temporarily?
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Enhanced Transparency Window

Post by adf88 »

adf88 wrote:Edit2: Yes you do want the ability to hide the town name, if you have some signal behind it, you want to be able to create a clear view!
Now we have extra zoom levels so that's no more relevant I think.
:] don't worry, be happy and checkout my patches
3298
Traffic Manager
Traffic Manager
Posts: 143
Joined: 02 Apr 2011 12:55

Re: Enhanced Transparency Window

Post by 3298 »

adf88 wrote:I think that all sign/name transparency should be a single option. Sometimes less is better. Semi-transparent town names can look exactly like non-transparent, there is nothing wrong with that.
You can still use the hotkeys, in the new version I just uploaded they are more logical. (Changes compared to trunk: Catenary controls full detail as well, signs control town names as well, new hotkey for station names/waypoint names.)
Since the options are removed from the settings dropdown, they need to be somewhere, which is the transparency window.
Alberth wrote:The problem with this window is that it looks like there are 2 values (transparent yes/no), but due to settings being temporarily changable, you actually have 3 values (or 4, depending on how you count).
When I attempted to improve this window, I could not figure out a nice way to represent all those values. While it is perfectly feasible to make 3 rows of buttons, I found 2 rows too ugly already (toooo much duplication of visual elements) to dare trying 3 rows.
With the default settings (not shown in the screenshot; they are meant to resemble trunk behavior for the X key), there are some settings that have none of the two buttons pressed down. With a little bit of thinking all players should be able to figure out that it's not a choice of "yes or no". Especially when they click on a button.
Edit (yeah, editing party): If you don't like the two rows, omit the third patch - I cleaned up my intermediate patches and appended them to the first post.
Alberth wrote:I didn't entirely get what you aim to do with the ctrl-click, but if you use that for temporarily changing a value, I would consider that a step back from the current simple click, which would be unfortunate.
Just try it! The simple click is not changed, only when you hold down Ctrl the settings of a column are swapped.
Alberth wrote:Suggestion: make a vertical list of buttons, and behind 2 green/red button columns. The button columns do what your rows do now, and the vertical list of buttons can be used for changing a settings temporarily?
Sorry, I don't really get what you mean. There is no such concept as changing something just temporarily. You change the settings in the first or second row, the X key switches to the other one. Hotkeys affect the currently active row.
adf88 wrote:Now we have extra zoom levels so that's no more relevant I think.
In my opinion, that's not a reason to remove an option entirely.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Enhanced Transparency Window

Post by planetmaker »

I haven't yet compiled... but is my understanding correct:
The two lines are the transparency states which the 'x' button switches between?

Wrt combining settings: I'd advocate to leave 'full details' separate and not combine it with catenary. Switching catenary is very helpful for finding sometimes electrification errors. 'Full details' could possibly be renamed to 'animation' even though it includes some other small things as well - but that's the main part and can easily eat or free a few CPU-% on its own if toggled.

Generally I suggest to NOT combine any existing settings to something new. At least make that combination a completely separate patch - as it's like the colour of the bike shed which is discussed most when building a nuclear plant.
3298
Traffic Manager
Traffic Manager
Posts: 143
Joined: 02 Apr 2011 12:55

Re: Enhanced Transparency Window

Post by 3298 »

planetmaker wrote:I haven't yet compiled... but is my understanding correct:
The two lines are the transparency states which the 'x' button switches between?
Yes, that's correct.
planetmaker wrote:Wrt combining settings: I'd advocate to leave 'full details' separate and not combine it with catenary. Switching catenary is very helpful for finding sometimes electrification errors. 'Full details' could possibly be renamed to 'animation' even though it includes some other small things as well - but that's the main part and can easily eat or free a few CPU-% on its own if toggled.

Generally I suggest to NOT combine any existing settings to something new. At least make that combination a completely separate patch - as it's like the colour of the bike shed which is discussed most when building a nuclear plant.
I did not combine the settings, they can still be toggled separately. Only the hotkeys got some combination, partly because I there are only ten numbers on a normal keyboard, and these are already fully used. I tried to make the hotkeys affect options that are closely related to each other - merging station names and waypoint names was suggested already, town names and signs have been mentioned together, catenary and full detail were already stuffed together in frosch's mockup (discussion topic, first page).
With "locking" (setting both options in a column to the same value) and the swapping hotkeys you can build yourself a hotkey for an option that shares its hotkey with another option. The other option can't be toggled on its own then, but compared to trunk you don't lose anything because for all shared hotkeys at least one option comes from _display_opt, which the X key didn't touch.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Enhanced Transparency Window

Post by planetmaker »

3298 wrote: I did not combine the settings, they can still be toggled separately. Only the hotkeys got some combination, partly because I there are only ten numbers on a normal keyboard, and these are already fully used. I tried to make the hotkeys affect options that are closely related to each other - merging station names and waypoint names was suggested already, town names and signs have been mentioned together, catenary and full detail were already stuffed together in frosch's mockup (discussion topic, first page).
With "locking" (setting both options in a column to the same value) and the swapping hotkeys you can build yourself a hotkey for an option that shares its hotkey with another option. The other option can't be toggled on its own then, but compared to trunk you don't lose anything because for all shared hotkeys at least one option comes from _display_opt, which the X key didn't touch.
Nah, don't use a combined hotkey for several settings either. Hotkeys are user-configurable via hotkeys.cfg. If you hard-code combine them, that's not good. I haven't tested whether the same hotkey can be used simultaneously by two widgets in the same window, probably not. But if you want to combine them, I suggest to go that way and make that feasible - but that's again a separate patch (queue).
3298
Traffic Manager
Traffic Manager
Posts: 143
Joined: 02 Apr 2011 12:55

Re: Enhanced Transparency Window

Post by 3298 »

I am aware that they are configurable, but I have to choose defaults. And as far as I know, many players use the default hotkeys. Combined hotkeys are at least not worse than the "show competitor signs" which the first part of my patch fixes, and nobody complained about that until I grep'ed for _display_opt and found it in the signs list. (I was like "What the heck does the sign list do with the display options? That's a setting for the viewport!")

I just tried setting two things to the same hotkey (through the hotkey config, but that probably doesn't matter). One of them wins, apparently the one that is listed in main_gui.cpp first.
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Enhanced Transparency Window

Post by frosch »

planetmaker wrote:'Full details' could possibly be renamed to 'animation' even though it includes some other small things as well
'Animation'? What about "rail fences" and "road trees" has to do with animation? :p

I guess you are confusing it with "full_animation", which enables/disables palette animation. This is actually no transparency seting at all, and should go to Game Options at some point (maybe combined with blitter selection).

About my ealier Ctrl-Click selection. I am not sure whether I still like it :p
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 49 guests