-
Notifications
You must be signed in to change notification settings - Fork 467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: properly load custom models on scene transition #2779
fix: properly load custom models on scene transition #2779
Conversation
When the skeleton is being loaded by the game it's always loading the vanilla one because it's not checking if we're in HD mode. To properly fix the issue, ResourceMgr_LoadSkeletonByName needs to be updated to: extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, SkelAnime* skelAnime)
{
std::string pathStr = std::string(path);
static const std::string sOtr = "__OTR__";
if (pathStr.starts_with(sOtr)) {
pathStr = pathStr.substr(sOtr.length());
}
bool isHD = CVarGetInteger("gAltAssets", 0);
if (isHD)
pathStr = Ship::Resource::gAltAssetPrefix + pathStr;
SkeletonHeader* skelHeader = (SkeletonHeader*)GetResourceDataByName(pathStr.c_str(), false);
// If there isn't an HD model, load the regular one
if (isHD && skelHeader == NULL)
skelHeader = (SkeletonHeader*)GetResourceDataByName(path, false);
// This function is only called when a skeleton is initialized.
// Therefore we can take this oppurtunity to take note of the Skeleton that is created...
if (skelAnime != nullptr) {
auto stringPath = std::string(path);
Ship::SkeletonPatcher::RegisterSkeleton(stringPath, skelAnime);
}
return skelHeader;
} |
Co-authored-by: Nicholas Estelami <NEstelami@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should probably do a bit more investigation and make it so we don't need this checking code on the SoH side of things at some point, but for now this is minimally invasive and fixes the issue so I say let's
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed working with a few scene transitions and the tplink model
this feels like a bad way to fix #2778 but it worksedit: as of 8e15348 i feel this is a good short/medium term solution. long term we should dig into where the logic in this PR should live #2779 (review)
i figure if nothing else it might be helpful when trying to come up with a fix we actually like
out.mp4
Build Artifacts