Skip to content

Fix custom ped textures persisting after resource stop/disconnect#5014

Open
TheCrazy17 wants to merge 1 commit into
multitheftauto:masterfrom
TheCrazy17:fix/skin-txd-persists-after-stop
Open

Fix custom ped textures persisting after resource stop/disconnect#5014
TheCrazy17 wants to merge 1 commit into
multitheftauto:masterfrom
TheCrazy17:fix/skin-txd-persists-after-stop

Conversation

@TheCrazy17

Copy link
Copy Markdown
Contributor

Summary

Fixes custom ped textures/skins applied via engineImportTXD not reverting to the original texture when the replacement is removed (resource stop, script stopResource, or disconnecting from the server).

Two issues in the ped texture-restream path, both specific to the local player:

  • CClientPedManager::RestreamPeds/RestreamAllPeds gated the model-refresh hack behind IsStreamedIn(), which never becomes true for the local player (its ped is created via _CreateLocalModel(), which doesn't go through the normal InternalStreamIn() path that sets that flag). This meant the refresh never even attempted to run when you were wearing the modified skin yourself.
  • CRenderWareSA::ModelInfoTXDRemoveTextures restored the original textures in the TXD dictionary, but never forced the ped model to drop its currently-loaded clump, unlike GetModelTexturesInfo which does this when the replacement is first applied. Without it, an already-rendered ped had no guarantee it would pick the restored textures back up.

Motivation

Fixes #1877.

Test plan

zm-skin.zip

  • Loaded a custom TXD onto a worn skin model via engineLoadTXD + engineImportTXD from a test resource.
  • Confirmed the texture applies correctly (unaffected by this change).
  • Stopped the resource while still connected: texture now reliably reverts to the original (previously it was inconsistent; sometimes reverted, sometimes stayed applied).
  • Disconnected while the custom texture was active and reconnected to a server without the resource: skin now shows correctly instead of keeping the modified texture.
  • Verified vehicles/objects are unaffected (they don't share the local-player streaming quirk that caused this).

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

@Zephkek

Zephkek commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

thx claude

…nnect

engineImportTXD replacements applied to a ped model never got visually reverted for the local player: the ped-restream gate checked IsStreamedIn(), which never becomes true for the local player since it's created via _CreateLocalModel() instead of the normal streaming path. Additionally, removing a replacement never forced the model to drop its loaded clump the way applying one does, so even when the restream did run it wasn't guaranteed to pick up the restored textures.

Fixes multitheftauto#1877.
@TheCrazy17 TheCrazy17 force-pushed the fix/skin-txd-persists-after-stop branch from fc2825e to a32aa2e Compare July 5, 2026 16:32
@QueryOfficial

Copy link
Copy Markdown
Contributor

thx claude

What exactly are you trying to achieve with these comments? Instead of mocking people who are actually working, contributing, and trying to improve the project, maybe you should focus on doing something useful yourself.

Trying to belittle people’s work with these passive-aggressive comments just looks petty and, honestly, pathetic. If you have a real technical criticism, say it properly. Otherwise, stop making these unnecessary remarks.

Don’t worry though, I won’t let these comments bother me.

Congratulations, @TheCrazy17.

@TheCrazy17

Copy link
Copy Markdown
Contributor Author

thx claude

I didn't see any policy that prohibits using AI tools as assistance. What matters is that the fix is correct and tested, do you have any actual feedback on the code itself? I'm just trying to help out while testing new tools. Otherwise, you're free to open your own pull request, and no one is obligated to accept mine. lol

@Zephkek

Zephkek commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

There's a difference between using AI and knowing what you're doing when using AI, keep at it though maybe one of these days gpt or claude will get something right and it'll get merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

engineImportTXD() persists through servers

3 participants