mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-25 13:58:55 -05:00
Support loading of .asset and .scene files
Fix hardcoded paths to placeholder image add placeholder image to repository Disable launcher in SyncWidget to keep it compiling until deletion
This commit is contained in:
@@ -134,8 +134,8 @@ SyncWidget::SyncWidget(QWidget* parent, Qt::WindowFlags f)
|
||||
setLayout(layout);
|
||||
|
||||
ghoul::initialize();
|
||||
_downloadManager = std::make_unique<openspace::DownloadManager>(
|
||||
"http://data.openspaceproject.com/request", DownloadApplicationVersion);
|
||||
// _downloadManager = std::make_unique<openspace::DownloadManager>(
|
||||
// "http://data.openspaceproject.com/request", DownloadApplicationVersion);
|
||||
|
||||
libtorrent::error_code ec;
|
||||
_session->listen_on(std::make_pair(20280, 20290), ec);
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
@@ -220,7 +220,7 @@ void RenderableModel::update(const UpdateData&) {
|
||||
_programObject->rebuildFromFile();
|
||||
}
|
||||
|
||||
_sunPos = OsEng.renderEngine().scene()->sceneGraphNode("Sun")->worldPosition();
|
||||
_sunPos = OsEng.renderEngine().scene()->sceneGraphNode("SolarSystemBarycenter")->worldPosition();
|
||||
}
|
||||
|
||||
void RenderableModel::loadTexture() {
|
||||
|
||||
@@ -46,7 +46,7 @@ HongKangParser::HongKangParser(std::string name, std::string fileName,
|
||||
ghoul::Dictionary translationDictionary,
|
||||
std::vector<std::string> potentialTargets)
|
||||
: _defaultCaptureImage(
|
||||
absPath("${OPENSPACE_DATA}/scene/common/textures/placeholder.png")
|
||||
absPath("${OPENSPACE_DATA}/placeholder.png")
|
||||
)
|
||||
, _name(std::move(name))
|
||||
, _fileName(std::move(fileName))
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace {
|
||||
constexpr const char* sequenceTypeInstrumentTimes = "instrument-times";
|
||||
|
||||
const char* placeholderFile =
|
||||
"${OPENSPACE_DATA}/scene/common/textures/placeholder.png";
|
||||
"${OPENSPACE_DATA}/placeholder.png";
|
||||
|
||||
constexpr const char* _loggerCat = "ProjectionComponent";
|
||||
|
||||
|
||||
@@ -48,14 +48,20 @@ namespace openspace {
|
||||
TorrentSynchronization::TorrentSynchronization(const ghoul::Dictionary& dict,
|
||||
const std::string& synchronizationRoot,
|
||||
TorrentClient* torrentClient)
|
||||
: openspace::ResourceSynchronization(dict)
|
||||
: ResourceSynchronization(dict)
|
||||
, _synchronizationRoot(synchronizationRoot)
|
||||
, _torrentClient(torrentClient)
|
||||
{
|
||||
documentation::testSpecificationAndThrow(
|
||||
ResourceSynchronization::Documentation(),
|
||||
dict,
|
||||
"ResourceSynchronization::TorrentSynchronization"
|
||||
);
|
||||
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
dict,
|
||||
"TorrentSynchroniztion"
|
||||
"TorrentSynchronization::TorrentSynchronization"
|
||||
);
|
||||
|
||||
_identifier = dict.value<std::string>(KeyIdentifier);
|
||||
|
||||
@@ -60,7 +60,7 @@ bool MissionManager::hasCurrentMission() const {
|
||||
void MissionManager::loadMission(const std::string& filename) {
|
||||
ghoul_assert(!filename.empty(), "filename must not be empty");
|
||||
ghoul_assert(!FileSys.containsToken(filename), "filename must not contain tokens");
|
||||
ghoul_assert(FileSys.fileExists(filename), "filename must exist");
|
||||
ghoul_assert(FileSys.fileExists(filename), "filename " + filename + " must exist");
|
||||
|
||||
// Changing the values might invalidate the _currentMission iterator
|
||||
std::string currentMission = hasCurrentMission() ? _currentMission->first : "";
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include <ghoul/misc/onscopeexit.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "assetloader_lua.inl"
|
||||
|
||||
namespace {
|
||||
@@ -56,6 +58,7 @@ namespace {
|
||||
const char* _loggerCat = "AssetLoader";
|
||||
|
||||
const char* AssetFileSuffix = "asset";
|
||||
const char* SceneFileSuffix = "scene";
|
||||
|
||||
enum class PathType : int {
|
||||
RelativeToAsset = 0,
|
||||
@@ -288,16 +291,50 @@ std::string AssetLoader::generateAssetPath(const std::string& baseDirectory,
|
||||
prefix = _assetRootDirectory + ghoul::filesystem::FileSystem::PathSeparator;
|
||||
}
|
||||
|
||||
// Support paths with and without ".asset" suffix.
|
||||
std::string suffix = std::string(".") + AssetFileSuffix;
|
||||
if (assetPath.size() > suffix.size() &&
|
||||
assetPath.substr(assetPath.size() - suffix.size()) == suffix)
|
||||
{
|
||||
suffix = "";
|
||||
// Construct the full path including the .asset extension
|
||||
std::string assetSuffix = std::string(".") + AssetFileSuffix;
|
||||
bool hasAssetSuffix =
|
||||
(assetPath.size() > assetSuffix.size()) &&
|
||||
(assetPath.substr(assetPath.size() - assetSuffix.size()) == assetSuffix);
|
||||
std::string fullAssetPath =
|
||||
hasAssetSuffix ?
|
||||
prefix + assetPath :
|
||||
prefix + assetPath + assetSuffix;
|
||||
bool fullAssetPathExists = FileSys.fileExists(FileSys.absPath(fullAssetPath));
|
||||
|
||||
// Construct the full path including the .scene extension
|
||||
std::string sceneSuffix = std::string(".") + SceneFileSuffix;
|
||||
bool hasSceneSuffix =
|
||||
(assetPath.size() > sceneSuffix.size()) &&
|
||||
(assetPath.substr(assetPath.size() - sceneSuffix.size()) == sceneSuffix);
|
||||
std::string fullScenePath =
|
||||
hasSceneSuffix ?
|
||||
prefix + assetPath :
|
||||
prefix + assetPath + sceneSuffix;
|
||||
bool fullScenePathExists = FileSys.fileExists(FileSys.absPath(fullScenePath));
|
||||
|
||||
if (fullAssetPathExists && fullScenePathExists) {
|
||||
LWARNING(
|
||||
fmt::format(
|
||||
"'{}' and '{}' file found with non-specific request '{}'. Loading '{}'. "
|
||||
"Explicitly add extension to suppress this warning.",
|
||||
fullAssetPath,
|
||||
fullScenePath,
|
||||
prefix + assetPath,
|
||||
fullAssetPath
|
||||
)
|
||||
);
|
||||
|
||||
return ghoul::filesystem::File(FileSys.absPath(fullAssetPath));
|
||||
}
|
||||
return ghoul::filesystem::File(FileSys.absPath(
|
||||
prefix + assetPath + suffix
|
||||
));
|
||||
|
||||
if (fullScenePathExists) {
|
||||
return ghoul::filesystem::File(FileSys.absPath(fullScenePath));
|
||||
}
|
||||
|
||||
// We don't check whether the file exists here as the error will be more
|
||||
// comprehensively logged by Lua either way
|
||||
return ghoul::filesystem::File(FileSys.absPath(fullAssetPath));
|
||||
}
|
||||
|
||||
std::shared_ptr<Asset> AssetLoader::getAsset(std::string name) {
|
||||
|
||||
Reference in New Issue
Block a user