Jump to content

[1.12.x] ZTheme v1.1.3 - A dark theme for KSP (2024-02-27)


zapsnh

Recommended Posts

14 hours ago, Hide1nbush1 said:

Hello Love the mod it looks very clean. I am playing RP-1 and there are UI changes (see photo) that add things and I wanted to ask if u have the time to maybe update those too would be nice.

https://imgur.com/a/sZpI8Q9

Unfortunately my main computer that can run KSP is broken. I am writing this on a laptop I bought in 2022 with 2020 hardware that is actually just repackaged hardware from 2017 that rivals mid-range desktops from 2011. (and is less powerful than my phone which was cheaper) :P
As soon as I fix my computer though, I'll try to investigate and fix the issue ASAP. (but it may be unfixable since HUDReplacer doesn't do well with mods.)

--

And now the main post formatting is messed up :(
 

Edited by zapsnh
Link to comment
Share on other sites

On 12/29/2023 at 11:51 AM, Hide1nbush1 said:

Hello Love the mod it looks very clean. I am playing RP-1 and there are UI changes (see photo) that add things and I wanted to ask if u have the time to maybe update those too would be nice.

https://imgur.com/a/sZpI8Q9

Maybe you could help with this:
Every UI element use images to render, and every image has a name. HUDReplacer (at least, in debug mode) can get the name images associated with UI elements your mouse pointer is on. So you can tell us the name and dimensions of the images for the two problematic elements, so we can try making images for them.

To enable debug mode, edit the file under <KSP directory>/GameData/HUDReplacer/Settings.cfg and change showDebugToolbar to 'true' (without the quotes). Then start KSP and open your save. There will be a new button in the toolbar, which looks like this: [bg=black]C1ZYzZj.png[/bg]. Click on it to toggle debug (it should turn to [bg=black]IqQ1mw0.png[/bg]. After that, open the console (alt-F12, or rightshift-F12 if on Linux), place the mouse cursor above the UI elements (one after another) and press 'd'. This will print stuff to the console, in which there is some info on these elements, so that's what we'll need; either copy the output to the forums, or take a screenshot and post it. We should be able to figure out how to make a new image for them.

For some elements, HUDReplacer is unable to get image data, so I hope it's not the case. If it were though, there is another way, but it requires trial-and-error, so we'll avoid it unless necessary.

Edited by Nazalassa
Link to comment
Share on other sites

18 minutes ago, Nazalassa said:

Maybe you could help with this:
Every UI element use images to render, and every image has a name. HUDReplacer (at least, in debug mode) can get the name images associated with UI elements your mouse pointer is on. So you can tell us the name and dimensions of the images for the two problematic elements, so we can try making images for them.

To enable debug mode, edit the file under <KSP directory>/GameData/HUDReplacer/Settings.cfg and change showDebugToolbar to 'true' (without the quotes). Then start KSP and open your save. There will be a new button in the toolbar, which looks like this: [bg=black]C1ZYzZj.png[/bg]. Click on it to toggle debug. After that, open the console (alt-F12, or rightshift-F12 if on Linux), place the mouse cursor above the UI elements (one after another) and press 'd'. This will print stuff to the console, in which there is some info on these elements, so that's what we'll need; either copy the output to the forums, or take a screenshot and post it. We should be able to figure out how to make a new image for them.

For some elements, HUDReplacer is unable to get image data, so I hope it's not the case. If it were though, there is another way, but it requires trial-and-error, so we'll avoid it unless necessary.

https://imgur.com/a/oUY8kkT

I just hovered and pressed d it popped out two texts.

https://imgur.com/a/adGszxH

This is from the missing wallpaper in the Mission Control Center

Edited by Hide1nbush1
Forgot Smthing
Link to comment
Share on other sites

2 hours ago, Hide1nbush1 said:

https://imgur.com/a/oUY8kkT

I just hovered and pressed d it popped out two texts.

https://imgur.com/a/adGszxH

This is from the missing wallpaper in the Mission Control Center

OK, so we need to make an image that is 204x52, named RP-1/Resources/rep_background, and another that has the same size, and is named RP-1/Resources/confidence_background. Problem is, these textures have slashes in their names, and since HUDReplacer uses the filename to get what texture to replace, we can't replace them. (at least, not until @UltraJohn updates his mod).

I am going through the ztheme files rn, maybe a copy of UiElement_03?
Or UiElement_10.

 

-- Upd. --

UiElements_xx
03: Funds display bg
04: Funds display tape
05: green Funds icon
06: red Funds icon
10: science display bg
11: science display
12: science display icon
13: some kind of background
14: reputation display bg
17: reputation tape
20: VAB/SPH vessel price display
24: Funds/rep/science show/hide in flight

So, a copy of UiElements_03 would be fine. (I think) Although we just lack the icon I guess.

Just looked and yup, we'll have to draw the icon as well. But that is feasible. Just need to resize the image (add 1 px in width) and add an icon, rename it, and done. (and wait for HR to support slashes in texture names - see <link>)


-- Upd. 2 --

@zapsnh pull request opened with both requested images: I copied the rep icon for rep_background, but since I had no icon for confidence_background I made a crude one. Also added a node in the config, to load these textures. https://github.com/zapSNH/ZTheme/pull/7

Edited by Nazalassa
Link to comment
Share on other sites

9 hours ago, Hide1nbush1 said:

I forgot to mention that there is another texture in the VAB https://imgur.com/a/PGHf1Pj The Icons name when u hover over it is "Hide Experimental Parts" I tried to do the debug method but all I got was HUDReplacer : [][][][][][][][][].

The image path (obtained by browsing RP-1's github) is RP-1/PluginData/Icons/KCT_dev_parts_{on|off}.png. But since they're in PluginData, I don't know whether they are loaded under that name or not.

To figure that out: enter HR debug mode, go to the VAB, press 'e' (that will dump the names of all loaded textures to the log), open your KSP.log (which you'll find under either your KSP install directory, or your home directory) in any text editor, and give us either all the lines that contain "KCT_dev_parts_" (without the quotes), or just the whole log. (whatever you prefer)

Hopefully, that will give the correct, full internal name of the texture.

Link to comment
Share on other sites

20 minutes ago, Nazalassa said:

The image path (obtained by browsing RP-1's github) is RP-1/PluginData/Icons/KCT_dev_parts_{on|off}.png. But since they're in PluginData, I don't know whether they are loaded under that name or not.

To figure that out: enter HR debug mode, go to the VAB, press 'e' (that will dump the names of all loaded textures to the log), open your KSP.log (which you'll find under either your KSP install directory, or your home directory) in any text editor, and give us either all the lines that contain "KCT_dev_parts_" (without the quotes), or just the whole log. (whatever you prefer)

Hopefully, that will give the correct, full internal name of the texture.

so I did it but I did not find anything related to "KCT_dev_parts_" idk u can check if u want.

https://drive.google.com/file/d/1SFLW6vEiUSJZrPBG6JyZxZ-RMN_NUPQi/view?usp=sharing

Link to comment
Share on other sites

5 hours ago, Hide1nbush1 said:

so I did it but I did not find anything related to "KCT_dev_parts_" idk u can check if u want.

https://drive.google.com/file/d/1SFLW6vEiUSJZrPBG6JyZxZ-RMN_NUPQi/view?usp=sharing

That's weird. Hmmm... I guess we'll have to see how RP-1 handles this UI element.

-- Upd. --
OK. In RP-1 source, file RP0/UI/KCT/GUI_TopRightButtons.cs:

Spoiler
	internal void Start()
        {
            _uiScale = GameSettings.UI_SCALE;

            if (HighLogic.LoadedSceneIsEditor)
            {
                int _offset = 260;
                if (IsMechJebInstalled)
                    _offset += 140;
                else if (SteamManager.Initialized)
                    _offset += 46;
                var btn = new GUI_DevPartsButton(_offset)
                {
                    DefaultTexturePath = "GameData/RP-1/PluginData/Icons/KCT_dev_parts_off",
                    DefaultHovTexturePath = "GameData/RP-1/PluginData/Icons/KCT_dev_parts_off",
                    OnTexturePath = "GameData/RP-1/PluginData/Icons/KCT_dev_parts_on",
                    OnHovTexturePath = "GameData/RP-1/PluginData/Icons/KCT_dev_parts_on",
                    TooltipDefaultText = "Show Experimental parts",
                    TooltipOnText = "Hide Experimental parts",
                    IsOn = SpaceCenterManagement.Instance.ExperimentalPartsEnabled
                };
                btn.Init();
                _buttons.Add(btn);
            }
			[...]
		}
	}

It appears the textures are directly loaded from the files, without passing through loaded KSP files. Will look at class GUI_DevPartsButton -> Inherits from GUI_TopRightButton -> loads textures with 'ToolbarControl.LoadImageFromFile' -> no way to change the image without also changing the source image :(
OR accessing the button instance's texture paths (easy/hard?)

Edited by Nazalassa
Link to comment
Share on other sites

Posted (edited)

ZTheme v1.1.0

About

A relatively minor release to address a couple of issues.
HUDReplacer v1.2.11 or higher is recommended.

Changelog

  • RP-1 support has been added.
    • The loading icons for RSS should now depict the RSS planets (AKA the irl planets). These have not been tested however.
  • Icons in the tracking station have been themed.
  • Minor design adjustments
    • The stage add and remove buttons are now less garish.
    • Reputation bar should now be more accurate.
    • The decline contract button is now less blurry.
    • The recover and space center buttons should no longer overlap eachother.
    • The SAS and RCS buttons should now look more sleek.
    • Other minor stuff.

Known Issues

  • KAL Editor icons sometimes don't show up.

 

v1.1.0b -> v1.1.2 release notes

Spoiler

ZTheme v1.1.0b

About

The zip file was broken so CKAN couldn't install it properly. Apparently SpaceDock can't update the zip download for the latest version so here's another version with the fixed zip file.
HUDReplacer v1.2.11 or higher is recommended.

Changelog

  • Fixed the zip file.

--

ZTheme v1.1.1

About

HUDReplacer v1.2.11 or higher is recommended.

Changelog

  • Fixed the RP-1 reputation bar.

--

ZTheme v1.1.2

About

HUDReplacer v1.2.11 or higher is recommended.

Changelog

  • Fixed the RP-1 reputation bar again. (hopefully)
Edited by zapsnh
Link to comment
Share on other sites

10 minutes ago, zapsnh said:

I've been """"learning""""  how to create plugins for KSP and I made one that makes the navball mimick the behavior of the KSP2 one.

Source Code: https://github.com/zapSNH/zui (will publish code as soon as I clean it up)

Would be nice if HUDReplacer had an option to make the throttle/gee gauges fo straight instead of being curved.

Link to comment
Share on other sites

On 1/8/2024 at 8:56 AM, Nazalassa said:

Would be nice if HUDReplacer had an option to make the throttle/gee gauges fo straight instead of being curved.

It actually sounds feasible, though not something I'm going to implement. I reckon you'd have to go into the two classes ThrottleGauge and GeeGauge, recreate these two classes to have a LinearGauge property instead of a RotationalGauge. Then finally figure out where these two classes are originally instantiated and use a harmony patch to replace the instantiation with the new version. Though honestly I doubt it would be that easy lol. :D 

I think the scope of this change alters too much the original code of the game for it to be included in HUDReplacer.

Edited by UltraJohn
Link to comment
Share on other sites

I found a way to "remove" the loading text without using Harmony!
image.png

Spoiler

Basically the loading screen is a GameObject (either LoadingBuffer or LoadingMask) and I can rotate and translate stuff with ZUI so I just rotated the loading text out of the screen.

With default textures
image.png

With loading text visible
image

 

Link to comment
Share on other sites

7 hours ago, zapsnh said:

I found a way to "remove" the loading text without using Harmony!
image.png

  Hide contents

Basically the loading screen is a GameObject (either LoadingBuffer or LoadingMask) and I can rotate and translate stuff with ZUI so I just rotated the loading text out of the screen.

With default textures
image.png

With loading text visible
image

 

Wow! How exactly did you do?

Link to comment
Share on other sites

13 hours ago, zapsnh said:

I found a way to "remove" the loading text without using Harmony!

Basically the loading screen is a GameObject (either LoadingBuffer or LoadingMask) and I can rotate and translate stuff with ZUI so I just rotated the loading text out of the screen.

 

Did you use the LoadingBufferMask class? I wonder what would happen if you were to run:

LoadingBufferMask.Instance.Hide();

 

Edit: I nevermind, that's an internal property. :(

Edited by UltraJohn
Link to comment
Share on other sites

8 hours ago, Nazalassa said:

Wow! How exactly did you do?

See: https://github.com/zapSNH/zui/blob/main/Transformer.cs and https://github.com/zapSNH/zui/blob/main/config.cfg

It's basically wheeeUI does but without the wheee. I wonder if you can achieve a linear(ish) throttle/gee gauge by making the rotation and x-position constant.

 

Link to comment
Share on other sites

Btw, I wouldn't really recommend doing this loop in a method that runs during gameplay. I would imagine it's gonna cause a cpu time spike whenever your navball changes. Instead I think you should run this once on Start() and cache the reference to the Texture2D object.

Link to comment
Share on other sites

12 hours ago, zapsnh said:

See: https://github.com/zapSNH/zui/blob/main/Transformer.cs and https://github.com/zapSNH/zui/blob/main/config.cfg

It's basically wheeeUI does but without the wheee. I wonder if you can achieve a linear(ish) throttle/gee gauge by making the rotation and x-position constant.

 

Glad my wheeeUI found some use ;)

Link to comment
Share on other sites

  • 1 month later...
5 hours ago, Monteir0 said:

Does anyone know where to change the color of this?
thanks

There are some limited options available inside KER itself. 

Click the KER button on the app bar. Select Edit beside the HUD you want to change.

  • To apply a dark shaded background to the HUD panel click the BG button at the top of the editor window
  • Each value colour can be changed individually by clicking on the coloured square next to its label in the installed section
  • The labels are fixed as bold white text.
Spoiler

GfWBVjI.png

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...