From 7da35272e4b4257b964eeb12e955b2ff0e32fb6b Mon Sep 17 00:00:00 2001 From: Luca-Philipp Grumbach Date: Thu, 4 Dec 2025 17:19:13 +0100 Subject: [PATCH 1/5] connect to constmgrs art intensity --- .../SkyCultureMaker/src/ScmConstellation.cpp | 39 +++++++++++-------- .../SkyCultureMaker/src/ScmConstellation.hpp | 4 +- .../src/ScmConstellationArtwork.cpp | 18 ++++++++- .../src/ScmConstellationArtwork.hpp | 15 ++++++- 4 files changed, 54 insertions(+), 22 deletions(-) diff --git a/plugins/SkyCultureMaker/src/ScmConstellation.cpp b/plugins/SkyCultureMaker/src/ScmConstellation.cpp index e1808de1d7c42..15f1504c6f235 100644 --- a/plugins/SkyCultureMaker/src/ScmConstellation.cpp +++ b/plugins/SkyCultureMaker/src/ScmConstellation.cpp @@ -32,23 +32,28 @@ scm::ScmConstellation::ScmConstellation(const QString &id, const std::vectorgetConstellationLineThickness(); - constellationNameFont.setPixelSize(constMgr->getFontSize()); - defaultConstellationLineColor = constMgr->getLinesColor(); - defaultConstellationNameColor = constMgr->getLabelsColor(); - - // Connections - QObject::connect(constMgr, &ConstellationMgr::constellationLineThicknessChanged, - [this](int v) { constellationLineThickness = v; }); - QObject::connect(constMgr, &ConstellationMgr::fontSizeChanged, - [this](int v) { constellationNameFont.setPixelSize(v); }); - QObject::connect(constMgr, &ConstellationMgr::linesColorChanged, - [this](const Vec3f &c) { defaultConstellationLineColor = c; }); - QObject::connect(constMgr, &ConstellationMgr::namesColorChanged, - [this](const Vec3f &c) { defaultConstellationNameColor = c; }); + if (ConstellationMgr *constMgr = GETSTELMODULE(ConstellationMgr)) + { + // Initial values + constellationLineThickness = constMgr->getConstellationLineThickness(); + constellationNameFont.setPixelSize(constMgr->getFontSize()); + defaultConstellationLineColor = constMgr->getLinesColor(); + defaultConstellationNameColor = constMgr->getLabelsColor(); + + // Connections + QObject::connect(constMgr, &ConstellationMgr::constellationLineThicknessChanged, + [this](int v) { constellationLineThickness = v; }); + QObject::connect(constMgr, &ConstellationMgr::fontSizeChanged, + [this](int v) { constellationNameFont.setPixelSize(v); }); + QObject::connect(constMgr, &ConstellationMgr::linesColorChanged, + [this](const Vec3f &c) { defaultConstellationLineColor = c; }); + QObject::connect(constMgr, &ConstellationMgr::namesColorChanged, + [this](const Vec3f &c) { defaultConstellationNameColor = c; }); + } + else + { + qWarning() << "SkyCultureMaker: Failed to load constellation settings, because the ConstellationMgr is null"; + } updateTextPosition(); } diff --git a/plugins/SkyCultureMaker/src/ScmConstellation.hpp b/plugins/SkyCultureMaker/src/ScmConstellation.hpp index 7472267ef9bcb..84de380720d93 100644 --- a/plugins/SkyCultureMaker/src/ScmConstellation.hpp +++ b/plugins/SkyCultureMaker/src/ScmConstellation.hpp @@ -245,10 +245,10 @@ class ScmConstellation QFont constellationNameFont; /// The default color used for drawing the constellation - Vec3f defaultConstellationLineColor = Vec3f(0.0f, 0.0f, 0.0f); + Vec3f defaultConstellationLineColor = Vec3f(0.5f, 0.5f, 0.7f); /// The default color used for drawing the constellation names - Vec3f defaultConstellationNameColor = Vec3f(0.0f, 0.0f, 0.0f); + Vec3f defaultConstellationNameColor = Vec3f(0.5f, 0.5f, 0.7f); /// Holds the artwork of this constellation. ScmConstellationArtwork artwork; diff --git a/plugins/SkyCultureMaker/src/ScmConstellationArtwork.cpp b/plugins/SkyCultureMaker/src/ScmConstellationArtwork.cpp index 261de634a0688..a959001dc23a5 100644 --- a/plugins/SkyCultureMaker/src/ScmConstellationArtwork.cpp +++ b/plugins/SkyCultureMaker/src/ScmConstellationArtwork.cpp @@ -22,6 +22,7 @@ */ #include "ScmConstellationArtwork.hpp" +#include "ConstellationMgr.hpp" #include "StarMgr.hpp" #include "StelApp.hpp" #include "StelModuleMgr.hpp" @@ -36,11 +37,26 @@ scm::ScmConstellationArtwork::ScmConstellationArtwork(const std::arraygetArtIntensity(); + QObject::connect(constMgr, &ConstellationMgr::artIntensityChanged, [this](float v) { artIntensity = v; }); + } + else + { + qWarning() << "SkyCultureMaker: Failed to load artwork settings, because the ConstellationMgr is null"; + } } void scm::ScmConstellationArtwork::setupArt() @@ -279,7 +295,7 @@ bool scm::ScmConstellationArtwork::save(const QString &filepath) const void scm::ScmConstellationArtwork::drawOptimized(StelPainter &sPainter, const SphericalRegion ®ion, const Vec3d &obsVelocity) const { - const float intensity = artOpacity * artIntensityFovScale; + const float intensity = artIntensity * artIntensityFovScale; if (artTexture && intensity > 0.0f && region.intersects(boundingCap)) { sPainter.setColor(intensity, intensity, intensity); diff --git a/plugins/SkyCultureMaker/src/ScmConstellationArtwork.hpp b/plugins/SkyCultureMaker/src/ScmConstellationArtwork.hpp index 58a79f61f6cc0..4c7ec4d8e0ab5 100644 --- a/plugins/SkyCultureMaker/src/ScmConstellationArtwork.hpp +++ b/plugins/SkyCultureMaker/src/ScmConstellationArtwork.hpp @@ -35,6 +35,13 @@ namespace scm { +/** + * @brief Class that represents a constellation artwork. + * + * Due to the lambda capture of 'this' in QObject::connect, + * the address of a ScmConstellationArtwork instance must + * not change during its lifetime! + */ class ScmConstellationArtwork { public: @@ -129,6 +136,10 @@ class ScmConstellationArtwork */ void drawOptimized(StelPainter &sPainter, const SphericalRegion ®ion, const Vec3d &obsVelocity) const; + * @brief Gets values and connects to signals from Stellariums manager classes. + */ + void getValuesFromMgrs(); + /// Holds the anchors of the artwork. std::array anchors; @@ -147,8 +158,8 @@ class ScmConstellationArtwork /// Holds the intensity scale based on the Field of View. float artIntensityFovScale = 1.0f; - /// Holds the opacity of the art. - float artOpacity = 0.42; + /// Holds the intensity of the art. + float artIntensity = 0.42; /// Indicates if the artwork has an image that can be drawn. bool hasArt = false; From c58edbb197b7e3d8983bb98fc9d1e745de1af1bf Mon Sep 17 00:00:00 2001 From: Luca-Philipp Grumbach Date: Thu, 4 Dec 2025 17:20:03 +0100 Subject: [PATCH 2/5] connect to constmgrs art intensity --- plugins/SkyCultureMaker/src/ScmConstellationArtwork.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/SkyCultureMaker/src/ScmConstellationArtwork.hpp b/plugins/SkyCultureMaker/src/ScmConstellationArtwork.hpp index 4c7ec4d8e0ab5..4ab238f1a7818 100644 --- a/plugins/SkyCultureMaker/src/ScmConstellationArtwork.hpp +++ b/plugins/SkyCultureMaker/src/ScmConstellationArtwork.hpp @@ -136,6 +136,7 @@ class ScmConstellationArtwork */ void drawOptimized(StelPainter &sPainter, const SphericalRegion ®ion, const Vec3d &obsVelocity) const; + /** * @brief Gets values and connects to signals from Stellariums manager classes. */ void getValuesFromMgrs(); From 60ccb9564abd6a963a4dfd76710a1b7ef1617b2e Mon Sep 17 00:00:00 2001 From: Luca-Philipp Grumbach Date: Thu, 4 Dec 2025 17:23:40 +0100 Subject: [PATCH 3/5] change function name --- plugins/SkyCultureMaker/src/ScmConstellationArtwork.cpp | 6 +++--- plugins/SkyCultureMaker/src/ScmConstellationArtwork.hpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/SkyCultureMaker/src/ScmConstellationArtwork.cpp b/plugins/SkyCultureMaker/src/ScmConstellationArtwork.cpp index a959001dc23a5..4c91a52881ffe 100644 --- a/plugins/SkyCultureMaker/src/ScmConstellationArtwork.cpp +++ b/plugins/SkyCultureMaker/src/ScmConstellationArtwork.cpp @@ -37,16 +37,16 @@ scm::ScmConstellationArtwork::ScmConstellationArtwork(const std::array anchors; From 0696470b44cebd7a9fff829f958d9a6775fe2190 Mon Sep 17 00:00:00 2001 From: Luca-Philipp Grumbach Date: Thu, 4 Dec 2025 17:43:50 +0100 Subject: [PATCH 4/5] revert addition of guards --- .../SkyCultureMaker/src/ScmConstellation.cpp | 39 ++++++++----------- .../src/ScmConstellationArtwork.cpp | 12 ++---- 2 files changed, 20 insertions(+), 31 deletions(-) diff --git a/plugins/SkyCultureMaker/src/ScmConstellation.cpp b/plugins/SkyCultureMaker/src/ScmConstellation.cpp index 15f1504c6f235..e1808de1d7c42 100644 --- a/plugins/SkyCultureMaker/src/ScmConstellation.cpp +++ b/plugins/SkyCultureMaker/src/ScmConstellation.cpp @@ -32,28 +32,23 @@ scm::ScmConstellation::ScmConstellation(const QString &id, const std::vectorgetConstellationLineThickness(); - constellationNameFont.setPixelSize(constMgr->getFontSize()); - defaultConstellationLineColor = constMgr->getLinesColor(); - defaultConstellationNameColor = constMgr->getLabelsColor(); - - // Connections - QObject::connect(constMgr, &ConstellationMgr::constellationLineThicknessChanged, - [this](int v) { constellationLineThickness = v; }); - QObject::connect(constMgr, &ConstellationMgr::fontSizeChanged, - [this](int v) { constellationNameFont.setPixelSize(v); }); - QObject::connect(constMgr, &ConstellationMgr::linesColorChanged, - [this](const Vec3f &c) { defaultConstellationLineColor = c; }); - QObject::connect(constMgr, &ConstellationMgr::namesColorChanged, - [this](const Vec3f &c) { defaultConstellationNameColor = c; }); - } - else - { - qWarning() << "SkyCultureMaker: Failed to load constellation settings, because the ConstellationMgr is null"; - } + ConstellationMgr *constMgr = GETSTELMODULE(ConstellationMgr); + + // Initial values + constellationLineThickness = constMgr->getConstellationLineThickness(); + constellationNameFont.setPixelSize(constMgr->getFontSize()); + defaultConstellationLineColor = constMgr->getLinesColor(); + defaultConstellationNameColor = constMgr->getLabelsColor(); + + // Connections + QObject::connect(constMgr, &ConstellationMgr::constellationLineThicknessChanged, + [this](int v) { constellationLineThickness = v; }); + QObject::connect(constMgr, &ConstellationMgr::fontSizeChanged, + [this](int v) { constellationNameFont.setPixelSize(v); }); + QObject::connect(constMgr, &ConstellationMgr::linesColorChanged, + [this](const Vec3f &c) { defaultConstellationLineColor = c; }); + QObject::connect(constMgr, &ConstellationMgr::namesColorChanged, + [this](const Vec3f &c) { defaultConstellationNameColor = c; }); updateTextPosition(); } diff --git a/plugins/SkyCultureMaker/src/ScmConstellationArtwork.cpp b/plugins/SkyCultureMaker/src/ScmConstellationArtwork.cpp index 4c91a52881ffe..e1023c451c7ff 100644 --- a/plugins/SkyCultureMaker/src/ScmConstellationArtwork.cpp +++ b/plugins/SkyCultureMaker/src/ScmConstellationArtwork.cpp @@ -48,15 +48,9 @@ scm::ScmConstellationArtwork::ScmConstellationArtwork() void scm::ScmConstellationArtwork::initValues() { - if (ConstellationMgr *constMgr = GETSTELMODULE(ConstellationMgr)) - { - artIntensity = constMgr->getArtIntensity(); - QObject::connect(constMgr, &ConstellationMgr::artIntensityChanged, [this](float v) { artIntensity = v; }); - } - else - { - qWarning() << "SkyCultureMaker: Failed to load artwork settings, because the ConstellationMgr is null"; - } + ConstellationMgr *constMgr = GETSTELMODULE(ConstellationMgr); + artIntensity = constMgr->getArtIntensity(); + QObject::connect(constMgr, &ConstellationMgr::artIntensityChanged, [this](float v) { artIntensity = v; }); } void scm::ScmConstellationArtwork::setupArt() From 3ecfd4e207cd5a6209ff3323399bdb0d5790a391 Mon Sep 17 00:00:00 2001 From: Luca-Philipp Grumbach Date: Thu, 4 Dec 2025 17:56:15 +0100 Subject: [PATCH 5/5] Update ScmConstellation.hpp --- plugins/SkyCultureMaker/src/ScmConstellation.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/SkyCultureMaker/src/ScmConstellation.hpp b/plugins/SkyCultureMaker/src/ScmConstellation.hpp index 84de380720d93..7472267ef9bcb 100644 --- a/plugins/SkyCultureMaker/src/ScmConstellation.hpp +++ b/plugins/SkyCultureMaker/src/ScmConstellation.hpp @@ -245,10 +245,10 @@ class ScmConstellation QFont constellationNameFont; /// The default color used for drawing the constellation - Vec3f defaultConstellationLineColor = Vec3f(0.5f, 0.5f, 0.7f); + Vec3f defaultConstellationLineColor = Vec3f(0.0f, 0.0f, 0.0f); /// The default color used for drawing the constellation names - Vec3f defaultConstellationNameColor = Vec3f(0.5f, 0.5f, 0.7f); + Vec3f defaultConstellationNameColor = Vec3f(0.0f, 0.0f, 0.0f); /// Holds the artwork of this constellation. ScmConstellationArtwork artwork;