Clothing Plugins

Guides Clothing Plugins

What is a "Clothing Plugin"?
It turns out that you can trick VAM into loading plugins when an item of clothing is loaded. These plugins don't go into the default Atom plugin UIs and are generally their own separate thing.

What can I do with a Clothing Plugin?
A clothing plugin can do anything a regular plugin can do. What's nice about clothing plugins is that a user doesn't need to load them manually. They're added automatically when an item of clothing is put on for the first time.

It's really just a way for content creators to package up their clothes with some additional logic. Some example uses are:
  • Automatically applying HeelAdjust(2) to shoes.
  • Putting on other clothes
  • Hiding or adding decals to parts of the main body
  • Adding and positioning Lights or CUAs
  • Animating clothing materials

Is it safe?
Probably. Since we're using VAM's plugin manager, the loaded plugins will have the same sandboxing to prevent access to the outside system. Similarly, there will be a confirmation dialog for any new plugin loaded this way.

I've run it by the devs and they gave the green light. Still, hard to make any guarantees with this sort of thing.

Hair Plugins
A similar thing can be done with Hair through a slightly different process.


Setting Up Clothing Plugins

Video walkthrough for adding a clothing plugin to an existing piece, and publishing.



1. Add an MVRPluginManager to the list of components

Locate the .vaj file for your clothing. 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 for this entry must be the base id of the clothing. In the example, I'm modifying mopedlampe:test-glasses, and all of the other components are named like mopedlampe:test-glassesXXX. In this case I will use "id" : "mopedlampe:test-glasses".

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" : "mopedlampe:test-glasses",
"plugins" : {
"plugin#0" : "Stopper.ClothingPluginManager.7:/Custom/Scripts/Stopper/ClothingPluginManager/ClothingPluginManager.cs"
}

},
{
"id" : "mopedlampe:test-glassesWrapControl",
"wrapToSmoothedVerts" : "false",
"surfaceOffset" : "-0.1204",
"additionalThicknessMultiplier" : "0.0001",
"smoothIterations" : "0"
},
{
"id" : "mopedlampe:test-glassesSim",
"simEnabled" : "false",
"integrateEnabled" : "true",
"collisionEnabled" : "true",
"allowDetach" : "false",
...

3. Add Plugins / Save Defaults

You should now 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 clothing.

4. Releasing Clothing


When packaging up the clothing, VAM will want to replace the ID of the storable with something like "SELF:/Custom/Clothing/Female/mopedlampe/test-glasses/test-glasses.vam", which will not work.

To get around this
  1. Click "Prep Package"
  2. Click "Open Prepped Folder In Windows Explorer"
  3. Find the .vaj file and modify it with the correct value
  4. Finalize Package

Making Clothing Plugins

A clothing plugin isn't fundamentally different from a regular plugin. In fact, many regular plugins will work fine when loaded as clothing plugins.

Still, a few things to keep in mind...

Multiple Copies
A clothing plugin is more likely to be added multiple times to the same atom (under different pieces of clothing). Make sure that this doesn't cause issues.

Storables and Store Ids
The PluginManager will register clothing plugins with the atom as a storable. This means that storable plugin parameters will generally work fine when saving/loading from scenes. Neat!

I recommend setting the storeId of the plugin (via the overrideId) to make it easier to find and less likely to collide with other instances of the plugin.
C#:
this.overrideId = $"{dazSkinWrap.name}:{this.storeId}";

Defaults For Clothing Items
A clothing creator will likely need to modify plugin settings to match the particular item. The best way I've thought to do this by allowing them to package up a default preset along with the clothing files.

Here is a simple pattern that I've used. Note, you'll need to find the clothing item's DAZDynamic component. It should be one hop up in the gameObject hierarchy above where the plugin exists.

C#:
string defaultFile = $"{dazDynamic.GetStoreFolderPath(true)}default.{fileExt}";
if(FileManagerSecure.FileExists(defaultFile)){
    LoadPreset(defaultFile);
}

Demo
A fully packaged var available here:
Author
Stopper
Views
20,786
First release
Last update
Rating
4.89 star(s) 9 ratings

More resources from Stopper

Latest reviews

y
Upvote 0
Ive had the pleasure of using this twice so far, along-side the sim proxy plugin, and i cant say enough how great this is to have in vam. THANK YOU! <3
Upvote 0
why can't I find the required morph in morph uid?
S
Stopper
Could be any number of things... If you add some more details in the discussion I can help you debug.
Upvote 0
This was super helpful for something I'm working on, where I'm using a leg prosthesis clothing item and want it to cause a plugin to load that will then adjust the skin transparency accordingly. I'm still trying to tie everything together in a nice resource I can release, but so far this seems to be working great.
Upvote 0
it looks good but i cant make it work i do the same thing you do at the video and i cant make the plugin option show up
S
Stopper
Hard to say what's wrong offhand. Feel free to paste the .vaj file in the discussion and I can check it.
Upvote 1
Amazing innovative work ? Thank you so much!
Upvote 0
Excellent guide!
Upvote 0
I love this plugin it makes dressing my models exciting
Upvote 0
I don't nderstand this, maybe because I'm drunk. But it seems to be awesome like everything you do!
S
Stopper
Imagine your HeelAdjust2 plugin wasn't something you added to an Atom. Instead, a pair of shoes were packaged up in such a way that it automatically applied to them when you put them on a model. No session/scene plugins needed.

That's what this allows. If that sounds cool, ping me on Discord and let's make it happen.
Upvote 0
Back
Top Bottom