Jump to content

[1.8.x - 1.12.x] SimpleRepaint: Universal, simple and lightweight parts recoloring


Judicator81

Recommended Posts

  SimpleRepaint [0.4.2]

Universal, simple and lightweight parts recoloring.

7Xtn7zg.png

More screenshots:

Spoiler

g5GP55q.jpeg

YypI8W9.png

rsAduVR.png

DcIbhQT.jpeg

fBjmp3K.jpeg

Demonstration of parts repainting in flight (yes, it's possible):
https://i.imgur.com/Vw18sTk.mp4

How do I repaint parts?

Open PAW menu by right-clicking on part (in VAB/Hangar or in flight), and choose desired color variant ("Part simple repaint"). See screenshot below.
iOAWoFB.png

How does it work?

Each part in the game has one or more 3D-models with materials, shaders and textures tied to them. There is "basic" stock shader (KSP/Bumped Specular) that majority of parts use. SimpleRepaint alters color modifier for materials with this shader, changing overall part color as a result.

This approach has some advantages:

  1. SimpleRepaint is universal. The majority of parts and mods are supported "out of the box" with no additional configs needed.
  2. Mod contains no textures at all and has low memory footprint. It does, however, generate tons of MM-patches.
  3. Possible colors variants list could be relatively easily edited and supplemented.

There are serious drawbacks though:

  1. Only white or mostly white parts will be repainted as expected. If part is not white (let's say, orange fuel tank or grey structural beam), repainting it will not give expected results.
  2. Parts, using not "basic" shader, will not be repainted. Obvious example are probe cores, covered with silver or golden foil. Another example are mods, which use their own shaders even for generic materials (so far I found only one such mod: WBI Mk-33).
  3. Only color can be altered, not shininess, transparency and such. Also, only colors from predefined list could be used.

Can Simple Repaint be used together with Textures Unlimited?

Yes. Those parts, that have no TU support, will get SimpleRepaint features.

What parts/mods are not supported?

  1. Various fairings, including stock ones, procedural decoupler shrouds and fairings from SimpleAdjustableFairing mod.
  2. Procedural parts from the eponymous mod, and procedural wings.
  3. Deployable science parts from Breaking Ground DLC.
  4. Deployable work lamps and kerbonauts equipment (EVA Jetpack, EVA Repair Kit, ...).
  5. Parts with SSTU Recolor or Textures Unlimited modules, as they already have support for much more powerful repainting mod.

Is it compatible with part variants?

Yes. However, there is a visual bug: changing part variant resets part color to default. Choosing another color after switching part variant fixes this.

Dependencies

Both mods are required and are bundled as part of download.

Installation

  1. Make a backup copy of Colors.cfg file GameData/SimpleRepaint folder inside your Kerbal Space Program folder. It's only needed if you changed and/or added your own colors.
  2. Remove mod folder SimpleRepaint from GameData folder inside your Kerbal Space Program folder before installation.
  3. Place the GameData folder from downloaded archive inside your Kerbal Space Program folder.
  4. Restore Colors.cfg file from backup to GameData/SimpleRepaint folder (see para. 1).

Possible colors

You can change possible colors variants in GameData/SimpleRepaint/Colors.cfg file. There are maximum 24 color variants available. Please set name to NOT_USED for all unused colors.

Black and grey lists

  1. Some parts do not support B9PartSwitch for some reason. These are added to so-called "grey list", and will (or will not, depending on UseStockVariantSwitcherForB9PSIncompatibleParts setting) get repainting via stock PartVariants. It's not as comfortable as B9PS (in my opinion), and also does not support repainting parts in flight. You can find those parts in GameData/SimpleRepaint/GreyList.cfg file.
  2. Some parts are not supported at all, and for some others SimpleRepaint recoloring does not have much sense: silver or golden foil covered, metallic or dark parts will not get any value from it. Those parts are added to black lists. You can find them in GameData/SimpleRepaint/IgnoreParts folder.

Settings

There are three settings in GameData/SimpleRepaint/Settings.cfg config file.

Repaint in flight

By default you can repaint your vessel parts even in flight scene. If you feel that it's not very realistic, you can disable this feature: just set RepaintInFlight value to false.

Using stock part variants switching instead B9PartSwitch

Where are some parts which does not seem to be compatible with B9PartSwitch, and they are added to "grey list".  Notable examples are stock (not ReStock!) radial ore drills. Those parts still get repaint ability through stock part variants interface. Set UseStockVariantSwitcherForB9PSIncompatibleParts value to false if you don't want repaint ability for any B9PS-incompatible parts.

Repainting only whitelisted parts

By default, all compatible parts (both stock and from mods) will get repainting ability.
If you disable this behavior by setting RepaintWhitelistedPartsOnly value to true, only specified parts will get color switching. Where are examples of whitelists in GameData/SimpleRepaint/Whitelists folder. They should be renamed to .cfg files in order to take effect.

Credits

Many thanks to:
- @Electrocutor for initial Module Manager config file (implementing colors switching via stock PartVariant), which became the basis of this mod. See this topic: https://forum.kerbalspaceprogram.com/index.php?/topic/173208-partvariant-color-tinting/.
- @Hohmannson for updating @Electrocutor's initial config and adding ReStock-friendly colors, for lots of suggestions and ideas, and extensive testing of SimpleRepaint.

Licensing

This mod is distributed under a Creative Commons Attribution 4.0 International License (CC-BY-4.0).

You are free to share and adapt the materials for any purpose, when providing appropriate attribution.

Bundled mods are distributed under their own licenses:

  • ModuleManager by ialdabaoth, Sarbian and Blowfish is licensed under a "CC share-alike license". More information can be found here.
  • B9PartSwitch by blowfish is distributed under LGPL v3.0. Details and source are here.

Changelog

Spoiler

0.4.2

  • Added three drills from MKS mod to greylist.
  • Added blacklist for Kerbal Atomics, added reactors and RTGs from dev version of Near Future Electrical to blacklist.
  • Moved greylist to separate GreyList.cfg file.
  • Bundled B9PartSwitch updated to last version (2.20.0).
  • Mod is marked as 1.12.5 compatible.

0.4.1

  • Added some parts from VaporVent mod to greylist.
  • Added blacklist for Bluedog_DB mod (about 600 parts are blacklisted from more than a thousand total in BDB).
  • Mod is marked as 1.12.4 compatible.

0.4.0

  • Changed MM patch order to get rid of problems, caused by interaction with other mods' patches, updating B9PS switchers (i.e. Kerbalism + SSPX).
  • Black and grey lists are now moved to separate folder (IgnoreParts). List of blacklisted parts is expanded, parts from several mods added.

0.3.3

  • Added some unsupported parts to blacklist (thanks to @Hohmannson).
  • Marked as KPS 1.12.3 compatible.

0.3.2

  • Made compability patch for BDArmory guns more universal, which hopefully will improve support for BDA-based parts mods in the future.
  • Several parts from Aviator Arsenal Continued mod added to greylist.

0.3.1

  • Added setting to use whitelist-only repainting (disabled by default, see readme).

0.3.0

  • Rearranged colors list, added new colors.
  • Parts incompatible with B9PartSwitch are added to grey list. So far three stock parts and several parts from BDArmory and MiningExpansion are greylisted.
  • Greylisted parts will still get repaint ability with stock Part Variants interface, added setting to disable this behavior (enabled by default).

0.2.1

  • Added ability to repaint parts in flight and setting to disable this behavior (enabled by default).

0.2.0

  • Fixed fatal bug: kerbals going on EVA gone missing, some parts of the vessel explode, B9PS error pop ups. Apparently having any B9PartSwitch module on kerbals themselves (KerbalEVA* parts) is a really bad idea.

0.1.0

  • Initial version with universal patch, using B9PartSwitch to choose part color.

Downloads

Edited by Judicator81
0.4.2
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 1 month later...
  • 2 months later...
  • 2 months later...
4 hours ago, chaos113 said:

this mod causes module manager to stop loading and freezes the start up

For me, this mod causes Module Manager to appear to stop loading at the stage when it's applying the Simple Repaint patches. It applies the patch individually to almost every part in the game. If you have a lot of added mod parts, it might have to apply thousands and thousands of patches. At least for me (with tons of extra part mods) it eventually gets going again and the game finishes loading. 

An alternative is to change the settings so it applies the patches only to whitelisted parts and then choose which specific  parts to apply it to. Your  game should load a lot quicker then.

Link to comment
Share on other sites

  • 1 month later...

Just to let you know, SimpleRepaint prevents some drills from showing in the VAB/SHP, like some from KPBS or the asteroid drill of Hangar

Link to comment
Share on other sites

  • 2 months later...

Version 0.3.3 released.

Changelog:

  • Added some unsupported parts to blacklist (thanks to @Hohmannson).
  • Marked mod as KPS 1.12.3 compatible.
On 5/5/2022 at 1:14 AM, Forked Camphor said:

Just to let you know, SimpleRepaint prevents some drills from showing in the VAB/SHP, like some from KPBS or the asteroid drill of Hangar

Fixed in 0.3.3.

Link to comment
Share on other sites

4 hours ago, Judicator81 said:

Version 0.3.3 released.

Changelog:

  • Added some unsupported parts to blacklist (thanks to @Hohmannson).
  • Marked mod as KPS 1.12.3 compatible.

Fixed in 0.3.3.

Sorry to double-post, but my game is hanging at startup, and it seems to be stalling at adding *all the patches* for way-too-many mods. 

Since the current method of blacklisting is part-based, is there an MM syntax to ignore an entire mod's / folders worth of parts?

Link to comment
Share on other sites

  • 2 months later...
On 9/19/2022 at 6:59 PM, TanoPrime said:

If I install this mod, launch some colorized craft, and uninstall the mod for some reason, will the colorized craft still work in my save?

Yes, your spacecraft will be fine in such situation.

Version 0.4.0 released.

Changelog:

  • Changed MM patch order to get rid of problems, caused by interaction with other mods' patches, updating B9PS switchers (i.e. Kerbalism + SSPX).
  • Black and grey lists are now moved to separate folder (IgnoreParts). List of blacklisted parts is expanded, parts from several mods added.
Link to comment
Share on other sites

  • 4 weeks later...

So this mod ended up being the culprit for my current issue. One being parts from Vapor Vents not showing up and some B9 menu functionality being missing ( Like on some engines have multiple configs that were missing )

KSP.log

Player.log

Mod List

Potential relevant line.

PartLoader: Compiling Part 'VaporVent/parts/Vent1/part/vent' 
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)

PartLoader: Encountered exception during compilation. System.NullReferenceException: Object reference not set to an instance of an object
  at B9PartSwitch.ColorPropertyModifierInfo+<CreateModifiers>d__4.MoveNext () [0x00050] in <a3c2951fc74e4639820ef37d2d29f386>:0 
  at B9PartSwitch.MaterialModifierInfo+<CreateModifiers>d__8.MoveNext () [0x001dd] in <a3c2951fc74e4639820ef37d2d29f386>:0 
  at B9PartSwitch.PartSubtype.Setup (B9PartSwitch.ModuleB9PartSwitch parent, System.Boolean displayWarnings) [0x00383] in <a3c2951fc74e4639820ef37d2d29f386>:0 
  at B9PartSwitch.ModuleB9PartSwitch.InitializeSubtypes (System.Boolean displayWarnings) [0x0005b] in <a3c2951fc74e4639820ef37d2d29f386>:0 
  at B9PartSwitch.ModuleB9PartSwitch.OnIconCreate () [0x00006] in <a3c2951fc74e4639820ef37d2d29f386>:0 
  at PartLoader.CreatePartIcon (UnityEngine.GameObject newPart, System.Single& iconScale) [0x0005c] in <39c0323fb6b449a4aaf3465c00ed3c8d>:0 
  at PartLoader.ParsePart (UrlDir+UrlConfig urlConfig, ConfigNode node) [0x00ff2] in <39c0323fb6b449a4aaf3465c00ed3c8d>:0 
  at PartLoader+<CompileParts>d__56.MoveNext () [0x00685] in <39c0323fb6b449a4aaf3465c00ed3c8d>:0  
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)

PartCompiler: Cannot compile part 
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)

 

Link to comment
Share on other sites

On 10/29/2022 at 2:54 AM, Motokid600 said:

So this mod ended up being the culprit for my current issue. One being parts from Vapor Vents not showing up and some B9 menu functionality being missing ( Like on some engines have multiple configs that were missing )

Yep, it looks like some parts from VaporVents mod are not compatible with B9PartSwitch. Fixed in 0.4.1.
 

Version 0.4.1 released.

Changelog:

  • Added some parts from VaporVent mod to greylist.
  • Added blacklist for Bluedog_DB mod (about 600 parts are blacklisted from more than a thousand total in BDB).
  • Mod is marked as 1.12.4 compatible.
     

P.S. It looks like spacedock.info is temporally down now. Get new mod version from github or CKAN, if you are in a hurry.

Link to comment
Share on other sites

  • 4 months later...

This works so well! Thank you!

I was looking for something like this, and ended up with procedural parts to use the variety of textures.. but this.. This seems to work with almost anything :)

It does bloat the MM patches a bit, I'm up to 60k (though I believe it was already around 35-40k) but I have not noticed a performance decrease.  As a side note\related to the above, I do not use FAR.

All in all, very satisfied that this does what it does! <3 

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...