mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
fix: angles can be an user setting too, also added detection for animation frames to show a warning
This commit is contained in:
parent
c3d969ecf8
commit
499c7490eb
@ -18,7 +18,8 @@ using namespace WallpaperEngine::Core::UserSettings;
|
|||||||
|
|
||||||
CObject::CObject (
|
CObject::CObject (
|
||||||
const Wallpapers::CScene* scene, const CUserSettingBoolean* visible, int id, std::string name, std::string type,
|
const Wallpapers::CScene* scene, const CUserSettingBoolean* visible, int id, std::string name, std::string type,
|
||||||
const CUserSettingVector3* origin, const CUserSettingVector3* scale, glm::vec3 angles, std::vector<int> dependencies
|
const CUserSettingVector3* origin, const CUserSettingVector3* scale, const CUserSettingVector3* angles,
|
||||||
|
std::vector<int> dependencies
|
||||||
) :
|
) :
|
||||||
m_type (std::move(type)),
|
m_type (std::move(type)),
|
||||||
m_visible (visible),
|
m_visible (visible),
|
||||||
@ -37,7 +38,7 @@ const CObject* CObject::fromJSON (
|
|||||||
const auto visible = jsonFindUserConfig<CUserSettingBoolean> (data, scene->getProject(), "visible", true);
|
const auto visible = jsonFindUserConfig<CUserSettingBoolean> (data, scene->getProject(), "visible", true);
|
||||||
const auto origin = jsonFindUserConfig<CUserSettingVector3> (data, scene->getProject(), "origin", {0, 0, 0});
|
const auto origin = jsonFindUserConfig<CUserSettingVector3> (data, scene->getProject(), "origin", {0, 0, 0});
|
||||||
const auto scale = jsonFindUserConfig<CUserSettingVector3> (data, scene->getProject(), "scale", {1, 1, 1});
|
const auto scale = jsonFindUserConfig<CUserSettingVector3> (data, scene->getProject(), "scale", {1, 1, 1});
|
||||||
const auto angles_val = jsonFindDefault<glm::vec3> (data, "angles", glm::vec3 (0, 0, 0));
|
const auto angles_val = jsonFindUserConfig<CUserSettingVector3> (data, scene->getProject(), "angles", glm::vec3 (0, 0, 0));
|
||||||
const auto name = jsonFindRequired <std::string> (data, "name", "Objects must have name");
|
const auto name = jsonFindRequired <std::string> (data, "name", "Objects must have name");
|
||||||
const auto effects_it = data.find ("effects");
|
const auto effects_it = data.find ("effects");
|
||||||
const auto dependencies_it = data.find ("dependencies");
|
const auto dependencies_it = data.find ("dependencies");
|
||||||
@ -66,7 +67,7 @@ const CObject* CObject::fromJSON (
|
|||||||
/// TODO: XXXHACK -- TO REMOVE WHEN PARTICLE SUPPORT IS PROPERLY IMPLEMENTED
|
/// TODO: XXXHACK -- TO REMOVE WHEN PARTICLE SUPPORT IS PROPERLY IMPLEMENTED
|
||||||
try {
|
try {
|
||||||
object = Objects::CParticle::fromFile (
|
object = Objects::CParticle::fromFile (
|
||||||
scene, particle_it->get<std::string> (), container, visible, id, name, origin, scale, dependencies);
|
scene, particle_it->get<std::string> (), container, visible, id, name, origin, angles_val, scale, dependencies);
|
||||||
} catch (std::runtime_error&) {
|
} catch (std::runtime_error&) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -92,7 +93,7 @@ const glm::vec3& CObject::getScale () const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const glm::vec3& CObject::getAngles () const {
|
const glm::vec3& CObject::getAngles () const {
|
||||||
return this->m_angles;
|
return this->m_angles->getVec3 ();
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& CObject::getName () const {
|
const std::string& CObject::getName () const {
|
||||||
|
@ -31,17 +31,17 @@ class CObject {
|
|||||||
public:
|
public:
|
||||||
static const CObject* fromJSON (const json& data, const Wallpapers::CScene* scene, const CContainer* container);
|
static const CObject* fromJSON (const json& data, const Wallpapers::CScene* scene, const CContainer* container);
|
||||||
|
|
||||||
template <class T> const T* as () const {
|
template <class T> [[nodiscard]] const T* as () const {
|
||||||
assert (is<T> ());
|
assert (is<T> ());
|
||||||
return reinterpret_cast<const T*> (this);
|
return reinterpret_cast<const T*> (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> T* as () {
|
template <class T> [[nodiscard]] T* as () {
|
||||||
assert (is<T> ());
|
assert (is<T> ());
|
||||||
return reinterpret_cast<T*> (this);
|
return reinterpret_cast<T*> (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> bool is () const {
|
template <class T> [[nodiscard]] bool is () const {
|
||||||
return this->m_type == T::Type;
|
return this->m_type == T::Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ class CObject {
|
|||||||
protected:
|
protected:
|
||||||
CObject (
|
CObject (
|
||||||
const Wallpapers::CScene* scene, const CUserSettingBoolean* visible, int id, std::string name, std::string type,
|
const Wallpapers::CScene* scene, const CUserSettingBoolean* visible, int id, std::string name, std::string type,
|
||||||
const CUserSettingVector3* origin, const CUserSettingVector3* scale, glm::vec3 angles,
|
const CUserSettingVector3* origin, const CUserSettingVector3* scale, const CUserSettingVector3* angles,
|
||||||
std::vector<int> dependencies);
|
std::vector<int> dependencies);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -70,7 +70,7 @@ class CObject {
|
|||||||
const std::string m_name;
|
const std::string m_name;
|
||||||
const CUserSettingVector3* m_origin;
|
const CUserSettingVector3* m_origin;
|
||||||
const CUserSettingVector3* m_scale;
|
const CUserSettingVector3* m_scale;
|
||||||
const glm::vec3 m_angles;
|
const CUserSettingVector3* m_angles;
|
||||||
|
|
||||||
const std::vector<int> m_dependencies;
|
const std::vector<int> m_dependencies;
|
||||||
|
|
||||||
|
@ -13,10 +13,10 @@ using namespace WallpaperEngine::Core::UserSettings;
|
|||||||
|
|
||||||
CImage::CImage (
|
CImage::CImage (
|
||||||
const Wallpapers::CScene* scene, const Images::CMaterial* material, const CUserSettingBoolean* visible, int id,
|
const Wallpapers::CScene* scene, const Images::CMaterial* material, const CUserSettingBoolean* visible, int id,
|
||||||
std::string name, const CUserSettingVector3* origin, const CUserSettingVector3* scale, glm::vec3 angles,
|
std::string name, const CUserSettingVector3* origin, const CUserSettingVector3* scale,
|
||||||
glm::vec2 size, std::string alignment, const CUserSettingVector3* color, const CUserSettingFloat* alpha,
|
const CUserSettingVector3* angles, glm::vec2 size, std::string alignment, const CUserSettingVector3* color,
|
||||||
float brightness, uint32_t colorBlendMode, glm::vec2 parallaxDepth, bool fullscreen, bool passthrough,
|
const CUserSettingFloat* alpha, float brightness, uint32_t colorBlendMode, glm::vec2 parallaxDepth, bool fullscreen,
|
||||||
bool autosize, std::vector<const Objects::CEffect*> effects, std::vector<int> dependencies
|
bool passthrough, bool autosize, std::vector<const Objects::CEffect*> effects, std::vector<int> dependencies
|
||||||
) :
|
) :
|
||||||
CObject (scene, visible, id, std::move(name), Type, origin, scale, angles, std::move(dependencies)),
|
CObject (scene, visible, id, std::move(name), Type, origin, scale, angles, std::move(dependencies)),
|
||||||
m_size (size),
|
m_size (size),
|
||||||
@ -35,7 +35,7 @@ CImage::CImage (
|
|||||||
const WallpaperEngine::Core::CObject* CImage::fromJSON (
|
const WallpaperEngine::Core::CObject* CImage::fromJSON (
|
||||||
const Wallpapers::CScene* scene, const json& data, const CContainer* container,
|
const Wallpapers::CScene* scene, const json& data, const CContainer* container,
|
||||||
const CUserSettingBoolean* visible, int id, std::string name, const CUserSettingVector3* origin,
|
const CUserSettingBoolean* visible, int id, std::string name, const CUserSettingVector3* origin,
|
||||||
const CUserSettingVector3* scale, glm::vec3 angles, const json::const_iterator& effects_it,
|
const CUserSettingVector3* scale, const CUserSettingVector3* angles, const json::const_iterator& effects_it,
|
||||||
std::vector<int> dependencies
|
std::vector<int> dependencies
|
||||||
) {
|
) {
|
||||||
const auto image = jsonFindRequired <std::string>(data, "image", "Image must have an image");
|
const auto image = jsonFindRequired <std::string>(data, "image", "Image must have an image");
|
||||||
|
@ -30,7 +30,7 @@ class CImage : public CObject {
|
|||||||
static const CObject* fromJSON (
|
static const CObject* fromJSON (
|
||||||
const Wallpapers::CScene* scene, const json& data, const CContainer* container,
|
const Wallpapers::CScene* scene, const json& data, const CContainer* container,
|
||||||
const CUserSettingBoolean* visible, int id, std::string name, const CUserSettingVector3* origin,
|
const CUserSettingBoolean* visible, int id, std::string name, const CUserSettingVector3* origin,
|
||||||
const CUserSettingVector3* scale, glm::vec3 angles, const json::const_iterator& effects_it,
|
const CUserSettingVector3* scale, const CUserSettingVector3* angles, const json::const_iterator& effects_it,
|
||||||
std::vector<int> dependencies);
|
std::vector<int> dependencies);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,10 +85,11 @@ class CImage : public CObject {
|
|||||||
protected:
|
protected:
|
||||||
CImage (
|
CImage (
|
||||||
const Wallpapers::CScene* scene, const Images::CMaterial* material, const CUserSettingBoolean* visible, int id,
|
const Wallpapers::CScene* scene, const Images::CMaterial* material, const CUserSettingBoolean* visible, int id,
|
||||||
std::string name, const CUserSettingVector3* origin, const CUserSettingVector3* scale, glm::vec3 angles,
|
std::string name, const CUserSettingVector3* origin, const CUserSettingVector3* scale,
|
||||||
glm::vec2 size, std::string alignment, const CUserSettingVector3* color, const CUserSettingFloat* alpha,
|
const CUserSettingVector3* angles, glm::vec2 size, std::string alignment, const CUserSettingVector3* color,
|
||||||
float brightness, uint32_t colorBlendMode, glm::vec2 parallaxDepth, bool fullscreen, bool passthrough,
|
const CUserSettingFloat* alpha, float brightness, uint32_t colorBlendMode, glm::vec2 parallaxDepth,
|
||||||
bool autosize, std::vector<const Objects::CEffect*> effects, std::vector<int> dependencies);
|
bool fullscreen, bool passthrough, bool autosize, std::vector<const Objects::CEffect*> effects,
|
||||||
|
std::vector<int> dependencies);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type value used to differentiate the different types of objects in a background
|
* Type value used to differentiate the different types of objects in a background
|
||||||
|
@ -7,7 +7,7 @@ using namespace WallpaperEngine::Core::Objects;
|
|||||||
const CParticle* CParticle::fromFile (
|
const CParticle* CParticle::fromFile (
|
||||||
const Wallpapers::CScene* scene, const std::string& filename, const CContainer* container,
|
const Wallpapers::CScene* scene, const std::string& filename, const CContainer* container,
|
||||||
const CUserSettingBoolean* visible, int id, const std::string& name, const CUserSettingVector3* origin,
|
const CUserSettingBoolean* visible, int id, const std::string& name, const CUserSettingVector3* origin,
|
||||||
const CUserSettingVector3* scale, std::vector<int> dependencies
|
const CUserSettingVector3* angles, const CUserSettingVector3* scale, std::vector<int> dependencies
|
||||||
) {
|
) {
|
||||||
json data = json::parse (container->readFileAsString (filename));
|
json data = json::parse (container->readFileAsString (filename));
|
||||||
const auto controlpoint_it = data.find ("controlpoint");
|
const auto controlpoint_it = data.find ("controlpoint");
|
||||||
@ -36,6 +36,7 @@ const CParticle* CParticle::fromFile (
|
|||||||
name,
|
name,
|
||||||
origin,
|
origin,
|
||||||
scale,
|
scale,
|
||||||
|
angles,
|
||||||
controlpoints,
|
controlpoints,
|
||||||
emitters,
|
emitters,
|
||||||
initializers,
|
initializers,
|
||||||
@ -46,11 +47,11 @@ const CParticle* CParticle::fromFile (
|
|||||||
CParticle::CParticle (
|
CParticle::CParticle (
|
||||||
const Wallpapers::CScene* scene, uint32_t starttime, uint32_t maxcount, const CUserSettingBoolean* visible, int id,
|
const Wallpapers::CScene* scene, uint32_t starttime, uint32_t maxcount, const CUserSettingBoolean* visible, int id,
|
||||||
const std::string& name, const CUserSettingVector3* origin, const CUserSettingVector3* scale,
|
const std::string& name, const CUserSettingVector3* origin, const CUserSettingVector3* scale,
|
||||||
const std::vector<const Particles::CControlPoint*>& controlpoints,
|
const CUserSettingVector3* angles, const std::vector<const Particles::CControlPoint*>& controlpoints,
|
||||||
const std::vector<const Particles::CEmitter*>& emitters,
|
const std::vector<const Particles::CEmitter*>& emitters,
|
||||||
const std::vector<const Particles::CInitializer*>& initializers, std::vector<int> dependencies
|
const std::vector<const Particles::CInitializer*>& initializers, std::vector<int> dependencies
|
||||||
) :
|
) :
|
||||||
CObject (scene, visible, id, name, Type, origin, scale, glm::vec3 (), std::move(dependencies)),
|
CObject (scene, visible, id, name, Type, origin, scale, angles, std::move(dependencies)),
|
||||||
m_starttime (starttime),
|
m_starttime (starttime),
|
||||||
m_maxcount (maxcount),
|
m_maxcount (maxcount),
|
||||||
m_controlpoints (controlpoints),
|
m_controlpoints (controlpoints),
|
||||||
|
@ -20,7 +20,7 @@ class CParticle : public CObject {
|
|||||||
static const CParticle* fromFile (
|
static const CParticle* fromFile (
|
||||||
const Wallpapers::CScene* scene, const std::string& filename, const CContainer* container,
|
const Wallpapers::CScene* scene, const std::string& filename, const CContainer* container,
|
||||||
const CUserSettingBoolean* visible, int id, const std::string& name, const CUserSettingVector3* origin,
|
const CUserSettingBoolean* visible, int id, const std::string& name, const CUserSettingVector3* origin,
|
||||||
const CUserSettingVector3* scale, std::vector<int> dependencies);
|
const CUserSettingVector3* angles, const CUserSettingVector3* scale, std::vector<int> dependencies);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The list of emitters for the particle system
|
* @return The list of emitters for the particle system
|
||||||
@ -39,7 +39,7 @@ class CParticle : public CObject {
|
|||||||
CParticle (
|
CParticle (
|
||||||
const Wallpapers::CScene* scene, uint32_t starttime, uint32_t maxcount, const CUserSettingBoolean* visible,
|
const Wallpapers::CScene* scene, uint32_t starttime, uint32_t maxcount, const CUserSettingBoolean* visible,
|
||||||
int id, const std::string& name, const CUserSettingVector3* origin, const CUserSettingVector3* scale,
|
int id, const std::string& name, const CUserSettingVector3* origin, const CUserSettingVector3* scale,
|
||||||
const std::vector<const Particles::CControlPoint*>& controlpoints,
|
const CUserSettingVector3* angles, const std::vector<const Particles::CControlPoint*>& controlpoints,
|
||||||
const std::vector<const Particles::CEmitter*>& emitters,
|
const std::vector<const Particles::CEmitter*>& emitters,
|
||||||
const std::vector<const Particles::CInitializer*>& initializers, std::vector<int> dependencies);
|
const std::vector<const Particles::CInitializer*>& initializers, std::vector<int> dependencies);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ using namespace WallpaperEngine::Core::Objects;
|
|||||||
|
|
||||||
CSound::CSound (
|
CSound::CSound (
|
||||||
const Wallpapers::CScene* scene, const CUserSettingBoolean* visible, int id, std::string name,
|
const Wallpapers::CScene* scene, const CUserSettingBoolean* visible, int id, std::string name,
|
||||||
const CUserSettingVector3* origin, const CUserSettingVector3* scale, glm::vec3 angles, bool repeat,
|
const CUserSettingVector3* origin, const CUserSettingVector3* scale, const CUserSettingVector3* angles, bool repeat,
|
||||||
std::vector<std::string> sounds, std::vector<int> dependencies
|
std::vector<std::string> sounds, std::vector<int> dependencies
|
||||||
) :
|
) :
|
||||||
CObject (scene, visible, id, std::move(name), Type, origin, scale, angles, std::move(dependencies)),
|
CObject (scene, visible, id, std::move(name), Type, origin, scale, angles, std::move(dependencies)),
|
||||||
@ -17,8 +17,8 @@ CSound::CSound (
|
|||||||
|
|
||||||
const WallpaperEngine::Core::CObject* CSound::fromJSON (
|
const WallpaperEngine::Core::CObject* CSound::fromJSON (
|
||||||
const Wallpapers::CScene* scene, const json& data, const CUserSettingBoolean* visible, int id,
|
const Wallpapers::CScene* scene, const json& data, const CUserSettingBoolean* visible, int id,
|
||||||
const std::string& name, const CUserSettingVector3* origin, const CUserSettingVector3* scale, glm::vec3 angles,
|
const std::string& name, const CUserSettingVector3* origin, const CUserSettingVector3* scale,
|
||||||
std::vector<int> dependencies
|
const CUserSettingVector3* angles, std::vector<int> dependencies
|
||||||
) {
|
) {
|
||||||
// TODO: PARSE AUDIO VOLUME
|
// TODO: PARSE AUDIO VOLUME
|
||||||
std::vector<std::string> sounds;
|
std::vector<std::string> sounds;
|
||||||
|
@ -21,8 +21,8 @@ class CSound : public CObject {
|
|||||||
public:
|
public:
|
||||||
static const CObject* fromJSON (
|
static const CObject* fromJSON (
|
||||||
const Wallpapers::CScene* scene, const json& data, const CUserSettingBoolean* visible,
|
const Wallpapers::CScene* scene, const json& data, const CUserSettingBoolean* visible,
|
||||||
int id, const std::string& name, const CUserSettingVector3* origin, const CUserSettingVector3* scale, glm::vec3 angles,
|
int id, const std::string& name, const CUserSettingVector3* origin, const CUserSettingVector3* scale,
|
||||||
std::vector<int> dependencies);
|
const CUserSettingVector3* angles, std::vector<int> dependencies);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The list of sounds to play
|
* @return The list of sounds to play
|
||||||
@ -36,8 +36,8 @@ class CSound : public CObject {
|
|||||||
protected:
|
protected:
|
||||||
CSound (
|
CSound (
|
||||||
const Wallpapers::CScene* scene, const CUserSettingBoolean* visible, int id, std::string name,
|
const Wallpapers::CScene* scene, const CUserSettingBoolean* visible, int id, std::string name,
|
||||||
const CUserSettingVector3* origin, const CUserSettingVector3* scale, glm::vec3 angles, bool repeat,
|
const CUserSettingVector3* origin, const CUserSettingVector3* scale, const CUserSettingVector3* angles,
|
||||||
std::vector<std::string> sounds, std::vector<int> dependencies);
|
bool repeat, std::vector<std::string> sounds, std::vector<int> dependencies);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type value used to differentiate the different types of objects in a background
|
* Type value used to differentiate the different types of objects in a background
|
||||||
|
@ -47,6 +47,7 @@ const CUserSettingBoolean* CUserSettingBoolean::fromJSON (const nlohmann::json&
|
|||||||
std::string expectedValue;
|
std::string expectedValue;
|
||||||
|
|
||||||
if (data.is_object ()) {
|
if (data.is_object ()) {
|
||||||
|
auto animation = data.find ("animation");
|
||||||
auto userIt = data.find ("user");
|
auto userIt = data.find ("user");
|
||||||
defaultValue = jsonFindDefault (data, "value", true); // is this default value right?
|
defaultValue = jsonFindDefault (data, "value", true); // is this default value right?
|
||||||
|
|
||||||
@ -73,6 +74,10 @@ const CUserSettingBoolean* CUserSettingBoolean::fromJSON (const nlohmann::json&
|
|||||||
} else {
|
} else {
|
||||||
sLog.error ("Boolean property doesn't have user member, this could mean an scripted value");
|
sLog.error ("Boolean property doesn't have user member, this could mean an scripted value");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (animation != data.end ()) {
|
||||||
|
sLog.error ("Detected a setting with animation data, which is not supported yet!");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!data.is_boolean ())
|
if (!data.is_boolean ())
|
||||||
sLog.error ("Expected boolean value on user setting");
|
sLog.error ("Expected boolean value on user setting");
|
||||||
|
@ -13,7 +13,7 @@ class CUserSettingBoolean : public CUserSettingValue {
|
|||||||
typedef bool data_type;
|
typedef bool data_type;
|
||||||
|
|
||||||
static const CUserSettingBoolean* fromJSON (const nlohmann::json& data, const CProject& project);
|
static const CUserSettingBoolean* fromJSON (const nlohmann::json& data, const CProject& project);
|
||||||
static const CUserSettingBoolean* fromScalar (const bool value);
|
static const CUserSettingBoolean* fromScalar (bool value);
|
||||||
static std::string Type;
|
static std::string Type;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -41,6 +41,7 @@ const CUserSettingFloat* CUserSettingFloat::fromJSON (const nlohmann::json& data
|
|||||||
const Projects::CProperty* sourceProperty = nullptr;
|
const Projects::CProperty* sourceProperty = nullptr;
|
||||||
|
|
||||||
if (data.is_object ()) {
|
if (data.is_object ()) {
|
||||||
|
auto animation = data.find ("animation");
|
||||||
auto userIt = data.find ("user");
|
auto userIt = data.find ("user");
|
||||||
defaultValue = jsonFindDefault (data, "value", 1.0f); // is this default value right?
|
defaultValue = jsonFindDefault (data, "value", 1.0f); // is this default value right?
|
||||||
|
|
||||||
@ -64,6 +65,10 @@ const CUserSettingFloat* CUserSettingFloat::fromJSON (const nlohmann::json& data
|
|||||||
if (sourceProperty == nullptr) {
|
if (sourceProperty == nullptr) {
|
||||||
sLog.error ("Cannot find property ", source, " to get value from for user setting value, using default value: ", defaultValue);
|
sLog.error ("Cannot find property ", source, " to get value from for user setting value, using default value: ", defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (animation != data.end ()) {
|
||||||
|
sLog.error ("Detected a setting with animation data, which is not supported yet!");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sLog.error ("Float property doesn't have user member, this could mean an scripted value");
|
sLog.error ("Float property doesn't have user member, this could mean an scripted value");
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ class CUserSettingFloat : public CUserSettingValue {
|
|||||||
typedef float data_type;
|
typedef float data_type;
|
||||||
|
|
||||||
static const CUserSettingFloat* fromJSON (const nlohmann::json& data, const CProject& project);
|
static const CUserSettingFloat* fromJSON (const nlohmann::json& data, const CProject& project);
|
||||||
static const CUserSettingFloat* fromScalar (const float value);
|
static const CUserSettingFloat* fromScalar (float value);
|
||||||
static std::string Type;
|
static std::string Type;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -41,6 +41,7 @@ const CUserSettingVector3* CUserSettingVector3::fromJSON (const nlohmann::json&
|
|||||||
std::string expectedValue;
|
std::string expectedValue;
|
||||||
|
|
||||||
if (data.is_object ()) {
|
if (data.is_object ()) {
|
||||||
|
auto animation = data.find ("animation");
|
||||||
auto userIt = data.find ("user");
|
auto userIt = data.find ("user");
|
||||||
defaultValue = jsonFindDefault (data, "value", glm::vec3()); // is this default value right?
|
defaultValue = jsonFindDefault (data, "value", glm::vec3()); // is this default value right?
|
||||||
|
|
||||||
@ -67,6 +68,10 @@ const CUserSettingVector3* CUserSettingVector3::fromJSON (const nlohmann::json&
|
|||||||
} else {
|
} else {
|
||||||
sLog.error ("Vector property doesn't have user member, this could mean an scripted value");
|
sLog.error ("Vector property doesn't have user member, this could mean an scripted value");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (animation != data.end ()) {
|
||||||
|
sLog.error ("Detected a setting with animation data, which is not supported yet!");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!data.is_string ())
|
if (!data.is_string ())
|
||||||
sLog.exception ("Expected vector value on user settings");
|
sLog.exception ("Expected vector value on user settings");
|
||||||
|
@ -15,7 +15,7 @@ class CUserSettingVector3 : public CUserSettingValue {
|
|||||||
typedef glm::vec3 data_type;
|
typedef glm::vec3 data_type;
|
||||||
|
|
||||||
static const CUserSettingVector3* fromJSON (const nlohmann::json& data, const CProject& project);
|
static const CUserSettingVector3* fromJSON (const nlohmann::json& data, const CProject& project);
|
||||||
static const CUserSettingVector3* fromScalar (const glm::vec3 value);
|
static const CUserSettingVector3* fromScalar (glm::vec3 value);
|
||||||
static std::string Type;
|
static std::string Type;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user