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..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", 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/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/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; 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/renderablecartesianaxes.cpp b/modules/base/rendering/renderablecartesianaxes.cpp index 792fc17adf..ebfa768ab4 100644 --- a/modules/base/rendering/renderablecartesianaxes.cpp +++ b/modules/base/rendering/renderablecartesianaxes.cpp @@ -68,8 +68,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()]]; diff --git a/modules/base/rendering/renderablesphereimagelocal.cpp b/modules/base/rendering/renderablesphereimagelocal.cpp index 2a80a598dd..5537a15780 100644 --- a/modules/base/rendering/renderablesphereimagelocal.cpp +++ b/modules/base/rendering/renderablesphereimagelocal.cpp @@ -42,7 +42,7 @@ namespace { openspace::properties::Property::Visibility::User }; - struct [[codegen::Dictionary(RenderableSphere)]] Parameters { + struct [[codegen::Dictionary(RenderableSphereImageLocal)]] Parameters { // [[codegen::verbatim(TextureInfo.description)]] std::string texture; @@ -57,7 +57,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 df81368cbe..febfa1efb8 100644 --- a/modules/base/rendering/renderablesphereimageonline.cpp +++ b/modules/base/rendering/renderablesphereimageonline.cpp @@ -64,7 +64,7 @@ namespace { ); } - struct [[codegen::Dictionary(RenderableSphere)]] Parameters { + struct [[codegen::Dictionary(RenderableSphereImageOnline)]] Parameters { // [[codegen::verbatim(TextureInfo.description)]] std::string url [[codegen::key("URL")]]; }; @@ -74,7 +74,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/base/rendering/screenspaceframebuffer.cpp b/modules/base/rendering/screenspaceframebuffer.cpp index 6b8572578c..ff3e6017d5 100644 --- a/modules/base/rendering/screenspaceframebuffer.cpp +++ b/modules/base/rendering/screenspaceframebuffer.cpp @@ -46,7 +46,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 14fd550176..bbac74ebec 100644 --- a/modules/space/rendering/renderabletravelspeed.cpp +++ b/modules/space/rendering/renderabletravelspeed.cpp @@ -83,7 +83,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; } diff --git a/modules/video/videomodule.cpp b/modules/video/videomodule.cpp index 13a5b97e2e..b15d8d91a7 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() }; } diff --git a/src/documentation/documentationengine.cpp b/src/documentation/documentationengine.cpp index 3597e53e00..904582cfa6 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); } } @@ -550,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 { @@ -604,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 @@ -626,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(); @@ -638,22 +633,34 @@ 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, - 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(); +} + +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 + 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 << scripting.dump(); + } + out.close(); } nlohmann::json DocumentationEngine::generateActionJson() const { diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 2e34ffdb05..ec4bc07ee1 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -805,7 +805,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