normales shift n flip normalHello,I meet a question when I try to import my own clothes. I want to import a skirt into the game, but I found that only the buttons on the skirt were displayed, and the materials were all displayed on the buttons. up to now I can't figure out what's wrong with this.
View attachment 5473448 View attachment 5473457
View attachment 5473458
You're correct, but it needs to be set up so that multiple parts can be hidden (assuming I didn't just miss something in my fiddling around). Under the hood, it's a series of binary flags, each corresponding to a body part, and each can be toggled independently:hiddenPartsType (string or int, default 0)
I believe setting this prevents NPCs from seeing the part - TBD.
Enum: HiddenBodyPartsByCostumeType
Example to hide boobs?: "effectType": "Boobs"
public enum HiddenBodyPartsByCostumeType
{
Boobs = 1,
Hip = 2,
Genitals = 4,
SideOrBackUpperBody = 8,
HipCrouch = 0x10
}
| String | Decimal | Binary |
|---|---|---|
| Boobs | 1 | 00001 |
| Genitals | 4 | 00100 |
| SideOrBackUpperBody | 8 | 01000 |
| Boobs + Genitals | 5 | 00101 |
| Boobs + Genitals + SideOrBackUpperBody | 13 | 01101 |
using System.Text.Json;
using System.Collections.Generic;
using UnityEngine;
using BepInEx.Logging;
using HarmonyLib;
using ExposureUnnoticed2.Master.Cosplay;
using ExposureUnnoticed2.Object3D.Player.Scripts;
namespace SFM_CosplayPatch;
public class CosplayPatcher : MonoBehaviour
{
internal static ManualLogSource Log;
private enum binaryMode
{
Subtract = 0,
Add = 1
}
private Dictionary<string, Dictionary<string, dynamic>> PatchDict;
private List<int> PatchedParts = new();
public CosplayPatcher(Dictionary<string, Dictionary<string, dynamic>> inputPatchDict, ManualLogSource logger)
{
PatchDict = inputPatchDict;
Log = logger;
}
public void ReRunPatch()
{
int[] tempPartArray = PatchedParts.ToArray();
PatchedParts.Clear();
foreach (int part in tempPartArray)
{
PatchCosplayPartById(part);
}
}
public void PatchCosplayPartById(int uniqueId)
{
var cosplayPart = ExposureUnnoticed2.Master.Cosplay.MCosplay.GetParts(uniqueId);
if (!PatchedParts.Contains(uniqueId))
{
PatchCosplayPart(cosplayPart);
PatchedParts.Add(uniqueId);
}
}
public void PatchCosplayPart(RCosplayParts cosplayPart)
{
Traverse trav = Traverse.Create(cosplayPart);
PlayerStateModel.HiddenBodyPartsByCostumeType hiddenParts = trav.Property("HiddenPartsType").GetValue<PlayerStateModel.HiddenBodyPartsByCostumeType>();
if (PatchDict.ContainsKey(cosplayPart.NameKey))
{
Dictionary<string, dynamic> patch = PatchDict[cosplayPart.NameKey];
if (patch != null)
{
foreach (KeyValuePair<string, dynamic> prop in patch)
{
if (prop.Key == "HiddenPartsType") SetPropertyHiddenPartsType(trav, prop);
else SetPropertyOther(trav, prop);
}
}
}
}
private PlayerStateModel.HiddenBodyPartsByCostumeType HiddenPartsBinaryOp(
PlayerStateModel.HiddenBodyPartsByCostumeType oldFlags, PlayerStateModel.HiddenBodyPartsByCostumeType newFlag, binaryMode mode)
{
if (mode == binaryMode.Add) return (oldFlags | newFlag);
else return (oldFlags ^ newFlag);
}
private void SetPropertyOther(Traverse trav, KeyValuePair<string, dynamic> prop)
{
var target = trav.Property(prop.Key);
if (target == null)
var targetVal = target.GetValue();
if (targetVal is int)
{
int value = JsonSerializer.Deserialize<int>(prop.Value);
trav.Property(prop.Key).SetValue(value);
}
else if (targetVal is float)
{
float value = JsonSerializer.Deserialize<float>(prop.Value);
trav.Property(prop.Key).SetValue(value);
}
else if (targetVal is double)
{
double value = JsonSerializer.Deserialize<double>(prop.Value);
trav.Property(prop.Key).SetValue(value);
}
else if (targetVal is bool)
{
bool value = JsonSerializer.Deserialize<bool>(prop.Value);
trav.Property(prop.Key).SetValue(value);
}
}
private void SetPropertyHiddenPartsType(Traverse trav, KeyValuePair<string, dynamic> prop)
{
PlayerStateModel.HiddenBodyPartsByCostumeType newFlags = trav.Property(prop.Key).GetValue<PlayerStateModel.HiddenBodyPartsByCostumeType>();
string[] flags = JsonSerializer.Deserialize<string[]>(prop.Value);
foreach (string f in flags)
{
string flag;
binaryMode mode = binaryMode.Add;
if (f.StartsWith('-'))
{
mode = binaryMode.Subtract;
flag = f.Trim('-');
}
else flag = f;
switch (flag)
{
case "Boobs":
newFlags = HiddenPartsBinaryOp(newFlags, PlayerStateModel.HiddenBodyPartsByCostumeType.Boobs, mode);
break;
case "Hip":
newFlags = HiddenPartsBinaryOp(newFlags, PlayerStateModel.HiddenBodyPartsByCostumeType.Hip, mode);
break;
case "Genitals":
newFlags = HiddenPartsBinaryOp(newFlags, PlayerStateModel.HiddenBodyPartsByCostumeType.Genitals, mode);
break;
case "SideOrBackUpper":
newFlags = HiddenPartsBinaryOp(newFlags, PlayerStateModel.HiddenBodyPartsByCostumeType.SideOrBackUpperBody, mode);
break;
case "HipCrouch":
newFlags = HiddenPartsBinaryOp(newFlags, PlayerStateModel.HiddenBodyPartsByCostumeType.HipCrouch, mode);
break;
default:
Log.LogWarning($"JSON error in patching {trav.Property("NameKey").GetValue<string>()}: {flag} is not a valid HiddenPartsType");
break;
}
}
trav.Property(prop.Key).SetValue(newFlags);
}
}
Welp, I just come back online after a long while... sorry if I didn't reply you in your past few messages, but seem like you know how to change clothes texture PNG, change the material name, move clothes to other category etc., and resolved the issues, so good job to you bro.I want as many people as possible to experience the author's great efforts and great kindness.
All I can do is introduce.
I would like to express my heartfelt respect to everyone who is working to evolve MANAKA.
View attachment 5476100
Yes, all added clothes are arranged in alphabetical order after the default base game clothes and I want to elaborate a bit more based on what I observed.Alphabetical order takes priority.
| ID Number (The game recognize what you brough based on this value) | Alphabetical Order (The game arrange all clothes in this order) | Initially: |
| 1 | Cloth A | Brought |
| 2 | Cloth C | Brought and equipped |
| ID Number | Alphabetical Order | What happened after you inserted Cloth B in the middle: |
| 1 | Cloth A | Brought |
| 2 | Cloth B | Automatically brought and equipped |
| 3 | Cloth C | Automatically "not brought" and unequipped |
I am new to Blender so I might not know much, but is it possible that the problem is because there is multiple material assigned to the skirt? From what I have done, I think the current mod can only assign 1 material into each clothes in game, so maybe deleting the material for the buttons in the Blender might solve your problem.Hello,I meet a question when I try to import my own clothes. I want to import a skirt into the game, but I found that only the buttons on the skirt were displayed, and the materials were all displayed on the buttons. up to now I can't figure out what's wrong with this.
View attachment 5473448 View attachment 5473457
View attachment 5473458
I think the mod and all clothes loaded successfully? Do you mind checking the shop? Every time you load new modded clothes, you will need to buy some modded clothes from the shop. Hope this comment help.How do I change the modded outfit in the game? I downloaded the mod but there's no change in my game View attachment 5473584