mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-24 21:19:46 -06:00
Merge remote-tracking branch 'origin/master' into feature/NewAtmosphere
# Conflicts: # modules/imgui/src/renderproperties.cpp
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user