detect minetest texture, turn off interp

master
poikilos 2019-05-17 13:43:02 -04:00
parent 44a842e79d
commit 60aa3d434e
3 changed files with 58 additions and 23 deletions

View File

@ -1,4 +1,10 @@
# Changelog
## [git] - 2019-05-16
(poikilos)
### Changed
* improve minetest texture detection (alternate conventions)
* turn off interpolation if loadNextTexture detects minetest directory
structure (../textures/<texture filename based on model name>)
## [git] - 2019-05-16
(poikilos)

View File

@ -23,6 +23,9 @@ Website: [poikilos.org](https://poikilos.org)
* export feature: COLLADA (non-Blender), IRR (Irrlicht Scene settings
and mesh file paths only), IRRMESH (Static Irrlicht Mesh), OBJ
(Wavefront), STL (stereolithography)
* Turn off interpolation if loadNextTexture (F3) detects minetest
directory structure
(../textures/<texture filename based on model name>)
## Compile
(the original version of this section is from

View File

@ -453,29 +453,55 @@ bool UserInterface::loadNextTexture(int direction)
if (fs::is_directory(fs::status(path))) {
if (this->m_Engine->m_PrevTexturePath.length() == 0) {
if (this->m_Engine->m_PreviousPath.length() > 0) {
tryPath = texturesPath + dirSeparator
+ Utility::withoutExtension(
Utility::basename(
this->m_Engine->m_PreviousPath
)
)
+ L".png";
tryPath = Utility::toWstring(Utility::toString(tryPath));
if (!Utility::isFile(tryPath)) {
tryPath = texturesPath + dirSeparator
+ Utility::withoutExtension(
Utility::basename(
this->m_Engine->m_PreviousPath
)
)
+ L".jpg";
tryPath = Utility::toWstring(
Utility::toString(tryPath)
);
if (Utility::isFile(tryPath)) {
nextPath = tryPath;
found = true;
force = true;
vector<wstring> dotExtensions;
dotExtensions.push_back(L".png");
dotExtensions.push_back(L".jpg");
wstring foundPath;
wstring partial = Utility::withoutExtension(
Utility::basename(
this->m_Engine->m_PreviousPath
)
);
vector<wstring> names;
names.push_back(partial+L"_mesh");
names.push_back(partial+L"1");
names.push_back(partial);
for(auto name : names) {
for(auto extension : dotExtensions) {
tryPath = texturesPath + dirSeparator
+ name
+ extension;
// tryPath = Utility::toWstring(Utility::toString(tryPath));
if (Utility::isFile(tryPath)) {
foundPath = tryPath;
break;
}
//else
//debug() << " - no '" << Utility::toString(tryPath) << "'" << endl;
}
if (foundPath.length() > 0) {
break;
}
}
if (foundPath.length() > 0) {
nextPath = foundPath;
found = true;
force = true;
m_TextureInterpolation = viewMenu->isItemChecked(
viewTextureInterpolationIdx
);
if (m_TextureInterpolation) {
m_TextureInterpolation = false;
m_Engine->setMeshDisplayMode(
m_WireframeDisplay,
m_Lighting,
m_TextureInterpolation
);
viewMenu->setItemChecked(
viewTextureInterpolationIdx,
m_TextureInterpolation
);
}
} else {
nextPath = tryPath;