Unverified Commit 92eefa81 authored by Emma Broman's avatar Emma Broman Committed by GitHub
Browse files

Add enabled property to Exoplanets and Skybrowser module (#1945)

* Add enabled property to exoplanets and sky browser module

* Create assets for default settings and restructure assets into a components folder

* Update exoplanets data

* Set sky browser enabled to true per default and include hover circle asset

* Add name and description of hover circle, and used synced version of ring image
parent 2b70aafa
master content/2012EventProfile feature/WSA feature/arrow-renderable feature/asset-require feature/atmosphere-stars-rendering feature/change-renderbin-runtime feature/compile-times feature/direction-hint-renderable feature/du-meshes-selection feature/gamma-correction feature/geojson feature/getting-started-tour feature/grid-labels feature/grids-update feature/gui-mouseinteraction-fix feature/horizons-unit-tests feature/imageTestKeys2Actions feature/jenkins-fix feature/jenkins-timeout feature/jwst-trail-update feature/labels-rendering feature/model-opacity feature/molecule_rendering feature/properties-visibility feature/renderable-enabled-event feature/satellites feature/saturn-shepherd-moons feature/skybrowser feature/skybrowser-cleanup feature/skybrowser-drag-and-drop feature/skybrowser-reload feature/spice-update feature/ubuntu2204 feature/userproperties feature/various-changes feature/video-on-globe feature/xbox-update issue/1479 issue/1607 issue/1751 issue/1814 issue/1827 issue/1851 issue/1989 issue/2029 issue/2055 issue/2093 issue/2111 issue/2118 issue/2121 issue/2127 issue/2133 issue/2137 issue/2194 issue/2207 issue/2209 issue/2212 issue/2236 issue/2259 issue/2261 issue/2266 issue/2269 jenkins/2286 project/2021-wisdome-installation project/exoplanet-explorer project/exoplanets-expert-tool rc/0.18.1 thesis/2020/sonification thesis/2022/climate thesis/2022/cosmic-view thesis/2022/fieldline-rendering thesis/2022/software-integration thesis/2022/software-integration_receive-ra-dec thesis/2022/streaming releases/v0.18.0
No related merge requests found
Showing with 131 additions and 19 deletions
+131 -19
......@@ -4,6 +4,10 @@
asset.require("./base_blank")
-- Modules and component settings
asset.require("modules/exoplanets/exoplanets")
asset.require("modules/skybrowser/skybrowser")
-- Specifying which other assets should be loaded in this scene
asset.require("scene/solarsystem/sun/sun")
asset.require("scene/solarsystem/sun/glare")
......@@ -20,10 +24,6 @@ asset.require("scene/milkyway/constellations/constellation_keybinds")
asset.require("scene/milkyway/objects/orionnebula/orionnebula")
asset.require("util/launcher_images")
-- For exoplanet system visualizations
asset.require("scene/milkyway/exoplanets/exoplanets_data")
asset.require("scene/milkyway/exoplanets/exoplanets_textures")
asset.require("scene/digitaluniverse/2dF")
asset.require("scene/digitaluniverse/2mass")
asset.require("scene/digitaluniverse/6dF")
......
data/assets/circle.png

17.8 KB

asset.onInitialize(function ()
openspace.setPropertyValueSingle("Modules.Exoplanets.Enabled", true)
openspace.setPropertyValueSingle("Modules.Exoplanets.ShowComparisonCircle", false)
openspace.setPropertyValueSingle("Modules.Exoplanets.ShowHabitableZone", true)
openspace.setPropertyValueSingle("Modules.Exoplanets.UseOptimisticZone", true)
openspace.setPropertyValueSingle("Modules.Exoplanets.HabitableZoneOpacity", 0.1)
end)
asset.meta = {
Name = "Exoplanet Default Settings",
Version = "1.0",
Description = [[ Some default settings related to the exoplanet module ]],
Author = "OpenSpace Team",
URL = "http://openspaceproject.com",
License = "MIT license"
}
asset.require("./default_settings")
asset.require("./exoplanets_data")
asset.require("./exoplanets_textures")
......@@ -2,7 +2,7 @@ local DataPath = asset.syncedResource({
Name = "Exoplanet Data Files",
Type = "HttpSynchronization",
Identifier = "exoplanets_data",
Version = 2
Version = 3
})
local colormaps = asset.syncedResource({
......@@ -13,6 +13,8 @@ local colormaps = asset.syncedResource({
})
asset.onInitialize(function ()
-- Set the default data files used for the exoplanet system creation
-- (Check if already set, to not override value set in another file)
local p = "Modules.Exoplanets.DataFolder";
if (openspace.getPropertyValue(p) == "") then
openspace.setPropertyValueSingle(p, DataPath)
......@@ -28,7 +30,7 @@ asset.export("DataPath", DataPath)
asset.meta = {
Name = "Exoplanet Data",
Version = "2.0",
Version = "3.0",
Description = [[ The data that is used for the exoplanet systems. The data has been
derived from the 'Planetary Systems Composite Data' dataset from the NASA Exoplanet
Archive]],
......
local habitableZoneTextures =
asset.require("../habitable_zones/habitable_zone_textures").TexturesPath
local habitableZoneTextures = asset.require(
"scene/milkyway/habitable_zones/habitable_zone_textures"
).TexturesPath
local sunTextures = asset.syncedResource({
Type = "HttpSynchronization",
......@@ -25,7 +26,7 @@ asset.onInitialize(function ()
local hzTexture = habitableZoneTextures .. "hot_to_cold_faded.png"
-- Set the default textures used for the exoplanet system creation
-- (Check if already set, to not override value in config file)
-- (Check if already set, to not override value set in another file)
local p = "Modules.Exoplanets.StarTexture";
if (openspace.getPropertyValue(p) == "") then
openspace.setPropertyValueSingle(p, starTexture)
......
asset.onInitialize(function ()
openspace.setPropertyValueSingle("Modules.SkyBrowser.Enabled", true)
-- More settings are available, but for now using the default values
end)
asset.meta = {
Name = "SkyBrowser Module Default Settings",
Version = "1.0",
Description = [[ Some default settings related to the SkyBrowser module ]],
Author = "OpenSpace Team",
URL = "http://openspaceproject.com",
License = "MIT license"
}
......@@ -2,6 +2,13 @@
local transforms = asset.require("scene/solarsystem/sun/transforms")
local ringImage = asset.syncedResource({
Name = "Hover Circle Image",
Type = "HttpSynchronization",
Identifier = "misc_ring_image",
Version = 1
})
local circle = {
Identifier = "hoverCircle",
Parent = transforms.SolarSystemBarycenter.Identifier,
......@@ -10,9 +17,13 @@ local circle = {
Size = 3.0E15,
Origin = "Center",
Billboard = true,
Texture = "${ASSETS}/circle.png"
Texture = ringImage
},
GUI = {
Name = "Hover Circle",
Description = [[A circular marker that shows the position on the night sky
of the object hovered in the sky browser UI. The circle will hide/show up
dynamically, depending on the interaction with the items in the UI. ]],
Path = "/SkyBrowser"
}
}
......@@ -27,3 +38,13 @@ asset.onDeinitialize(function()
end)
asset.export(circle)
asset.meta = {
Name = "SkyBrowser Hover Circle",
Version = "1.0",
Description = [[Includes a circular marker that shows the position on the night sky
of the object hovered in the sky browser UI. ]],
Author = "OpenSpace Team",
URL = "http://openspaceproject.com",
License = "MIT license"
}
asset.require("./default_settings")
asset.require("./hoverCircle")
......@@ -51,6 +51,12 @@
#include "exoplanetsmodule_lua.inl"
namespace {
constexpr const openspace::properties::Property::PropertyInfo EnabledInfo = {
"Enabled",
"Enabled",
"Decides if the GUI for this module should be enabled."
};
constexpr const openspace::properties::Property::PropertyInfo DataFolderInfo = {
"DataFolder",
"Data Folder",
......@@ -139,6 +145,9 @@ namespace {
constexpr const char LookupTableFileName[] = "lookup.txt";
struct [[codegen::Dictionary(ExoplanetsModule)]] Parameters {
// [[codegen::verbatim(EnabledInfo.description)]]
std::optional<bool> enabled;
// [[codegen::verbatim(DataFolderInfo.description)]]
std::optional<std::filesystem::path> dataFolder [[codegen::directory()]];
......@@ -181,6 +190,7 @@ using namespace exoplanets;
ExoplanetsModule::ExoplanetsModule()
: OpenSpaceModule(Name)
, _enabled(EnabledInfo)
, _exoplanetsDataFolder(DataFolderInfo)
, _bvColorMapPath(BvColorMapInfo)
, _starTexturePath(StarTextureInfo)
......@@ -191,10 +201,12 @@ ExoplanetsModule::ExoplanetsModule()
, _showComparisonCircle(ShowComparisonCircleInfo, false)
, _showHabitableZone(ShowHabitableZoneInfo, true)
, _useOptimisticZone(UseOptimisticZoneInfo, true)
, _habitableZoneOpacity(HabitableZoneOpacityInfo, 0.1f, 0.0f, 1.0f)
, _habitableZoneOpacity(HabitableZoneOpacityInfo, 0.1f, 0.f, 1.f)
{
_exoplanetsDataFolder.setReadOnly(true);
addProperty(_enabled);
addProperty(_exoplanetsDataFolder);
addProperty(_bvColorMapPath);
addProperty(_starTexturePath);
......@@ -273,6 +285,8 @@ float ExoplanetsModule::habitableZoneOpacity() const {
void ExoplanetsModule::internalInitialize(const ghoul::Dictionary& dict) {
const Parameters p = codegen::bake<Parameters>(dict);
_enabled = p.enabled.value_or(true);
if (p.dataFolder.has_value()) {
_exoplanetsDataFolder = p.dataFolder.value().string();
}
......
......@@ -74,6 +74,8 @@ protected:
properties::BoolProperty _useOptimisticZone;
properties::FloatProperty _habitableZoneOpacity;
properties::BoolProperty _enabled;
};
} // namespace openspace
......
......@@ -39,6 +39,12 @@
#include "skybrowsermodule_lua.inl"
namespace {
constexpr const openspace::properties::Property::PropertyInfo EnabledInfo = {
"Enabled",
"Enabled",
"Decides if the GUI for this module should be enabled."
};
constexpr const openspace::properties::Property::PropertyInfo AllowRotationInfo = {
"AllowCameraRotation",
"Allow Camera Rotation",
......@@ -66,6 +72,9 @@ namespace {
};
struct [[codegen::Dictionary(SkyBrowserModule)]] Parameters {
// [[codegen::verbatim(EnabledInfo.description)]]
std::optional<bool> enabled;
// [[codegen::verbatim(AllowRotationInfo.description)]]
std::optional<bool> allowCameraRotation;
......@@ -86,11 +95,13 @@ namespace openspace {
SkyBrowserModule::SkyBrowserModule()
: OpenSpaceModule(SkyBrowserModule::Name)
, _enabled(EnabledInfo)
, _allowCameraRotation(AllowRotationInfo, true)
, _cameraRotationSpeed(CameraRotSpeedInfo, 0.5, 0.0, 1.0)
, _targetAnimationSpeed(TargetSpeedInfo, 0.2, 0.0, 1.0)
, _browserAnimationSpeed(BrowserSpeedInfo, 5.0, 0.0, 10.0)
{
addProperty(_enabled);
addProperty(_allowCameraRotation);
addProperty(_cameraRotationSpeed);
addProperty(_targetAnimationSpeed);
......@@ -108,7 +119,7 @@ SkyBrowserModule::SkyBrowserModule()
global::callback::preSync->emplace_back([this]() {
constexpr double SolarSystemRadius = 30.0 * distanceconstants::AstronomicalUnit;
// Disable browser and targets when camera is outside of solar system
bool camWasInSolarSystem = _isCameraInSolarSystem;
glm::dvec3 cameraPos = global::navigationHandler->camera()->positionVec3();
......@@ -160,7 +171,8 @@ SkyBrowserModule::SkyBrowserModule()
void SkyBrowserModule::internalInitialize(const ghoul::Dictionary& dict) {
const Parameters p = codegen::bake<Parameters>(dict);
// Register ScreenSpaceRenderable
_enabled = p.enabled.value_or(true);
ghoul::TemplateFactory<ScreenSpaceRenderable>* fScreenSpaceRenderable =
FactoryManager::ref().factory<ScreenSpaceRenderable>();
ghoul_assert(fScreenSpaceRenderable, "ScreenSpaceRenderable factory was not created");
......@@ -168,7 +180,6 @@ void SkyBrowserModule::internalInitialize(const ghoul::Dictionary& dict) {
// Register ScreenSpaceSkyBrowser
fScreenSpaceRenderable->registerClass<ScreenSpaceSkyBrowser>("ScreenSpaceSkyBrowser");
// Register ScreenSpaceRenderable
ghoul::TemplateFactory<Renderable>* fRenderable =
FactoryManager::ref().factory<Renderable>();
ghoul_assert(fRenderable, "Renderable factory was not created");
......
......@@ -103,6 +103,7 @@ protected:
void internalInitialize(const ghoul::Dictionary& dict) override;
private:
properties::BoolProperty _enabled;
properties::BoolProperty _allowCameraRotation;
properties::DoubleProperty _cameraRotationSpeed;
properties::DoubleProperty _targetAnimationSpeed;
......
......@@ -187,13 +187,10 @@ ModuleConfigurations = {
},
Space = {
ShowExceptions = false
},
Exoplanets = {
ShowComparisonCircle = false,
ShowHabitableZone = true,
UseOptimisticZone = true,
HabitableZoneOpacity = 0.1
}
-- OBS! The settings for the SkyBrowser and Exoplanets modules are
-- set in individual assets, see "data/assets/modules". Note that
-- any settings addded here might be overwritten by those assets
}
Fonts = {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment