forked from TrenchBroom/TrenchBroom
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request TrenchBroom#3912 from TrenchBroom/3911-obj-mtl-paths
3883: Make exported .obj material paths relative to export path
- Loading branch information
Showing
26 changed files
with
649 additions
and
100 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
Copyright (C) 2021 Amara M. Kilic | ||
Copyright (C) 2021 Kristian Duske | ||
This file is part of TrenchBroom. | ||
TrenchBroom is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
TrenchBroom is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with TrenchBroom. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "Macros.h" | ||
#include "IO/ExportOptions.h" | ||
|
||
#include <kdl/overload.h> | ||
|
||
#include <ostream> | ||
|
||
namespace TrenchBroom { | ||
namespace IO { | ||
bool operator==(const MapExportOptions& lhs, const MapExportOptions& rhs) { | ||
return lhs.exportPath == rhs.exportPath; | ||
} | ||
|
||
bool operator!=(const MapExportOptions& lhs, const MapExportOptions& rhs) { | ||
return !(lhs == rhs); | ||
} | ||
|
||
std::ostream& operator<<(std::ostream& lhs, const MapExportOptions& rhs) { | ||
lhs << "MapExportOptions{"; | ||
lhs << "exportPath: " << rhs.exportPath; | ||
lhs << "}"; | ||
return lhs; | ||
} | ||
|
||
std::ostream& operator<<(std::ostream& lhs, const ObjMtlPathMode rhs) { | ||
switch (rhs) { | ||
case ObjMtlPathMode::RelativeToGamePath: | ||
lhs << "RelativeToGamePath"; | ||
break; | ||
case ObjMtlPathMode::RelativeToExportPath: | ||
lhs << "RelativeToExportPath"; | ||
break; | ||
switchDefault(); | ||
} | ||
return lhs; | ||
} | ||
|
||
bool operator==(const ObjExportOptions& lhs, const ObjExportOptions& rhs) { | ||
return lhs.exportPath == rhs.exportPath && lhs.mtlPathMode == rhs.mtlPathMode; | ||
} | ||
|
||
bool operator!=(const ObjExportOptions& lhs, const ObjExportOptions& rhs) { | ||
return !(lhs == rhs); | ||
} | ||
|
||
std::ostream& operator<<(std::ostream& lhs, const ObjExportOptions& rhs) { | ||
lhs << "ObjExportOptions{"; | ||
lhs << "exportPath: " << rhs.exportPath << ", "; | ||
lhs << "mtlPathMode: " << rhs.mtlPathMode; | ||
lhs << "}"; | ||
return lhs; | ||
} | ||
|
||
std::ostream& operator<<(std::ostream& lhs, const ExportOptions& rhs) { | ||
std::visit([&](const auto& o) { lhs << o; }, rhs); | ||
return lhs; | ||
} | ||
} | ||
} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
Copyright (C) 2021 Amara M. Kilic | ||
Copyright (C) 2021 Kristian Duske | ||
This file is part of TrenchBroom. | ||
TrenchBroom is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
TrenchBroom is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with TrenchBroom. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "IO/Path.h" | ||
|
||
#include <iosfwd> | ||
#include <variant> | ||
|
||
namespace TrenchBroom { | ||
namespace IO { | ||
struct MapExportOptions { | ||
Path exportPath; | ||
}; | ||
|
||
bool operator==(const MapExportOptions& lhs, const MapExportOptions& rhs); | ||
bool operator!=(const MapExportOptions& lhs, const MapExportOptions& rhs); | ||
std::ostream& operator<<(std::ostream& lhs, const MapExportOptions& rhs); | ||
|
||
enum class ObjMtlPathMode { | ||
RelativeToGamePath, | ||
RelativeToExportPath | ||
}; | ||
|
||
std::ostream& operator<<(std::ostream& lhs, ObjMtlPathMode rhs); | ||
|
||
struct ObjExportOptions { | ||
Path exportPath; | ||
ObjMtlPathMode mtlPathMode; | ||
}; | ||
|
||
bool operator==(const ObjExportOptions& lhs, const ObjExportOptions& rhs); | ||
bool operator!=(const ObjExportOptions& lhs, const ObjExportOptions& rhs); | ||
std::ostream& operator<<(std::ostream& lhs, const ObjExportOptions& rhs); | ||
|
||
using ExportOptions = std::variant<MapExportOptions, ObjExportOptions>; | ||
|
||
std::ostream& operator<<(std::ostream& lhs, const ExportOptions& rhs); | ||
} | ||
} | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.