ousnius / BodySlide-and-Outfit-Studio

BodySlide and Outfit Studio, a tool to convert, create, and customize outfits and bodies for Bethesda games.
GNU General Public License v3.0
286 stars 63 forks source link

SliderCategory::MergeSliders does not add displayNames #471

Closed LenAnderson closed 1 year ago

LenAnderson commented 1 year ago

Description When multiple bodies with overlapping slider category names are installed, only the first body to be loaded has their sliders' display names shown in BodySlide.

Tested with BodySlide 5.6.0 (as well as built from source) and Fallout 4.

How to reproduce

  1. Install CBBE body
  2. Install BodyTalk3 body
  3. Open BodySlide
  4. Select CBBE body
  5. Check Torso category (will show ChestDepth instead of Chest Depth etc.)

My quick workaround to get the display names loaded was to edit SliderCategory::MergeSliders in src/components/SliderCategories.cpp as follows:

void SliderCategory::MergeSliders(const SliderCategory& sourceCategory) {
    for (size_t i = 0; i < sourceCategory.sliders.size(); i++) {
        sliders.push_back(sourceCategory.sliders[i]);
        if (sourceCategory.displayNames.find(sourceCategory.sliders[i]) != sourceCategory.displayNames.end()) {
            displayNames[sourceCategory.sliders[i]] = sourceCategory.displayNames.at(sourceCategory.sliders[i]);
        }
        sourceFiles.push_back(sourceCategory.sourceFiles[i]);
    }
}

This is probably still going to cause issues when multiple bodies have identical slider names in the same category but with different display names as any later loaded body would overwrite the previously defined display names.

I'm unfamiliar with the code base and have never touched C++ before, otherwise I would have created a pull request.

ousnius commented 1 year ago

@LenAnderson Thanks for the fix.