Add property to set space craft animation time

This commit is contained in:
Ylva Selling
2022-04-29 11:05:36 -04:00
parent 89bd33d7eb
commit db7c5ee23f
3 changed files with 20 additions and 1 deletions
+16
View File
@@ -94,6 +94,13 @@ namespace {
"inversed."
};
constexpr const openspace::properties::Property::PropertyInfo SpaceCraftTimeInfo = {
"SpaceCraftAnimationTime",
"Space Craft Animation Time",
"Sets the duration (in seconds) of the animation of the space craft when it is "
"pointed to where the target is aiming."
};
struct [[codegen::Dictionary(SkyBrowserModule)]] Parameters {
// [[codegen::verbatim(EnabledInfo.description)]]
std::optional<bool> enabled;
@@ -115,6 +122,9 @@ namespace {
// [[codegen::verbatim(InverseZoomInfo.description)]]
std::optional<bool> inverseZoomDirection;
// [[codegen::verbatim(SpaceCraftTimeInfo.description)]]
std::optional<double> spaceCraftAnimationTime;
};
#include "skybrowsermodule_codegen.cpp"
@@ -132,6 +142,7 @@ SkyBrowserModule::SkyBrowserModule()
, _browserAnimationSpeed(BrowserSpeedInfo, 5.0, 0.0, 10.0)
, _hideTargetsBrowsersWithGui(HideWithGuiInfo, false)
, _inverseZoomDirection(InverseZoomInfo, false)
, _spaceCraftAnimationTime(SpaceCraftTimeInfo, 2.0, 0.0, 10.0)
{
addProperty(_enabled);
addProperty(_showTitleInGuiBrowser);
@@ -141,6 +152,7 @@ SkyBrowserModule::SkyBrowserModule()
addProperty(_browserAnimationSpeed);
addProperty(_hideTargetsBrowsersWithGui);
addProperty(_inverseZoomDirection);
addProperty(_spaceCraftAnimationTime);
// Set callback functions
global::callback::mouseButton->emplace(global::callback::mouseButton->begin(),
@@ -405,6 +417,10 @@ double SkyBrowserModule::browserAnimationSpeed() const {
return _browserAnimationSpeed;
}
double SkyBrowserModule::spaceCraftAnimationTime() const {
return _spaceCraftAnimationTime;
}
void SkyBrowserModule::setSelectedBrowser(const std::string& id) {
TargetBrowserPair* found = getPair(id);
if (found) {
+2
View File
@@ -70,6 +70,7 @@ public:
void incrementallyAnimateTargets();
double targetAnimationSpeed() const;
double browserAnimationSpeed() const;
double spaceCraftAnimationTime() const;
bool isCameraInSolarSystem() const;
bool isSelectedPairFacingCamera() const;
@@ -105,6 +106,7 @@ private:
properties::DoubleProperty _cameraRotationSpeed;
properties::DoubleProperty _targetAnimationSpeed;
properties::DoubleProperty _browserAnimationSpeed;
properties::DoubleProperty _spaceCraftAnimationTime;
glm::ivec3 _highlightAddition = glm::ivec3(35); // Highlight object when mouse hovers
// The browsers and targets
+2 -1
View File
@@ -755,7 +755,8 @@ namespace {
glm::dvec2 equatorial = pair->targetDirectionEquatorial();
global::eventEngine->publishEvent<events::EventPointSpacecraft>(
equatorial.x,
equatorial.y
equatorial.y,
module->spaceCraftAnimationTime()
);
}