From 9777f3cca422e729f1fc5e1bde85bb83cd5d5905 Mon Sep 17 00:00:00 2001 From: Ylva Selling Date: Tue, 26 Mar 2024 11:55:10 +0100 Subject: [PATCH 1/8] Add members variable with an empty array for components that don't have members This is for easier processing later --- src/documentation/documentationengine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/documentation/documentationengine.cpp b/src/documentation/documentationengine.cpp index 0323e6be76..8423694f7a 100644 --- a/src/documentation/documentationengine.cpp +++ b/src/documentation/documentationengine.cpp @@ -512,6 +512,7 @@ nlohmann::json DocumentationEngine::generateFactoryManagerJson() const { nlohmann::json documentation; documentation[NameKey] = factoryInfo.name; documentation[IdentifierKey] = factoryInfo.name; + documentation[MembersKey] = nlohmann::json::array(); factory[ClassesKey].push_back(documentation); } @@ -532,6 +533,7 @@ nlohmann::json DocumentationEngine::generateFactoryManagerJson() const { nlohmann::json documentation; documentation[NameKey] = c; documentation[IdentifierKey] = c; + documentation[MembersKey] = nlohmann::json::array(); factory[ClassesKey].push_back(documentation); } } From f0951bc6b578ba52b607c05558f5714a012db0c8 Mon Sep 17 00:00:00 2001 From: Ylva Selling Date: Tue, 26 Mar 2024 11:55:47 +0100 Subject: [PATCH 2/8] Make lists have a whitespace after a comma It will make the string more readable and enable linebreaks in a table --- include/openspace/documentation/verifier.inl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/openspace/documentation/verifier.inl b/include/openspace/documentation/verifier.inl index 40a623cd54..dab3c5d699 100644 --- a/include/openspace/documentation/verifier.inl +++ b/include/openspace/documentation/verifier.inl @@ -404,12 +404,12 @@ std::string InListVerifier::documentation() const { std::copy( values.begin(), values.end(), - std::ostream_iterator(s, ",") + std::ostream_iterator(s, ", ") ); std::string joined = s.str(); - // We need to remove a trailing ',' at the end of the string - result += joined.substr(0, joined.size() - 1); + // We need to remove a trailing ',' and whitespace at the end of the string + result += joined.substr(0, joined.size() - 2); result += " }"; return result; From 318a3b6f4537f54a12dcd7dbfcc009d813e067ec Mon Sep 17 00:00:00 2001 From: Ylva Selling Date: Wed, 27 Mar 2024 11:17:59 +0100 Subject: [PATCH 3/8] Write two json files for the asset components and the scripting api and .gitignore them --- documentation | 2 +- src/documentation/documentationengine.cpp | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/documentation b/documentation index 3bd1b1600a..15696c6d5c 160000 --- a/documentation +++ b/documentation @@ -1 +1 @@ -Subproject commit 3bd1b1600a015172cd38bf8bbaf6be99dd81d162 +Subproject commit 15696c6d5c95bf51b136efb76a6467a6d2ecfa8f diff --git a/src/documentation/documentationengine.cpp b/src/documentation/documentationengine.cpp index 8423694f7a..fdfb11971f 100644 --- a/src/documentation/documentationengine.cpp +++ b/src/documentation/documentationengine.cpp @@ -649,15 +649,28 @@ void DocumentationEngine::writeDocumentation() const { scriptingResult[DataKey] = scripting; nlohmann::json documentation = { - sceneGraph, sceneProperties, actions, events, keybindings, license, - scriptingResult, factory + sceneGraph, sceneProperties, actions, events, keybindings, license }; nlohmann::json result; result[DocumentationKey] = documentation; + // Make into a javascript variable so that it is possible to open with static html std::ofstream out = std::ofstream(absPath("${DOCUMENTATION}/documentationData.js")); out << "var data = " << result.dump(); + out.close(); + + // Write two json files for the static docs page - asset components and scripting api + out.open(absPath("${DOCUMENTATION}/assetComponents.json")); + if (out) { + out << factory.dump(); + } + out.close(); + out.open(absPath("${DOCUMENTATION}/scriptingApi.json")); + if (out) { + out << scriptingResult.dump(); + } + out.close(); } nlohmann::json DocumentationEngine::generateActionJson() const { From 22c00f243797e012dd8e7c0270941603acda7ae8 Mon Sep 17 00:00:00 2001 From: Ylva Selling Date: Mon, 8 Apr 2024 13:45:01 +0200 Subject: [PATCH 4/8] Clean up typos and duplicates in documentation --- .../earth/moon/nasa-treks/LRO_Narrow_Angle_Camera.asset | 2 +- modules/base/rendering/renderablesphereimagelocal.cpp | 2 +- modules/base/rendering/renderablesphereimageonline.cpp | 2 +- modules/base/rendering/screenspaceframebuffer.cpp | 2 +- modules/gaia/scripts/filtering.lua | 5 ----- modules/space/rendering/renderabletravelspeed.cpp | 2 +- modules/video/src/screenspacevideo.cpp | 5 +---- 7 files changed, 6 insertions(+), 14 deletions(-) diff --git a/data/assets/scene/solarsystem/planets/earth/moon/nasa-treks/LRO_Narrow_Angle_Camera.asset b/data/assets/scene/solarsystem/planets/earth/moon/nasa-treks/LRO_Narrow_Angle_Camera.asset index 78de5ec0a9..314df1893f 100644 --- a/data/assets/scene/solarsystem/planets/earth/moon/nasa-treks/LRO_Narrow_Angle_Camera.asset +++ b/data/assets/scene/solarsystem/planets/earth/moon/nasa-treks/LRO_Narrow_Angle_Camera.asset @@ -293,7 +293,7 @@ asset.export("NAC_DTM_APOLLO17_SLOPE", treks_NAC_DTM_APOLLO17_SLOPE) asset.meta = { - Name = [[NASA Treks Layers for Moon LRO_Narrow_Angle_Camera], + Name = [NASA Treks Layers for Moon LRO_Narrow_Angle_Camera], Version = "1.0", Author = "NASA/Treks", URL = "https://trek.nasa.gov/moon", diff --git a/modules/base/rendering/renderablesphereimagelocal.cpp b/modules/base/rendering/renderablesphereimagelocal.cpp index c82abf7788..c1f1cf97a3 100644 --- a/modules/base/rendering/renderablesphereimagelocal.cpp +++ b/modules/base/rendering/renderablesphereimagelocal.cpp @@ -43,7 +43,7 @@ namespace { openspace::properties::Property::Visibility::User }; - struct [[codegen::Dictionary(RenderableSphere)]] Parameters { + struct [[codegen::Dictionary(RenderableSphereImageLocal)]] Parameters { // [[codegen::verbatim(TextureInfo.description)]] std::string texture; diff --git a/modules/base/rendering/renderablesphereimageonline.cpp b/modules/base/rendering/renderablesphereimageonline.cpp index bf2757bdc1..c9090bce1d 100644 --- a/modules/base/rendering/renderablesphereimageonline.cpp +++ b/modules/base/rendering/renderablesphereimageonline.cpp @@ -65,7 +65,7 @@ namespace { ); } - struct [[codegen::Dictionary(RenderableSphere)]] Parameters { + struct [[codegen::Dictionary(RenderableSphereImageOnline)]] Parameters { // [[codegen::verbatim(TextureInfo.description)]] std::string url [[codegen::key("URL")]]; }; diff --git a/modules/base/rendering/screenspaceframebuffer.cpp b/modules/base/rendering/screenspaceframebuffer.cpp index 81380c5ede..d0d555e027 100644 --- a/modules/base/rendering/screenspaceframebuffer.cpp +++ b/modules/base/rendering/screenspaceframebuffer.cpp @@ -47,7 +47,7 @@ namespace openspace { documentation::Documentation ScreenSpaceFramebuffer::Documentation() { using namespace documentation; return { - "ScreenSpace Framebuffer", + "ScreenSpaceFramebuffer", "base_screenspace_framebuffer", {} }; diff --git a/modules/gaia/scripts/filtering.lua b/modules/gaia/scripts/filtering.lua index f070583daf..a1f7adea56 100644 --- a/modules/gaia/scripts/filtering.lua +++ b/modules/gaia/scripts/filtering.lua @@ -13,11 +13,6 @@ openspace.gaia.documentation = { Name = "addClippingSphere", Arguments = { name = "String", radius = "Number" }, Documentation = "Creates a clipping sphere for the Gaia renderable in the first argument" - }, - { - Name = "removeClippingBox", - Arguments = {}, - Documentation = "" } } diff --git a/modules/space/rendering/renderabletravelspeed.cpp b/modules/space/rendering/renderabletravelspeed.cpp index 5b3ab4d252..afbb068ae8 100644 --- a/modules/space/rendering/renderabletravelspeed.cpp +++ b/modules/space/rendering/renderabletravelspeed.cpp @@ -86,7 +86,7 @@ namespace { openspace::properties::Property::Visibility::User }; - struct [[codegen::Dictionary(RenderableLightTravel)]] Parameters { + struct [[codegen::Dictionary(RenderableTravelSpeed)]] Parameters { // [[codegen::verbatim(TargetInfo.description)]] std::string target; diff --git a/modules/video/src/screenspacevideo.cpp b/modules/video/src/screenspacevideo.cpp index 9d5f62964c..fed1d4b58b 100644 --- a/modules/video/src/screenspacevideo.cpp +++ b/modules/video/src/screenspacevideo.cpp @@ -38,13 +38,10 @@ namespace openspace { documentation::Documentation ScreenSpaceVideo::Documentation() { - documentation::Documentation doc = ScreenSpaceRenderable::Documentation(); + documentation::Documentation doc = VideoPlayer::Documentation(); doc.name = "ScreenSpaceVideo"; doc.id = "video_screenspacevideo"; - documentation::Documentation vp = VideoPlayer::Documentation(); - doc.entries.insert(doc.entries.end(), vp.entries.begin(), vp.entries.end()); - return doc; } From 5fdc3bf45fca75cd581ee63371143ff1b81e83da Mon Sep 17 00:00:00 2001 From: Ylva Selling Date: Mon, 8 Apr 2024 14:10:37 +0200 Subject: [PATCH 5/8] Remove todo link (as the documentation will link to asset) --- modules/base/rendering/renderablecartesianaxes.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/base/rendering/renderablecartesianaxes.cpp b/modules/base/rendering/renderablecartesianaxes.cpp index da67e3c4ce..12b1791a29 100644 --- a/modules/base/rendering/renderablecartesianaxes.cpp +++ b/modules/base/rendering/renderablecartesianaxes.cpp @@ -71,8 +71,6 @@ namespace { // other node as the Parent of the node with this renderable. Also, the axes have to // be scaled to match the parent object for the axes to be visible in the scene, for // example using a StaticScale. - // - // See example asset (@TODO: link to asset file). struct [[codegen::Dictionary(RenderableCartesianAxes)]] Parameters { // [[codegen::verbatim(XColorInfo.description)]] std::optional xColor [[codegen::color()]]; From 9db86c79d4fb84469ae473ec1ad764e3f7b3ef42 Mon Sep 17 00:00:00 2001 From: Ylva Selling Date: Fri, 19 Apr 2024 11:13:19 +0200 Subject: [PATCH 6/8] Make abstract classes RenderablePlane and RenderableSphere, as well as VideoPlayer, not appear in the documentation. Add them to the derived classes instead --- modules/base/basemodule.cpp | 2 -- modules/base/rendering/renderablesphereimagelocal.cpp | 5 ++++- modules/base/rendering/renderablesphereimageonline.cpp | 5 ++++- modules/video/videomodule.cpp | 3 +-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/modules/base/basemodule.cpp b/modules/base/basemodule.cpp index 011cce0547..73662afcf6 100644 --- a/modules/base/basemodule.cpp +++ b/modules/base/basemodule.cpp @@ -236,7 +236,6 @@ std::vector BaseModule::documentations() const { RenderableModel::Documentation(), RenderableNodeArrow::Documentation(), RenderableNodeLine::Documentation(), - RenderablePlane::Documentation(), RenderablePlaneImageLocal::Documentation(), RenderablePlaneImageOnline::Documentation(), RenderablePlaneTimeVaryingImage::Documentation(), @@ -244,7 +243,6 @@ std::vector BaseModule::documentations() const { RenderablePolygonCloud::Documentation(), RenderablePrism::Documentation(), RenderableRadialGrid::Documentation(), - RenderableSphere::Documentation(), RenderableSphereImageLocal::Documentation(), RenderableSphereImageOnline::Documentation(), RenderableSphericalGrid::Documentation(), diff --git a/modules/base/rendering/renderablesphereimagelocal.cpp b/modules/base/rendering/renderablesphereimagelocal.cpp index c1f1cf97a3..044edb458b 100644 --- a/modules/base/rendering/renderablesphereimagelocal.cpp +++ b/modules/base/rendering/renderablesphereimagelocal.cpp @@ -58,7 +58,10 @@ namespace { namespace openspace { documentation::Documentation RenderableSphereImageLocal::Documentation() { - return codegen::doc("base_renderable_sphere_image_local"); + return codegen::doc( + "base_renderable_sphere_image_local", + RenderableSphere::Documentation() + ); } RenderableSphereImageLocal::RenderableSphereImageLocal( diff --git a/modules/base/rendering/renderablesphereimageonline.cpp b/modules/base/rendering/renderablesphereimageonline.cpp index c9090bce1d..9813fe52fe 100644 --- a/modules/base/rendering/renderablesphereimageonline.cpp +++ b/modules/base/rendering/renderablesphereimageonline.cpp @@ -75,7 +75,10 @@ namespace { namespace openspace { documentation::Documentation RenderableSphereImageOnline::Documentation() { - return codegen::doc("base_renderable_sphere_image_online"); + return codegen::doc( + "base_renderable_sphere_image_online", + RenderableSphere::Documentation() + ); } RenderableSphereImageOnline::RenderableSphereImageOnline( diff --git a/modules/video/videomodule.cpp b/modules/video/videomodule.cpp index cb914478c2..ba0652f03e 100644 --- a/modules/video/videomodule.cpp +++ b/modules/video/videomodule.cpp @@ -85,8 +85,7 @@ std::vector VideoModule::documentations() const { RenderableVideoPlane::Documentation(), RenderableVideoSphere::Documentation(), ScreenSpaceVideo::Documentation(), - globebrowsing::VideoTileProvider::Documentation(), - VideoPlayer::Documentation() + globebrowsing::VideoTileProvider::Documentation() }; } From 708143d06e6eff9f6717a38739293960ecba7764 Mon Sep 17 00:00:00 2001 From: Ylva Selling Date: Tue, 23 Apr 2024 10:54:30 +0200 Subject: [PATCH 7/8] Make json file printout a separate function --- .../documentation/documentationengine.h | 3 ++- src/documentation/documentationengine.cpp | 26 +++++++------------ src/engine/openspaceengine.cpp | 2 +- src/engine/openspaceengine_lua.inl | 2 +- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/include/openspace/documentation/documentationengine.h b/include/openspace/documentation/documentationengine.h index 17a9bb0991..cf9dbeff45 100644 --- a/include/openspace/documentation/documentationengine.h +++ b/include/openspace/documentation/documentationengine.h @@ -87,7 +87,8 @@ public: */ static DocumentationEngine& ref(); - void writeDocumentation() const; + void writeJavascriptDocumentation() const; + void writeJsonDocumentation() const; nlohmann::json generateScriptEngineJson() const; nlohmann::json generateFactoryManagerJson() const; diff --git a/src/documentation/documentationengine.cpp b/src/documentation/documentationengine.cpp index 5c69c9ba3e..904582cfa6 100644 --- a/src/documentation/documentationengine.cpp +++ b/src/documentation/documentationengine.cpp @@ -552,12 +552,7 @@ nlohmann::json DocumentationEngine::generateFactoryManagerJson() const { json.push_back(leftovers); sortJson(json, NameKey); - // I did not check the output of this for correctness ---abock - nlohmann::json result; - result[NameKey] = FactoryTitle; - result[DataKey] = json; - - return result; + return json; } nlohmann::json DocumentationEngine::generateKeybindingsJson() const { @@ -606,7 +601,7 @@ nlohmann::json DocumentationEngine::generatePropertyOwnerJson( return result; } -void DocumentationEngine::writeDocumentation() const { +void DocumentationEngine::writeJavascriptDocumentation() const { ZoneScoped; // Write documentation to json files if config file supplies path for doc files @@ -628,8 +623,6 @@ void DocumentationEngine::writeDocumentation() const { global::renderEngine->scene() ); - nlohmann::json scripting = generateScriptEngineJson(); - nlohmann::json factory = generateFactoryManagerJson(); nlohmann::json keybindings = generateKeybindingsJson(); nlohmann::json license = generateLicenseGroupsJson(); nlohmann::json sceneProperties = settings.get(); @@ -640,12 +633,6 @@ void DocumentationEngine::writeDocumentation() const { sceneProperties[NameKey] = SettingsTitle; sceneGraph[NameKey] = SceneTitle; - // Add this here so that the generateJson function is the same as before to ensure - // backwards compatibility - nlohmann::json scriptingResult; - scriptingResult[NameKey] = ScriptingTitle; - scriptingResult[DataKey] = scripting; - nlohmann::json documentation = { sceneGraph, sceneProperties, actions, events, keybindings, license }; @@ -657,16 +644,21 @@ void DocumentationEngine::writeDocumentation() const { std::ofstream out = std::ofstream(absPath("${DOCUMENTATION}/documentationData.js")); out << "var data = " << result.dump(); out.close(); +} + +void DocumentationEngine::writeJsonDocumentation() const { + nlohmann::json factory = generateFactoryManagerJson(); + nlohmann::json scripting = generateScriptEngineJson(); // Write two json files for the static docs page - asset components and scripting api - out.open(absPath("${DOCUMENTATION}/assetComponents.json")); + std::ofstream out = std::ofstream(absPath("${DOCUMENTATION}/assetComponents.json")); if (out) { out << factory.dump(); } out.close(); out.open(absPath("${DOCUMENTATION}/scriptingApi.json")); if (out) { - out << scriptingResult.dump(); + out << scripting.dump(); } out.close(); } diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index cf91a8cf1c..04a5021b09 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -806,7 +806,7 @@ void OpenSpaceEngine::loadAssets() { runGlobalCustomizationScripts(); _writeDocumentationTask = std::async( - &documentation::DocumentationEngine::writeDocumentation, + &documentation::DocumentationEngine::writeJavascriptDocumentation, DocEng ); diff --git a/src/engine/openspaceengine_lua.inl b/src/engine/openspaceengine_lua.inl index 031eaa5193..616e64446b 100644 --- a/src/engine/openspaceengine_lua.inl +++ b/src/engine/openspaceengine_lua.inl @@ -39,7 +39,7 @@ namespace { * Writes out documentation files */ [[codegen::luawrap]] void writeDocumentation() { - DocEng.writeDocumentation(); + DocEng.writeJavascriptDocumentation(); } // Sets the folder used for storing screenshots or session recording frames From c79de65486c995e552673b23905eb724b6421762 Mon Sep 17 00:00:00 2001 From: Ylva Selling Date: Tue, 30 Apr 2024 16:10:33 +0200 Subject: [PATCH 8/8] Update data/assets/scene/solarsystem/planets/earth/moon/nasa-treks/LRO_Narrow_Angle_Camera.asset Co-authored-by: Alexander Bock --- .../planets/earth/moon/nasa-treks/LRO_Narrow_Angle_Camera.asset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/assets/scene/solarsystem/planets/earth/moon/nasa-treks/LRO_Narrow_Angle_Camera.asset b/data/assets/scene/solarsystem/planets/earth/moon/nasa-treks/LRO_Narrow_Angle_Camera.asset index 314df1893f..80d2838451 100644 --- a/data/assets/scene/solarsystem/planets/earth/moon/nasa-treks/LRO_Narrow_Angle_Camera.asset +++ b/data/assets/scene/solarsystem/planets/earth/moon/nasa-treks/LRO_Narrow_Angle_Camera.asset @@ -293,7 +293,7 @@ asset.export("NAC_DTM_APOLLO17_SLOPE", treks_NAC_DTM_APOLLO17_SLOPE) asset.meta = { - Name = [NASA Treks Layers for Moon LRO_Narrow_Angle_Camera], + Name = [[NASA Treks Layers for Moon LRO_Narrow_Angle_Camera]], Version = "1.0", Author = "NASA/Treks", URL = "https://trek.nasa.gov/moon",