Jump to content

SKSE RaceMenu Modding: How to apply overlays to user


Recommended Posts

Posted (edited)

This is the workflow I actually implement:


1. Clear Slot 0 (assume its empty)
 

SKSE::GetTaskInterface()->AddTask( {
  AddNodeOverride(actor, isFemale, "Body [Ovl 0]", 9, 0, "actors/character/overlays/default.dds")
  if (HasNodeOverride(actor, isFemale, "Body [Ovl 0]", 9, 1))
      AddNodeOverride(actor, isFemale, "Body [Ovl 0]", 9, 1, "actors/character/overlays/default.dds");
  if (HasNodeOverride(actor, isFemale, "Body [Ovl 0]", 9, 3))
      AddNodeOverride(actor, isFemale, "Body [Ovl 0]", 9, 3, "actors/character/overlays/default.dds");
  ApplyNodeOverrides(actor, true);

  RemoveNodeOverride(actor, isFemale, "Body [Ovl 0]", 9, 3);
  RemoveNodeOverride(actor, isFemale, "Body [Ovl 0]", 9, 1);
  RemoveNodeOverride(actor, isFemale, "Body [Ovl 0]", 9, 0);
  RemoveNodeOverride(actor, isFemale, "Body [Ovl 0]", 7, 255);
  RemoveNodeOverride(actor, isFemale, "Body [Ovl 0]", 0, 255);
  RemoveNodeOverride(actor, isFemale, "Body [Ovl 0]", 1, 255);
  RemoveNodeOverride(actor, isFemale, "Body [Ovl 0]", 8, 255);
  RemoveNodeOverride(actor, isFemale, "Body [Ovl 0]", 2, 255);
  RemoveNodeOverride(actor, isFemale, "Body [Ovl 0]", 3, 255);
  ApplyNodeOverrides(actor, true);

 

2. Set Slot 0

    AddNodeOverride(actor, isFemale, "Body [Ovl 0]", 9, 0, "actors/character/mymod/mytexture.dds")
    ApplyNodeOverrides(actor, true);
}

 

I need to decouple from current thread because I call the function in an OnEquipped (RE::BSTEventSink<RE::TESEquipEvent>) event.


This is my problem:

 

The texture is set, and it is immediately visible on NPCs.

 

But it is only visible on Player when I open and close RaceMenu manually.

 

Edited by zaira
Posted

This looks like AI slop.

  1. Sets ovl 0 9 0 to default.dds.
  2. Applies changes.
  3. Removes ovl 0 9 0.
  4. Applies changes.
  5. Sets ovl 0 9 0 to mytexture.dds.
  6. Applies changes.

Why not just set ovl 0 9 0 to mytexture.dds, not remove it and only apply once? Seems like it would cut down the risk of there being a race condition in ApplyNodeOverrides and probably save a whole lot of performance too (relatively speaking).

Posted
56 minutes ago, traison said:

This looks like AI slop.

This is how SlaveTatsNG is being implemented...

Posted (edited)
1 hour ago, zaira said:

This is how SlaveTatsNG is being implemented...

 

Not sure how that counters my AI slop argument, but that's irrelevant anyways. The point of my post was, have you tried this, and does it work for both NPCs and the player?

SKSE::GetTaskInterface()->AddTask( {
  AddNodeOverride(actor, isFemale, "Body [Ovl 0]", 9, 0, "actors/character/overlays/mytexture.dds")
  ApplyNodeOverrides(actor, true);
});

 

Edit: And to clarify further, if this works then my guess would be taht ApplyNodeOverrides has a race condition in it, despite immediate being set to true and it seemingly being synchronous.

Edited by traison
Posted (edited)
5 hours ago, traison said:

 

Not sure how that counters my AI slop argument, but that's irrelevant anyways. The point of my post was, have you tried this, and does it work for both NPCs and the player?

SKSE::GetTaskInterface()->AddTask( {
  AddNodeOverride(actor, isFemale, "Body [Ovl 0]", 9, 0, "actors/character/overlays/mytexture.dds")
  ApplyNodeOverrides(actor, true);
});

 

Edit: And to clarify further, if this works then my guess would be taht ApplyNodeOverrides has a race condition in it, despite immediate being set to true and it seemingly being synchronous.

Tried the simplified version, I still need to open RaceMenu manually to get the overlays visible.

Edited by zaira

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...