Question Dynamically trigger hair preset on 'yet to be' allocated hair asset? Pre-Cache?

Metix

New member
Messages
22
Reactions
11
Points
3
So I've set up a scene with a lot of swapping of things like clothing and hair assets on a set person/look. I've also created a number of individual presets for some of the hair assets, in particular (color, look, physics), that when I set up a trigger to 'LoadPresetWithPath' end up failing.

The hair assets that fail like this are ones that have yet to be 'loaded' into the scene. So they when the trigger fires to activate the hair, it pulls from the store. I then setup a LoadingDelay trigger to apply the preset to the hair I just activated on the person. The problem is that when I freshly load the scene, the LoadingDelay triggers that apply the preset completely blank out the 'Receiver' field. The 'Receiver' field being the newly activated hair asset.

This makes sense, because the reference to the instanced asset does not exist on the person at scene load. I'm assuming that onLoad the triggers go through all of the references inside them to make sure they're valid, and apparently blank out the ones that aren't.

Is there a way around this? Can I pre-cache the hair somehow? Or is there some way to force a preset to load, in this scene, when X hair asset is loaded?

I was able to work around this problem with clothing by using the clothing triggers plugin, such that whenever X clothing item is loaded if fires any number of triggers, in my case loading preset on itself. Does anything like this exist for hair styles?

Thanks
 
Last edited:
Solution
You could use VAMStory, and more specifically VAMStoryDirector, which ensure everything is loaded prior to triggering something. You can also apply a delay for the trigger if needed.

Btw, delay are kind of "not ideal" even tho they help, since you are gonna match the delay to YOUR gear. Anybody could have longer or faster loading times.

And if this is isn't enough. You could load a hair preset that has all hairs included on the char, save for the initial scene load. And instead of applying a preset, ou simply disable the unwanted one for the scene start, and swap out when needed afterwards.

So I actually managed to find a solution to this myself, after learning of the limitations of presets from the VaM discord help channel...
So I've set up a scene with a lot of swapping of things like clothing and hair assets on a set person/look. I've also created a number of individual presets for some of the hair assets, in particular (color, look, physics), that when I set up a trigger to 'LoadPresetWithPath' end up failing.

[...]

You could use VAMStory, and more specifically VAMStoryDirector, which ensure everything is loaded prior to triggering something. You can also apply a delay for the trigger if needed.

Btw, delay are kind of "not ideal" even tho they help, since you are gonna match the delay to YOUR gear. Anybody could have longer or faster loading times.

And if this is isn't enough. You could load a hair preset that has all hairs included on the char, save for the initial scene load. And instead of applying a preset, ou simply disable the unwanted one for the scene start, and swap out when needed afterwards.
 
Upvote 0
You could use VAMStory, and more specifically VAMStoryDirector, which ensure everything is loaded prior to triggering something. You can also apply a delay for the trigger if needed.

Btw, delay are kind of "not ideal" even tho they help, since you are gonna match the delay to YOUR gear. Anybody could have longer or faster loading times.

And if this is isn't enough. You could load a hair preset that has all hairs included on the char, save for the initial scene load. And instead of applying a preset, ou simply disable the unwanted one for the scene start, and swap out when needed afterwards.

So I actually managed to find a solution to this myself, after learning of the limitations of presets from the VaM discord help channel. Good to know about VAMStory, I'm slowly picking my way through learning all the VaM systems and plugins I can. Initially I jumped into everything at once and quickly found myself totally overwhelmed, so trying to be more deliberate now.

I'll write my findings here in case it helps someone in the future:

tldr; If it's simple, just use Person Atom level presets. If you want to go deeper, it's possible to sort of 'pre-cache' assets and their presets, and prevent triggers from blanking references to them out, or you can sort of bake a preset into assets. read on for more info:

The primary problem I was having is that if you set up a trigger to reference an active asset, like a piece of clothing or a hairstyle on a person, when you freshly load that scene, in your triggers all of those references will be blanked out! And as a result the trigger will stop working. This makes sense, because the triggers want to make sure that all of their references are valid, so instead of potentially erroring out in unknown ways, it just blanks the Receiver field out.

So I have a bunch of clothing and hair assets that I want to swap onto a person atom using triggers. The trick is that I also want to load a specific preset for some of these assets. I'm not talking about the group presets (the ones that get their own large atom button), but the individual preset, like changing the lighting color on a hairstyle.

So these assets are not yet loaded into the scene. For organizational, and performance reasons, I am adding them to the person atom with the geometry Receiver. Now I want to load an asset level preset to newly toggled item. Sorry, the trigger has been blanked out!

In experimenting, I discovered that whatever process is validating the trigger fields only initializes on scene load, based on whether or not those references are valid at that moment. So there are essentially two ways around this problem: One, Pre-Cache the assets and prevent the triggers from blanking fields; Two, bake the asset preset into the instanced scene.

Pre-caching - If you have all of the assets you are going to use in your scene in the scene at onSceneLoad, then even if you remove them, any references to them in triggers will not get blanked.

These assets don't even need to be on the person atom that you want to use them on. So you could theoretically have a second person atom wearing all the clothing and hairstyles you are going to use, placed off camera somewhere. Or you could simply place them all on one of your primary person atoms and then remove them using a SceneLoad plugin trigger. At this point you can do whatever you want with these assets, remove them, whatever... the trigger fields wont get blanked.

Baking Presets - Item level presets seem to save their preset state on a per-person atom level. So, again you would need to load up one of your person atoms will all of clothing and hair you need, with the desired presets, and then remove them after SceneLoad. Now, whenever you instantiate those clothing items again to that same atom they will come in with that preset already loaded. Note that the baking only seems to occur on a person-atom by atom basis. If you load that same hair onto a different person atom it will come in as default.

Baking the presets into the assets is, for me, the cleaner approach as I would no longer have to manually trigger the presets on to each piece of clothing or hair style.

Last thing to note is that you can avoid all of this by just using Atom level presets, like hair and clothing presets. For the most part this is the simplest way to swap stuff. But if you're trying to swap individual items, like put gloves on, take boots off, etc... while maintaining the rest of the clothing state, Inside VaM's interface, The BOOL logic quickly becomes a total pain to handle.; With layers upon layers of merged clothing presets and exponential management of conditionals. Also, using Atom level presets seems to be less performant than adding items using the Geometry Receiver.

Yeesh, sorry for the rambling explanation! I was unable to find this info anywhere else, so I figured might as well post it for posterity. I hope someone finds this useful!
 
Last edited:
Upvote 0
Solution
I use a way to have resources like clothing that is independent from a scene. It works for hair too or any other preset, the only requirement is the person's name to be the same. I name these as quickdress, quickplace, etc. with guides explaining in detail and all my recent scenes make use of them.

The system is a mix of presets with VAMStory Actions or Timeline, depending on what it is, with the focus being on reuse and scaling. This may be beyond what you currently need, but could be useful to see another method that works to have many clothing, hair, etc. options for a scene without even being part of a scene.
 
Upvote 0
I use a way to have resources like clothing that is independent from a scene. It works for hair too or any other preset, the only requirement is the person's name to be the same. I name these as quickdress, quickplace, etc. with guides explaining in detail and all my recent scenes make use of them.

The system is a mix of presets with VAMStory Actions or Timeline, depending on what it is, with the focus being on reuse and scaling. This may be beyond what you currently need, but could be useful to see another method that works to have many clothing, hair, etc. options for a scene without even being part of a scene.
Good to know. It seems like asset management requires a bit of a workaround with vanilla VaM. Slowly working my way through some of the basic, underlying systems, and trying to understand them before I just throw a bunch of plugins at everything and end up covered in spaghetti. I'll appreciate what they do for me that much more though, in the end.
 
Upvote 0
Back
Top Bottom