fix: properly load custom models on scene transition#2779
Merged
leggettc18 merged 3 commits intoHarbourMasters:develop-spockfrom May 4, 2023
Merged
fix: properly load custom models on scene transition#2779leggettc18 merged 3 commits intoHarbourMasters:develop-spockfrom
leggettc18 merged 3 commits intoHarbourMasters:develop-spockfrom
Conversation
Contributor
|
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;
} |
NEstelami
reviewed
Apr 29, 2023
Co-authored-by: Nicholas Estelami <NEstelami@users.noreply.github.com>
briaguya0
commented
Apr 29, 2023
Contributor
Author
briaguya0
left a comment
There was a problem hiding this comment.
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 ![]()
leggettc18
approved these changes
May 4, 2023
Contributor
leggettc18
left a comment
There was a problem hiding this comment.
Confirmed working with a few scene transitions and the tplink model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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