UltraJohn Posted March 9 Author Share Posted March 9 @Nazalassa Hey thanks! I wish there was some easy way to automate this, but unfortunately it's going to be a per-element case where I have to individually write code for every single piece of text in the game. The same goes for adding custom opacity values to textures. Actually thinking about it some more, I have a few ideas I'll have to test when I have the time to do so. The challenge is figuring out how to dynamically link the cfg file to the text elements in game. How would the cfg files be formatted to support this? I wonder if every text element has a designated internal name, just like the textures do.. I'll see what I can come up with On a side note, I have thought about changing the license of the mod, since I never really intended to use the current one, but I just picked whatever at the time to get started. Not sure how I go about that in terms of CKAN metadata. Anyone know? Quote Link to comment Share on other sites More sharing options...
Nazalassa Posted March 9 Share Posted March 9 3 minutes ago, UltraJohn said: @Nazalassa Hey thanks! I wish there was some easy way to automate this, but unfortunately it's going to be a per-element case where I have to individually write code for every single piece of text in the game. The same goes for adding custom opacity values to textures. Actually thinking about it some more, I have a few ideas I'll have to test when I have the time to do so. The challenge is figuring out how to dynamically link the cfg file to the text elements in game. How would the cfg files be formatted to support this? I wonder if every text element has a designated internal name, just like the textures do.. I'll see what I can come up with On a side note, I have thought about changing the license of the mod, since I never really intended to use the current one, but I just picked whatever at the time to get started. Not sure how I go about that in terms of CKAN metadata. Anyone know? The cfg might be like: HUDReplacerTextColor { // Generic text colors greenText = #004000 lightGreenText = #008000 // See shades of green in screenshot from difficulty settings, the 5 buttons on top orangeText = #804000 blueText = #000080 limeText = #004080 whiteText = #000000 greyText = #505050 barText = #0000ff // For text in the green bars, like in a PAW or in the 'Resources' tab redText = #800000 PerElement { // Keys are internal element names, overrides generic colors elementName = #ffffff elementName2 = #808080 } } The PerElement section (or whatever you call it) allows modders to specify a color for certain named element, such as a specific button, etc. Maybe also add a PerCategory section? Like for green-colored text on buttons. Quote Link to comment Share on other sites More sharing options...
UltraJohn Posted March 9 Author Share Posted March 9 21 minutes ago, Nazalassa said: The cfg might be like: I like it! Quote Link to comment Share on other sites More sharing options...
UltraJohn Posted March 25 Author Share Posted March 25 Just a quick update, I am taking a small break currently due to being busy with real life and work at the moment. When I have the time I will continue adding the requested features! Should hopefully be soon™. Quote Link to comment Share on other sites More sharing options...
ceteræ Posted April 11 Share Posted April 11 This mod is amazing, thank you so much for everyone involved! Quote Link to comment Share on other sites More sharing options...
123sderhy1 Posted April 25 Share Posted April 25 Why when I try to get the texture name in the main menu, I only get this [][][][][][][][][] I downloaded the mod through CKAN Quote Link to comment Share on other sites More sharing options...
UltraJohn Posted April 27 Author Share Posted April 27 On 4/25/2024 at 7:13 PM, 123sderhy1 said: Why when I try to get the texture name in the main menu, I only get this [][][][][][][][][] I downloaded the mod through CKAN That is just the spacer used to separate lines in the log. If you don't see any specific textures listed in between, you need to hover over your mouse on the element you want to grab (if using the hotkey D.) Quote Link to comment Share on other sites More sharing options...
lenaic Posted May 8 Share Posted May 8 i don't know why but the mod juste dose not work, my game is stock no other mod exept HUD, Harmony, ZTheme and module manager everything is in the gamedata folder. i just don't know what to do ? Quote Link to comment Share on other sites More sharing options...
Nazalassa Posted May 9 Share Posted May 9 18 hours ago, lenaic said: i don't know why but the mod juste dose not work, my game is stock no other mod exept HUD, Harmony, ZTheme and module manager everything is in the gamedata folder. i just don't know what to do ? To help us find out where the problem is, could you please tell us which version of KSP you are using (HR doesn't work below 1.8), and give us a few screenshots? Thanks. (more) Also, welcome to the forums! Quote Link to comment Share on other sites More sharing options...
UltraJohn Posted July 12 Author Share Posted July 12 1.2.12-beta is released. https://github.com/UltraJohn/HUDReplacer/releases/tag/1.2.12-beta What's Changed Editor category buttons can now be monochrome color. Advanced editor category buttons can also now be colored. New config options: EditorCategoryButtonColor = 1,1,1,1 EditorCategoryModuleButtonColor = 1,1,1,1 EditorCategoryResourceButtonColor = 1,1,1,1 EditorCategoryManufacturerButtonColor = 1,1,1,1 EditorCategoryTechButtonColor = 1,1,1,1 EditorCategoryProfileButtonColor = 1,1,1,1 EditorCategorySubassemblyButtonColor = 1,1,1,1 EditorCategoryVariantsButtonColor = 1,1,1,1 EditorCategoryCustomButtonColor = 1,1,1,1 Thanks to @zapsnh for this update! Quote Link to comment Share on other sites More sharing options...
zapsnh Posted July 15 Share Posted July 15 I'm trying to create an in-game GUI for configuring theme options with HUDReplacer (kinda similar to this but changes are triggered by a custom GUI). I currently have a system with a config file which has nodes that look like this: Spoiler ZUIConfig { name = Invert ZUIHUDReplacerConfig { filePath = GameData/999_ZUI/PluginData/ConfigImages/Invert/ priority = 99 } ZUIHUDReplacerRecolorConfig { PAWTitleBar = 0,1,0,1 METDisplayColorGreen = 1,0,1,1 } } which are converted to HUDReplacer nodes and saved to a config file depending if the nodes are enabled (which is in another node). This seems to work if I enable/disable nodes while the game isn't running but whenever nodes are enabled/disabled at runtime it seems that HUDReplacer (or KSP) doesn't recognize a change if I forced a reload. I tried using GameDatabase.CompileConfig(configNode)but it the game still doesn't recognize a change. I think I have a solution that would require modification of HUDReplacer's code (which I would rather not do for my silly GUI (but also could allow other less silly mods to use HUDReplacer to dynamically change/recolor stuff)). Potential solution: Spoiler I propose something like this: Spoiler public void LoadTexturesFromConfigNode(ConfigNode node) { if (!node.HasValue("filePath")) { // error handling return; } // rest is just adapted from GetTextures string filePath = node.GetValue("filePath"); string onScene = node.HasValue("onScene") ? node.GetValue("onScene") : ""; if (onScene != "") { try { GameScenes scene = (GameScenes) Enum.Parse(typeof(GameScenes), onScene); if (HighLogic.LoadedScene != scene) continue; } catch (Exception e) { Debug.LogError("HUDReplacer: Error loading onScene variable '" + onScene + "' from filePath: " + filePath); } } int priority = int.Parse(node.GetValue("priority")); Debug.Log("HUDReplacer: path " + filePath + " - priority: " + priority); // string[] files = Directory.GetFiles(filePath, "*.png"); string[] files = Directory.GetFiles(KSPUtil.ApplicationRootPath + filePath, "*.png"); Dictionary<string, string> images = new Dictionary<string, string>(); // allows for overriding currently loaded images foreach (string text in files) { Debug.Log("HUDReplacer: Found file " + text); string filename = Path.GetFileNameWithoutExtension(text); if (!images.ContainsKey(filename)) { images.Add(filename, text); } } ReplaceTextures(images); } internal void ReplaceTextures(Dictionary<string, string> images) { Texture2D[] tex_array = (Texture2D[])(object) Resources.FindObjectsOfTypeAll(typeof(Texture2D)); ReplaceTextures(tex_array, images); // ReplaceTextures would have to be modified to accept an images dict } public void LoadHUDColorsFromConfigNode(ConfigNode node) { // the inside of the LoadHUDColors foreach loop except configFile.config is node } There'd probably be a freeze whenever LoadTexturesFromConfigNode is called but that's likely the tradeoff of replacing that many textures. (or you could do something like this if you're only replacing a handful of textures) Quote Link to comment Share on other sites More sharing options...
UltraJohn Posted July 16 Author Share Posted July 16 @zapsnh So you are trying to create a GUI that lets you change the config options in realtime ingame, if I understand that correctly? I'm unsure how or if it's even possible to use the methods to overwrite config nodes, and if that would still require a game reload to take effect, as it probably doesn't alter the in memory config nodes that are already loaded. As you say, it would indeed require a rewrite to allow this functionality directly in HUDReplacer, which I do not have the time for currently. You are ofcourse welcome to submit merge requests, if you think you've got a great implementation that seamlessly integrates! As for the freeze, that will happen whenever you are replacing a lot of textures at once, hence why I really only let it do that during scene load (with the exception of something like the KAL editor as that loads after you try to open the interface.) Quote Link to comment Share on other sites More sharing options...
Nightside Posted July 20 Share Posted July 20 Could I use this mod to create NEW UI elements? I’d like to create buttons for the action groups (for touch screens) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.