Decal Maker

Plugins Decal Maker

Yes...this was the issue. I had the Makeup Pefabs var in a subfolder. @Chokaphi, just FYI, that the referenced VAR also needs to be in the same exact folder as the Decal Maker Var.

For thinks like the Kemeate preset vars and goo var that add prefab/preset to DecalMaker?

That code was written before we have proper file API and is a huge kludge I made to work around it. I will try and get time to see if I can remake/clean it up and get subfolder detection fixed.

I believe that section of code still has the following comment //this is a nasty fucking mess
 
I've been using this new version since yesterday and while I do LOVE the new Normal blending, I may have to go back to the previous version as this one is very buggy. It will often carry over textures from previous scenes, when you load a new one, and it will also auto load settings from a figure when you load an appearance, even before you've chosen one of the three options. It also feels like there may be some sort of memory leak or something going on as I'm getting odd glitches that I can't quite put into a clear description.
 
Tried the new version yesterday and restoring look presets did not seam to work anymore? I add the plugin (through a plugin preset which contains 1 layer), dialog pops up, I select clear & add and then nothing. No errors.

Edit:
it will also auto load settings from a figure when you load an appearance, even before you've chosen one of the three options
Not sure if it loaded something beforehand in my case, I looked at the dialog at the time :D
 
I did not intentionally change anything other than the normal system, perhaps it broke some other features, I will try and get time to see if I can find whats wrong with the preset and appearance functions.

One thing I suspect is the Character monitor coroutine that detects VAM character load/change and resets things to stock is not firing in the correct order

EDIT: Ok so it is a timing issue, the coroutine MonitorLastLoadedAppearance() was not properly waiting for the CharacterUpdated coroutine to finish. The flag it raises was too slow since the new normal system is fractionally slower .

Now to track down the memory leak
 
Last edited:
EDIT: Ok so it is a timing issue, the coroutine MonitorLastLoadedAppearance() was not properly waiting for the CharacterUpdated coroutine to finish. The flag it raises was too slow since the new normal system is fractionally slower .
Have you checked if there is a callback for that available now? I think there have been a few additions over the years. Might be a bit more robust if there is one.

Historically, there has always been an issue with Decal Maker where when you load a scene with the plugin already loaded on a person atom with custom texture maps, loading a new appearance that has a decal preset will fry the RenderTexture assignment somehow (torso and face become white, specular and glossy maps too/1.0f, not sure about normals). I think you can trigger some error messages when you then switch the skin, where it will complain about RenderTexture. Only fix in that situation is to manually clear the custom texture maps.

Maybe that is also somehow related to the VaM UI breaking when you load a scene that contains the plugin and you need to allow a new plugin to load (the security dialog box does not close). Could well be a timing issue where something breaks internally because the plugin tried to access something that wasn't there yet.
 
Have you checked if there is a callback for that available now? I think there have been a few additions over the years. Might be a bit more robust if there is one.

Historically, there has always been an issue with Decal Maker where when you load a scene with the plugin already loaded on a person atom with custom texture maps, loading a new appearance that has a decal preset will fry the RenderTexture assignment somehow (torso and face become white, specular and glossy maps too/1.0f, not sure about normals). I think you can trigger some error messages when you then switch the skin, where it will complain about RenderTexture. Only fix in that situation is to manually clear the custom texture maps.

Maybe that is also somehow related to the VaM UI breaking when you load a scene that contains the plugin and you need to allow a new plugin to load (the security dialog box does not close). Could well be a timing issue where something breaks internally because the plugin tried to access something that wasn't there yet.
I really need to rework and see what better methods are available. Right now its 1 main coroutine and 2 sub-coroutines monitoring for a character/skin changes. All of it is second hand wait for X beacause I did nto have direct access to VAM built in skin system, its brittle as all fuck
 
I really need to rework and see what better methods are available. Right now its 1 main coroutine and 2 sub-coroutines monitoring for a character/skin changes. All of it is second hand wait for X beacause I did nto have direct access to VAM built in skin system, its brittle as all fuck
Maybe reach out to @Stopper? He's been on fire with plugins and probably has a really deep working knowledge of VAM under the hood. Decal Maker is one of my absolute go-to plugins. :)
 
Maybe reach out to @Stopper? He's been on fire with plugins and probably has a really deep working knowledge of VAM under the hood. Decal Maker is one of my absolute go-to plugins. :)
Sure thing. I'm pretty great at race-condition bugs. How many do you want to add? 😅

Always happy to talk through this sort of stuff over discord, but Chokaphi's intuition on this part of the code is way better than mine.
 
yes, my old presets now have too high value.I think replacing them also didnt make any difference so i switched back to the previous version where i was used to the values
I have to wonder if instead of the value being too high, it's more related to what we were talking about above and double loading the preset. It loads the preset saved with the appearance even before you've chosen one of the three options and then if you say to add it...It'll add it again...on top of the already loaded textures.
 
I have to wonder if instead of the value being too high, it's more related to what we were talking about above and double loading the preset. It loads the preset saved with the appearance even before you've chosen one of the three options and then if you say to add it...It'll add it again...on top of the already loaded textures.
this
 
Chokaphi updated Decal Maker with a new update entry:

RC 11: Bug Fixes

Fix: Loading a Appearance with a save Decal Maker settings will not auto apply. The UI properly works again.

Fix: Minor memory leak of discarded textures.

NOTE: Since Decal Maker now properly uses the built in Normal Maps a character has, they will need to be removed if you duplicated the skin normal Maps in decal Maker. Otherwise you will end up doubling up the effect.

Read the rest of this update entry...
 
So for Character and Skin Texture changes here are the considerations for how the monitors work.

Is Decal Maker loading with the scene or being added after
Is it a skin update on the current character or a character change + possible skin changes
Is Vam Unload characters option on

So we store the DazCharacter and DazCharacterSelector classes and use those to monitor Characters. Here is the current code.
The Coroutine is started if the Saved DazCharacter != to the current DdazCharacterSelector.selectedCharacter

C#:
 private IEnumerator CharacterChanged()
 {
     LogError("CharacterChanged");
     //used to know which character is being used or changed
     _dazCharacterSelector = _parentAtom.GetComponentInChildren<DAZCharacterSelector>();
     DAZCharacter previousDazCharacter = _dazCharacter;
     ResetOriginalGPUTextures(previousDazCharacter);
     _dazCharacter = _dazCharacterSelector.selectedCharacter;

     yield return new WaitUntil(() => _dazCharacter.ready);
     _dazSkin = (DAZMergedSkinV2)_dazCharacter.skin;
     _isMale = _dazCharacter.isMale;
     _uvSetName = _dazCharacter.UVname.Replace("UV: ", "");

     LogError("Waiting on UI");
     yield return new WaitUntil(() => _SetupFinished == true);
     LogError("UI should be ready");

     _processingCharacterChange = true;
     yield return StartCoroutine(CharacterUpdated(true));

     if (_savedData != null)
     {
         LogError("Restore save state");
         PerformLoad(_savedData);
         _savedData = null;
     }

     _processingCharacterChange = false;
}

 private IEnumerator CharacterUpdated(bool newCharacter = false)
 {
     if (!newCharacter)
         yield return new WaitForSeconds(1);
     LogError("CharacterUpdated");

     //loadingIcon.gameObject stays true until all texture/cloathing load process is finished
     LogError("yielding till all textures load " + SuperController.singleton.loadingIcon.gameObject.activeSelf);
     yield return new WaitWhile(() => SuperController.singleton.loadingIcon.gameObject.activeSelf);
     LogError("textures load finished continue coroutine");

     //should store the current skin textures.
     LogError("STORE Current Skin Textures");

     gpuTextureData = new GpuTextureData(this, _dazSkin); //auto stores mats on creation
     yield return new WaitWhile(()=> gpuTextureData.finished == false);

     OnCoreChange(this, new PanelEventArgs(EventEnum.CoreNewCharacterSelected, newCharacter));
     _processingCharacterChange = false;
 
 }
 
Last edited:
Hi,
thanks for great plugin, i have two question, first edit of image now works only in X axis, sometimes, but 2 versions before was ok,
and second it is possibe to add normal texture directly over diffuse (means with same size, rotation, X and Y), Thanks
 
Hi,
thanks for great plugin, i have two question, first edit of image now works only in X axis, sometimes, but 2 versions before was ok,
and second it is possibe to add normal texture directly over diffuse (means with same size, rotation, X and Y), Thanks
Could you clarify this ?
, first edit of image now works only in X axis,

Currently only the decals are set to use the translate/resize feature. ATM, I really really really need to rewrite a lot of the plugin from scratch before I add anything else. The plugin works massively different than it did when I initially designed the core.

The initial versions took 30 seconds to bake the layers down to a texture
Later versions took seconds to bake but it was still a manual process and we only changed decals.
Now we generate in near real time, with far more texture types supported and body regions plus texture resize and movement.

It also doesn't help that I often used it to practice different coding techniques, so the way parts "talk" to other parts differ.
 
Hi Chokaphi, is it possible to add ability to load custom preset from ui-assist? That means new function registered as action, and new
JSONStorableString registered as string. And the logic itself is quite staightforward:
C#:
public void PresetLoadCustom()
{
    PresetLoad(PresetLoadCustomPath.val);
}
After this, ui-assist button can be set up to trigger this action, with this string assigned by decal-maker custom preset path.
 
Hi Chokaphi, is it possible to add ability to load custom preset from ui-assist? That means new function registered as action, and new
JSONStorableString registered as string. And the logic itself is quite staightforward:
C#:
public void PresetLoadCustom()
{
    PresetLoad(PresetLoadCustomPath.val);
}
After this, ui-assist button can be set up to trigger this action, with this string assigned by decal-maker custom preset path.
I thought UI assist already had a call for this using an older method? But I do have a some newer methods for loading things.

Can UI assist call JSONStorableURLs?
It was added back in RC 3.
  • Added: JSONStorableUrl ("Load Preset File") that allows directly loading of a preset *json
    Just pass in the URL path and it will be loaded and applied.
 
I thought UI assist already had a call for this using an older method? But I do have a some newer methods for loading things.

Can UI assist call JSONStorableURLs?
It was added back in RC 3.
  • Added: JSONStorableUrl ("Load Preset File") that allows directly loading of a preset *json
    Just pass in the URL path and it will be loaded and applied.
Thanks, there are really "Load Preset File" variable and even "PerformLoad" action.
So either I wrote my code before RC3, or I tried these and they didn't worked. Anyway, I'll try again.
 
I thought UI assist already had a call for this using an older method? But I do have a some newer methods for loading things.

Can UI assist call JSONStorableURLs?
It was added back in RC 3.
  • Added: JSONStorableUrl ("Load Preset File") that allows directly loading of a preset *json
    Just pass in the URL path and it will be loaded and applied.
I checked out, this "Load Preset File" variable is not available for choosing from UIAssist. Maybe because of "loadPresetFile.isStorable = false;" line under it, but not sure. Other JSONStorableAction near this variable are available.
 
Back
Top Bottom