mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
Compare commits
No commits in common. "fc865499fcf19d27803e1db40a8163ec5d274b77" and "fae2b5e01e2a6ca39ed144cdcba336651b604690" have entirely different histories.
fc865499fc
...
fae2b5e01e
@ -400,6 +400,19 @@ add_executable(
|
||||
src/WallpaperEngine/WebBrowser/CWebBrowserContext.cpp
|
||||
src/WallpaperEngine/WebBrowser/CWebBrowserContext.h
|
||||
|
||||
src/WallpaperEngine/Core/Projects/CProperty.h
|
||||
src/WallpaperEngine/Core/Projects/CProperty.cpp
|
||||
src/WallpaperEngine/Core/Projects/CPropertyColor.h
|
||||
src/WallpaperEngine/Core/Projects/CPropertyColor.cpp
|
||||
src/WallpaperEngine/Core/Projects/CPropertyBoolean.h
|
||||
src/WallpaperEngine/Core/Projects/CPropertyBoolean.cpp
|
||||
src/WallpaperEngine/Core/Projects/CPropertySlider.h
|
||||
src/WallpaperEngine/Core/Projects/CPropertySlider.cpp
|
||||
src/WallpaperEngine/Core/Projects/CPropertyCombo.h
|
||||
src/WallpaperEngine/Core/Projects/CPropertyCombo.cpp
|
||||
src/WallpaperEngine/Core/Projects/CPropertyText.h
|
||||
src/WallpaperEngine/Core/Projects/CPropertyText.cpp
|
||||
|
||||
src/WallpaperEngine/Data/Model/Types.h
|
||||
src/WallpaperEngine/Data/Model/Project.h
|
||||
src/WallpaperEngine/Data/Model/Wallpaper.h
|
||||
@ -410,7 +423,6 @@ add_executable(
|
||||
src/WallpaperEngine/Data/Model/UserSetting.h
|
||||
src/WallpaperEngine/Data/Model/DynamicValue.h
|
||||
src/WallpaperEngine/Data/Model/DynamicValue.cpp
|
||||
src/WallpaperEngine/Data/Model/Property.h
|
||||
src/WallpaperEngine/Data/Utils/TypeCaster.cpp
|
||||
src/WallpaperEngine/Data/Utils/TypeCaster.h
|
||||
src/WallpaperEngine/Data/Utils/SFINAE.h
|
||||
@ -428,8 +440,6 @@ add_executable(
|
||||
src/WallpaperEngine/Data/Parsers/ModelParser.h
|
||||
src/WallpaperEngine/Data/Parsers/ShaderConstantParser.cpp
|
||||
src/WallpaperEngine/Data/Parsers/ShaderConstantParser.h
|
||||
src/WallpaperEngine/Data/Parsers/PropertyParser.cpp
|
||||
src/WallpaperEngine/Data/Parsers/PropertyParser.h
|
||||
src/WallpaperEngine/Data/Builders/UserSettingBuilder.h
|
||||
src/WallpaperEngine/Data/Builders/VectorBuilder.cpp
|
||||
src/WallpaperEngine/Data/Builders/VectorBuilder.h
|
||||
|
@ -10,11 +10,12 @@
|
||||
#include "WallpaperEngine/Render/CRenderContext.h"
|
||||
#include "WallpaperEngine/Render/Drivers/CVideoFactories.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Projects/CProperty.h"
|
||||
|
||||
#include "WallpaperEngine/Data/Parsers/ProjectParser.h"
|
||||
#include "WallpaperEngine/Data/Dumpers/StringPrinter.h"
|
||||
|
||||
#include "WallpaperEngine/Data/Model/Wallpaper.h"
|
||||
#include "WallpaperEngine/Data/Model/Property.h"
|
||||
|
||||
#if DEMOMODE
|
||||
#include "recording.h"
|
||||
@ -226,11 +227,11 @@ void CWallpaperApplication::setupPropertiesForProject (const Project& project) {
|
||||
if (override != this->m_context.settings.general.properties.end ()) {
|
||||
sLog.out ("Applying override value for ", key);
|
||||
|
||||
cur->update (override->second);
|
||||
cur->set (override->second);
|
||||
}
|
||||
|
||||
if (this->m_context.settings.general.onlyListProperties)
|
||||
sLog.out (cur->toString ());
|
||||
sLog.out (cur->dump ());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ void pa_stream_notify_cb (pa_stream* stream, void* /*userdata*/) {
|
||||
switch (pa_stream_get_state (stream)) {
|
||||
case PA_STREAM_FAILED: sLog.error ("Cannot open stream for capture. Audio processing is disabled"); break;
|
||||
case PA_STREAM_READY: sLog.debug ("Capture stream ready"); break;
|
||||
default: break;
|
||||
default: sLog.debug("pa_stream_get_state unknown result"); break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,6 +145,7 @@ void pa_context_notify_cb (pa_context* ctx, void* userdata) {
|
||||
sLog.error ("PulseAudio context initialization failed. Audio processing is disabled");
|
||||
break;
|
||||
default:
|
||||
sLog.debug ("pa_context_get_state unknown result");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
46
src/WallpaperEngine/Core/Projects/CProperty.cpp
Normal file
46
src/WallpaperEngine/Core/Projects/CProperty.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
#include "CProperty.h"
|
||||
#include "CPropertyBoolean.h"
|
||||
#include "CPropertyColor.h"
|
||||
#include "CPropertyCombo.h"
|
||||
#include "CPropertySlider.h"
|
||||
#include "CPropertyText.h"
|
||||
#include "WallpaperEngine/Logging/CLog.h"
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
using namespace WallpaperEngine::Core::Projects;
|
||||
|
||||
std::shared_ptr<CProperty> CProperty::fromJSON (const JSON& data, const std::string& name) {
|
||||
const auto type = data.require <std::string> ("type", "Project properties must have the type field");
|
||||
|
||||
if (type == "color")
|
||||
return CPropertyColor::fromJSON (data, name);
|
||||
if (type == "bool")
|
||||
return CPropertyBoolean::fromJSON (data, name);
|
||||
if (type == "slider")
|
||||
return CPropertySlider::fromJSON (data, name);
|
||||
if (type == "combo")
|
||||
return CPropertyCombo::fromJSON (data, name);
|
||||
if (type == "text")
|
||||
return CPropertyText::fromJSON (data, name);
|
||||
|
||||
if (type != "group") {
|
||||
// show the error and ignore this property
|
||||
sLog.error ("Unexpected type for property: ", type);
|
||||
sLog.error (data);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CProperty::CProperty (std::string name, std::string text) :
|
||||
m_name (std::move(name)),
|
||||
m_text (std::move(text)) {}
|
||||
|
||||
const std::string& CProperty::getName () const {
|
||||
return this->m_name;
|
||||
}
|
||||
|
||||
const std::string& CProperty::getText () const {
|
||||
return this->m_text;
|
||||
}
|
55
src/WallpaperEngine/Core/Projects/CProperty.h
Normal file
55
src/WallpaperEngine/Core/Projects/CProperty.h
Normal file
@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include "WallpaperEngine/Data/Utils/TypeCaster.h"
|
||||
#include "WallpaperEngine/Data/Model/DynamicValue.h"
|
||||
#include "WallpaperEngine/Data/JSON.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Projects {
|
||||
using JSON = WallpaperEngine::Data::JSON::JSON;
|
||||
using namespace WallpaperEngine::Data::Model;
|
||||
using namespace WallpaperEngine::Data::Utils;
|
||||
/**
|
||||
* Represents a property in a background
|
||||
*
|
||||
* Properties are settings that alter how the background looks or works
|
||||
* and are configurable by the user so they can customize it to their likings
|
||||
*/
|
||||
class CProperty : public DynamicValue, public TypeCaster {
|
||||
public:
|
||||
using UniquePtr = std::unique_ptr<CProperty>;
|
||||
using SharedPtr = std::shared_ptr<CProperty>;
|
||||
using WeakPtr = std::weak_ptr<CProperty>;
|
||||
|
||||
static std::shared_ptr<CProperty> fromJSON (const JSON& data, const std::string& name);
|
||||
|
||||
/**
|
||||
* @return Representation of what the property does and the default values
|
||||
*/
|
||||
[[nodiscard]] virtual std::string dump () const = 0;
|
||||
/**
|
||||
* Updates the value of the property with the one in the string
|
||||
*
|
||||
* @param value New value for the property
|
||||
*/
|
||||
virtual void set (const std::string& value) = 0;
|
||||
/**
|
||||
* @return Name of the property
|
||||
*/
|
||||
[[nodiscard]] const std::string& getName () const;
|
||||
/**
|
||||
* @return Textual type representation of this property
|
||||
*/
|
||||
[[nodiscard]] virtual const char* getPropertyType () const = 0;
|
||||
/**
|
||||
* @return Text of the property
|
||||
*/
|
||||
[[nodiscard]] const std::string& getText () const;
|
||||
|
||||
protected:
|
||||
CProperty (std::string name, std::string text);
|
||||
/** Name of the property */
|
||||
const std::string m_name;
|
||||
/** Description of the property for the user */
|
||||
mutable std::string m_text;
|
||||
};
|
||||
} // namespace WallpaperEngine::Core::Projects
|
38
src/WallpaperEngine/Core/Projects/CPropertyBoolean.cpp
Normal file
38
src/WallpaperEngine/Core/Projects/CPropertyBoolean.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
#include "CPropertyBoolean.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Projects;
|
||||
|
||||
std::shared_ptr<CPropertyBoolean> CPropertyBoolean::fromJSON (const JSON& data, std::string name) {
|
||||
return std::make_shared <CPropertyBoolean> (
|
||||
data.require ("value", "Boolean property must have a value"),
|
||||
std::move(name),
|
||||
data.optional <std::string> ("text", "")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void CPropertyBoolean::set (const std::string& value) {
|
||||
this->update (value == "1" || value == "true" || value == "on");
|
||||
}
|
||||
|
||||
std::string CPropertyBoolean::dump () const {
|
||||
std::stringstream ss;
|
||||
|
||||
ss << this->m_name << " - boolean" << std::endl
|
||||
<< "\t"
|
||||
<< "Description: " << this->m_text << std::endl
|
||||
<< "\t"
|
||||
<< "Value: " << &this->getBool ();
|
||||
|
||||
return ss.str ();
|
||||
}
|
||||
|
||||
const char* CPropertyBoolean::getPropertyType () const {
|
||||
return "bool";
|
||||
}
|
||||
|
||||
CPropertyBoolean::CPropertyBoolean (bool value, std::string name, std::string text) :
|
||||
CProperty (std::move(name), std::move(text)) {}
|
21
src/WallpaperEngine/Core/Projects/CPropertyBoolean.h
Normal file
21
src/WallpaperEngine/Core/Projects/CPropertyBoolean.h
Normal file
@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "CProperty.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Projects {
|
||||
using JSON = WallpaperEngine::Data::JSON::JSON;
|
||||
|
||||
/**
|
||||
* Represents a boolean property
|
||||
*/
|
||||
class CPropertyBoolean final : public CProperty {
|
||||
public:
|
||||
CPropertyBoolean (bool value, std::string name, std::string text);
|
||||
|
||||
static std::shared_ptr<CPropertyBoolean> fromJSON (const JSON& data, std::string name);
|
||||
[[nodiscard]] std::string dump () const override;
|
||||
void set (const std::string& value) override;
|
||||
|
||||
[[nodiscard]] const char* getPropertyType () const override;
|
||||
};
|
||||
} // namespace WallpaperEngine::Core::Projects
|
81
src/WallpaperEngine/Core/Projects/CPropertyColor.cpp
Normal file
81
src/WallpaperEngine/Core/Projects/CPropertyColor.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
#include "CPropertyColor.h"
|
||||
|
||||
using namespace WallpaperEngine::Data::Builders;
|
||||
using namespace WallpaperEngine::Core::Projects;
|
||||
|
||||
glm::vec3 ParseColor (std::string value) {
|
||||
// TODO: ENSURE THIS PARSING IS ACTUALLY ACCURATE
|
||||
if (value.find (',') != std::string::npos) {
|
||||
// replace commas with dots so it can be parsed
|
||||
std::replace (value.begin (), value.end (), ',', ' ');
|
||||
}
|
||||
|
||||
if (value.find ('.') == std::string::npos && value != "0 0 0" && value != "1 1 1") {
|
||||
if (value.find ('#') == 0) {
|
||||
// hex color, parse it to int color and then convert it to float
|
||||
auto number = value.substr (1);
|
||||
|
||||
if (number.size () == 3) {
|
||||
// CSS short-number, expand to the proper size
|
||||
number = number[0] + number[0] + number[1] + number[1] + number[2] + number[2];
|
||||
}
|
||||
|
||||
// remove alpha if it's present, should look into it more closely
|
||||
if (number.size () > 6) {
|
||||
sLog.error ("Color value has alpha channel, which is not supported");
|
||||
number = number.substr (0, 6);
|
||||
}
|
||||
|
||||
const auto color = std::stoi (number, nullptr, 16);
|
||||
|
||||
return {
|
||||
(((color >> 16) & 0xFF) / 255.0),
|
||||
(((color >> 8) & 0xFF) / 255.0),
|
||||
(((color >> 0) & 0xFF) / 255.0)
|
||||
};
|
||||
}
|
||||
|
||||
const auto intcolor = VectorBuilder::parse <glm::ivec3> (value);
|
||||
|
||||
return {intcolor.r / 255.0, intcolor.g / 255.0, intcolor.b / 255.0};
|
||||
}
|
||||
|
||||
return VectorBuilder::parse <glm::vec3> (value);
|
||||
}
|
||||
|
||||
std::shared_ptr<CPropertyColor> CPropertyColor::fromJSON (const JSON& data, std::string name) {
|
||||
return std::make_shared <CPropertyColor> (
|
||||
data.require ("value", "Color property must have a value"),
|
||||
std::move(name),
|
||||
data.optional <std::string> ("text", "")
|
||||
);
|
||||
}
|
||||
|
||||
void CPropertyColor::set (const std::string& value) {
|
||||
this->update (ParseColor (std::string (value)));
|
||||
}
|
||||
|
||||
std::string CPropertyColor::dump () const {
|
||||
const auto color = this->getVec3 ();
|
||||
std::stringstream ss;
|
||||
|
||||
ss << this->m_name << " - color" << std::endl
|
||||
<< "\t"
|
||||
<< "Description: " << this->m_text << std::endl
|
||||
<< "\t"
|
||||
<< "R: " << color.r << " G: " << color.g << " B: " << color.b;
|
||||
|
||||
return ss.str ();
|
||||
}
|
||||
|
||||
const char* CPropertyColor::getPropertyType () const {
|
||||
return "color";
|
||||
}
|
||||
|
||||
CPropertyColor::CPropertyColor (const std::string& color, std::string name, std::string text) :
|
||||
CProperty (std::move(name), std::move(text)) {
|
||||
this->set (color);
|
||||
}
|
23
src/WallpaperEngine/Core/Projects/CPropertyColor.h
Normal file
23
src/WallpaperEngine/Core/Projects/CPropertyColor.h
Normal file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "CProperty.h"
|
||||
|
||||
#include "WallpaperEngine/Data/JSON.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Projects {
|
||||
using JSON = WallpaperEngine::Data::JSON::JSON;
|
||||
|
||||
/**
|
||||
* Represents a color property
|
||||
*/
|
||||
class CPropertyColor final : public CProperty {
|
||||
public:
|
||||
CPropertyColor (const std::string& color, std::string name, std::string text);
|
||||
|
||||
static std::shared_ptr<CPropertyColor> fromJSON (const JSON& data, std::string name);
|
||||
[[nodiscard]] std::string dump () const override;
|
||||
void set (const std::string& value) override;
|
||||
|
||||
[[nodiscard]] const char* getPropertyType () const override;
|
||||
};
|
||||
} // namespace WallpaperEngine::Core::Projects
|
112
src/WallpaperEngine/Core/Projects/CPropertyCombo.cpp
Normal file
112
src/WallpaperEngine/Core/Projects/CPropertyCombo.cpp
Normal file
@ -0,0 +1,112 @@
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
#include "CPropertyCombo.h"
|
||||
|
||||
#include "WallpaperEngine/Logging/CLog.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Projects;
|
||||
|
||||
std::shared_ptr<CPropertyCombo> CPropertyCombo::fromJSON (const JSON& data, std::string name) {
|
||||
std::vector<CPropertyComboValue> values;
|
||||
const auto options = data.require ("options", "Options for a property combo is required");
|
||||
|
||||
if (!options.is_array ())
|
||||
sLog.exception ("Property combo options should be an array");
|
||||
|
||||
for (auto& cur : options) {
|
||||
// TODO: PROPERLY REPORT THESE ISSUES
|
||||
if (!cur.is_object ())
|
||||
continue;
|
||||
|
||||
const auto valueIt = cur.require ("value", "Value is required for a property combo option");
|
||||
auto value = valueIt.is_number () ? std::to_string (valueIt.get <int> ()) : valueIt.get <std::string> ();
|
||||
|
||||
// check for label and value to ensure they're there
|
||||
values.push_back ({
|
||||
.label = cur.require ("label", "Label is required for a property combo option"),
|
||||
.value = value
|
||||
});
|
||||
}
|
||||
|
||||
const auto valueIt = data.require ("value", "Value is required for a property combo");
|
||||
auto value = valueIt.is_number () ? std::to_string (valueIt.get <int> ()) : valueIt.get <std::string> ();
|
||||
|
||||
return std::make_shared <CPropertyCombo> (
|
||||
std::move(name),
|
||||
data.optional <std::string> ("text", ""),
|
||||
value,
|
||||
values
|
||||
);
|
||||
}
|
||||
|
||||
CPropertyCombo::CPropertyCombo (
|
||||
std::string name, std::string text, const std::string& defaultValue,
|
||||
std::vector<CPropertyComboValue> values
|
||||
) :
|
||||
CProperty (std::move(name), std::move(text)),
|
||||
m_values (std::move(values)) {
|
||||
this->set (defaultValue);
|
||||
}
|
||||
|
||||
std::string CPropertyCombo::dump () const {
|
||||
std::stringstream ss;
|
||||
|
||||
ss << this->m_name << " - combolist" << std::endl
|
||||
<< "\t"
|
||||
<< "Description: " << this->m_text << std::endl
|
||||
<< "\t"
|
||||
<< "Value: " << &this->getInt () << std::endl
|
||||
<< "\t\t"
|
||||
<< "Posible values:" << std::endl;
|
||||
|
||||
for (const auto& cur : this->m_values)
|
||||
ss << "\t\t" << cur.label << " -> " << cur.value << std::endl;
|
||||
|
||||
return ss.str ();
|
||||
}
|
||||
|
||||
void CPropertyCombo::set (const std::string& value) {
|
||||
bool found = false;
|
||||
int index = 0;
|
||||
|
||||
// ensure the value is present somewhere in the value list
|
||||
for (const auto& cur : this->m_values) {
|
||||
if (cur.value == value) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
index ++;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
sLog.exception ("Assigning invalid value to property ", this->m_name);
|
||||
|
||||
this->update (index);
|
||||
}
|
||||
|
||||
int CPropertyCombo::translateValueToIndex (const std::string& value) const {
|
||||
bool found = false;
|
||||
int index = 0;
|
||||
|
||||
// ensure the value is present somewhere in the value list
|
||||
for (const auto& cur : this->m_values) {
|
||||
if (cur.value == value) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
index ++;
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
const char* CPropertyCombo::getPropertyType () const {
|
||||
return "combo";
|
||||
}
|
42
src/WallpaperEngine/Core/Projects/CPropertyCombo.h
Normal file
42
src/WallpaperEngine/Core/Projects/CPropertyCombo.h
Normal file
@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include "CProperty.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Projects {
|
||||
using JSON = WallpaperEngine::Data::JSON::JSON;;
|
||||
|
||||
/**
|
||||
* Represents different combo values
|
||||
*/
|
||||
struct CPropertyComboValue {
|
||||
public:
|
||||
const std::string label;
|
||||
const std::string value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents a combo property
|
||||
*
|
||||
* Combos are properties that have different values available and only one can be selected at once
|
||||
* this limits the user's possibilities, used for things like the amount of samples to use in audioprocessing
|
||||
* backgrounds
|
||||
*/
|
||||
class CPropertyCombo final : public CProperty {
|
||||
public:
|
||||
static std::shared_ptr<CPropertyCombo> fromJSON (const JSON& data, std::string name);
|
||||
|
||||
CPropertyCombo (
|
||||
std::string name, std::string text, const std::string& defaultValue,
|
||||
std::vector<CPropertyComboValue> values);
|
||||
|
||||
[[nodiscard]] std::string dump () const override;
|
||||
void set (const std::string& value) override;
|
||||
int translateValueToIndex (const std::string& value) const;
|
||||
|
||||
[[nodiscard]] const char* getPropertyType () const override;
|
||||
|
||||
private:
|
||||
/** List of values available to select */
|
||||
const std::vector<CPropertyComboValue> m_values;
|
||||
};
|
||||
} // namespace WallpaperEngine::Core::Projects
|
67
src/WallpaperEngine/Core/Projects/CPropertySlider.cpp
Normal file
67
src/WallpaperEngine/Core/Projects/CPropertySlider.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
#include "CPropertySlider.h"
|
||||
#include "WallpaperEngine/Logging/CLog.h"
|
||||
#include <sstream>
|
||||
|
||||
using namespace WallpaperEngine::Core::Projects;
|
||||
|
||||
std::shared_ptr<CPropertySlider> CPropertySlider::fromJSON (const JSON& data, const std::string& name) {
|
||||
const auto value = data.find ("value");
|
||||
const auto text = data.optional <std::string> ("text", "");
|
||||
const auto min = data.optional ("min", 0.0f);
|
||||
const auto max = data.optional ("max", 0.0f);
|
||||
const auto step = data.optional ("step", 0.0f);
|
||||
|
||||
return std::make_shared <CPropertySlider> (*value, name, text, min, max, step);
|
||||
}
|
||||
|
||||
const float& CPropertySlider::getMinValue () const {
|
||||
return this->m_min;
|
||||
}
|
||||
|
||||
const float& CPropertySlider::getMaxValue () const {
|
||||
return this->m_max;
|
||||
}
|
||||
|
||||
const float& CPropertySlider::getStep () const {
|
||||
return this->m_step;
|
||||
}
|
||||
|
||||
std::string CPropertySlider::dump () const {
|
||||
std::stringstream ss;
|
||||
|
||||
ss << this->m_name << " - slider" << std::endl
|
||||
<< "\t"
|
||||
<< "Description: " << this->m_text << std::endl
|
||||
<< "\t"
|
||||
<< "Value: " << &this->getFloat () << std::endl
|
||||
<< "\t"
|
||||
<< "Minimum value: " << this->m_min << std::endl
|
||||
<< "\t"
|
||||
<< "Maximum value: " << this->m_max << std::endl
|
||||
<< "\t"
|
||||
<< "Step: " << this->m_step << std::endl;
|
||||
|
||||
return ss.str ();
|
||||
}
|
||||
|
||||
void CPropertySlider::set (const std::string& value) {
|
||||
const auto newValue = strtof (value.c_str (), nullptr);
|
||||
|
||||
if (newValue < this->m_min || newValue > this->m_max)
|
||||
sLog.exception ("Slider value (", newValue, ") is out of range (", this->m_min, ",", this->m_max, ")");
|
||||
|
||||
this->update (newValue);
|
||||
}
|
||||
|
||||
const char* CPropertySlider::getPropertyType () const {
|
||||
return "slider";
|
||||
}
|
||||
|
||||
CPropertySlider::CPropertySlider (float value, const std::string& name, const std::string& text, float min,
|
||||
float max, float step) :
|
||||
CProperty (name, text),
|
||||
m_min (min),
|
||||
m_max (max),
|
||||
m_step (step) {
|
||||
this->update (value);
|
||||
}
|
41
src/WallpaperEngine/Core/Projects/CPropertySlider.h
Normal file
41
src/WallpaperEngine/Core/Projects/CPropertySlider.h
Normal file
@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include "CProperty.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Projects {
|
||||
using JSON = WallpaperEngine::Data::JSON::JSON;
|
||||
|
||||
/**
|
||||
* Represents a slider value with a minimum and maximum value
|
||||
*/
|
||||
class CPropertySlider final : public CProperty {
|
||||
public:
|
||||
CPropertySlider (float value, const std::string& name, const std::string& text, float min, float max, float step);
|
||||
|
||||
static std::shared_ptr<CPropertySlider> fromJSON (const JSON& data, const std::string& name);
|
||||
/**
|
||||
* @return The slider's minimum value
|
||||
*/
|
||||
[[nodiscard]] const float& getMinValue () const;
|
||||
/**
|
||||
* @return The slider's maximum value
|
||||
*/
|
||||
[[nodiscard]] const float& getMaxValue () const;
|
||||
/**
|
||||
* @return The slider's value increment steps, only really used in the UI
|
||||
*/
|
||||
[[nodiscard]] const float& getStep () const;
|
||||
[[nodiscard]] std::string dump () const override;
|
||||
void set (const std::string& value) override;
|
||||
|
||||
[[nodiscard]] const char* getPropertyType () const override;
|
||||
|
||||
private:
|
||||
/** Minimum value */
|
||||
const float m_min;
|
||||
/** Maximum value */
|
||||
const float m_max;
|
||||
/** Increment steps for the slider in the UI */
|
||||
const float m_step;
|
||||
};
|
||||
} // namespace WallpaperEngine::Core::Projects
|
34
src/WallpaperEngine/Core/Projects/CPropertyText.cpp
Normal file
34
src/WallpaperEngine/Core/Projects/CPropertyText.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include "CPropertyText.h"
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
using namespace WallpaperEngine::Core::Projects;
|
||||
|
||||
std::shared_ptr<CPropertyText> CPropertyText::fromJSON (const JSON& data, std::string name) {
|
||||
//TODO: VALIDATE THIS IS RIGHT
|
||||
return std::make_shared <CPropertyText> (
|
||||
std::move(name),
|
||||
data.optional <std::string> ("text", "")
|
||||
);
|
||||
}
|
||||
|
||||
std::string CPropertyText::dump () const {
|
||||
std::stringstream ss;
|
||||
|
||||
ss << this->m_name << " - text" << std::endl
|
||||
<< "\t"
|
||||
<< "Value: " << this->m_text;
|
||||
|
||||
return ss.str ();
|
||||
}
|
||||
|
||||
void CPropertyText::set (const std::string& value) {
|
||||
this->m_text = value;
|
||||
}
|
||||
|
||||
const char* CPropertyText::getPropertyType () const {
|
||||
return "text";
|
||||
}
|
||||
|
||||
CPropertyText::CPropertyText (std::string name, std::string text) :
|
||||
CProperty (std::move(name), std::move(text)) {}
|
22
src/WallpaperEngine/Core/Projects/CPropertyText.h
Normal file
22
src/WallpaperEngine/Core/Projects/CPropertyText.h
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include "CProperty.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Projects {
|
||||
using JSON = WallpaperEngine::Data::JSON::JSON;
|
||||
|
||||
/**
|
||||
* Represents a text property
|
||||
*/
|
||||
class CPropertyText final : public CProperty {
|
||||
public:
|
||||
CPropertyText (std::string name, std::string text);
|
||||
|
||||
static std::shared_ptr<CPropertyText> fromJSON (const JSON& data, std::string name);
|
||||
[[nodiscard]] std::string dump () const override;
|
||||
void set (const std::string& value) override;
|
||||
|
||||
[[nodiscard]] const char* getPropertyType () const override;
|
||||
private:
|
||||
};
|
||||
} // namespace WallpaperEngine::Core::Projects
|
@ -13,7 +13,7 @@ class UserSettingBuilder {
|
||||
|
||||
return std::make_unique <UserSetting> (UserSetting {
|
||||
.value = std::move (value),
|
||||
.property = PropertySharedPtr (),
|
||||
.property = PropertyWeakPtr (),
|
||||
.condition = std::nullopt,
|
||||
});
|
||||
}
|
||||
|
@ -271,9 +271,6 @@ void DynamicValue::connect (DynamicValue* other) {
|
||||
this->update (other);
|
||||
});
|
||||
|
||||
// update our value on connection
|
||||
this->update (*other);
|
||||
|
||||
this->m_connections.push_back (deregisterFunction);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ class DynamicValue {
|
||||
[[nodiscard]] const int& getInt () const;
|
||||
[[nodiscard]] const bool& getBool () const;
|
||||
[[nodiscard]] UnderlyingType getType () const;
|
||||
[[nodiscard]] virtual std::string toString () const;
|
||||
[[nodiscard]] std::string toString () const;
|
||||
|
||||
void update (float newValue);
|
||||
void update (int newValue);
|
||||
|
@ -65,7 +65,7 @@ struct ImageEffect {
|
||||
/** Effect's name for the editor */
|
||||
std::string name;
|
||||
/** If this effect is visible or not */
|
||||
UserSettingUniquePtr visible;
|
||||
UserSettingSharedPtr visible;
|
||||
/** Pass overrides to apply to the effect's passes */
|
||||
std::vector <ImageEffectPassOverrideUniquePtr> passOverrides;
|
||||
/** The effect definition */
|
||||
@ -74,17 +74,17 @@ struct ImageEffect {
|
||||
|
||||
struct ImageData {
|
||||
/** The point of origin of the image */
|
||||
UserSettingUniquePtr origin;
|
||||
UserSettingSharedPtr origin;
|
||||
/** The scale of the image */
|
||||
UserSettingUniquePtr scale;
|
||||
UserSettingSharedPtr scale;
|
||||
/** The rotation of the image */
|
||||
UserSettingUniquePtr angles;
|
||||
UserSettingSharedPtr angles;
|
||||
/** If the image is visible or not */
|
||||
UserSettingUniquePtr visible;
|
||||
UserSettingSharedPtr visible;
|
||||
/** The alpha of the image */
|
||||
UserSettingUniquePtr alpha;
|
||||
UserSettingSharedPtr alpha;
|
||||
/** The color of the image */
|
||||
UserSettingUniquePtr color;
|
||||
UserSettingSharedPtr color;
|
||||
// TODO: WRITE A COUPLE OF ENUMS FOR THIS
|
||||
/** The alignment of the image */
|
||||
std::string alignment;
|
||||
|
@ -1,138 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include "DynamicValue.h"
|
||||
#include "../Utils/TypeCaster.h"
|
||||
|
||||
namespace WallpaperEngine::Data::Model {
|
||||
using namespace WallpaperEngine::Data::Utils;
|
||||
using namespace WallpaperEngine::Data::Builders;
|
||||
|
||||
struct PropertyData {
|
||||
std::string name;
|
||||
std::string text;
|
||||
};
|
||||
|
||||
struct SliderData {
|
||||
float min;
|
||||
float max;
|
||||
float step;
|
||||
};
|
||||
|
||||
struct ComboData {
|
||||
std::map<std::string, std::string> values;
|
||||
};
|
||||
|
||||
class Property : public DynamicValue, public TypeCaster, public PropertyData {
|
||||
public:
|
||||
explicit Property (PropertyData data) : PropertyData (std::move(data)), TypeCaster (), DynamicValue () {}
|
||||
|
||||
using DynamicValue::update;
|
||||
virtual void update(const std::string& value) = 0;
|
||||
};
|
||||
|
||||
class PropertySlider : public Property, SliderData {
|
||||
public:
|
||||
PropertySlider (PropertyData data, SliderData sliderData, float value) : Property (std::move(data)), SliderData (sliderData) {
|
||||
this->update (value);
|
||||
}
|
||||
|
||||
using Property::update;
|
||||
void update(const std::string& value) override {
|
||||
this->update (std::stof (value));
|
||||
}
|
||||
};
|
||||
|
||||
class PropertyBoolean : public Property {
|
||||
public:
|
||||
explicit PropertyBoolean (PropertyData data, bool value) : Property (std::move(data)) {
|
||||
this->update (value);
|
||||
}
|
||||
|
||||
using Property::update;
|
||||
void update(const std::string& value) override {
|
||||
this->update (value == "true" || value == "1");
|
||||
}
|
||||
};
|
||||
|
||||
class PropertyColor : public Property {
|
||||
public:
|
||||
explicit PropertyColor (PropertyData data, std::string value) : Property (std::move(data)) {
|
||||
this->update (value);
|
||||
}
|
||||
|
||||
using Property::update;
|
||||
void update(const std::string& value) override {
|
||||
auto copy = value;
|
||||
|
||||
// TODO: ENSURE ALL THIS PARSING IS CORRECT
|
||||
if (copy.find (',') != std::string::npos) {
|
||||
// replace comma separator with spaces so it's
|
||||
std::replace (copy.begin (), copy.end (), ',', ' ');
|
||||
}
|
||||
|
||||
// hex colors should be converted to int colors
|
||||
if (copy.find ('#') == 0) {
|
||||
auto number = copy.substr (1);
|
||||
|
||||
// support for css notation
|
||||
if (number.size () == 3) {
|
||||
number = number[0] + number[0] + number[1] + number[1] + number[2] + number[2];
|
||||
}
|
||||
|
||||
// remove alpha if it's present, should look into it more closely
|
||||
if (number.size () > 6) {
|
||||
sLog.error ("Color value has alpha channel, which is not supported");
|
||||
number = number.substr (0, 6);
|
||||
}
|
||||
|
||||
const auto color = std::stoi (number, nullptr, 16);
|
||||
|
||||
// format the number as float vector
|
||||
copy =
|
||||
std::to_string (((color >> 16) & 0xFF) / 255.0) + " " +
|
||||
std::to_string (((color >> 8) & 0xFF) / 255.0) + " " +
|
||||
std::to_string ((color & 0xFF) / 255.0);
|
||||
} else if (copy.find ('.') == std::string::npos) {
|
||||
// integer vector, convert it to float vector
|
||||
const auto intcolor = VectorBuilder::parse <glm::ivec3> (copy);
|
||||
|
||||
copy =
|
||||
std::to_string (intcolor.r / 255.0) + " " +
|
||||
std::to_string (intcolor.g / 255.0) + " " +
|
||||
std::to_string (intcolor.b / 255.0);
|
||||
}
|
||||
|
||||
// finally parse the string as a float vector
|
||||
this->update (VectorBuilder::parse <glm::vec3> (copy));
|
||||
}
|
||||
};
|
||||
|
||||
class PropertyCombo : public Property, ComboData {
|
||||
public:
|
||||
PropertyCombo (PropertyData data, ComboData comboData, std::string value) : Property (std::move(data)), ComboData (std::move(comboData)) {
|
||||
this->update (value);
|
||||
}
|
||||
|
||||
using Property::update;
|
||||
void update(const std::string& value) override {
|
||||
this->update (std::stoi (value));
|
||||
}
|
||||
};
|
||||
|
||||
class PropertyText : public Property {
|
||||
public:
|
||||
explicit PropertyText (PropertyData data) : Property (std::move(data)) {}
|
||||
|
||||
using Property::update;
|
||||
void update(const std::string& value) override {
|
||||
throw std::runtime_error ("PropertyText::update() is not implemented");
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string toString () const override {
|
||||
return this->text;
|
||||
}
|
||||
};
|
||||
}
|
@ -8,6 +8,10 @@
|
||||
|
||||
#include "WallpaperEngine/Assets/CContainer.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Projects {
|
||||
class CProperty;
|
||||
}
|
||||
|
||||
namespace WallpaperEngine::Data::Model {
|
||||
struct Project;
|
||||
class Wallpaper;
|
||||
@ -22,12 +26,6 @@ struct ImageEffect;
|
||||
struct ImageEffectPassOverride;
|
||||
class Particle;
|
||||
class DynamicValue;
|
||||
class Property;
|
||||
class PropertySlider;
|
||||
class PropertyBoolean;
|
||||
class PropertyCombo;
|
||||
class PropertyText;
|
||||
class PropertyColor;
|
||||
struct Material;
|
||||
struct MaterialPass;
|
||||
struct FBO;
|
||||
@ -38,10 +36,16 @@ struct ModelStruct;
|
||||
// TODO: REMOVE ONCE THESE ARE RENAMED AND MOVED
|
||||
using Container = WallpaperEngine::Assets::CContainer;
|
||||
|
||||
using Property = WallpaperEngine::Core::Projects::CProperty;
|
||||
using PropertySharedPtr = std::shared_ptr <Property>;
|
||||
using PropertyWeakPtr = std::weak_ptr <Property>;
|
||||
using Properties = std::map <std::string, PropertySharedPtr>;
|
||||
using DynamicValueUniquePtr = std::unique_ptr <DynamicValue>;
|
||||
using DynamicValueSharedPtr = std::shared_ptr <DynamicValue>;
|
||||
using DynamicValueWeakPtr = std::weak_ptr <DynamicValue>;
|
||||
using UserSettingSharedPtr = std::shared_ptr <UserSetting>;
|
||||
using UserSettingUniquePtr = std::unique_ptr <UserSetting>;
|
||||
using UserSettingWeakPtr = std::weak_ptr <UserSetting>;
|
||||
// TODO: UP TO THIS POINT
|
||||
|
||||
using ShaderConstantMap = std::map <std::string, UserSettingUniquePtr>;
|
||||
|
@ -22,7 +22,7 @@ struct UserSetting {
|
||||
*/
|
||||
DynamicValueUniquePtr value;
|
||||
/** The property this setting takes the value from (if specified) */
|
||||
PropertySharedPtr property;
|
||||
PropertyWeakPtr property;
|
||||
/** Condition required for this setting, this should be possible to run in JS' V8 */
|
||||
std::optional <ConditionInfo> condition;
|
||||
/** TODO: Value might come from a script and not have conditions, implement this later */
|
||||
|
@ -5,8 +5,8 @@
|
||||
|
||||
#include "WallpaperParser.h"
|
||||
|
||||
#include "PropertyParser.h"
|
||||
#include "WallpaperEngine/Data/Model/Wallpaper.h"
|
||||
#include "WallpaperEngine/Core/Projects/CProperty.h"
|
||||
|
||||
using namespace WallpaperEngine::Data::Parsers;
|
||||
|
||||
@ -70,15 +70,18 @@ Properties ProjectParser::parseProperties (const std::optional <JSON>& data) {
|
||||
|
||||
Properties result = {};
|
||||
|
||||
// TODO: CHANGE THIS ONCE THE PROPERTIES PARSING IS HANDLED IN THE NEW TYPES
|
||||
// THESE ARE COMPLEX TYPES THAT INCLUDE SOME RUNTIME INFO THAT ISN'T EXPLICITLY DATA
|
||||
// SO THIS WILL NEED A RETHINK IN THE FUTURE
|
||||
for (const auto& cur : properties.value ().items ()) {
|
||||
const auto& property = PropertyParser::parse (cur.value (), cur.key ());
|
||||
const auto& property = Property::fromJSON (cur.value (), cur.key ());
|
||||
|
||||
// ignore properties that failed, these are generally groups
|
||||
if (property == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
result.emplace (cur.key (), property);
|
||||
result.emplace (property->getName (), property);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -1,98 +0,0 @@
|
||||
#include "PropertyParser.h"
|
||||
#include "../Model/Property.h"
|
||||
|
||||
using namespace WallpaperEngine::Data::Parsers;
|
||||
using namespace WallpaperEngine::Data::Model;
|
||||
|
||||
PropertySharedPtr PropertyParser::parse (const JSON& it, std::string name) {
|
||||
const auto type = it.require <std::string> ("type", "Property type is required");
|
||||
|
||||
if (type == "color") {
|
||||
return parseColor (it, name);
|
||||
}
|
||||
if (type == "bool") {
|
||||
return parseBoolean (it, name);
|
||||
}
|
||||
if (type == "slider") {
|
||||
return parseSlider (it, name);
|
||||
}
|
||||
if (type == "combo") {
|
||||
return parseCombo (it, name);
|
||||
}
|
||||
if (type == "text") {
|
||||
return parseText (it, name);
|
||||
}
|
||||
|
||||
if (type != "group") {
|
||||
// show the error and ignore this property
|
||||
sLog.error ("Unexpected type for property: ", type);
|
||||
sLog.error (it.dump ());
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
PropertySharedPtr PropertyParser::parseCombo (const JSON& it, std::string name) {
|
||||
std::map <std::string, std::string> optionsMap = {};
|
||||
|
||||
const auto options = it.require ("options", "Combo property must have options");
|
||||
|
||||
if (!options.is_array ()) {
|
||||
sLog.exception ("Property combo options should be an array");
|
||||
}
|
||||
|
||||
for (auto& cur : options) {
|
||||
if (!cur.is_object ()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto value = cur.require ("value", "Combo option must have a value");
|
||||
|
||||
optionsMap.emplace (
|
||||
cur.require ("label", "Combo option must have a label"),
|
||||
value.is_number () ? std::to_string (value.get <int> ()) : value.get <std::string> ()
|
||||
);
|
||||
}
|
||||
|
||||
const auto value = it.require ("value", "Combo property must have a value");
|
||||
|
||||
return std::make_shared <PropertyCombo> (PropertyData {
|
||||
.name = name,
|
||||
.text = it.optional <std::string> ("text", ""),
|
||||
}, ComboData {
|
||||
.values = optionsMap
|
||||
}, value.is_number () ? std::to_string (value.get <int> ()) : value.get <std::string> ());
|
||||
}
|
||||
|
||||
PropertySharedPtr PropertyParser::parseColor (const JSON& it, std::string name) {
|
||||
return std::make_shared <PropertyColor> (PropertyData {
|
||||
.name = name,
|
||||
.text = it.optional <std::string> ("text", ""),
|
||||
}, it.require ("value", "Property must have a value"));
|
||||
}
|
||||
|
||||
PropertySharedPtr PropertyParser::parseBoolean (const JSON& it, std::string name) {
|
||||
return std::make_shared <PropertyBoolean> (PropertyData {
|
||||
.name = name,
|
||||
.text = it.optional <std::string> ("text", ""),
|
||||
}, it.require ("value", "Property must have a value"));
|
||||
}
|
||||
|
||||
PropertySharedPtr PropertyParser::parseSlider (const JSON& it, std::string name) {
|
||||
return std::make_shared <PropertySlider> (PropertyData {
|
||||
.name = name,
|
||||
.text = it.optional <std::string> ("text", ""),
|
||||
}, SliderData {
|
||||
.min = it.optional ("min", 0.0f),
|
||||
.max = it.optional ("max", 0.0f),
|
||||
.step = it.optional ("step", 0.0f),
|
||||
}, it.require ("value", "Property must have a value"));
|
||||
}
|
||||
|
||||
PropertySharedPtr PropertyParser::parseText (const JSON& it, std::string name) {
|
||||
return std::make_shared <PropertyText> (PropertyData {
|
||||
.name = name,
|
||||
.text = it.optional <std::string> ("text", ""),
|
||||
});
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "WallpaperEngine/Data/JSON.h"
|
||||
|
||||
namespace WallpaperEngine::Data::Parsers {
|
||||
using JSON = WallpaperEngine::Data::JSON::JSON;
|
||||
using namespace WallpaperEngine::Data::Model;
|
||||
|
||||
class PropertyParser {
|
||||
public:
|
||||
static PropertySharedPtr parse (const JSON& it, std::string name);
|
||||
|
||||
private:
|
||||
static PropertySharedPtr parseCombo (const JSON& it, std::string name);
|
||||
static PropertySharedPtr parseColor (const JSON& it, std::string name);
|
||||
static PropertySharedPtr parseBoolean (const JSON& it, std::string name);
|
||||
static PropertySharedPtr parseSlider (const JSON& it, std::string name);
|
||||
static PropertySharedPtr parseText (const JSON& it, std::string name);
|
||||
};
|
||||
}
|
@ -1,14 +1,13 @@
|
||||
#include "UserSettingParser.h"
|
||||
|
||||
#include "WallpaperEngine/Data/Model/UserSetting.h"
|
||||
#include "WallpaperEngine/Data/Model/Property.h"
|
||||
|
||||
using namespace WallpaperEngine::Data::Parsers;
|
||||
using namespace WallpaperEngine::Data::Builders;
|
||||
|
||||
UserSettingUniquePtr UserSettingParser::parse (const json& data, const Properties& properties) {
|
||||
DynamicValueUniquePtr value = std::make_unique <DynamicValue> ();
|
||||
PropertySharedPtr property;
|
||||
PropertyWeakPtr property;
|
||||
std::optional<ConditionInfo> condition;
|
||||
auto valueIt = data;
|
||||
std::string content = data.dump ();
|
||||
@ -65,9 +64,6 @@ UserSettingUniquePtr UserSettingParser::parse (const json& data, const Propertie
|
||||
value->update (valueIt.get <float> ());
|
||||
} else if (valueIt.is_boolean ()) {
|
||||
value->update (valueIt.get <bool> ());
|
||||
} else if (valueIt.is_null () && property != nullptr) {
|
||||
// null values are directly connected to the property
|
||||
value->connect (property.get());
|
||||
} else {
|
||||
sLog.exception ("Unsupported user setting type ", valueIt.type_name ());
|
||||
}
|
||||
|
@ -10,6 +10,12 @@
|
||||
#include "WallpaperEngine/Render/Objects/CImage.h"
|
||||
#include "WallpaperEngine/Render/CFBO.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Projects/CProperty.h"
|
||||
#include "WallpaperEngine/Core/Projects/CPropertyColor.h"
|
||||
#include "WallpaperEngine/Core/Projects/CPropertyCombo.h"
|
||||
#include "WallpaperEngine/Core/Projects/CPropertySlider.h"
|
||||
#include "WallpaperEngine/Core/Projects/CPropertyBoolean.h"
|
||||
|
||||
#include "WallpaperEngine/Render/Shaders/Variables/CShaderVariable.h"
|
||||
#include "WallpaperEngine/Render/Shaders/Variables/CShaderVariableFloat.h"
|
||||
#include "WallpaperEngine/Render/Shaders/Variables/CShaderVariableInteger.h"
|
||||
|
@ -17,6 +17,7 @@ class CImage;
|
||||
namespace WallpaperEngine::Render::Objects::Effects {
|
||||
using namespace WallpaperEngine::Assets;
|
||||
using namespace WallpaperEngine::Render::Shaders::Variables;
|
||||
using namespace WallpaperEngine::Core::Projects;
|
||||
using namespace WallpaperEngine::Data::Model;
|
||||
|
||||
class CPass final : public Helpers::CContextAware {
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "CGLSLContext.h"
|
||||
|
||||
using namespace WallpaperEngine::Core;
|
||||
using namespace WallpaperEngine::Assets;
|
||||
|
||||
namespace WallpaperEngine::Render::Shaders {
|
||||
|
@ -47,6 +47,7 @@
|
||||
"#define varying out\n"
|
||||
#define DEFINE_COMBO(name, value) "#define " + name + " " + std::to_string (value) + "\n";
|
||||
|
||||
using namespace WallpaperEngine::Core;
|
||||
using namespace WallpaperEngine::Assets;
|
||||
using namespace WallpaperEngine::Data::Builders;
|
||||
using namespace WallpaperEngine::Render::Shaders;
|
||||
@ -410,6 +411,10 @@ void CShaderUnit::parseParameterConfiguration (
|
||||
// TODO: BETTER CONVERSION HERE
|
||||
size_t index = value - '0';
|
||||
|
||||
if (combo != data.end () && paintDefaultColor != data.end () && combo->get <std::string> () == "MASK" && this->m_file.find ("water")) {
|
||||
sLog.debug("mask defaultcolor!");
|
||||
}
|
||||
|
||||
if (combo != data.end ()) {
|
||||
// TODO: CLEANUP HOW THIS IS DETERMINED FIRST
|
||||
// if the texture exists (and is not null), add to the combo
|
||||
|
Loading…
Reference in New Issue
Block a user