Resource icon

Plugins Pubes Clipping Reducer

vamtaco

Active member
Messages
6
Reactions
246
Points
28
Website
www.patreon.com
vamtaco submitted a new resource:

Pubes Clipping Reducer - Prevent pubes poking through clothing.

Evaluates tags on hair and clothing to show and hide pubic hair when clothing is on/off.

Hair
When the plugin is loaded/reloaded, any hair with tag Genital is cached. When you activate/deactivate clothing managed by the plugin, any cached hair is either hidden (clothing on) or shown (clothing off).
View attachment 2074

Clothing
You must add custom tag HidePubes to any clothing that you want to be managed by the plugin.
[ATTACH...

Read more about this resource...
 
Hello,

Either I'm doing something wrong or this plugin doesn't work anymore with VaM 1.20.1.4 beta.

Settings:

pcr-screen2.jpg
pcr-screen3.jpg


Result:

pcr-screen1.jpg


and yes, I've hit the plugin reload button.

Any help appreciated.
 
It looks like the newest version of VAM forces tags to only be lowercase, so "HidePubes" becomes "hidepubes". Unfortunately the plugin doesn't seem to work right now because of this.
 
Last edited:
Need to update to support user defined tags, like a text field. Actually, i'll make one that does clothes layers and pubes... the tags are case sensitive, so having that might be helpful
 
I got it working, caSE INSenSiTIve ( .toLower() ) and found another glitch as well, where multiple items of the same name break the listq object single call as well added a few text fields you can specify your own clipping tags, so maybe if you wanted to do some layered clipping or something. Somethign similar for tight pants and underwear would be cool using the same idea too... th oughts?
 
I got it working, caSE INSenSiTIve ( .toLower() ) and found another glitch as well, where multiple items of the same name break the listq object single call as well added a few text fields you can specify your own clipping tags, so maybe if you wanted to do some layered clipping or something. Somethign similar for tight pants and underwear would be cool using the same idea too... th oughts?

I saw that the creator used to have a similar bug with their nipple clipping reducer plugin and eventually patched it. Perhaps you can find a work around in that plugin's code. Like you, I've patched this plugin for my own use. One of us should eventually release a new version for other people to use, but it sounds like you've probably put more work into yours than I ever did.
 
With the breadcrumbs from the above conversations I was able to fix this and get it working for me. I hope this is appropriate to paste here for everyone to copy/paste into their non working cs file replacing all below these lines:

```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````

using System.Collections.Generic;
using System.Linq;

namespace vamtaco
{
public class PubesClippingReducer : MVRScript
{
private DAZCharacterSelector _character;
private List<PubesNoClipClothingItem> _noClipClothingItems;
private List<string> _hiddenHairUids;

public override void Init()
{
if (containingAtom.type != "Person")
{
SuperController.LogMessage("Pubes Clipping Reducer (Disabled): This plugin is designed to be used on a person atom.");
enabled = false;
return;
}

_noClipClothingItems = new List<PubesNoClipClothingItem>();
_hiddenHairUids = new List<string>();

var geometry = containingAtom.GetStorableByID("geometry");
_character = geometry as DAZCharacterSelector;

//load supported clothing
foreach (var clothing in _character.clothingItems.Where(c => c.tagsArray.Contains("hidepubes")))
{
LoadNoClipClothingItem(clothing.displayName);
}
}

void Start()
{
//if any clothing is active, hide pubes
if (_noClipClothingItems.Any(o => o.ClothingItem.isActiveAndEnabled))
{
hidepubes();
}
}

void Update()
{
foreach (var c in _noClipClothingItems)
{
c.EvaluateStateChange();
}
}

public void OnClothingItemStateChanged(DAZClothingItem clothingItem)
{
//item is now active so hide pubes
if (clothingItem.isActiveAndEnabled)
{
var clothSimControlChildren = clothingItem.GetComponentsInChildren<ClothSimControl>();
bool anyUndressed = clothSimControlChildren.Any(o => o.clothSettings.BreakEnabled);

if (anyUndressed)
{
ShowPubes();
return;
}

hidepubes();
return;
}

ShowPubes();
}

private void hidepubes()
{
_hiddenHairUids = _character.hairItems.Where(h => h.active == true && h.tags.Contains("genital")).Select(h => h.uid).ToList();
_hiddenHairUids.ForEach(hid => _character.SetActiveHairItem(hid, false));
}

private void ShowPubes()
{
_hiddenHairUids.ForEach(hid => _character.SetActiveHairItem(hid, true));
_hiddenHairUids.Clear();
}

private void LoadNoClipClothingItem(string name)
{
var clothing = _character.clothingItems.SingleOrDefault(c => c.displayName == name);
if (clothing != null)
{
var ncci = new PubesNoClipClothingItem(clothing);
ncci.OnStateChanged += new PubesNoClipClothingItem.OnStateChangedEvent(OnClothingItemStateChanged);
_noClipClothingItems.Add(ncci);
}
}
}

public class PubesNoClipClothingItem
{
public string Name { get { return ClothingItem.displayName; } }

public DAZClothingItem ClothingItem { get; }

public delegate void OnStateChangedEvent(DAZClothingItem clothingItem);
public OnStateChangedEvent OnStateChanged;

private bool _previousState;
private bool _previousUndressState;
private ClothSimControl[] _clothSimControls;

public PubesNoClipClothingItem(DAZClothingItem clothingItem)
{
ClothingItem = clothingItem;
_previousState = clothingItem.isActiveAndEnabled;
_clothSimControls = clothingItem.GetComponentsInChildren<ClothSimControl>();
_previousUndressState = _clothSimControls.Any(o => o.clothSettings.BreakEnabled);
}

public void EvaluateStateChange()
{
if (ClothingItem == null)
return;

//clothing item state has changed
bool anyUndressed = _clothSimControls.Any(o => o.clothSettings.BreakEnabled);

if (ClothingItem.isActiveAndEnabled != _previousState
|| anyUndressed != _previousUndressState)
{
_previousState = ClothingItem.isActiveAndEnabled;
_previousUndressState = anyUndressed;
OnStateChanged?.Invoke(ClothingItem);
}
}
}
}
 
When I try the edit, i get issues. I couldn't find any typos, however Notepad++ claimed there was a bracket error
 
Anyone ever get this working? It appears that renaming "HidePubes" to "hidepubes" causes a <filenameunknown> error message within VaM now. (This workaround did work in earlier versions of VaM.)
 
It's very odd, it was working for me for about a week then just stopped and I cant get it to work again. Maybe @aawalker or another coding guru could chime in and help with the heavy lifting here.
 
I was able to get it working with code basically identical to cmramlow, except I didn't rename the HidePubes function, just the tag. I doubt that would cause any problems, though. All you really need is to replace the "HidePubes" on line 29 with "hidepubes", and the "Genital" on line 75 with "genital". There's no need to rename the HidePubes function, but that shouldn't be causing any trouble, either.

I did run into weird errors trying to editing vamtaco's original, and had to start a new plugin from scratch for some weird reason, with my own namespace. Try that?
 
Back
Top Bottom