mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-24 13:59:09 -06:00
fix template and writer for scene license info
This commit is contained in:
@@ -3,14 +3,12 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<p>
|
||||
<a href="#{{urlify module}}" name="{{urlify module}}">
|
||||
<span class="documentation-key">{{module}}</span>
|
||||
</a>
|
||||
<p>{{name}}</p>
|
||||
<br />
|
||||
<p>{{attribution}}</p>
|
||||
<p>{{url}}</p>
|
||||
<p>{{licenseText}}</p>
|
||||
<h3>Asset - {{name}}</h3>
|
||||
<p>{{description}}</p>
|
||||
<p>Version - {{version}}</p>
|
||||
<p>Author - {{author}}</p>
|
||||
<p>Associated URL - <a href="{{url}}">{{url}}</a></p>
|
||||
<p>Filepath - {{path}}</p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -51,6 +51,16 @@ std::string SceneLicenseWriter::generateJson() const {
|
||||
std::vector<const Asset*> assets =
|
||||
global::openSpaceEngine.assetManager().rootAsset().subTreeAssets();
|
||||
|
||||
int metaTotal = 0;
|
||||
for (const Asset* asset : assets) {
|
||||
std::optional<Asset::MetaInformation> meta = asset->metaInformation();
|
||||
if (!meta.has_value()) {
|
||||
continue;
|
||||
}
|
||||
metaTotal++;
|
||||
}
|
||||
|
||||
int metaCount = 0;
|
||||
for (const Asset* asset : assets) {
|
||||
std::optional<Asset::MetaInformation> meta = asset->metaInformation();
|
||||
|
||||
@@ -69,10 +79,12 @@ std::string SceneLicenseWriter::generateJson() const {
|
||||
json << fmt::format(replStr, "author", escapedJson(meta->author));
|
||||
json << fmt::format(replStr, "url", escapedJson(meta->url));
|
||||
//json << fmt::format(replStr2, "licenseText", escapedJson(license.licenseText));
|
||||
json << fmt::format(replStr2, "license", escapedJson(meta->license));
|
||||
json << fmt::format(replStr, "license", escapedJson(meta->license));
|
||||
json << fmt::format(replStr2, "path", escapedJson(asset->assetFilePath()));
|
||||
json << "}";
|
||||
|
||||
if (&asset != &(assets.back())) {
|
||||
metaCount++;
|
||||
if (metaCount != metaTotal) {
|
||||
json << ",";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user