mirror of
https://github.com/leozide/leocad
synced 2025-01-30 20:34:56 +01:00
Split light power into different properties for Blender and POV-Ray.
This commit is contained in:
parent
69ae4ea492
commit
5d5274b2b4
10 changed files with 97 additions and 39 deletions
|
@ -642,7 +642,8 @@ QVariant lcCamera::GetPropertyValue(lcObjectPropertyId PropertyId) const
|
|||
case lcObjectPropertyId::LightName:
|
||||
case lcObjectPropertyId::LightType:
|
||||
case lcObjectPropertyId::LightColor:
|
||||
case lcObjectPropertyId::LightPower:
|
||||
case lcObjectPropertyId::LightBlenderPower:
|
||||
case lcObjectPropertyId::LightPOVRayPower:
|
||||
case lcObjectPropertyId::LightCastShadow:
|
||||
case lcObjectPropertyId::LightPOVRayFadeDistance:
|
||||
case lcObjectPropertyId::LightPOVRayFadePower:
|
||||
|
@ -705,7 +706,8 @@ bool lcCamera::SetPropertyValue(lcObjectPropertyId PropertyId, lcStep Step, bool
|
|||
case lcObjectPropertyId::LightName:
|
||||
case lcObjectPropertyId::LightType:
|
||||
case lcObjectPropertyId::LightColor:
|
||||
case lcObjectPropertyId::LightPower:
|
||||
case lcObjectPropertyId::LightBlenderPower:
|
||||
case lcObjectPropertyId::LightPOVRayPower:
|
||||
case lcObjectPropertyId::LightCastShadow:
|
||||
case lcObjectPropertyId::LightPOVRayFadeDistance:
|
||||
case lcObjectPropertyId::LightPOVRayFadePower:
|
||||
|
@ -767,7 +769,8 @@ bool lcCamera::HasKeyFrame(lcObjectPropertyId PropertyId, lcStep Time) const
|
|||
case lcObjectPropertyId::LightName:
|
||||
case lcObjectPropertyId::LightType:
|
||||
case lcObjectPropertyId::LightColor:
|
||||
case lcObjectPropertyId::LightPower:
|
||||
case lcObjectPropertyId::LightBlenderPower:
|
||||
case lcObjectPropertyId::LightPOVRayPower:
|
||||
case lcObjectPropertyId::LightCastShadow:
|
||||
case lcObjectPropertyId::LightPOVRayFadeDistance:
|
||||
case lcObjectPropertyId::LightPOVRayFadePower:
|
||||
|
@ -829,7 +832,8 @@ bool lcCamera::SetKeyFrame(lcObjectPropertyId PropertyId, lcStep Time, bool KeyF
|
|||
case lcObjectPropertyId::LightName:
|
||||
case lcObjectPropertyId::LightType:
|
||||
case lcObjectPropertyId::LightColor:
|
||||
case lcObjectPropertyId::LightPower:
|
||||
case lcObjectPropertyId::LightBlenderPower:
|
||||
case lcObjectPropertyId::LightPOVRayPower:
|
||||
case lcObjectPropertyId::LightCastShadow:
|
||||
case lcObjectPropertyId::LightPOVRayFadeDistance:
|
||||
case lcObjectPropertyId::LightPOVRayFadePower:
|
||||
|
|
|
@ -3190,9 +3190,19 @@ void lcModel::SetLightSize(lcLight* Light, lcVector2 LightAreaSize)
|
|||
UpdateAllViews();
|
||||
}
|
||||
|
||||
void lcModel::SetLightPower(lcLight* Light, float Power)
|
||||
void lcModel::SetLightBlenderPower(lcLight* Light, float Power)
|
||||
{
|
||||
Light->SetPower(Power, mCurrentStep, gMainWindow->GetAddKeys());
|
||||
Light->SetBlenderPower(Power, mCurrentStep, gMainWindow->GetAddKeys());
|
||||
Light->UpdatePosition(mCurrentStep);
|
||||
|
||||
SaveCheckpoint(tr("Changing Light Power"));
|
||||
gMainWindow->UpdateSelectedObjects(false);
|
||||
UpdateAllViews();
|
||||
}
|
||||
|
||||
void lcModel::SetLightPOVRayPower(lcLight* Light, float Power)
|
||||
{
|
||||
Light->SetPOVRayPower(Power, mCurrentStep, gMainWindow->GetAddKeys());
|
||||
Light->UpdatePosition(mCurrentStep);
|
||||
|
||||
SaveCheckpoint(tr("Changing Light Power"));
|
||||
|
|
|
@ -377,7 +377,8 @@ public:
|
|||
void SetSpotLightPenumbraAngle(lcLight* Light, float Angle);
|
||||
void SetSpotLightPOVRayTightness(lcLight* Light, float Tightness);
|
||||
void SetLightSize(lcLight* Light, lcVector2 LightAreaSize);
|
||||
void SetLightPower(lcLight* Light, float Power);
|
||||
void SetLightBlenderPower(lcLight* Light, float Power);
|
||||
void SetLightPOVRayPower(lcLight* Light, float Power);
|
||||
|
||||
void ShowPropertiesDialog();
|
||||
void ShowSelectByNameDialog();
|
||||
|
|
|
@ -25,7 +25,8 @@ enum class lcObjectPropertyId
|
|||
LightName,
|
||||
LightType,
|
||||
LightColor,
|
||||
LightPower,
|
||||
LightBlenderPower,
|
||||
LightPOVRayPower,
|
||||
LightCastShadow,
|
||||
LightPOVRayFadeDistance,
|
||||
LightPOVRayFadePower,
|
||||
|
|
|
@ -372,9 +372,13 @@ void lcPropertiesWidget::FloatChanged()
|
|||
|
||||
if (Light)
|
||||
{
|
||||
if (PropertyId == lcObjectPropertyId::LightPower)
|
||||
if (PropertyId == lcObjectPropertyId::LightBlenderPower)
|
||||
{
|
||||
Model->SetLightPower(Light, Value);
|
||||
Model->SetLightBlenderPower(Light, Value);
|
||||
}
|
||||
else if (PropertyId == lcObjectPropertyId::LightPOVRayPower)
|
||||
{
|
||||
Model->SetLightPOVRayPower(Light, Value);
|
||||
}
|
||||
else if (PropertyId == lcObjectPropertyId::LightPOVRayFadeDistance)
|
||||
{
|
||||
|
@ -1031,7 +1035,8 @@ void lcPropertiesWidget::CreateWidgets()
|
|||
AddSpacing();
|
||||
|
||||
AddColorProperty(lcObjectPropertyId::LightColor, tr("Color"), tr("Light color"), true);
|
||||
AddFloatProperty(lcObjectPropertyId::LightPower, tr("Power"), tr("Power of the light (Watts in Blender, multiplicative factor in POV-Ray)"), true, 0.0f, FLT_MAX);
|
||||
AddFloatProperty(lcObjectPropertyId::LightBlenderPower, tr("Blender Power"), tr("Power of the light in Watts"), true, 0.0f, FLT_MAX);
|
||||
AddFloatProperty(lcObjectPropertyId::LightPOVRayPower, tr("POV-Ray Power"), tr("Power of the light (multiplicative factor)"), true, 0.0f, FLT_MAX);
|
||||
AddFloatProperty(lcObjectPropertyId::LightPOVRayFadeDistance, tr("Fade Distance"), tr("The distance at which the full light intensity arrives (POV-Ray only)"), true, 0.0f, FLT_MAX);
|
||||
AddFloatProperty(lcObjectPropertyId::LightPOVRayFadePower, tr("Fade Power"), tr("Light falloff rate (POV-Ray only)"), true, 0.0f, FLT_MAX);
|
||||
AddBoolProperty(lcObjectPropertyId::LightCastShadow, tr("Cast Shadow"), tr("Cast a shadow from this light"), false);
|
||||
|
@ -1258,7 +1263,7 @@ void lcPropertiesWidget::SetLight(const lcArray<lcObject*>& Selection, lcObject*
|
|||
lcLightType LightType = lcLightType::Count;
|
||||
lcLightAreaShape LightAreaShape = lcLightAreaShape::Count;
|
||||
lcVector2 LightSize(0.0f, 0.0f);
|
||||
float Power = 0.0f;
|
||||
float BlenderPower = 0.0f, POVRayPower = 0.0f;
|
||||
float FadeDistance = 0.0f;
|
||||
float FadePower = 0.0f;
|
||||
lcVector3 Position(0.0f, 0.0f, 0.0f);
|
||||
|
@ -1272,7 +1277,8 @@ void lcPropertiesWidget::SetLight(const lcArray<lcObject*>& Selection, lcObject*
|
|||
|
||||
Position = Light->GetPosition();
|
||||
Rotation = lcMatrix44ToEulerAngles(Light->GetWorldMatrix()) * LC_RTOD;
|
||||
Power = Light->GetPower();
|
||||
BlenderPower = Light->GetBlenderPower();
|
||||
POVRayPower = Light->GetPOVRayPower();
|
||||
FadeDistance = Light->GetPOVRayFadeDistance();
|
||||
FadePower = Light->GetPOVRayFadePower();
|
||||
SpotConeAngle = Light->GetSpotConeAngle();
|
||||
|
@ -1319,7 +1325,8 @@ void lcPropertiesWidget::SetLight(const lcArray<lcObject*>& Selection, lcObject*
|
|||
UpdateStringList(lcObjectPropertyId::LightType);
|
||||
UpdateColor(lcObjectPropertyId::LightColor);
|
||||
|
||||
UpdateFloat(lcObjectPropertyId::LightPower, Power);
|
||||
UpdateFloat(lcObjectPropertyId::LightBlenderPower, BlenderPower);
|
||||
UpdateFloat(lcObjectPropertyId::LightPOVRayPower, POVRayPower);
|
||||
UpdateBool(lcObjectPropertyId::LightCastShadow);
|
||||
|
||||
UpdateFloat(lcObjectPropertyId::LightPOVRayFadeDistance, FadeDistance);
|
||||
|
|
|
@ -133,7 +133,8 @@ void lcLight::SaveLDraw(QTextStream& Stream) const
|
|||
mRotation.Save(Stream, "LIGHT", "ROTATION", true);
|
||||
mColor.Save(Stream, "LIGHT", "COLOR", true);
|
||||
mSize.Save(Stream, "LIGHT", "SIZE", true);
|
||||
mPower.Save(Stream, "LIGHT", "POWER", true);
|
||||
mBlenderPower.Save(Stream, "LIGHT", "BLENDER_POWER", true);
|
||||
mPOVRayPower.Save(Stream, "LIGHT", "POVRAY_POWER", true);
|
||||
mPOVRayFadeDistance.Save(Stream, "LIGHT", "POVRAY_FADE_DISTANCE", true);
|
||||
mPOVRayFadePower.Save(Stream, "LIGHT", "POVRAY_FADE_POWER", true);
|
||||
|
||||
|
@ -238,7 +239,9 @@ bool lcLight::ParseLDrawLine(QTextStream& Stream)
|
|||
continue;
|
||||
else if (mSize.Load(Stream, Token, "SIZE"))
|
||||
continue;
|
||||
else if (mPower.Load(Stream, Token, "POWER"))
|
||||
else if (mBlenderPower.Load(Stream, Token, "BLENDER_POWER"))
|
||||
continue;
|
||||
else if (mPOVRayPower.Load(Stream, Token, "POVRAY_POWER"))
|
||||
continue;
|
||||
else if (mPOVRayFadeDistance.Load(Stream, Token, "POVRAY_FADE_DISTANCE"))
|
||||
continue;
|
||||
|
@ -568,9 +571,14 @@ void lcLight::SetSize(lcVector2 Size, lcStep Step, bool AddKey)
|
|||
mSize.ChangeKey(Size, Step, AddKey);
|
||||
}
|
||||
|
||||
void lcLight::SetPower(float Power, lcStep Step, bool AddKey)
|
||||
void lcLight::SetBlenderPower(float Power, lcStep Step, bool AddKey)
|
||||
{
|
||||
mPower.ChangeKey(Power, Step, AddKey);
|
||||
mBlenderPower.ChangeKey(Power, Step, AddKey);
|
||||
}
|
||||
|
||||
void lcLight::SetPOVRayPower(float Power, lcStep Step, bool AddKey)
|
||||
{
|
||||
mPOVRayPower.ChangeKey(Power, Step, AddKey);
|
||||
}
|
||||
|
||||
bool lcLight::SetCastShadow(bool CastShadow)
|
||||
|
@ -594,7 +602,8 @@ void lcLight::InsertTime(lcStep Start, lcStep Time)
|
|||
mSpotPOVRayTightness.InsertTime(Start, Time);
|
||||
mAreaPOVRayGrid.InsertTime(Start, Time);
|
||||
mSize.InsertTime(Start, Time);
|
||||
mPower.InsertTime(Start, Time);
|
||||
mBlenderPower.InsertTime(Start, Time);
|
||||
mPOVRayPower.InsertTime(Start, Time);
|
||||
mPOVRayFadeDistance.InsertTime(Start, Time);
|
||||
mPOVRayFadePower.InsertTime(Start, Time);
|
||||
}
|
||||
|
@ -609,7 +618,8 @@ void lcLight::RemoveTime(lcStep Start, lcStep Time)
|
|||
mSpotPOVRayTightness.RemoveTime(Start, Time);
|
||||
mAreaPOVRayGrid.RemoveTime(Start, Time);
|
||||
mSize.RemoveTime(Start, Time);
|
||||
mPower.RemoveTime(Start, Time);
|
||||
mBlenderPower.RemoveTime(Start, Time);
|
||||
mPOVRayPower.RemoveTime(Start, Time);
|
||||
mPOVRayFadeDistance.RemoveTime(Start, Time);
|
||||
mPOVRayFadePower.RemoveTime(Start, Time);
|
||||
}
|
||||
|
@ -624,7 +634,8 @@ void lcLight::UpdatePosition(lcStep Step)
|
|||
mSpotPOVRayTightness.Update(Step);
|
||||
mAreaPOVRayGrid.Update(Step);
|
||||
mSize.Update(Step);
|
||||
mPower.Update(Step);
|
||||
mBlenderPower.Update(Step);
|
||||
mPOVRayPower.Update(Step);
|
||||
mPOVRayFadeDistance.Update(Step);
|
||||
mPOVRayFadePower.Update(Step);
|
||||
|
||||
|
@ -1081,7 +1092,8 @@ QVariant lcLight::GetPropertyValue(lcObjectPropertyId PropertyId) const
|
|||
case lcObjectPropertyId::LightColor:
|
||||
return QVariant::fromValue<lcVector3>(GetColor());
|
||||
|
||||
case lcObjectPropertyId::LightPower:
|
||||
case lcObjectPropertyId::LightBlenderPower:
|
||||
case lcObjectPropertyId::LightPOVRayPower:
|
||||
break;
|
||||
|
||||
case lcObjectPropertyId::LightCastShadow:
|
||||
|
@ -1155,7 +1167,8 @@ bool lcLight::SetPropertyValue(lcObjectPropertyId PropertyId, lcStep Step, bool
|
|||
case lcObjectPropertyId::LightColor:
|
||||
return SetColor(Value.value<lcVector3>(), Step, AddKey);
|
||||
|
||||
case lcObjectPropertyId::LightPower:
|
||||
case lcObjectPropertyId::LightBlenderPower:
|
||||
case lcObjectPropertyId::LightPOVRayPower:
|
||||
break;
|
||||
|
||||
case lcObjectPropertyId::LightCastShadow:
|
||||
|
@ -1225,8 +1238,11 @@ bool lcLight::HasKeyFrame(lcObjectPropertyId PropertyId, lcStep Time) const
|
|||
case lcObjectPropertyId::LightColor:
|
||||
return mColor.HasKeyFrame(Time);
|
||||
|
||||
case lcObjectPropertyId::LightPower:
|
||||
return mPower.HasKeyFrame(Time);
|
||||
case lcObjectPropertyId::LightBlenderPower:
|
||||
return mBlenderPower.HasKeyFrame(Time);
|
||||
|
||||
case lcObjectPropertyId::LightPOVRayPower:
|
||||
return mPOVRayPower.HasKeyFrame(Time);
|
||||
|
||||
case lcObjectPropertyId::LightCastShadow:
|
||||
return false;
|
||||
|
@ -1307,8 +1323,11 @@ bool lcLight::SetKeyFrame(lcObjectPropertyId PropertyId, lcStep Time, bool KeyFr
|
|||
case lcObjectPropertyId::LightColor:
|
||||
return mColor.SetKeyFrame(Time, KeyFrame);
|
||||
|
||||
case lcObjectPropertyId::LightPower:
|
||||
return mPower.SetKeyFrame(Time, KeyFrame);
|
||||
case lcObjectPropertyId::LightBlenderPower:
|
||||
return mBlenderPower.SetKeyFrame(Time, KeyFrame);
|
||||
|
||||
case lcObjectPropertyId::LightPOVRayPower:
|
||||
return mPOVRayPower.SetKeyFrame(Time, KeyFrame);
|
||||
|
||||
case lcObjectPropertyId::LightCastShadow:
|
||||
return false;
|
||||
|
@ -1370,7 +1389,8 @@ void lcLight::RemoveKeyFrames()
|
|||
mSpotPOVRayTightness.RemoveAllKeys();
|
||||
mAreaPOVRayGrid.RemoveAllKeys();
|
||||
mSize.RemoveAllKeys();
|
||||
mPower.RemoveAllKeys();
|
||||
mBlenderPower.RemoveAllKeys();
|
||||
mPOVRayPower.RemoveAllKeys();
|
||||
mPOVRayFadeDistance.RemoveAllKeys();
|
||||
mPOVRayFadePower.RemoveAllKeys();
|
||||
}
|
||||
|
|
|
@ -290,11 +290,18 @@ public:
|
|||
return mSize;
|
||||
}
|
||||
|
||||
void SetPower(float Power, lcStep Step, bool AddKey);
|
||||
void SetBlenderPower(float Power, lcStep Step, bool AddKey);
|
||||
|
||||
float GetPower() const
|
||||
float GetBlenderPower() const
|
||||
{
|
||||
return mPower;
|
||||
return mBlenderPower;
|
||||
}
|
||||
|
||||
void SetPOVRayPower(float Power, lcStep Step, bool AddKey);
|
||||
|
||||
float GetPOVRayPower() const
|
||||
{
|
||||
return mPOVRayPower;
|
||||
}
|
||||
|
||||
bool SetCastShadow(bool CastShadow);
|
||||
|
@ -338,7 +345,8 @@ protected:
|
|||
lcObjectProperty<lcMatrix33> mRotation = lcObjectProperty<lcMatrix33>(lcMatrix33Identity());
|
||||
lcObjectProperty<lcVector3> mColor = lcObjectProperty<lcVector3>(lcVector3(1.0f, 1.0f, 1.0f));
|
||||
lcObjectProperty<lcVector2> mSize = lcObjectProperty<lcVector2>(lcVector2(0.0f, 0.0f));
|
||||
lcObjectProperty<float> mPower = lcObjectProperty<float>(1.0f);
|
||||
lcObjectProperty<float> mBlenderPower = lcObjectProperty<float>(10.0f);
|
||||
lcObjectProperty<float> mPOVRayPower = lcObjectProperty<float>(1.0f);
|
||||
lcObjectProperty<float> mPOVRayFadeDistance = lcObjectProperty<float>(0.0f);
|
||||
lcObjectProperty<float> mPOVRayFadePower = lcObjectProperty<float>(0.0f);
|
||||
lcObjectProperty<float> mSpotConeAngle = lcObjectProperty<float>(80.0f);
|
||||
|
|
|
@ -53,8 +53,11 @@ QString lcObject::GetCheckpointString(lcObjectPropertyId PropertyId)
|
|||
case lcObjectPropertyId::LightColor:
|
||||
return QT_TRANSLATE_NOOP("Checkpoint", "Changing Light Color");
|
||||
|
||||
case lcObjectPropertyId::LightPower:
|
||||
break;
|
||||
case lcObjectPropertyId::LightBlenderPower:
|
||||
return QT_TRANSLATE_NOOP("Checkpoint", "Changing Light Blender Power");
|
||||
|
||||
case lcObjectPropertyId::LightPOVRayPower:
|
||||
return QT_TRANSLATE_NOOP("Checkpoint", "Changing Light POV-Ray Power");
|
||||
|
||||
case lcObjectPropertyId::LightCastShadow:
|
||||
return QT_TRANSLATE_NOOP("Checkpoint", "Changing Light Shadow");
|
||||
|
|
|
@ -687,7 +687,8 @@ QVariant lcPiece::GetPropertyValue(lcObjectPropertyId PropertyId) const
|
|||
case lcObjectPropertyId::LightName:
|
||||
case lcObjectPropertyId::LightType:
|
||||
case lcObjectPropertyId::LightColor:
|
||||
case lcObjectPropertyId::LightPower:
|
||||
case lcObjectPropertyId::LightBlenderPower:
|
||||
case lcObjectPropertyId::LightPOVRayPower:
|
||||
case lcObjectPropertyId::LightCastShadow:
|
||||
case lcObjectPropertyId::LightPOVRayFadeDistance:
|
||||
case lcObjectPropertyId::LightPOVRayFadePower:
|
||||
|
@ -748,7 +749,8 @@ bool lcPiece::SetPropertyValue(lcObjectPropertyId PropertyId, lcStep Step, bool
|
|||
case lcObjectPropertyId::LightName:
|
||||
case lcObjectPropertyId::LightType:
|
||||
case lcObjectPropertyId::LightColor:
|
||||
case lcObjectPropertyId::LightPower:
|
||||
case lcObjectPropertyId::LightBlenderPower:
|
||||
case lcObjectPropertyId::LightPOVRayPower:
|
||||
case lcObjectPropertyId::LightCastShadow:
|
||||
case lcObjectPropertyId::LightPOVRayFadeDistance:
|
||||
case lcObjectPropertyId::LightPOVRayFadePower:
|
||||
|
@ -802,7 +804,8 @@ bool lcPiece::HasKeyFrame(lcObjectPropertyId PropertyId, lcStep Time) const
|
|||
case lcObjectPropertyId::LightName:
|
||||
case lcObjectPropertyId::LightType:
|
||||
case lcObjectPropertyId::LightColor:
|
||||
case lcObjectPropertyId::LightPower:
|
||||
case lcObjectPropertyId::LightBlenderPower:
|
||||
case lcObjectPropertyId::LightPOVRayPower:
|
||||
case lcObjectPropertyId::LightCastShadow:
|
||||
case lcObjectPropertyId::LightPOVRayFadeDistance:
|
||||
case lcObjectPropertyId::LightPOVRayFadePower:
|
||||
|
@ -862,7 +865,8 @@ bool lcPiece::SetKeyFrame(lcObjectPropertyId PropertyId, lcStep Time, bool KeyFr
|
|||
case lcObjectPropertyId::LightName:
|
||||
case lcObjectPropertyId::LightType:
|
||||
case lcObjectPropertyId::LightColor:
|
||||
case lcObjectPropertyId::LightPower:
|
||||
case lcObjectPropertyId::LightBlenderPower:
|
||||
case lcObjectPropertyId::LightPOVRayPower:
|
||||
case lcObjectPropertyId::LightCastShadow:
|
||||
case lcObjectPropertyId::LightPOVRayFadeDistance:
|
||||
case lcObjectPropertyId::LightPOVRayFadePower:
|
||||
|
|
|
@ -2188,7 +2188,7 @@ bool Project::ExportPOVRay(const QString& FileName)
|
|||
const QString LightName = QString(Light->GetName()).replace(" ", "_");
|
||||
LightType = Light->GetLightType();
|
||||
Shadowless = Light->GetCastShadow() ? 0 : 1;
|
||||
Power = Light->GetPower();
|
||||
Power = Light->GetPOVRayPower();
|
||||
FadeDistance = Light->GetPOVRayFadeDistance();
|
||||
FadePower = Light->GetPOVRayFadePower();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue