Add back resource handling workarounds to the gui code

c++11
scrawl 10 years ago
parent bd8f0248f0
commit 82c4d01b37

@ -353,6 +353,11 @@ namespace MWBase
virtual void cycleSpell(bool next) = 0;
/// Cycle to next or previous weapon
virtual void cycleWeapon(bool next) = 0;
// In WindowManager for now since there isn't a VFS singleton
virtual std::string correctIconPath(const std::string& path) = 0;
virtual std::string correctBookartPath(const std::string& path, int width, int height) = 0;
virtual std::string correctTexturePath(const std::string& path) = 0;
};
}

@ -183,7 +183,7 @@ namespace MWGui
const ESM::BirthSign *birth =
store.get<ESM::BirthSign>().find(mCurrentBirthId);
//mBirthImage->setImageTexture(Misc::ResourceHelpers::correctTexturePath(birth->mTexture));
mBirthImage->setImageTexture(MWBase::Environment::get().getWindowManager()->correctTexturePath(birth->mTexture));
std::vector<std::string> abilities, powers, spells;

@ -6,6 +6,10 @@
#include <MyGUI_ImageBox.h>
#include <MyGUI_FontManager.h>
// correctBookartPath
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/predicate.hpp>
@ -463,7 +467,7 @@ namespace MWGui
MyGUI::IntCoord(left, pag.getCurrentTop(), width, mImageHeight), MyGUI::Align::Left | MyGUI::Align::Top,
parent->getName() + MyGUI::utility::toString(parent->getChildCount()));
std::string image;// = Misc::ResourceHelpers::correctBookartPath(src, width, mImageHeight);
std::string image = MWBase::Environment::get().getWindowManager()->correctBookartPath(src, width, mImageHeight);
mImageBox->setImageTexture(image);
mImageBox->setProperty("NeedMouse", "false");
}

@ -448,7 +448,7 @@ namespace MWGui
std::string icon = effect->mIcon;
int slashPos = icon.rfind('\\');
icon.insert(slashPos+1, "b_");
//icon = Misc::ResourceHelpers::correctIconPath(icon);
icon = MWBase::Environment::get().getWindowManager()->correctIconPath(icon);
mSpellImage->setItem(MWWorld::Ptr());
mSpellImage->setIcon(icon);

@ -6,6 +6,10 @@
#include <components/misc/resourcehelpers.hpp>
// correctIconPath
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwworld/class.hpp"
namespace
@ -77,7 +81,7 @@ namespace MWGui
void ItemWidget::setIcon(const MWWorld::Ptr &ptr)
{
//setIcon(Misc::ResourceHelpers::correctIconPath(ptr.getClass().getInventoryIcon(ptr)));
setIcon(MWBase::Environment::get().getWindowManager()->correctIconPath(ptr.getClass().getInventoryIcon(ptr)));
}

@ -245,7 +245,7 @@ namespace MWGui
std::string path = effect->mIcon;
int slashPos = path.rfind('\\');
path.insert(slashPos+1, "b_");
//path = Misc::ResourceHelpers::correctIconPath(path);
path = MWBase::Environment::get().getWindowManager()->correctIconPath(path);
button->setFrame("textures\\menu_icon_select_magic.dds", MyGUI::IntCoord(2, 2, 40, 40));
button->setIcon(path);

@ -180,7 +180,7 @@ namespace MWGui
void EditEffectDialog::setMagicEffect (const ESM::MagicEffect *effect)
{
//mEffectImage->setImageTexture(Misc::ResourceHelpers::correctIconPath(effect->mIcon));
mEffectImage->setImageTexture(MWBase::Environment::get().getWindowManager()->correctIconPath(effect->mIcon));
mEffectName->setCaptionWithReplacing("#{"+ESM::MagicEffect::effectIdToString (effect->mIndex)+"}");

@ -145,7 +145,7 @@ namespace MWGui
("ImageBox", MyGUI::IntCoord(w,2,16,16), MyGUI::Align::Default);
mWidgetMap[it->first] = image;
//image->setImageTexture(Misc::ResourceHelpers::correctIconPath(effect->mIcon));
image->setImageTexture(MWBase::Environment::get().getWindowManager()->correctIconPath(effect->mIcon));
std::string name = ESM::MagicEffect::effectIdToString (it->first);

@ -388,7 +388,7 @@ namespace MWGui
const int imageCaptionHPadding = (caption != "" ? 8 : 0);
const int imageCaptionVPadding = (caption != "" ? 4 : 0);
std::string realImage;// = Misc::ResourceHelpers::correctIconPath(image);
std::string realImage = MWBase::Environment::get().getWindowManager()->correctIconPath(image);
MyGUI::EditBox* captionWidget = mDynamicToolTipBox->createWidget<MyGUI::EditBox>("NormalText", MyGUI::IntCoord(0, 0, 300, 300), MyGUI::Align::Left | MyGUI::Align::Top, "ToolTipCaption");
captionWidget->setProperty("Static", "true");
@ -686,7 +686,7 @@ namespace MWGui
widget->setUserString("ToolTipType", "Layout");
widget->setUserString("ToolTipLayout", "BirthSignToolTip");
widget->setUserString("ImageTexture_BirthSignImage", "");//Misc::ResourceHelpers::correctTexturePath(sign->mTexture));
widget->setUserString("ImageTexture_BirthSignImage", MWBase::Environment::get().getWindowManager()->correctTexturePath(sign->mTexture));
std::string text;
text += sign->mName;

@ -474,7 +474,7 @@ namespace MWGui
mTextWidget->setCaptionWithReplacing(spellLine);
mRequestedWidth = mTextWidget->getTextSize().width + 24;
//mImageWidget->setImageTexture(Misc::ResourceHelpers::correctIconPath(magicEffect->mIcon));
mImageWidget->setImageTexture(MWBase::Environment::get().getWindowManager()->correctIconPath(magicEffect->mIcon));
}
MWSpellEffect::~MWSpellEffect()

@ -33,6 +33,8 @@
#include <components/widgets/widgets.hpp>
#include <components/widgets/tags.hpp>
#include <components/misc/resourcehelpers.hpp>
#include "../mwbase/inputmanager.hpp"
#include "../mwbase/statemanager.hpp"
@ -102,7 +104,8 @@ namespace MWGui
osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ResourceSystem* resourceSystem
, const std::string& logpath, const std::string& resourcePath, bool consoleOnlyScripts,
Translation::Storage& translationDataStorage, ToUTF8::FromType encoding, bool exportFonts, const std::map<std::string, std::string>& fallbackMap)
: mViewer(viewer)
: mResourceSystem(resourceSystem)
, mViewer(viewer)
, mConsoleOnlyScripts(consoleOnlyScripts)
, mHud(NULL)
, mMap(NULL)
@ -1917,4 +1920,19 @@ namespace MWGui
mScrollWindow->open(item, showTakeButton);
}
std::string WindowManager::correctIconPath(const std::string& path)
{
return Misc::ResourceHelpers::correctIconPath(path, mResourceSystem->getVFS());
}
std::string WindowManager::correctBookartPath(const std::string& path, int width, int height)
{
return Misc::ResourceHelpers::correctBookartPath(path, width, height, mResourceSystem->getVFS());
}
std::string WindowManager::correctTexturePath(const std::string& path)
{
return Misc::ResourceHelpers::correctTexturePath(path, mResourceSystem->getVFS());
}
}

@ -358,7 +358,14 @@ namespace MWGui
/// Cycle to next or previous weapon
virtual void cycleWeapon(bool next);
// In WindowManager for now since there isn't a VFS singleton
virtual std::string correctIconPath(const std::string& path);
virtual std::string correctBookartPath(const std::string& path, int width, int height);
virtual std::string correctTexturePath(const std::string& path);
private:
Resource::ResourceSystem* mResourceSystem;
osgMyGUI::Platform* mGuiPlatform;
osgViewer::Viewer* mViewer;

@ -10,6 +10,9 @@ namespace VFS
namespace Misc
{
// Workarounds for messy resource handling in vanilla morrowind
// The below functions are provided on a opt-in basis, instead of built into the VFS,
// so we have the opportunity to use proper resource handling for content created in OpenMW-CS.
namespace ResourceHelpers
{
bool changeExtensionToDds(std::string &path);
@ -18,7 +21,7 @@ namespace Misc
std::string correctIconPath(const std::string &resPath, const VFS::Manager* vfs);
std::string correctBookartPath(const std::string &resPath, const VFS::Manager* vfs);
std::string correctBookartPath(const std::string &resPath, int width, int height, const VFS::Manager* vfs);
/// Uses "xfoo.nif" instead of "foo.nif" if available
/// Use "xfoo.nif" instead of "foo.nif" if available
std::string correctActorModelPath(const std::string &resPath, const VFS::Manager* vfs);
}
}

Loading…
Cancel
Save