mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-24 04:59:24 -06:00
Merge remote-tracking branch 'origin/master' into feature/NewAtmosphere
# Conflicts: # modules/imgui/src/renderproperties.cpp
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -135,3 +135,4 @@ data/scene/digitaluniverse/*/textures/*.jpg
|
||||
data/scene/digitaluniverse/*/textures/*.pbm
|
||||
data/scene/digitaluniverse/*/textures/*.png
|
||||
data/scene/digitaluniverse/*/textures/*.sgi
|
||||
customization.lua
|
||||
|
||||
@@ -19,7 +19,7 @@ function postInitialization()
|
||||
created and initialized, but before the first render call. This is the place to set
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
set_default_gui_sorting()
|
||||
openspace.set_default_gui_sorting()
|
||||
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("Sun.renderable.Enabled", false)
|
||||
|
||||
@@ -19,7 +19,7 @@ function postInitialization()
|
||||
created and initialized, but before the first render call. This is the place to set
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
set_default_gui_sorting()
|
||||
openspace.set_default_gui_sorting()
|
||||
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("Sun.renderable.Enabled", false)
|
||||
|
||||
@@ -18,8 +18,6 @@ local vrt_folders = {
|
||||
}
|
||||
}
|
||||
|
||||
dofile(openspace.absPath('${SCRIPTS}/scene_helper.lua'))
|
||||
|
||||
function preInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after the scene is loaded but before the
|
||||
@@ -74,7 +72,7 @@ function preInitialization()
|
||||
end
|
||||
|
||||
function postInitialization()
|
||||
set_default_gui_sorting()
|
||||
openspace.set_default_gui_sorting()
|
||||
|
||||
openspace.addVirtualProperty(
|
||||
"BoolProperty",
|
||||
@@ -113,7 +111,7 @@ function postInitialization()
|
||||
|
||||
-- Defined in scene_helper.lua
|
||||
-- Used to create focus buttons for a subset of scenegraph nodes
|
||||
mark_interesting_nodes({
|
||||
openspace.mark_interesting_nodes({
|
||||
"Earth", "Mars", "Moon"
|
||||
})
|
||||
end
|
||||
|
||||
@@ -193,6 +193,10 @@ return {
|
||||
Name = "ESRI Imagery World 2D",
|
||||
FilePath = "map_service_configs/ESRI/ESRI_Imagery_World_2D.wms",
|
||||
},
|
||||
{
|
||||
Name = "World Imagery",
|
||||
FilePath = "map_service_configs/ESRI/World_Imagery.wms",
|
||||
},
|
||||
{
|
||||
Name = "Temporal VIIRS SNPP",
|
||||
Type = "TemporalTileLayer",
|
||||
|
||||
21
data/scene/earth/map_service_configs/ESRI/World_Imagery.wms
Normal file
21
data/scene/earth/map_service_configs/ESRI/World_Imagery.wms
Normal file
@@ -0,0 +1,21 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://wi.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/WMTS/tile/1.0.0/World_Imagery/default/default/${z}/${y}/${x}.jpg</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90</UpperLeftY>
|
||||
<LowerRightX>180</LowerRightX>
|
||||
<LowerRightY>-89.999999</LowerRightY>
|
||||
<TileLevel>19</TileLevel>
|
||||
<TileCountX>2</TileCountX>
|
||||
<TileCountY>1</TileCountY>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>256</BlockSizeX>
|
||||
<BlockSizeY>256</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
<MaxConnections>5</MaxConnections>
|
||||
<OfflineMode>false</OfflineMode>
|
||||
</GDAL_WMS>
|
||||
@@ -19,7 +19,7 @@ function postInitialization()
|
||||
created and initialized, but before the first render call. This is the place to set
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
set_default_gui_sorting()
|
||||
openspace.set_default_gui_sorting()
|
||||
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("Sun.renderable.Enabled", false)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
dofile(openspace.absPath('${SCRIPTS}/scene_helper.lua'))
|
||||
|
||||
function preInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after the scene is loaded but before the
|
||||
@@ -27,7 +25,7 @@ function postInitialization()
|
||||
created and initialized, but before the first render call. This is the place to set
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
set_default_gui_sorting()
|
||||
openspace.set_default_gui_sorting()
|
||||
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("Sun.renderable.Enabled", false)
|
||||
@@ -41,7 +39,7 @@ function postInitialization()
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
|
||||
mark_interesting_nodes({
|
||||
openspace.mark_interesting_nodes({
|
||||
"Jupiter", "Juno"
|
||||
})
|
||||
end
|
||||
|
||||
@@ -23,10 +23,6 @@ return {
|
||||
Layers = {
|
||||
ColorLayers = {
|
||||
-- MoonTrek based servers
|
||||
{
|
||||
Name = "Apollo 16 Metric Cam Image Mosaic",
|
||||
FilePath = "map_service_configs/MoonTrek/Apollo16_Metric_Cam_Image_Mosaic.wms"
|
||||
},
|
||||
-- Utah based servers
|
||||
{
|
||||
Name = "ClemUvvis",
|
||||
|
||||
@@ -19,8 +19,6 @@ charon_image = "textures/NH_Charon_mosaic.png"
|
||||
charon_height = "textures/NH_Charon_DTM.png"
|
||||
-- charon_height = "textures/NH_Charon_DTM_8192.png"
|
||||
|
||||
dofile(openspace.absPath('${SCRIPTS}/scene_helper.lua'))
|
||||
|
||||
function preInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after the scene is loaded but before the
|
||||
@@ -28,7 +26,7 @@ function preInitialization()
|
||||
which the scene should start and other settings that might determine initialization
|
||||
critical objects.
|
||||
]]--
|
||||
set_default_gui_sorting()
|
||||
openspace.set_default_gui_sorting()
|
||||
|
||||
openspace.spice.loadKernel("${SPICE}/naif0012.tls")
|
||||
openspace.spice.loadKernel("${SPICE}/pck00010.tpc")
|
||||
@@ -193,7 +191,7 @@ function postInitialization()
|
||||
|
||||
-- Defined in scene_helper.lua
|
||||
-- Used to create focus buttons for a subset of scenegraph nodes
|
||||
mark_interesting_nodes({
|
||||
openspace.mark_interesting_nodes({
|
||||
"Pluto", "NewHorizons", "Charon"
|
||||
})
|
||||
end
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
KernelCase = 2 -- Right now we only have the image times for case 2
|
||||
|
||||
dofile(openspace.absPath('${SCRIPTS}/scene_helper.lua'))
|
||||
|
||||
function preInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after the scene is loaded but before the
|
||||
@@ -83,7 +81,7 @@ function postInitialization()
|
||||
created and initialized, but before the first render call. This is the place to set
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
set_default_gui_sorting()
|
||||
openspace.set_default_gui_sorting()
|
||||
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("Sun.renderable.Enabled", false)
|
||||
@@ -106,7 +104,7 @@ function postInitialization()
|
||||
|
||||
openspace.navigation.resetCameraDirection()
|
||||
|
||||
mark_interesting_nodes({
|
||||
openspace.mark_interesting_nodes({
|
||||
"OsirisRex", "BennuBarycenter", "Earth"
|
||||
})
|
||||
end
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
dofile(openspace.absPath('${SCRIPTS}/scene_helper.lua'))
|
||||
|
||||
function preInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after the scene is loaded but before the
|
||||
@@ -93,7 +91,7 @@ function postInitialization()
|
||||
created and initialized, but before the first render call. This is the place to set
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
set_default_gui_sorting()
|
||||
openspace.set_default_gui_sorting()
|
||||
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("Sun.renderable.Enabled", false)
|
||||
@@ -107,7 +105,7 @@ function postInitialization()
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
|
||||
mark_interesting_nodes({
|
||||
openspace.mark_interesting_nodes({
|
||||
"Pluto", "NewHorizons", "Charon"
|
||||
})
|
||||
end
|
||||
|
||||
@@ -19,7 +19,7 @@ function postInitialization()
|
||||
created and initialized, but before the first render call. This is the place to set
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
set_default_gui_sorting()
|
||||
openspace.set_default_gui_sorting()
|
||||
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("Sun.renderable.Enabled", false)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
dofile(openspace.absPath('${SCRIPTS}/scene_helper.lua'))
|
||||
|
||||
function preInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after the scene is loaded but before the
|
||||
@@ -19,7 +17,7 @@ end
|
||||
function postInitialization()
|
||||
openspace.printInfo("Setting default values")
|
||||
|
||||
set_default_gui_sorting()
|
||||
openspace.set_default_gui_sorting()
|
||||
|
||||
openspace.setPropertyValueSingle("Global Properties.GlobeBrowsing.GdalWrapper.LogGdalErrors", false)
|
||||
openspace.setPropertyValueSingle("Earth.RenderableGlobe.Debug.LevelByProjectedAreaElseDistance", false)
|
||||
@@ -30,7 +28,7 @@ function postInitialization()
|
||||
|
||||
-- Defined in scene_helper.lua
|
||||
-- Used to create focus buttons for a subset of scenegraph nodes
|
||||
mark_interesting_nodes({
|
||||
openspace.mark_interesting_nodes({
|
||||
"Earth", "Voyager 1", "Voyager 2", "Jupiter", "Saturn", "Uranus", "Neptune"
|
||||
})
|
||||
end
|
||||
|
||||
@@ -51,6 +51,9 @@ public:
|
||||
/// The key that stores the location of the SGCT configuration file that is used on
|
||||
/// application launch
|
||||
static const std::string KeyConfigSgct;
|
||||
/// The key that defines a list of scripts for global customization that get executed
|
||||
/// regardless of which scene is loaded
|
||||
static const std::string KeyGlobalCustomizationScripts;
|
||||
/// The part of the key that defines the type
|
||||
static const std::string PartType;
|
||||
/// The part of the key that defines the file
|
||||
|
||||
@@ -104,8 +104,6 @@ public:
|
||||
void writeDocumentation();
|
||||
void toggleShutdownMode();
|
||||
|
||||
void runPostInitializationScripts(const std::string& sceneDescription);
|
||||
|
||||
// Guaranteed to return a valid pointer
|
||||
ConfigurationManager& configurationManager();
|
||||
LuaConsole& console();
|
||||
@@ -178,6 +176,8 @@ private:
|
||||
void gatherCommandlineArguments();
|
||||
void loadFonts();
|
||||
void runPreInitializationScripts(const std::string& sceneDescription);
|
||||
void runPostInitializationScripts(const std::string& sceneDescription);
|
||||
void runGlobalCustomizationScripts(const std::string& sceneDescription);
|
||||
void configureLogging();
|
||||
|
||||
// Components
|
||||
|
||||
@@ -40,6 +40,15 @@ namespace openspace::interaction {
|
||||
|
||||
class KeyBindingManager : public DocumentationGenerator {
|
||||
public:
|
||||
using IsLocalBind = ghoul::Boolean;
|
||||
using IsSynchronized = ghoul::Boolean;
|
||||
|
||||
struct KeyInformation {
|
||||
std::string command;
|
||||
IsSynchronized synchronization;
|
||||
std::string documentation;
|
||||
};
|
||||
|
||||
KeyBindingManager();
|
||||
~KeyBindingManager() = default;
|
||||
|
||||
@@ -59,19 +68,17 @@ public:
|
||||
std::string documentation = ""
|
||||
);
|
||||
|
||||
void removeKeyBinding(const std::string& key);
|
||||
|
||||
std::vector<std::pair<KeyWithModifier, KeyInformation>> keyBinding(
|
||||
const std::string& key) const;
|
||||
|
||||
static scripting::LuaLibrary luaLibrary();
|
||||
|
||||
// Callback functions
|
||||
void keyboardCallback(Key key, KeyModifier modifier, KeyAction action);
|
||||
|
||||
private:
|
||||
using Synchronized = ghoul::Boolean;
|
||||
|
||||
struct KeyInformation {
|
||||
std::string command;
|
||||
Synchronized synchronization;
|
||||
std::string documentation;
|
||||
};
|
||||
|
||||
std::string generateJson() const override;
|
||||
|
||||
|
||||
@@ -367,12 +367,12 @@ void NumericalProperty<T>::setMaxValue(T value) {
|
||||
|
||||
template <typename T>
|
||||
T NumericalProperty<T>::steppingValue() const {
|
||||
return _steppingValue;
|
||||
return _stepping;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void NumericalProperty<T>::setSteppingValue(T value) {
|
||||
_steppingValue = std::move(value);
|
||||
_stepping = std::move(value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -217,6 +217,7 @@ struct KeyWithModifier {
|
||||
|
||||
KeyWithModifier stringToKey(std::string str);
|
||||
bool operator<(const KeyWithModifier& lhs, const KeyWithModifier& rhs);
|
||||
bool operator==(const KeyWithModifier& lhs, const KeyWithModifier& rhs);
|
||||
|
||||
static const std::map<std::string, KeyModifier> KeyModifierMapping = {
|
||||
{ "SHIFT", KeyModifier::Shift },
|
||||
|
||||
@@ -88,6 +88,7 @@ public:
|
||||
bool _showInternals;
|
||||
|
||||
properties::BoolProperty _showHelpText;
|
||||
properties::FloatProperty _helpTextDelay;
|
||||
|
||||
private:
|
||||
void renderAndUpdatePropertyVisibility();
|
||||
|
||||
@@ -60,6 +60,7 @@ public:
|
||||
void setVisibility(properties::Property::Visibility visibility);
|
||||
void setHasRegularProperties(bool hasOnlyRegularProperties);
|
||||
void setShowHelpTooltip(bool showHelpTooltip);
|
||||
void setShowHelpTooltipDelay(double delay);
|
||||
|
||||
void render() override;
|
||||
|
||||
@@ -79,6 +80,7 @@ protected:
|
||||
properties::StringListProperty _treeOrdering;
|
||||
|
||||
bool _showHelpTooltip;
|
||||
double _tooltipDelay;
|
||||
};
|
||||
|
||||
} // namespace openspace::gui
|
||||
|
||||
@@ -43,87 +43,87 @@ void executeScript(const std::string& id, const std::string& value,
|
||||
|
||||
void renderBoolProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderOptionProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderSelectionProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderStringProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderStringListProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderDoubleProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderIntProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderIVec2Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderIVec3Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderIVec4Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderFloatProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderVec2Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderVec3Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderVec4Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderDVec2Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderDVec3Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderDVec4Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderDMat2Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderDMat3Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderDMat4Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
void renderTriggerProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes, double tooltipDelay = 1.0);
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
@@ -253,6 +253,12 @@ static const openspace::properties::Property::PropertyInfo ShowHelpInfo = {
|
||||
"explaining what impact they have on the visuals."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo HelpTextDelayInfo = {
|
||||
"HelpTextDelay",
|
||||
"Tooltip Delay (in s)",
|
||||
"This value determines the delay in seconds after which the tooltip is shown."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo HiddenInfo = {
|
||||
"IsHidden",
|
||||
"Is Hidden",
|
||||
@@ -282,6 +288,7 @@ GUI::GUI()
|
||||
, _featuredProperties("Featured Properties", GuiPropertyComponent::UseTreeLayout::No)
|
||||
, _showInternals(false)
|
||||
, _showHelpText(ShowHelpInfo, true)
|
||||
, _helpTextDelay(HelpTextDelayInfo, 1.0, 0.0, 10.0)
|
||||
, _currentVisibility(properties::Property::Visibility::Developer)
|
||||
, _allHidden(HiddenInfo, true)
|
||||
{
|
||||
@@ -304,13 +311,29 @@ GUI::GUI()
|
||||
addPropertySubOwner(_iswa);
|
||||
#endif // OPENSPACE_MODULE_ISWA_ENABLED
|
||||
|
||||
addProperty(_showHelpText);
|
||||
_showHelpText.onChange([this](){
|
||||
_globalProperty.setShowHelpTooltip(_showHelpText);
|
||||
_property.setShowHelpTooltip(_showHelpText);
|
||||
_screenSpaceProperty.setShowHelpTooltip(_showHelpText);
|
||||
_virtualProperty.setShowHelpTooltip(_showHelpText);
|
||||
});
|
||||
{
|
||||
auto showHelpTextFunc = [this](){
|
||||
_globalProperty.setShowHelpTooltip(_showHelpText);
|
||||
_property.setShowHelpTooltip(_showHelpText);
|
||||
_screenSpaceProperty.setShowHelpTooltip(_showHelpText);
|
||||
_virtualProperty.setShowHelpTooltip(_showHelpText);
|
||||
};
|
||||
showHelpTextFunc();
|
||||
_showHelpText.onChange(std::move(showHelpTextFunc));
|
||||
addProperty(_showHelpText);
|
||||
}
|
||||
|
||||
{
|
||||
auto helpTextDelayFunc = [this](){
|
||||
_globalProperty.setShowHelpTooltipDelay(_helpTextDelay);
|
||||
_property.setShowHelpTooltipDelay(_helpTextDelay);
|
||||
_screenSpaceProperty.setShowHelpTooltipDelay(_helpTextDelay);
|
||||
_virtualProperty.setShowHelpTooltipDelay(_helpTextDelay);
|
||||
};
|
||||
helpTextDelayFunc();
|
||||
_helpTextDelay.onChange(std::move(helpTextDelayFunc));
|
||||
addProperty(_helpTextDelay);
|
||||
}
|
||||
|
||||
addProperty(_allHidden);
|
||||
}
|
||||
|
||||
@@ -187,6 +187,10 @@ void GuiPropertyComponent::setShowHelpTooltip(bool showHelpTooltip) {
|
||||
_showHelpTooltip = showHelpTooltip;
|
||||
}
|
||||
|
||||
void GuiPropertyComponent::setShowHelpTooltipDelay(double delay) {
|
||||
_tooltipDelay = delay;
|
||||
}
|
||||
|
||||
void GuiPropertyComponent::renderPropertyOwner(properties::PropertyOwner* owner) {
|
||||
if (owner->propertiesRecursive().empty()) {
|
||||
return;
|
||||
@@ -425,7 +429,8 @@ void GuiPropertyComponent::renderProperty(properties::Property* prop,
|
||||
properties::PropertyOwner* owner)
|
||||
{
|
||||
using Func = std::function<
|
||||
void(properties::Property*, const std::string&, IsRegularProperty, ShowToolTip)
|
||||
void(properties::Property*, const std::string&, IsRegularProperty, ShowToolTip,
|
||||
double)
|
||||
>;
|
||||
static const std::map<std::string, Func> FunctionMapping = {
|
||||
{ "BoolProperty", &renderBoolProperty },
|
||||
@@ -463,7 +468,8 @@ void GuiPropertyComponent::renderProperty(properties::Property* prop,
|
||||
prop,
|
||||
owner->name(),
|
||||
IsRegularProperty(_hasOnlyRegularProperties),
|
||||
ShowToolTip(_showHelpTooltip)
|
||||
ShowToolTip(_showHelpTooltip),
|
||||
_tooltipDelay
|
||||
);
|
||||
}
|
||||
else {
|
||||
@@ -471,7 +477,8 @@ void GuiPropertyComponent::renderProperty(properties::Property* prop,
|
||||
prop,
|
||||
"",
|
||||
IsRegularProperty(_hasOnlyRegularProperties),
|
||||
ShowToolTip(_showHelpTooltip)
|
||||
ShowToolTip(_showHelpTooltip),
|
||||
_tooltipDelay
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <modules/imgui/include/gui.h>
|
||||
#include <modules/imgui/include/imgui_include.h>
|
||||
|
||||
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/util/timemanager.h>
|
||||
#include <openspace/util/time.h>
|
||||
@@ -82,8 +81,6 @@ void GuiSpaceTimeComponent::render() {
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10.f);
|
||||
|
||||
ImGui::Text("%s", "Focus on:");
|
||||
ImGui::SameLine();
|
||||
// Buttons for important SceneGraphNodes
|
||||
for (SceneGraphNode* n : nodes) {
|
||||
const std::vector<std::string>& tags = n->tags();
|
||||
@@ -119,7 +116,7 @@ void GuiSpaceTimeComponent::render() {
|
||||
}
|
||||
int currentPosition = static_cast<int>(std::distance(nodes.begin(), iCurrentFocus));
|
||||
|
||||
bool hasChanged = ImGui::Combo("Focus Node", ¤tPosition, nodeNames.c_str());
|
||||
bool hasChanged = ImGui::Combo("", ¤tPosition, nodeNames.c_str());
|
||||
if (hasChanged) {
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.setPropertyValue('NavigationHandler.Origin', '" +
|
||||
|
||||
@@ -41,13 +41,14 @@
|
||||
#include <ghoul/misc/misc.h>
|
||||
|
||||
#include <glm/ext.hpp>
|
||||
#include <imgui_internal.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
using namespace properties;
|
||||
|
||||
void renderTooltip(Property* prop) {
|
||||
if (ImGui::IsItemHovered()) {
|
||||
void renderTooltip(Property* prop, double delay) {
|
||||
if (ImGui::IsItemHovered() && (GImGui->HoveredIdTimer > delay)) {
|
||||
ImGui::BeginTooltip();
|
||||
if (!prop->description().empty()) {
|
||||
ImGui::TextWrapped("%s", prop->description().c_str());
|
||||
@@ -91,7 +92,8 @@ void executeScript(const std::string& id, const std::string& value,
|
||||
}
|
||||
|
||||
void renderBoolProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
BoolProperty* p = static_cast<BoolProperty*>(prop);
|
||||
@@ -101,7 +103,7 @@ void renderBoolProperty(Property* prop, const std::string& ownerName,
|
||||
BoolProperty::ValueType value = *p;
|
||||
ImGui::Checkbox(name.c_str(), &value);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
@@ -111,7 +113,8 @@ void renderBoolProperty(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderOptionProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
OptionProperty* p = static_cast<OptionProperty*>(prop);
|
||||
@@ -129,7 +132,7 @@ void renderOptionProperty(Property* prop, const std::string& ownerName,
|
||||
for (const OptionProperty::Option& o : options) {
|
||||
ImGui::RadioButton(o.description.c_str(), &value, o.value);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
}
|
||||
ImGui::Separator();
|
||||
@@ -154,6 +157,9 @@ void renderOptionProperty(Property* prop, const std::string& ownerName,
|
||||
|
||||
int oldIdx = idx;
|
||||
ImGui::Combo(name.c_str(), &idx, nodeNames.c_str());
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (idx != oldIdx) {
|
||||
value = options[idx].value;
|
||||
@@ -169,7 +175,8 @@ void renderOptionProperty(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderSelectionProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
SelectionProperty* p = static_cast<SelectionProperty*>(prop);
|
||||
@@ -190,7 +197,7 @@ void renderSelectionProperty(Property* prop, const std::string& ownerName,
|
||||
|
||||
ImGui::Checkbox(description.c_str(), &selected);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (selected) {
|
||||
@@ -212,7 +219,8 @@ void renderSelectionProperty(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderStringProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
StringProperty* p = static_cast<StringProperty*>(prop);
|
||||
@@ -235,7 +243,7 @@ void renderStringProperty(Property* prop, const std::string& ownerName,
|
||||
ImGuiInputTextFlags_EnterReturnsTrue
|
||||
);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (hasNewValue) {
|
||||
@@ -250,7 +258,8 @@ void renderStringProperty(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderStringListProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
StringListProperty* p = static_cast<StringListProperty*>(prop);
|
||||
@@ -275,7 +284,7 @@ void renderStringListProperty(Property* prop, const std::string& ownerName,
|
||||
ImGuiInputTextFlags_EnterReturnsTrue
|
||||
);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (hasNewValue) {
|
||||
@@ -300,7 +309,8 @@ void renderStringListProperty(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderDoubleProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DoubleProperty* p = static_cast<DoubleProperty*>(prop);
|
||||
@@ -313,7 +323,7 @@ void renderDoubleProperty(properties::Property* prop, const std::string& ownerNa
|
||||
|
||||
ImGui::SliderFloat(name.c_str(), &value, min, max, "%.5f", p->exponent());
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != static_cast<float>(p->value())) {
|
||||
@@ -324,7 +334,8 @@ void renderDoubleProperty(properties::Property* prop, const std::string& ownerNa
|
||||
}
|
||||
|
||||
void renderIntProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
IntProperty* p = static_cast<IntProperty*>(prop);
|
||||
@@ -337,7 +348,7 @@ void renderIntProperty(Property* prop, const std::string& ownerName,
|
||||
|
||||
ImGui::SliderInt(name.c_str(), &value, min, max);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
@@ -348,7 +359,8 @@ void renderIntProperty(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderIVec2Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
IVec2Property* p = static_cast<IVec2Property*>(prop);
|
||||
@@ -365,7 +377,7 @@ void renderIVec2Property(Property* prop, const std::string& ownerName,
|
||||
max
|
||||
);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
@@ -380,7 +392,8 @@ void renderIVec2Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderIVec3Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
IVec3Property* p = static_cast<IVec3Property*>(prop);
|
||||
@@ -398,7 +411,7 @@ void renderIVec3Property(Property* prop, const std::string& ownerName,
|
||||
max
|
||||
);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
@@ -412,7 +425,8 @@ void renderIVec3Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderIVec4Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
IVec4Property* p = static_cast<IVec4Property*>(prop);
|
||||
@@ -430,7 +444,7 @@ void renderIVec4Property(Property* prop, const std::string& ownerName,
|
||||
max
|
||||
);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
@@ -444,7 +458,8 @@ void renderIVec4Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderFloatProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
FloatProperty* p = static_cast<FloatProperty*>(prop);
|
||||
@@ -456,7 +471,7 @@ void renderFloatProperty(Property* prop, const std::string& ownerName,
|
||||
float max = p->maxValue();
|
||||
ImGui::SliderFloat(name.c_str(), &value, min, max, "%.5f", p->exponent());
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
@@ -467,7 +482,8 @@ void renderFloatProperty(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderVec2Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
Vec2Property* p = static_cast<Vec2Property*>(prop);
|
||||
@@ -487,7 +503,7 @@ void renderVec2Property(Property* prop, const std::string& ownerName,
|
||||
p->exponent()
|
||||
);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
@@ -502,7 +518,8 @@ void renderVec2Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderVec3Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
Vec3Property* p = static_cast<Vec3Property*>(prop);
|
||||
@@ -530,7 +547,7 @@ void renderVec3Property(Property* prop, const std::string& ownerName,
|
||||
);
|
||||
}
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
@@ -545,7 +562,8 @@ void renderVec3Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderVec4Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
Vec4Property* p = static_cast<Vec4Property*>(prop);
|
||||
@@ -573,7 +591,7 @@ void renderVec4Property(Property* prop, const std::string& ownerName,
|
||||
);
|
||||
}
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
@@ -588,7 +606,8 @@ void renderVec4Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderDVec2Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DVec2Property* p = static_cast<DVec2Property*>(prop);
|
||||
@@ -607,7 +626,7 @@ void renderDVec2Property(Property* prop, const std::string& ownerName,
|
||||
p->exponent()
|
||||
);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (glm::dvec2(value) != p->value()) {
|
||||
@@ -622,7 +641,8 @@ void renderDVec2Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderDVec3Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DVec3Property* p = static_cast<DVec3Property*>(prop);
|
||||
@@ -642,7 +662,7 @@ void renderDVec3Property(Property* prop, const std::string& ownerName,
|
||||
p->exponent()
|
||||
);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
@@ -657,7 +677,8 @@ void renderDVec3Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderDVec4Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DVec4Property* p = static_cast<DVec4Property*>(prop);
|
||||
@@ -677,7 +698,7 @@ void renderDVec4Property(Property* prop, const std::string& ownerName,
|
||||
p->exponent()
|
||||
);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (glm::dvec4(value) != p->value()) {
|
||||
@@ -692,7 +713,8 @@ void renderDVec4Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderDMat2Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DMat2Property* p = static_cast<DMat2Property*>(prop);
|
||||
@@ -718,7 +740,7 @@ void renderDMat2Property(Property* prop, const std::string& ownerName,
|
||||
ImGui::SliderFloat2("[1]", glm::value_ptr(value[1]), min, max, "%.5f", p->exponent());
|
||||
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (glm::dmat2(value) != p->value()) {
|
||||
@@ -733,7 +755,8 @@ void renderDMat2Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderDMat3Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DMat3Property* p = static_cast<DMat3Property*>(prop);
|
||||
@@ -763,7 +786,7 @@ void renderDMat3Property(Property* prop, const std::string& ownerName,
|
||||
ImGui::SliderFloat3("[2]", glm::value_ptr(value[2]), min, max, "%.5f", p->exponent());
|
||||
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (glm::dmat3(value) != p->value()) {
|
||||
@@ -778,7 +801,8 @@ void renderDMat3Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderDMat4Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DMat4Property* p = static_cast<DMat4Property*>(prop);
|
||||
@@ -811,7 +835,7 @@ void renderDMat4Property(Property* prop, const std::string& ownerName,
|
||||
ImGui::SliderFloat4("[3]", glm::value_ptr(value[3]), min, max, "%.5f", p->exponent());
|
||||
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
if (glm::dmat4(value) != p->value()) {
|
||||
@@ -826,7 +850,8 @@ void renderDMat4Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderTriggerProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip,
|
||||
double tooltipDelay)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
std::string name = prop->guiName();
|
||||
@@ -837,7 +862,7 @@ void renderTriggerProperty(Property* prop, const std::string& ownerName,
|
||||
executeScript(prop->fullyQualifiedIdentifier(), "nil", isRegular);
|
||||
}
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
renderTooltip(prop, tooltipDelay);
|
||||
}
|
||||
|
||||
ImGui::PopID();
|
||||
|
||||
@@ -41,6 +41,13 @@ return {
|
||||
|
||||
TasksRoot = "${OPENSPACE_DATA}/tasks",
|
||||
|
||||
-- These scripts are executed after the postInitialization of each scene, thus making
|
||||
-- it possible to have global overrides to default values or execute other scripts
|
||||
-- regardless of the scene that is loaded
|
||||
GlobalCustomizationScripts = {
|
||||
"${SCRIPTS}/customization.lua"
|
||||
},
|
||||
|
||||
Paths = {
|
||||
SCRIPTS = "${BASE_PATH}/scripts",
|
||||
SHADERS = "${BASE_PATH}/shaders",
|
||||
|
||||
@@ -12,14 +12,6 @@ helper.scheduledScript.reversible = {}
|
||||
-- Function that sets the most common key bindings that are common to most (all?)
|
||||
-- scenes
|
||||
helper.setCommonKeys = function()
|
||||
openspace.bindKeyLocal(
|
||||
"F1",
|
||||
[[local b = openspace.getPropertyValue('Global Properties.ImGUI.Main.Enabled');
|
||||
openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.Enabled', not b);
|
||||
openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.IsHidden', b);]],
|
||||
"Shows or hides the entire user interface"
|
||||
)
|
||||
|
||||
openspace.bindKeyLocal(
|
||||
"F2",
|
||||
[[local b = openspace.getPropertyValue('Global Properties.ImGUI.Main.Properties.Enabled');
|
||||
@@ -31,8 +23,10 @@ helper.setCommonKeys = function()
|
||||
-- windows are hidden
|
||||
openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.IsHidden', false);
|
||||
openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.Properties.Enabled', true);
|
||||
openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.Space/Time.Enabled', true);
|
||||
else
|
||||
openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.Properties.Enabled', not b);
|
||||
openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.Space/Time.Enabled', not b);
|
||||
openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.IsHidden', b);
|
||||
end]],
|
||||
"Shows or hides the properties window"
|
||||
@@ -40,6 +34,14 @@ helper.setCommonKeys = function()
|
||||
|
||||
openspace.bindKeyLocal(
|
||||
"F3",
|
||||
[[local b = openspace.getPropertyValue('Global Properties.ImGUI.Main.Enabled');
|
||||
openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.Enabled', not b);
|
||||
openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.IsHidden', b);]],
|
||||
"Shows or hides the entire user interface"
|
||||
)
|
||||
|
||||
openspace.bindKeyLocal(
|
||||
"F4",
|
||||
helper.property.invert("RenderEngine.PerformanceMeasurements"),
|
||||
"Toogles performance measurements that shows rendering time informations."
|
||||
)
|
||||
|
||||
20
scripts/common_scripts.lua
Normal file
20
scripts/common_scripts.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
openspace.documentation = {
|
||||
{
|
||||
Name = "rebindKey",
|
||||
Arguments = "string, string",
|
||||
Documentation = "Rebinds all scripts from the old key (first argument) to the " ..
|
||||
"new key (second argument)."
|
||||
}
|
||||
}
|
||||
|
||||
openspace.rebindKey = function(old_key, new_key)
|
||||
local t = openspace.getKeyBinding(old_key)
|
||||
openspace.clearKey(old_key)
|
||||
for _, v in pairs(t) do
|
||||
if v["Remote"] then
|
||||
openspace.bindKey(new_key, v["Command"])
|
||||
else
|
||||
openspace.bindKeyLocal(new_key, v["Command"])
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,4 +1,21 @@
|
||||
mark_interesting_nodes = function(nodes)
|
||||
openspace.documentation = {
|
||||
{
|
||||
Name = "mark_interating_nodes",
|
||||
Arguments = "List of nodes",
|
||||
Documentation = "This function marks the scene graph nodes identified by name " ..
|
||||
"as interesting, which will provide shortcut access to focus buttons and " ..
|
||||
"featured properties."
|
||||
},
|
||||
{
|
||||
Name = "set_default_gui_sorting",
|
||||
Arguments = "",
|
||||
Documentation = "This function sets the default GUI sorting for the space " ..
|
||||
"environment to increasing size, from solar system, through Milky Way, " ..
|
||||
"Universe and finishing with other elements"
|
||||
}
|
||||
}
|
||||
|
||||
openspace.mark_interesting_nodes = function(nodes)
|
||||
for _, n in pairs(nodes) do
|
||||
if openspace.hasSceneGraphNode(n) then
|
||||
openspace.addTag(n, "GUI.Interesting")
|
||||
@@ -6,7 +23,7 @@ mark_interesting_nodes = function(nodes)
|
||||
end
|
||||
end
|
||||
|
||||
set_default_gui_sorting = function()
|
||||
openspace.set_default_gui_sorting = function()
|
||||
openspace.setPropertyValueSingle(
|
||||
'Global Properties.ImGUI.Main.Properties.Ordering',
|
||||
{
|
||||
|
||||
@@ -48,6 +48,8 @@ const string ConfigurationManager::KeyPaths = "Paths";
|
||||
const string ConfigurationManager::KeyCache = "CACHE";
|
||||
const string ConfigurationManager::KeyFonts = "Fonts";
|
||||
const string ConfigurationManager::KeyConfigSgct = "SGCTConfig";
|
||||
const string ConfigurationManager::KeyGlobalCustomizationScripts =
|
||||
"GlobalCustomizationScripts";
|
||||
|
||||
const string ConfigurationManager::PartType = "Type";
|
||||
const string ConfigurationManager::PartFile = "File";
|
||||
|
||||
@@ -52,6 +52,14 @@ documentation::Documentation ConfigurationManager::Documentation() {
|
||||
"time and other scene-specific settings. More information is provided in "
|
||||
"the Scene documentation."
|
||||
},
|
||||
{
|
||||
ConfigurationManager::KeyGlobalCustomizationScripts,
|
||||
new StringListVerifier,
|
||||
Optional::Yes,
|
||||
"This value names a list of scripts that get executed after initialization "
|
||||
"of any scene. These scripts can be used for user-specific customization, "
|
||||
"such as a global rebinding of keys from the default."
|
||||
},
|
||||
{
|
||||
ConfigurationManager::KeyConfigTasksRoot,
|
||||
new StringAnnotationVerifier(
|
||||
|
||||
@@ -720,6 +720,13 @@ void OpenSpaceEngine::loadScene(const std::string& scenePath) {
|
||||
LFATALC(e.component, e.message);
|
||||
}
|
||||
|
||||
// Run the global configuration scripts
|
||||
try {
|
||||
runGlobalCustomizationScripts(scenePath);
|
||||
} catch (ghoul::RuntimeError& e) {
|
||||
LERRORC(e.component, e.message);
|
||||
}
|
||||
|
||||
// Write keyboard documentation.
|
||||
if (configurationManager().hasKey(ConfigurationManager::KeyKeyboardShortcuts)) {
|
||||
keyBindingManager().writeDocumentation(
|
||||
@@ -887,6 +894,36 @@ void OpenSpaceEngine::runPostInitializationScripts(const std::string& sceneDescr
|
||||
}
|
||||
}
|
||||
|
||||
void OpenSpaceEngine::runGlobalCustomizationScripts(const std::string& sceneDescription) {
|
||||
// @CLEANUP: Move this into the scene loading? ---abock
|
||||
LINFO("Running Global initialization scripts");
|
||||
ghoul::lua::LuaState state;
|
||||
OsEng.scriptEngine().initializeLuaState(state);
|
||||
|
||||
// First execute the script to get all global variables
|
||||
ghoul::lua::runScriptFile(state, absPath(sceneDescription));
|
||||
|
||||
std::string k = ConfigurationManager::KeyGlobalCustomizationScripts;
|
||||
if (_configurationManager->hasKey(k)) {
|
||||
ghoul::Dictionary dict = _configurationManager->value<ghoul::Dictionary>(k);
|
||||
for (int i = 1; i <= dict.size(); ++i) {
|
||||
std::string script = dict.value<std::string>(std::to_string(i));
|
||||
|
||||
if (FileSys.fileExists(script)) {
|
||||
try {
|
||||
LINFO("Running global customization script: " << script);
|
||||
ghoul::lua::runScriptFile(state, absPath(script));
|
||||
} catch (ghoul::RuntimeError& e) {
|
||||
LERRORC(e.component, e.message);
|
||||
}
|
||||
}
|
||||
else {
|
||||
LDEBUG("Ignoring non-existing script file: " << script);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OpenSpaceEngine::loadFonts() {
|
||||
ghoul::Dictionary fonts;
|
||||
configurationManager().getValue(ConfigurationManager::KeyFonts, fonts);
|
||||
@@ -1506,6 +1543,9 @@ scripting::LuaLibrary OpenSpaceEngine::luaLibrary() {
|
||||
"string, string",
|
||||
"Removes a tag (second argument) from a scene graph node (first argument)"
|
||||
}
|
||||
},
|
||||
{
|
||||
absPath("${SCRIPTS}/common_scripts.lua")
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ void KeyBindingManager::bindKeyLocal(Key key, KeyModifier modifier,
|
||||
{ key, modifier },
|
||||
{
|
||||
std::move(luaCommand),
|
||||
Synchronized::No,
|
||||
IsSynchronized::No,
|
||||
std::move(documentation)
|
||||
}
|
||||
});
|
||||
@@ -99,12 +99,55 @@ void KeyBindingManager::bindKey(Key key, KeyModifier modifier,
|
||||
{ key, modifier },
|
||||
{
|
||||
std::move(luaCommand),
|
||||
Synchronized::Yes,
|
||||
IsSynchronized::Yes,
|
||||
std::move(documentation)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void KeyBindingManager::removeKeyBinding(const std::string& key) {
|
||||
// Erase-remove idiom does not work for std::multimap so we have to do this on foot
|
||||
|
||||
KeyWithModifier k = stringToKey(key);
|
||||
|
||||
for (auto it = _keyLua.begin(); it != _keyLua.end(); ) {
|
||||
// If the current iterator is the key that we are looking for, delete it
|
||||
// (std::multimap::erase will return the iterator to the next element for us)
|
||||
if (it->first == k) {
|
||||
it = _keyLua.erase(it);
|
||||
}
|
||||
else {
|
||||
// We if it is not, we continue iteration
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
// _keyLua.erase(
|
||||
// std::remove_if(
|
||||
// _keyLua.begin(),
|
||||
// _keyLua.end(),
|
||||
// [key](const std::pair<KeyWithModifier, KeyInformation>& val) {
|
||||
// KeyWithModifier k = stringToKey(key);
|
||||
// return val.first == k;
|
||||
// }
|
||||
// ),
|
||||
// _keyLua.end()
|
||||
// );
|
||||
}
|
||||
|
||||
std::vector<std::pair<KeyWithModifier, KeyBindingManager::KeyInformation>>
|
||||
KeyBindingManager::keyBinding(const std::string& key) const
|
||||
{
|
||||
std::vector<std::pair<KeyWithModifier, KeyInformation>> result;
|
||||
|
||||
KeyWithModifier k = stringToKey(key);
|
||||
auto itRange = _keyLua.equal_range(k);
|
||||
for (auto it = itRange.first; it != itRange.second; ++it) {
|
||||
result.push_back({ it->first, it->second });
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string KeyBindingManager::generateJson() const {
|
||||
std::stringstream json;
|
||||
json << "[";
|
||||
@@ -146,6 +189,12 @@ scripting::LuaLibrary KeyBindingManager::luaLibrary() {
|
||||
"",
|
||||
"Clear all key bindings"
|
||||
},
|
||||
{
|
||||
"clearKey",
|
||||
&luascriptfunctions::clearKey,
|
||||
"string",
|
||||
"Unbinds all of the scripts that are bound to the provided key + modifier"
|
||||
},
|
||||
{
|
||||
"bindKey",
|
||||
&luascriptfunctions::bindKey,
|
||||
@@ -165,6 +214,15 @@ scripting::LuaLibrary KeyBindingManager::luaLibrary() {
|
||||
"that is to be executed, and the optional third argument is a human "
|
||||
"readable description of the command for documentation purposes."
|
||||
},
|
||||
{
|
||||
"getKeyBinding",
|
||||
&luascriptfunctions::getKeyBindings,
|
||||
"string",
|
||||
"Returns a list of information about the keybindings for the provided "
|
||||
"key. Each element in the list is a table describing the 'Command' that "
|
||||
"was bound and whether it was a 'Remote' script or not."
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -118,17 +118,72 @@ int bindKeyLocal(lua_State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup LuaScripts
|
||||
* getKeyBindings(string):
|
||||
* Returns the strings of the script that are bound to the passed key and whether they were
|
||||
* local or remote key binds
|
||||
*/
|
||||
int getKeyBindings(lua_State* L) {
|
||||
int nArguments = lua_gettop(L);
|
||||
if (nArguments != 1) {
|
||||
return luaL_error(L, "Expected %i arguments, got %i", 1, nArguments);
|
||||
}
|
||||
|
||||
std::string key = luaL_checkstring(L, -1);
|
||||
|
||||
using KeyInformation = interaction::KeyBindingManager::KeyInformation;
|
||||
|
||||
std::vector<std::pair<KeyWithModifier, KeyInformation>> info =
|
||||
OsEng.keyBindingManager().keyBinding(key);
|
||||
|
||||
lua_createtable(L, static_cast<int>(info.size()), 0);
|
||||
int i = 1;
|
||||
for (const std::pair<KeyWithModifier, KeyInformation>& it : info) {
|
||||
lua_pushnumber(L, i);
|
||||
|
||||
lua_createtable(L, 2, 0);
|
||||
lua_pushstring(L, "Command");
|
||||
lua_pushstring(L, it.second.command.c_str());
|
||||
lua_settable(L, -3);
|
||||
lua_pushstring(L, "Remote");
|
||||
lua_pushboolean(L, it.second.synchronization);
|
||||
lua_settable(L, -3);
|
||||
|
||||
lua_settable(L, -3);
|
||||
++i;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup LuaScripts
|
||||
* clearKey(string):
|
||||
* Clears the keybinding of the key named as argument
|
||||
*/
|
||||
int clearKey(lua_State* L) {
|
||||
int nArguments = lua_gettop(L);
|
||||
if (nArguments != 1) {
|
||||
return luaL_error(L, "Expected %i arguments, got %i", 1, nArguments);
|
||||
}
|
||||
|
||||
std::string key = luaL_checkstring(L, -1);
|
||||
|
||||
OsEng.keyBindingManager().removeKeyBinding(key);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup LuaScripts
|
||||
* clearKeys():
|
||||
* Clears all key bindings
|
||||
*/
|
||||
int clearKeys(lua_State* L) {
|
||||
using ghoul::lua::luaTypeToString;
|
||||
|
||||
int nArguments = lua_gettop(L);
|
||||
if (nArguments != 0)
|
||||
if (nArguments != 0) {
|
||||
return luaL_error(L, "Expected %i arguments, got %i", 0, nArguments);
|
||||
}
|
||||
|
||||
OsEng.keyBindingManager().resetKeyBindings();
|
||||
|
||||
|
||||
@@ -58,9 +58,10 @@ bool toLuaConversion(lua_State* state, std::vector<std::string> val) {
|
||||
|
||||
int i = 1;
|
||||
for (std::string& v : val) {
|
||||
lua_pushstring(state, std::to_string(i).c_str());
|
||||
lua_pushnumber(state, i);
|
||||
lua_pushstring(state, v.c_str());
|
||||
lua_settable(state, -3);
|
||||
++i;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -76,7 +76,7 @@ void TransferFunction::setPath(const std::string& filepath) {
|
||||
}
|
||||
_filepath = f;
|
||||
_file = std::make_unique<ghoul::filesystem::File>(
|
||||
filepath,
|
||||
_filepath,
|
||||
ghoul::filesystem::File::RawPath::Yes
|
||||
);
|
||||
_needsUpdate = true;
|
||||
|
||||
@@ -489,6 +489,9 @@ scripting::LuaLibrary Scene::luaLibrary() {
|
||||
"Checks whether the specifies SceneGraphNode is present in the current "
|
||||
"scene"
|
||||
}
|
||||
},
|
||||
{
|
||||
absPath("${SCRIPTS}/scene_helper.lua")
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -274,6 +274,7 @@ void ScriptEngine::addLibraryFunctions(lua_State* state, LuaLibrary& library,
|
||||
ghoul::lua::runScriptFile(state, absPath(script));
|
||||
|
||||
library.documentations.clear();
|
||||
|
||||
// Then, we extract the documentation information from the file
|
||||
lua_pushstring(state, "documentation");
|
||||
lua_gettable(state, -2);
|
||||
@@ -303,10 +304,9 @@ void ScriptEngine::addLibraryFunctions(lua_State* state, LuaLibrary& library,
|
||||
lua_pop(state, 1);
|
||||
|
||||
library.documentations.push_back({ name, arguments, documentation });
|
||||
|
||||
}
|
||||
lua_pop(state, 1);
|
||||
}
|
||||
lua_pop(state, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,6 +119,11 @@ bool operator<(const KeyWithModifier& lhs, const KeyWithModifier& rhs) {
|
||||
}
|
||||
}
|
||||
|
||||
bool operator==(const KeyWithModifier& lhs, const KeyWithModifier& rhs) {
|
||||
return (lhs.key == rhs.key) && (lhs.modifier == rhs.modifier);
|
||||
}
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
namespace std {
|
||||
|
||||
Reference in New Issue
Block a user