Jump to content

[1.2.0] Toolbar 1.7.13 - Common API for draggable/resizable buttons toolbar


blizzy78

Recommended Posts

Heres the Kerbal Alarm Clock integrated with the Toolbar - user can choose to use either button model, and the button icon changes in the toolbar same as the native one does

Looking good, glad to see you could animate it the same way as you did with the native button. I'd suggest changing the tool tip text to just "Kerbal Alarm Clock".

Link to comment
Share on other sites

Looking good, glad to see you could animate it the same way as you did with the native button. I'd suggest changing the tool tip text to just "Kerbal Alarm Clock".

Yeah thats a good point, I need to share nice and play well with others :).

I'm also pretty close on the on-demand calls stuff, but I'm getting tired of the debugging method :( - (start KSP, 3 mins later, damn, stop change one work, rinse/repeat)

Link to comment
Share on other sites

@ blizzy78: I have a (minor) annoyance with Toolbar_plugin (ver. 1.1.0) in relation to other mods.

Everytime I switch from one to another ship, the main window of some mods opens (the window normally opened by pressing their button on the toolbar) if that mod was inactive before.

Being a common issue, I suspect it could be a bug with the toolbar, or more than one mod author did introduce the same bug with their mod.

This is verified with Steamgauges by Trueborn and ActionGroupManager by Sir Julio.

I also have a different annoyance, but that is with MechJeb only so I can't say where the bug may lie: the main MechJeb button disappears from the toolbar during launch or ascent (making MJ's main window not activable). Can't say if the two annoyances may be related.

Link to comment
Share on other sites

Everytime I switch from one to another ship, the main window of some mods opens (the window normally opened by pressing their button on the toolbar) if that mod was inactive before.

That's odd, because all the Toolbar Plugin really does is create a regular Unity button, then listen to button clicks, which it routes through to the respective plugins. So unless Unity sends a button click event for whatever reason, the toolbar does nothing on its own. Also, it doesn't know or care what the third-party plugin will do once it receives a button click event.

But I'll see what I can find.

I also have a different annoyance, but that is with MechJeb only so I can't say where the bug may lie: the main MechJeb button disappears from the toolbar during launch or ascent (making MJ's main window not activable). Can't say if the two annoyances may be related.

I think I read about that over on sarbian's new thread. At first glance I'd say that must be a MechJeb bug (or rather sarbian's new toolbar-related DLL) because the Toolbar Plugin doesn't care about switching vessels. The toolbar itself is global, so a button will be held on to for as long as the plugin that created it wishes. In the case of MechJeb, it needs to take care that it may run multiple times on different vessels (within physics range), but only a single button should be created. I haven't checked sarbian's source code to see how he handles that.

Link to comment
Share on other sites

...But I'll see what I can find.

Many thanks. I guess I may find somthing useful to isolate the issue, maybe in output_log.txt. Or from the KSP debug window (Alt-F12). But I don't really know what to look for, there is too much activity going on during a vessel switch.

Maybe tracing events related to the different plugins will do, but need to run a specific version of those plugins with tracing active. If that's a sensible way to proceed in your opinion, and want me to conduct specific tests with yours, wilco!

Link to comment
Share on other sites

Question: When KSP is played in Windowed mode, how does the user unhide a docked and auto-hidden bar?

Reason: To conveniently reach something at the window border of a full-screen application, a user usually abuses the fact that the mouse pointer never leaves the window, stopping at the border, an option which isn't available in most Windowed-mode applications (of course except for those who do act like a "windowed fullscreen" one and can only be "left" through Alt-Tabbing or similar). As a user, I would not want to have to aim my mouse pointer exactly at an invisible, 1 pixel wide sensitive line or the like. How does this Toolbar plugin avoid this? Does it perhaps disallow the mouse pointer to leave the game window along the length of a hidden bar's border?

Edited by Andersenman
Link to comment
Share on other sites

As a user, I would not want to have to aim my mouse pointer exactly at an invisible, 1 pixel wide sensitive line or the like. How does this Toolbar plugin avoid this? Does it perhaps disallow the mouse pointer to leave the game window along the length of a hidden bar's border?

It doesn't. It looks like there is some way to restrict the mouse pointer to the window, but it's OS-specific. I really don't want to go that route.

Link to comment
Share on other sites

haven't checked sarbian's source code to see how he handles that.

Badly :)

I fixed my plugin yesterday and users seems to be happy with this version. Code is a bit more complex than I hoped, but that may come from too much iteration. The fact that I did a distinct MJ module did not help :)

The toolbar use for partmodule addon can be tricky, you have to manage multiple version of the partmodule active (more than one module on the same ship or nearby ship) and do a proper cleanup when all the active part are gone but not before.

If you need only one button you should use it to change the state of a static boolean. For cleanup the only method I have is a static list of the using partmodule and cleaning up when the list is empty. If anyone has a better idea I would welcome it.

Blizzy you should hide the bar when there is no button, the black square hoovering over the spacecenter annoys some user.

Link to comment
Share on other sites

The fact that I did a distinct MJ module did not help :)

Just as an aside, do you plan to integrate the toolbar into the main MJ module? I know you would need to edit the Jenkins job and such, but aside from that? I'm curious ;)

If anyone has a better idea I would welcome it.

How about holding a static list of your buttons, along with some "use" counter? As soon as the use counter is zero, you could set the buttons to visible=false. There is no real need to actually Destroy() them because they are very lightweight.

Blizzy you should hide the bar when there is no button, the black square hoovering over the spacecenter annoys some user.

I already do...? https://github.com/blizzy78/ksp_toolbar/commit/9b6f9a8289f3ba477b413e551ea00976d32e2299

(This commit made it into Toolbar 1.1.0)

Link to comment
Share on other sites

blizzy78, if it's something you're interested in, I've developed a wrapper class for late binding, which allows mods to optionally use your Toolbar without depending on any of its code. I've shared it with TriggerAU, who I knew was working on the same thing. If this is useful to you or any other developers using your Toolbar, it's free to use.

Also, if you've any recommendations for how you think it would be done better or more in line with your ideas of things, feel free to let me know.

Link to comment
Share on other sites

I've added new API to the Toolbar Plugin that allows a button to be marked as "important" (not yet released.) You may know that the toolbar can be configured by the user to auto-hide if it is positioned at any screen edge. Now the "important" feature will make the toolbar show itself again as long as any of the buttons is marked as "important." If there no longer is a button that is "important," auto-hiding will continue to work as normal.

Note that all of this is only relevant if the toolbar really is in auto-hide mode: If it has not been positioned at the screen edge, it will never auto-hide itself, regardless of the user's configuration of that setting. Also in this case, the "important" button will not do anything special, because it is shown all the time already.

So what is all this good for? I'd like to give a concrete example: In the next version of my IRC plugin, I will be using this feature to signal the arrival of a private message to the user. So even if the toolbar would normally be auto-hidden, it will temporarily unhide itself so that the user is notified of the message. The button will reset its "important" flag as soon as the user reads the message.

Please use this feature only sparingly, because it is obviously quite intrusive.

Link to comment
Share on other sites

Toolbar Plugin 1.2.0 is now available for download. The toolbar position is now stored separately for every game scene. There is also the new API for "important" buttons.

There appears to be an Issue with the way KSP is loading .tga textures. Here's my VOID icon and your reposition and open textures in tga:

toolbar_textures_tga.png

I converted them all to png (no other changes at all), and everything looks clean again:

toolbar_textures_png.png

Link to comment
Share on other sites

Would it be possible for the toolbar position to be unlocked by default? Or to have an obvious lock-unlock icon visible on it somewhere? A lot of new users seem to be confused by the fact that the position is locked by default.

Link to comment
Share on other sites

There appears to be an Issue with the way KSP is loading .tga textures. ... I converted them all to png (no other changes at all), and everything looks clean again:

They still look awful after your conversion. Anyway, I have been having lots of trouble with the cursor textures, and at least they work for me right now. I think sarbian has been testing these in 1.1.0 and they worked for him, too. Since then I've only been changing the alpha channel on the TGA files, so that shouldn't really have an effect. Have you tried without other mods, especially the "active memory reducer" (or what it's called) that compresses textures on the fly?

Would it be possible for the toolbar position to be unlocked by default? Or to have an obvious lock-unlock icon visible on it somewhere? A lot of new users seem to be confused by the fact that the position is locked by default.

There is the little triangle button on the side of the toolbar that gives access to a toolbar-specific menu. I'd rather not unlock it by default since in unlocked mode, all buttons need to be disabled to prevent a click. That would lead to even more confusion if none of the buttons "work." Also, button tooltips are hidden in unlocked mode, preventing discoverability of what is what.

Edited by blizzy78
Link to comment
Share on other sites

There is the little triangle button on the side of the toolbar that gives access to a toolbar-specific menu. I'd rather not unlock it by default since in unlocked mode, all buttons need to be disabled to prevent a click. That would lead to even more confusion if none of the buttons "work." Also, button tooltips are hidden in unlocked mode, preventing discoverability of what is what.

What about an extra little lock/unlock icon above the drop down one?

(apologies for the large pic) eg.

y4Ymev3.jpg

Edited by TriggerAu
resized pic
Link to comment
Share on other sites

They still look awful after your conversion. Anyway, I have been having lots of trouble with the cursor textures, and at least they work for me right now. I think sarbian has been testing these in 1.1.0 and they worked for him, too. Since then I've only been changing the alpha channel on the TGA files, so that shouldn't really have an effect. Have you tried without other mods, especially the "active memory reducer" (or what it's called) that compresses textures on the fly?

I didn't have any other mods installed; except VOID, which doesn't do anything like active texture reducing. It was a clean KSP 0.23.0 install, plus clean installs of VOID and Toolbar 1.2.0, to test compatibility. Do you want me to test Toolbar with nothing but your test buttons or something like that?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...