Hair Plugins

Guides Hair Plugins

What is a "Hair Plugin"?
It turns out that you can trick VAM into loading plugins when a hair is put on. These plugins don't go into the default Atom plugin UIs and are generally their own separate thing.

Hair Plugins are very similar to Clothing Plugins and I recommend going through that guide as well if you haven't worked with them before


1. Add an MVRPluginManager to the list of components

Locate the .vaj file for your hair. It will contain a json file with "components" and "storables". Under components, add an item of type MVRPluginManager

"components" : [
{
"type" : "DAZMesh"
},
{
"type" : "DAZSkinWrap"
},
{
"type" : "DAZSkinWrapMaterialOptions"
},
{
"type" : "MVRPluginManager"
},
]

2. Add the ClothingPluginManager

Next, add an entry to 'storables' with your plugin list. The ID must be "CustomScalp" (even if you use a different scalp).

If the hair does not use a custom scalp, you will get an error when putting it on (it'll still work). See "Known Issues" below.

The only required item under the plugins list is the latest version of the ClothingPluginManager. This will quiet VAM's various complaints about being forced to load plugins this way.

"storables" : [
{
"id" : "CustomScalp",
"plugins" : {
"plugin#0" : "Stopper.ClothingPluginManager.7:/Custom/Scripts/Stopper/ClothingPluginManager/ClothingPluginManager.cs",
}
},

{
"id" : "Stopper:TestHairSim",
"styleModeAllowControlOtherNodes" : "false",
"styleModeShowCurls" : "false",
"styleModeShowTool1" : "true",
"styleModeShowTool2" : "true",
"styleModeShowTool3" : "false",
"styleModeShowTool4" : "false",
"simulationEnabled" : "true",
"collisionEnabled" : "true",
"usePaintedRigidity" : "true",
"curlAllowReverse" : "false",
...

3. Add Plugins / Save Defaults

Open the hair UI. You should see a Plugins tab under the customization UI. Use this to add and configure additional plugins.

The ClothingPluginManager UI also has buttons to save and load presets. By default it will save a default.clothingplugins file, which will be loaded with the hair.

4. Releasing Hair


Unlike with Clothing, nothing special needs to be done here. Package up the var file as normal.

5. Known Issues

PreRestore error on default scalps

If the hair does not use a custom scalp, you will get the following error when putting the hair on for the first time:
!> Exception during PreRestore of CustomScalp: System.ArgumentNullException: Argument cannot be null.Parameter name: collection at System.Collections.Generic.List`1[MVRPlugin].CheckCollection (IEnumerable`1 collection) [0x00000] in <filename unknown>:0 at System.Collections.Generic.List`1[MVRPlugin]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0 at MVRPluginManager.RemoveAllPlugins () [0x00000] in <filename unknown>:0 at MVRPluginManager.PreRestore (Boolean restorePhysical, Boolean restoreAppearance) [0x00000] in <filename unknown>:0 at MeshVR.PresetManager.PreRestoreStorable (.JSONStorable js) [0x00000] in <filename unknown>:0
Everything should still work, but is annoying. The only workaround for now is to use a custom scalp.

Unfortunately I can't find a way to fix this without changing VAM or maybe adding a session plugin. For those curious, it's because the CustomScalp is the binaryStorableBucket for hair and where all vaj file components (including the MVRPluginManager we're adding) go by default. If you're using a built-in scalp, the CustomScalp object is not active when the MVRPluginManager gets initialized, and as such doesn't wake up and run its Init(). This causes the initial plugin list to be null, hence the exception on PreRestore.
Author
Stopper
Views
1,293
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Stopper

Credits

Creator Support Link
S Stopper
Back
Top Bottom