leocad/common/lc_objectproperty.h

96 lines
1.7 KiB
C
Raw Normal View History

#pragma once
enum class lcObjectPropertyId
{
PieceId,
PieceColor,
PieceStepShow,
PieceStepHide,
CameraName,
CameraType,
CameraFOV,
CameraNear,
CameraFar,
CameraPositionX,
CameraPositionY,
CameraPositionZ,
CameraTargetX,
CameraTargetY,
CameraTargetZ,
CameraUpX,
CameraUpY,
CameraUpZ,
LightName,
LightType,
LightColor,
LightBlenderPower,
LightPOVRayPower,
LightCastShadow,
LightPOVRayFadeDistance,
LightPOVRayFadePower,
LightPointBlenderRadius,
LightSpotBlenderRadius,
LightDirectionalBlenderAngle,
LightAreaSizeX,
LightAreaSizeY,
LightSpotConeAngle,
LightSpotPenumbraAngle,
LightSpotPOVRayTightness,
LightAreaShape,
LightAreaPOVRayGridX,
LightAreaPOVRayGridY,
ObjectPositionX,
ObjectPositionY,
ObjectPositionZ,
ObjectRotationX,
ObjectRotationY,
ObjectRotationZ,
Count
};
template<typename T>
struct lcObjectPropertyKey
{
lcStep Step;
T Value;
};
template<typename T>
class lcObjectProperty
{
public:
explicit lcObjectProperty(const T& DefaultValue)
: mValue(DefaultValue)
{
}
operator const T& () const
{
return mValue;
}
void SetValue(const T& Value)
{
mValue = Value;
}
void RemoveAllKeys()
{
mKeys.clear();
}
void Update(lcStep Step);
2024-02-19 23:54:45 +01:00
bool ChangeKey(const T& Value, lcStep Step, bool AddKey);
void InsertTime(lcStep Start, lcStep Time);
void RemoveTime(lcStep Start, lcStep Time);
2024-01-15 02:41:01 +01:00
bool HasKeyFrame(lcStep Time) const;
2024-01-21 21:53:18 +01:00
bool SetKeyFrame(lcStep Time, bool KeyFrame);
void Save(QTextStream& Stream, const char* ObjectName, const char* VariableName, bool SaveEmpty) const;
bool Load(QTextStream& Stream, const QString& Token, const char* VariableName);
protected:
T mValue;
std::vector<lcObjectPropertyKey<T>> mKeys;
};