Bladeren bron

feat: allow users to disable particles

Almamu 9 maanden geleden
bovenliggende
commit
3407851552

+ 7 - 0
src/WallpaperEngine/Application/ApplicationContext.cpp

@@ -445,6 +445,13 @@ void ApplicationContext::loadSettingsFromArgv () {
 
     auto& configurationGroup = program.add_group ("Wallpaper configuration options");
 
+        configurationGroup.add_argument ("--disable-particles")
+            .help ("Disables particles for the backgrounds")
+            .flag()
+            .action([this](const std::string& value) -> void {
+                this->settings.general.disableParticles = true;
+            });
+
         configurationGroup.add_argument ("--disable-mouse")
             .help ("Disables mouse interaction with the backgrounds")
             .flag ()

+ 2 - 0
src/WallpaperEngine/Application/ApplicationContext.h

@@ -63,6 +63,8 @@ class ApplicationContext {
             bool onlyListProperties;
             /** If the user requested a dump of the background structure */
             bool dumpStructure;
+            /** If the user requested the particles to be deactivated */
+            bool disableParticles;
             /** The path to the assets folder */
             std::filesystem::path assets;
             /** Background to load (provided as the final argument) as fallback for multi-screen setups */

+ 5 - 0
src/WallpaperEngine/Render/Wallpapers/CScene.cpp

@@ -188,6 +188,11 @@ Render::CObject* CScene::createObject (const Object& object) {
     } else if (object.is<Sound> ()) {
         renderObject = new Objects::CSound (*this, *object.as<Sound> ());
     } else if (object.is<Particle> ()) {
+        if (this->getContext ().getApp ().getContext ().settings.general.disableParticles == true) {
+            sLog.debug("Ignoring particle system (disabled in settings): ", object.as<Particle> ()->name);
+            return nullptr;
+        }
+
         auto* particle = new Objects::CParticle (*this, *object.as<Particle> ());
 
         try {