[1.0] Don't Shave Your Head! - v1.0.0

Started by Dark_Inquisitor, November 03, 2017, 10:39:20 AM

Previous topic - Next topic

Dark_Inquisitor


Authors: NoImageAvailable, Dark_Inquisitor

Description:
This mod allows hair to show under headwear.
Headwear that doesn't cover the upper head (e.g. sunshades, goggles, etc.) displays the whole hair texture.
Headwear that covers hair in some way will have the texture replaced with custom textures that fit exactly under the headwear, thus allowing to display hair at all times without any clipping. Works with all headwear, both vanilla and modded.

Supported hairstyles (mods):
- vanilla (default)
- Rimsenal Hair Pack*
- NackbladInc Rimhair 2.2*
- Spoon's Hair Mod*
- RimNGE*
- Xeva's Hairstyles*

*Remember that you have to download them separately.

Your favourite hairstyle not supported yet? Consider using Show Hair with Hats!

To-do list:
1) Roppoi Hair compatibility (this will take a looong time...)


Remember to back-up your save file before adding any mods!

Pictures
You don't have to shave your hair to put on sunglasses! (apparel from Shinzy's Apparello)


What's the difference, though? (apparel from Shinzy's Apparello)






Special thanks:
To NoImageAvailable - without him and his coding skills, this mod would never exist;
To rooki1, spoonshortage, nackblad, sumghai and Xeva - for letting us use art from their mods.


How to install:
- Unzip the contents and place them in your RimWorld/Mods folder.
- Activate the mod in the mod menu in the game.

Technical mumbo-jumbo for modders:
How does it work?
The mod places texture sets called "FullHead" and "UpperHead" within a folder structure equal to the hair's texPath, e.g. the textures for the vanilla Afro would be placed in `Things/Pawn/Humanlike/Hairs/Afro/`. The mod automatically detects properly placed and named textures, and will switch to the FullHead/UpperHead texture if the respective BodyPartGroup is covered. If a texture can't be found it will default to Shaved hair, meaning vanilla style hiding of hair.

To make a hair mod compatible:

  • Make a folder next to your png files and name it the same as the hairstyle, like ABC_front.png means the folder should be named ABC
  • Inside that folder you add Bodypart + _front, _back, _side, like FullHead_front.png
  • Valid bodyparts are FullHead, UpperHead and Jaw, making a total of 9 if all are used
  • If an image is missing, the shaved head will be used

Licensing:
- You can use this mod in your modpack. Why are you waiting? Go and add it!
- Wait, you want to use the files? Ask me first!
- Want to ONLY update mod to the newest version? You are allowed to do so, but put it ONLY on this thread.

Nightinggale

ModCheck - boost your patch loading times and include patchmods in your main mod.

NoImageAvailable

Quote from: Nightinggale on November 03, 2017, 10:43:48 AM
How is this different from Show Hair with Hats?

That one simply displays hair with hat graphics, resulting in tons of clipping. This mod switches between regular hair and custom textures that are designed to fit perfectly under hats, meaning it actually looks like what you would see in reality when someone with long hair, a mohawk, etc. puts on a hat.
"The power of friendship destroyed the jellyfish."

Dark_Inquisitor

Quote from: NoImageAvailable on November 03, 2017, 11:00:09 AM
Quote from: Nightinggale on November 03, 2017, 10:43:48 AM
How is this different from Show Hair with Hats?

That one simply displays hair with hat graphics, resulting in tons of clipping. This mod switches between regular hair and custom textures that are designed to fit perfectly under hats, meaning it actually looks like what you would see in reality when someone with long hair, a mohawk, etc. puts on a hat.

Exactly, just like in the pictures shown in the post...

indy2018

#4
I have some issue with your mod.

Screenshots included
My save with your mod activated (Top)
And how it looks with the  [A18] Show Hair with Hats (AlienRaces now supported) mod that was already mentioned in this thread. (Second screenshot).



[attachment deleted by admin: too old]

Dark_Inquisitor

Quote from: indy2018 on November 03, 2017, 12:23:47 PM
I have some issue with your mod.

Screenshots included
My save with your mod activated (Top)
And how it looks with the  [A18] Show Hair with Hats (AlienRaces now supported) mod that was already mentioned in this thread. (Second screenshot).
I guess I will stick with Show Hair with Hats mod for now.

Something here is deffinetly wrong, since those are not textures that should be displayed when no hat is worn.
Tell me, does the pawns look like this in game, or just the top bar is like this?

indy2018

#6
I think I know what my issue was. These screenshots were made with in game option "hats shown only on game map" turned on (they had their invisible hats on so the hairs looked "funny".

Dark_Inquisitor

Quote from: indy2018 on November 03, 2017, 01:37:52 PM
I think I know what my issue was. These screenshots were made with in game option "hats shown only on game map" turned on (they had their hats on but they weren't "rendered" so the hairs looked "funny".

Good to hear everything was solved :)
Also it's a thing that slipped by, we'll see what can be done about this.

Nightinggale

I like the new comparison images. It really makes clear what the difference is between each version. Also I do like this mod quite a bit now that I'm complete aware of how it stands out.

I have studied the C# code and I must say it's brilliant. I'm keeping it for future reference because it's Harmony Transpillar done right, meaning the dll should be compatible with all other mods unless they mod the very same instructions. Secondly the concept of controlling the drawing code based on presence of png files rather than xml is great. It really is a showcase example of mod coding done right.

I do wonder about the added hair pngs. If it doesn't matter which mod they are in, then why copy hair from other mods with concent rather than just adding the files to the mods, which provides the hairstyles in the first place? This mod would be easier to maintain if it becomes common knowledge that adding a hairstyle should add extra files to support DSYH. In fact people can add hairstyles, add support and you wouldn't even need to be involved.

Another thing I wondered about is has this been tested with alien race framework? AFAIK that mod is using Transpillar on the very same method.

Last, but not least: the guide on how to add support is quite short and lacks details. Looks like the real approach is something like this:

  • Make a folder next to your png files and name it the same as the hairstyle, like ABC_front.png means the folder should be named ABC
  • Inside that folder you add Bodypart + _front, _back, _side, like FullHead_front.png
  • Valid bodyparts are FullHead, UpperHead and Jaw, making a total of 9 if all are used
  • If an image is missing, the shaved head will be used
Maybe not a perfect guide, but it provides a lot more information on the approach.
ModCheck - boost your patch loading times and include patchmods in your main mod.

Kiame

#9
If you want to say in your picture comparing the different approaches "Show Hair w/ Hats" I give you permission to - just so it's clearer what's being compared.  :)

I am going to try out this mod. Initially (before trying it) I almost want to be able to toggle which hats will show un-clipped hair or which hats hide hair.

And quick nitpick...
"What's the difference, tough? (apparel from Shinzy's Apparello)"
should probably be "though"

Dark_Inquisitor

Quote from: Kiame on November 03, 2017, 03:58:15 PM
If you want to say in your picture comparing the different approaches "Show Hair w/ Hats" I give you permission to - just so it's clearer what's being compared.  :)

I am going to try out this mod. Initially (before trying it) I almost want to be able to toggle which hats will show un-clipped hair or which hats hide hair.

And quick nitpick...
"What's the difference, tough? (apparel from Shinzy's Apparello)"
should probably be "though"

Thanks for your kind words :)
As for comparison - I think there are few mods with similar problem (facial stuff, i think? I don't really remember...) Besides, i don't really want to point at anyone. It just don't seem right.
Also yeah, description corrected ;)


Quote from: Nightinggale on November 03, 2017, 03:42:36 PM
I have studied the C# code and I must say it's brilliant. I'm keeping it for future reference because it's Harmony Transpillar done right, meaning the dll should be compatible with all other mods unless they mod the very same instructions. Secondly the concept of controlling the drawing code based on presence of png files rather than xml is great. It really is a showcase example of mod coding done right.

To clear things up - whole code was written by NoImageAvailable. As goes for me, I literally suck when it comes to writing actual code.
All kudos to him! :)


Quote from: Nightinggale on November 03, 2017, 03:42:36 PM
Another thing I wondered about is has this been tested with alien race framework? AFAIK that mod is using Transpillar on the very same method.

Technically speaking it should work.


Quote from: Nightinggale on November 03, 2017, 03:42:36 PM
Last, but not least: the guide on how to add support is quite short and lacks details. Looks like the real approach is something like this:

  • Make a folder next to your png files and name it the same as the hairstyle, like ABC_front.png means the folder should be named ABC
  • Inside that folder you add Bodypart + _front, _back, _side, like FullHead_front.png
  • Valid bodyparts are FullHead, UpperHead and Jaw, making a total of 9 if all are used
  • If an image is missing, the shaved head will be used
Maybe not a perfect guide, but it provides a lot more information on the approach.

You wrote this? I wrote this.
(indeed it is much better description of what to do, i hope you won't mind if i incorporate it)

Diana Winters

#11
I'm having a small problem with an item from fashion rimsta



It's relevant tags are:

<apparel>
<bodyPartGroups>
<li>UpperHead</li>
<li>Teeth</li>
</bodyPartGroups>
<wornGraphicPath>Things/Pawn/Humanlike/Apparel/Hats/FSSurgicalMask</wornGraphicPath>
<layers>
<li>Overhead</li>
</layers>
<tags>
<li>Outlander</li>
<li>Workforce</li>
</tags>
<defaultOutfitTags>
<li>Worker</li>
</defaultOutfitTags>
</apparel>


so I am not sure why the textures are not working properly (as I am sure that they have vanilla hairs)

Testing with the cowboy hat indicates that it is a problem specific to this headgear.

Nightinggale

Quote from: Dark_Inquisitor on November 03, 2017, 06:20:50 PM(indeed it is much better description of what to do, i hope you won't mind if i incorporate it)
Sure. I wrote this for people to read. I'm thinking the easier it is to add support, the more likely it is that people will add support in their own mods. It doesn't help that the mod itself makes it easy if people don't know what to do.

Quote from: Nightinggale on November 03, 2017, 03:42:36 PM

  • If an image is missing, the shaved head will be used
I minor correction to make it completely accurate.

  • A bodypart set contains _front, _back and _side. Either add all or none as incomplete sets will result in serious problems!
  • Bodyparts with no set will use shaved head graphics
The first version doesn't make it clear that just adding _front will make the code assume _back and _side to be present and read those without checking if they exist first. I don't know what will happen, but with a bit of luck, it will just be errors in the log. Worst case is crashing the game. Either way the code can't get to shaved head once it figures _front is present for the bodytype in question, which in itself is an issue.
ModCheck - boost your patch loading times and include patchmods in your main mod.

NoImageAvailable

Quote from: Diana Winters on November 03, 2017, 09:03:18 PM
I'm having a small problem with an item from fashion rimsta

And what exactly is the problem?
"The power of friendship destroyed the jellyfish."

Diana Winters

Quote from: NoImageAvailable on November 04, 2017, 05:17:32 AM
Quote from: Diana Winters on November 03, 2017, 09:03:18 PM
I'm having a small problem with an item from fashion rimsta

And what exactly is the problem?

Ooops, posted the wrong liknk for the image

As you can see, these hairs are clippng through the hat instead of using the alternate textures.
Edit: I think the hairs are Afro and Scorpiontail