mirror of
https://github.com/leozide/leocad
synced 2024-12-26 21:58:44 +01:00
Merged POV-Ray and Blender light power.
This commit is contained in:
parent
321b9389ed
commit
6774b17051
8 changed files with 4 additions and 207 deletions
|
@ -107,7 +107,6 @@ struct lcMeshSection;
|
||||||
struct lcRenderMesh;
|
struct lcRenderMesh;
|
||||||
struct lcObjectSection;
|
struct lcObjectSection;
|
||||||
struct lcPieceInfoRayTest;
|
struct lcPieceInfoRayTest;
|
||||||
struct lcLightProperties;
|
|
||||||
class lcTexture;
|
class lcTexture;
|
||||||
class lcScene;
|
class lcScene;
|
||||||
class lcViewManipulator;
|
class lcViewManipulator;
|
||||||
|
|
|
@ -3092,15 +3092,6 @@ void lcModel::SetSelectedPiecesStepHide(lcStep Step)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcModel::UpdateLight(lcLight* Light, const lcLightProperties Props, int Property)
|
|
||||||
{
|
|
||||||
Light->UpdateLight(mCurrentStep, Props, Property);
|
|
||||||
|
|
||||||
SaveCheckpoint(tr("Update Light"));
|
|
||||||
UpdateAllViews();
|
|
||||||
gMainWindow->UpdateSelectedObjects(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void lcModel::SetCameraOrthographic(lcCamera* Camera, bool Ortho)
|
void lcModel::SetCameraOrthographic(lcCamera* Camera, bool Ortho)
|
||||||
{
|
{
|
||||||
if (Camera->IsOrtho() == Ortho)
|
if (Camera->IsOrtho() == Ortho)
|
||||||
|
|
|
@ -381,7 +381,6 @@ public:
|
||||||
void SetLightPower(lcLight* Light, float Power);
|
void SetLightPower(lcLight* Light, float Power);
|
||||||
void SetLightCastShadow(lcLight* Light, bool CastShadow);
|
void SetLightCastShadow(lcLight* Light, bool CastShadow);
|
||||||
void SetLightName(lcLight* Light, const QString& Name);
|
void SetLightName(lcLight* Light, const QString& Name);
|
||||||
void UpdateLight(lcLight* Light, const lcLightProperties Props, int Property);
|
|
||||||
|
|
||||||
void ShowPropertiesDialog();
|
void ShowPropertiesDialog();
|
||||||
void ShowSelectByNameDialog();
|
void ShowSelectByNameDialog();
|
||||||
|
|
|
@ -25,10 +25,6 @@ lcLight::lcLight(const lcVector3& Position, lcLightType LightType)
|
||||||
{
|
{
|
||||||
mWorldMatrix = lcMatrix44Translation(Position);
|
mWorldMatrix = lcMatrix44Translation(Position);
|
||||||
|
|
||||||
mPOVRayLight = false;
|
|
||||||
mSpotExponent = 10.0f;
|
|
||||||
mPOVRayExponent = 1.0f;
|
|
||||||
|
|
||||||
UpdateLightType();
|
UpdateLightType();
|
||||||
|
|
||||||
mPositionKeys.ChangeKey(mWorldMatrix.GetTranslation(), 1, true);
|
mPositionKeys.ChangeKey(mWorldMatrix.GetTranslation(), 1, true);
|
||||||
|
@ -42,8 +38,6 @@ lcLight::lcLight(const lcVector3& Position, lcLightType LightType)
|
||||||
mSpotTightnessKeys.ChangeKey(mSpotTightness, 1, true);
|
mSpotTightnessKeys.ChangeKey(mSpotTightness, 1, true);
|
||||||
mAreaGridKeys.ChangeKey(mAreaGrid, 1, true);
|
mAreaGridKeys.ChangeKey(mAreaGrid, 1, true);
|
||||||
|
|
||||||
mSpotExponentKeys.ChangeKey(mSpotExponent, 1, true);
|
|
||||||
|
|
||||||
UpdatePosition(1);
|
UpdatePosition(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,9 +120,6 @@ void lcLight::SaveLDraw(QTextStream& Stream) const
|
||||||
{
|
{
|
||||||
const QLatin1String LineEnding("\r\n");
|
const QLatin1String LineEnding("\r\n");
|
||||||
|
|
||||||
if (mPOVRayLight)
|
|
||||||
Stream << QLatin1String("0 !LEOCAD LIGHT POV_RAY") << LineEnding;
|
|
||||||
|
|
||||||
if (!mCastShadow)
|
if (!mCastShadow)
|
||||||
Stream << QLatin1String("0 !LEOCAD LIGHT SHADOWLESS") << LineEnding;
|
Stream << QLatin1String("0 !LEOCAD LIGHT SHADOWLESS") << LineEnding;
|
||||||
|
|
||||||
|
@ -154,8 +145,6 @@ void lcLight::SaveLDraw(QTextStream& Stream) const
|
||||||
SaveAttribute(Stream, mAttenuationDistance, mAttenuationDistanceKeys, "LIGHT", "ATTENUATION_DISTANCE");
|
SaveAttribute(Stream, mAttenuationDistance, mAttenuationDistanceKeys, "LIGHT", "ATTENUATION_DISTANCE");
|
||||||
SaveAttribute(Stream, mAttenuationPower, mAttenuationPowerKeys, "LIGHT", "ATTENUATION_POWER");
|
SaveAttribute(Stream, mAttenuationPower, mAttenuationPowerKeys, "LIGHT", "ATTENUATION_POWER");
|
||||||
|
|
||||||
// SaveAttribute(Stream, (mPOVRayLight ? mPOVRayExponent : mSpotExponent), mSpotExponentKeys, "LIGHT", "POWER");
|
|
||||||
|
|
||||||
switch (mLightType)
|
switch (mLightType)
|
||||||
{
|
{
|
||||||
case lcLightType::Count:
|
case lcLightType::Count:
|
||||||
|
@ -169,7 +158,6 @@ void lcLight::SaveLDraw(QTextStream& Stream) const
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lcLightType::Directional:
|
case lcLightType::Directional:
|
||||||
SaveAttribute(Stream, mSpotExponent, mSpotExponentKeys, "LIGHT", "STRENGTH");
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lcLightType::Area:
|
case lcLightType::Area:
|
||||||
|
@ -316,20 +304,6 @@ bool lcLight::ParseLDrawLine(QTextStream& Stream)
|
||||||
}
|
}
|
||||||
else if (LoadAttribute(Stream, Token, mAreaGrid, mAreaGridKeys, "AREA_GRID"))
|
else if (LoadAttribute(Stream, Token, mAreaGrid, mAreaGridKeys, "AREA_GRID"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// else if (Token == QLatin1String("POWER") || Token == QLatin1String("STRENGTH"))
|
|
||||||
// {
|
|
||||||
// if (mPOVRayLight)
|
|
||||||
// {
|
|
||||||
// Stream >> mPOVRayExponent;
|
|
||||||
// mSpotExponentKeys.ChangeKey(mPOVRayExponent, 1, true);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// Stream >> mSpotExponent;
|
|
||||||
// mSpotExponentKeys.ChangeKey(mSpotExponent, 1, true);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
else if (Token == QLatin1String("TYPE"))
|
else if (Token == QLatin1String("TYPE"))
|
||||||
{
|
{
|
||||||
QString Type;
|
QString Type;
|
||||||
|
@ -344,16 +318,10 @@ bool lcLight::ParseLDrawLine(QTextStream& Stream)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Token == QLatin1String("POV_RAY"))
|
|
||||||
{
|
|
||||||
mPOVRayLight = true;
|
|
||||||
}
|
|
||||||
else if (Token == QLatin1String("SHADOWLESS"))
|
else if (Token == QLatin1String("SHADOWLESS"))
|
||||||
{
|
{
|
||||||
mCastShadow = false;
|
mCastShadow = false;
|
||||||
}
|
}
|
||||||
else if ((Token == QLatin1String("POWER_KEY")) || (Token == QLatin1String("STRENGTH_KEY")))
|
|
||||||
mSpotExponentKeys.LoadKeysLDraw(Stream);
|
|
||||||
else if (Token == QLatin1String("NAME"))
|
else if (Token == QLatin1String("NAME"))
|
||||||
{
|
{
|
||||||
mName = Stream.readAll().trimmed();
|
mName = Stream.readAll().trimmed();
|
||||||
|
@ -376,29 +344,6 @@ void lcLight::CompareBoundingBox(lcVector3& Min, lcVector3& Max)
|
||||||
Max = lcMax(Point, Max);
|
Max = lcMax(Point, Max);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcLight::UpdateLight(lcStep Step, lcLightProperties Props, int Property)
|
|
||||||
{
|
|
||||||
switch(Property)
|
|
||||||
{
|
|
||||||
case LC_LIGHT_EXPONENT:
|
|
||||||
if (Props.mPOVRayLight)
|
|
||||||
{
|
|
||||||
mPOVRayExponent = Props.mSpotExponent;
|
|
||||||
mSpotExponentKeys.ChangeKey(mPOVRayExponent, Step, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mSpotExponent = Props.mSpotExponent;
|
|
||||||
mSpotExponentKeys.ChangeKey(mSpotExponent, Step, false);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LC_LIGHT_POVRAY:
|
|
||||||
mPOVRayLight = Props.mPOVRayLight;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
UpdatePosition(Step);
|
|
||||||
}
|
|
||||||
|
|
||||||
void lcLight::RayTest(lcObjectRayTest& ObjectRayTest) const
|
void lcLight::RayTest(lcObjectRayTest& ObjectRayTest) const
|
||||||
{
|
{
|
||||||
if (IsPointLight())
|
if (IsPointLight())
|
||||||
|
@ -679,8 +624,6 @@ void lcLight::InsertTime(lcStep Start, lcStep Time)
|
||||||
mPowerKeys.InsertTime(Start, Time);
|
mPowerKeys.InsertTime(Start, Time);
|
||||||
mAttenuationDistanceKeys.InsertTime(Start, Time);
|
mAttenuationDistanceKeys.InsertTime(Start, Time);
|
||||||
mAttenuationPowerKeys.InsertTime(Start, Time);
|
mAttenuationPowerKeys.InsertTime(Start, Time);
|
||||||
|
|
||||||
mSpotExponentKeys.InsertTime(Start, Time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcLight::RemoveTime(lcStep Start, lcStep Time)
|
void lcLight::RemoveTime(lcStep Start, lcStep Time)
|
||||||
|
@ -696,8 +639,6 @@ void lcLight::RemoveTime(lcStep Start, lcStep Time)
|
||||||
mPowerKeys.RemoveTime(Start, Time);
|
mPowerKeys.RemoveTime(Start, Time);
|
||||||
mAttenuationDistanceKeys.RemoveTime(Start, Time);
|
mAttenuationDistanceKeys.RemoveTime(Start, Time);
|
||||||
mAttenuationPowerKeys.RemoveTime(Start, Time);
|
mAttenuationPowerKeys.RemoveTime(Start, Time);
|
||||||
|
|
||||||
mSpotExponentKeys.RemoveTime(Start, Time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcLight::UpdatePosition(lcStep Step)
|
void lcLight::UpdatePosition(lcStep Step)
|
||||||
|
@ -724,8 +665,6 @@ void lcLight::UpdatePosition(lcStep Step)
|
||||||
mPower = mPowerKeys.CalculateKey(Step);
|
mPower = mPowerKeys.CalculateKey(Step);
|
||||||
mAttenuationDistance = mAttenuationDistanceKeys.CalculateKey(Step);
|
mAttenuationDistance = mAttenuationDistanceKeys.CalculateKey(Step);
|
||||||
mAttenuationPower = mAttenuationPowerKeys.CalculateKey(Step);
|
mAttenuationPower = mAttenuationPowerKeys.CalculateKey(Step);
|
||||||
|
|
||||||
mSpotExponent = mSpotExponentKeys.CalculateKey(Step);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcLight::DrawInterface(lcContext* Context, const lcScene& Scene) const
|
void lcLight::DrawInterface(lcContext* Context, const lcScene& Scene) const
|
||||||
|
@ -1170,9 +1109,6 @@ void lcLight::RemoveKeyFrames()
|
||||||
|
|
||||||
mAttenuationPowerKeys.RemoveAll();
|
mAttenuationPowerKeys.RemoveAll();
|
||||||
mAttenuationPowerKeys.ChangeKey(mAttenuationPower, 1, true);
|
mAttenuationPowerKeys.ChangeKey(mAttenuationPower, 1, true);
|
||||||
|
|
||||||
mSpotExponentKeys.RemoveAll();
|
|
||||||
mSpotExponentKeys.ChangeKey(mSpotExponent, 1, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lcLight::Setup(int LightIndex)
|
bool lcLight::Setup(int LightIndex)
|
||||||
|
|
|
@ -31,18 +31,6 @@ enum class lcLightAreaShape
|
||||||
Count
|
Count
|
||||||
};
|
};
|
||||||
|
|
||||||
enum lcLightProperty
|
|
||||||
{
|
|
||||||
LC_LIGHT_EXPONENT,
|
|
||||||
LC_LIGHT_POVRAY
|
|
||||||
};
|
|
||||||
|
|
||||||
struct lcLightProperties
|
|
||||||
{
|
|
||||||
float mSpotExponent;
|
|
||||||
bool mPOVRayLight;
|
|
||||||
};
|
|
||||||
|
|
||||||
class lcLight : public lcObject
|
class lcLight : public lcObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -326,22 +314,9 @@ public:
|
||||||
void Rotate(lcStep Step, bool AddKey, const lcMatrix33& RotationMatrix, const lcVector3& Center, const lcMatrix33& RotationFrame);
|
void Rotate(lcStep Step, bool AddKey, const lcMatrix33& RotationMatrix, const lcVector3& Center, const lcMatrix33& RotationFrame);
|
||||||
bool Setup(int LightIndex);
|
bool Setup(int LightIndex);
|
||||||
void CreateName(const lcArray<lcLight*>& Lights);
|
void CreateName(const lcArray<lcLight*>& Lights);
|
||||||
void UpdateLight(lcStep Step, lcLightProperties Props, int Property);
|
|
||||||
|
|
||||||
lcLightProperties GetLightProperties() const
|
|
||||||
{
|
|
||||||
lcLightProperties props;
|
|
||||||
props.mSpotExponent = mSpotExponent;
|
|
||||||
props.mPOVRayLight = mPOVRayLight;
|
|
||||||
return props;
|
|
||||||
}
|
|
||||||
|
|
||||||
lcMatrix44 mWorldMatrix;
|
lcMatrix44 mWorldMatrix;
|
||||||
|
|
||||||
bool mPOVRayLight;
|
|
||||||
float mSpotExponent;
|
|
||||||
float mPOVRayExponent;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void UpdateLightType();
|
void UpdateLightType();
|
||||||
|
|
||||||
|
@ -387,7 +362,5 @@ protected:
|
||||||
lcObjectKeyArray<float> mSpotTightnessKeys;
|
lcObjectKeyArray<float> mSpotTightnessKeys;
|
||||||
lcObjectKeyArray<lcVector2i> mAreaGridKeys;
|
lcObjectKeyArray<lcVector2i> mAreaGridKeys;
|
||||||
|
|
||||||
lcObjectKeyArray<float> mSpotExponentKeys;
|
|
||||||
|
|
||||||
static constexpr float mTargetDistance = 50.0f;
|
static constexpr float mTargetDistance = 50.0f;
|
||||||
};
|
};
|
||||||
|
|
|
@ -2188,7 +2188,7 @@ bool Project::ExportPOVRay(const QString& FileName)
|
||||||
const QString LightName = QString(Light->GetName()).replace(" ", "_");
|
const QString LightName = QString(Light->GetName()).replace(" ", "_");
|
||||||
LightType = Light->GetLightType();
|
LightType = Light->GetLightType();
|
||||||
Shadowless = Light->GetCastShadow() ? 0 : 1;
|
Shadowless = Light->GetCastShadow() ? 0 : 1;
|
||||||
Power = Light->mPOVRayExponent;
|
Power = Light->GetPower();
|
||||||
FadeDistance = Light->GetAttenuationDistance();
|
FadeDistance = Light->GetAttenuationDistance();
|
||||||
FadePower = Light->GetAttenuationPower();
|
FadePower = Light->GetAttenuationPower();
|
||||||
|
|
||||||
|
|
|
@ -526,25 +526,6 @@ QWidget* lcQPropertiesTree::createEditor(QWidget* Parent, QTreeWidgetItem* Item)
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PropertyLightFormat:
|
|
||||||
{
|
|
||||||
QComboBox *editor = new QComboBox(Parent);
|
|
||||||
|
|
||||||
editor->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
|
|
||||||
editor->setMinimumContentsLength(1);
|
|
||||||
|
|
||||||
QStringList formats = { QLatin1String("Blender"), QLatin1String("POVRay") };
|
|
||||||
for (int i = 0; i < formats.size(); i++)
|
|
||||||
editor->addItem(formats.at(i), QVariant::fromValue(i));
|
|
||||||
|
|
||||||
int value = Item->data(0, PropertyValueRole).toInt();
|
|
||||||
editor->setCurrentIndex(value);
|
|
||||||
|
|
||||||
connect(editor, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSetValue(int)));
|
|
||||||
|
|
||||||
return editor;
|
|
||||||
}
|
|
||||||
|
|
||||||
case PropertyColor:
|
case PropertyColor:
|
||||||
{
|
{
|
||||||
QPushButton *Editor = new QPushButton(Parent);
|
QPushButton *Editor = new QPushButton(Parent);
|
||||||
|
@ -830,8 +811,6 @@ void lcQPropertiesTree::slotReturnPressed()
|
||||||
{
|
{
|
||||||
if (Light)
|
if (Light)
|
||||||
{
|
{
|
||||||
lcLightProperties Props = Light->GetLightProperties();
|
|
||||||
|
|
||||||
if (Item == mLightAttenuationDistanceItem)
|
if (Item == mLightAttenuationDistanceItem)
|
||||||
{
|
{
|
||||||
float Value = lcParseValueLocalized(Editor->text());
|
float Value = lcParseValueLocalized(Editor->text());
|
||||||
|
@ -896,12 +875,6 @@ void lcQPropertiesTree::slotReturnPressed()
|
||||||
|
|
||||||
Model->SetLightPower(Light, Value);
|
Model->SetLightPower(Light, Value);
|
||||||
}
|
}
|
||||||
else if (Item == lightExponent)
|
|
||||||
{
|
|
||||||
Props.mSpotExponent = lcParseValueLocalized(Editor->text());
|
|
||||||
|
|
||||||
Model->UpdateLight(Light, Props, LC_LIGHT_EXPONENT);
|
|
||||||
}
|
|
||||||
else if (Item == mLightNameItem)
|
else if (Item == mLightNameItem)
|
||||||
{
|
{
|
||||||
QString Value = Editor->text();
|
QString Value = Editor->text();
|
||||||
|
@ -962,8 +935,6 @@ void lcQPropertiesTree::slotSetValue(int Value)
|
||||||
|
|
||||||
if (Light)
|
if (Light)
|
||||||
{
|
{
|
||||||
lcLightProperties Props = Light->GetLightProperties();
|
|
||||||
|
|
||||||
if (Item == mLightTypeItem)
|
if (Item == mLightTypeItem)
|
||||||
{
|
{
|
||||||
Model->SetLightType(Light, static_cast<lcLightType>(Value));
|
Model->SetLightType(Light, static_cast<lcLightType>(Value));
|
||||||
|
@ -972,11 +943,6 @@ void lcQPropertiesTree::slotSetValue(int Value)
|
||||||
{
|
{
|
||||||
Model->SetLightAreaShape(Light, static_cast<lcLightAreaShape>(Value));
|
Model->SetLightAreaShape(Light, static_cast<lcLightAreaShape>(Value));
|
||||||
}
|
}
|
||||||
else if (Item == lightFormat)
|
|
||||||
{
|
|
||||||
Props.mPOVRayLight = Value;
|
|
||||||
Model->UpdateLight(Light, Props, LC_LIGHT_POVRAY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1101,11 +1067,9 @@ void lcQPropertiesTree::SetEmpty()
|
||||||
cameraFar = nullptr;
|
cameraFar = nullptr;
|
||||||
mCameraNameItem = nullptr;
|
mCameraNameItem = nullptr;
|
||||||
|
|
||||||
lightConfiguration = nullptr;
|
|
||||||
mLightColorItem = nullptr;
|
mLightColorItem = nullptr;
|
||||||
mLightPowerItem = nullptr;
|
mLightPowerItem = nullptr;
|
||||||
mLightAttributesItem = nullptr;
|
mLightAttributesItem = nullptr;
|
||||||
lightExponent = nullptr;
|
|
||||||
mLightTypeItem = nullptr;
|
mLightTypeItem = nullptr;
|
||||||
mLightNameItem = nullptr;
|
mLightNameItem = nullptr;
|
||||||
mLightAttenuationDistanceItem = nullptr;
|
mLightAttenuationDistanceItem = nullptr;
|
||||||
|
@ -1118,7 +1082,6 @@ void lcQPropertiesTree::SetEmpty()
|
||||||
mLightAreaGridYItem = nullptr;
|
mLightAreaGridYItem = nullptr;
|
||||||
mLightSizeXItem = nullptr;
|
mLightSizeXItem = nullptr;
|
||||||
mLightSizeYItem = nullptr;
|
mLightSizeYItem = nullptr;
|
||||||
lightFormat = nullptr;
|
|
||||||
mLightCastShadowItem = nullptr;
|
mLightCastShadowItem = nullptr;
|
||||||
|
|
||||||
mPositionItem = nullptr;
|
mPositionItem = nullptr;
|
||||||
|
@ -1365,8 +1328,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
|
||||||
lcLight* Light = (Focus && Focus->IsLight()) ? (lcLight*)Focus : nullptr;
|
lcLight* Light = (Focus && Focus->IsLight()) ? (lcLight*)Focus : nullptr;
|
||||||
|
|
||||||
QString Name = tr("Light");
|
QString Name = tr("Light");
|
||||||
QString ExponentLabel = tr("Exponent");
|
|
||||||
QString Format, ExponentToolTip;
|
|
||||||
lcLightType LightType = lcLightType::Point;
|
lcLightType LightType = lcLightType::Point;
|
||||||
lcLightAreaShape LightAreaShape = lcLightAreaShape::Rectangle;
|
lcLightAreaShape LightAreaShape = lcLightAreaShape::Rectangle;
|
||||||
lcVector2 LightSize(0.0f, 0.0f);
|
lcVector2 LightSize(0.0f, 0.0f);
|
||||||
|
@ -1374,11 +1335,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
|
||||||
float Power = 0.0f;
|
float Power = 0.0f;
|
||||||
float AttenuationDistance = 0.0f;
|
float AttenuationDistance = 0.0f;
|
||||||
float AttenuationPower = 0.0f;
|
float AttenuationPower = 0.0f;
|
||||||
int FormatIndex = 0;
|
|
||||||
float Cutoff = 0.0f;
|
|
||||||
float Exponent = 0.0f;
|
|
||||||
bool EnableCutoff = false;
|
|
||||||
bool POVRayLight = false;
|
|
||||||
bool CastShadow = true;
|
bool CastShadow = true;
|
||||||
lcVector3 Position(0.0f, 0.0f, 0.0f);
|
lcVector3 Position(0.0f, 0.0f, 0.0f);
|
||||||
QColor Color(Qt::white);
|
QColor Color(Qt::white);
|
||||||
|
@ -1388,10 +1344,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
|
||||||
{
|
{
|
||||||
Name = Light->GetName();
|
Name = Light->GetName();
|
||||||
|
|
||||||
POVRayLight = Light->mPOVRayLight;
|
|
||||||
FormatIndex = static_cast<int>(POVRayLight);
|
|
||||||
Format = POVRayLight ? QLatin1String("POVRay") : QLatin1String("Blender");
|
|
||||||
|
|
||||||
CastShadow = Light->GetCastShadow();
|
CastShadow = Light->GetCastShadow();
|
||||||
Position = Light->GetPosition();
|
Position = Light->GetPosition();
|
||||||
Color = lcQColorFromVector3(Light->GetColor());
|
Color = lcQColorFromVector3(Light->GetColor());
|
||||||
|
@ -1400,49 +1352,15 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
|
||||||
AttenuationPower = Light->GetAttenuationPower();
|
AttenuationPower = Light->GetAttenuationPower();
|
||||||
SpotConeAngle = Light->GetSpotConeAngle();
|
SpotConeAngle = Light->GetSpotConeAngle();
|
||||||
SpotPenumbraAngle = Light->GetSpotPenumbraAngle();
|
SpotPenumbraAngle = Light->GetSpotPenumbraAngle();
|
||||||
|
SpotTightness = Light->GetSpotTightness();
|
||||||
|
|
||||||
LightType = Light->GetLightType();
|
LightType = Light->GetLightType();
|
||||||
LightAreaShape = Light->GetAreaShape();
|
LightAreaShape = Light->GetAreaShape();
|
||||||
LightSize = Light->GetSize();
|
LightSize = Light->GetSize();
|
||||||
AreaGrid = Light->GetAreaGrid();
|
AreaGrid = Light->GetAreaGrid();
|
||||||
|
|
||||||
switch (LightType)
|
|
||||||
{
|
|
||||||
case lcLightType::Point:
|
|
||||||
ExponentLabel = tr("Exponent");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case lcLightType::Spot:
|
|
||||||
ExponentLabel = tr("Power");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case lcLightType::Directional:
|
|
||||||
ExponentLabel = tr("Strength");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case lcLightType::Area:
|
|
||||||
ExponentLabel = tr("Power");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (POVRayLight)
|
if (mWidgetMode != LC_PROPERTY_WIDGET_LIGHT || mLightType != LightType)
|
||||||
{
|
|
||||||
Exponent = Light->mPOVRayExponent;
|
|
||||||
ExponentToolTip = tr("Intensity of the light with typical range of 0 to 1.0.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Exponent = Light->mSpotExponent;
|
|
||||||
ExponentToolTip = tr("Intensity of the light in watts.");
|
|
||||||
}
|
|
||||||
|
|
||||||
ExponentLabel = LightType == lcLightType::Directional ? tr("Strength") : tr("Power");
|
|
||||||
SpotTightness = Light->GetSpotTightness();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mWidgetMode != LC_PROPERTY_WIDGET_LIGHT || mLightType != LightType || mPOVRayLight != POVRayLight)
|
|
||||||
{
|
{
|
||||||
SetEmpty();
|
SetEmpty();
|
||||||
|
|
||||||
|
@ -1455,7 +1373,7 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
|
||||||
mLightColorItem->setToolTip(1, tr("Color of the emitted light."));
|
mLightColorItem->setToolTip(1, tr("Color of the emitted light."));
|
||||||
|
|
||||||
mLightPowerItem = addProperty(mLightAttributesItem, tr("Power"), PropertyFloat);
|
mLightPowerItem = addProperty(mLightAttributesItem, tr("Power"), PropertyFloat);
|
||||||
mLightPowerItem->setToolTip(1, tr("Power of the light in Watts (Blender only)."));
|
mLightPowerItem->setToolTip(1, tr("Power of the light (Watts in Blender)."));
|
||||||
|
|
||||||
mLightCastShadowItem = addProperty(mLightAttributesItem, tr("Cast Shadows"), PropertyBool);
|
mLightCastShadowItem = addProperty(mLightAttributesItem, tr("Cast Shadows"), PropertyBool);
|
||||||
|
|
||||||
|
@ -1532,12 +1450,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
lightExponent = addProperty(mLightAttributesItem, ExponentLabel, PropertyFloat);
|
|
||||||
|
|
||||||
// Configuration
|
|
||||||
lightConfiguration = addProperty(nullptr, tr("Configuration"), PropertyGroup);
|
|
||||||
lightFormat = addProperty(lightConfiguration, tr("Format"), PropertyLightFormat);
|
|
||||||
|
|
||||||
mPositionItem = addProperty(nullptr, tr("Position"), PropertyGroup);
|
mPositionItem = addProperty(nullptr, tr("Position"), PropertyGroup);
|
||||||
mPositionXItem = addProperty(mPositionItem, tr("X"), PropertyFloat);
|
mPositionXItem = addProperty(mPositionItem, tr("X"), PropertyFloat);
|
||||||
mPositionYItem = addProperty(mPositionItem, tr("Y"), PropertyFloat);
|
mPositionYItem = addProperty(mPositionItem, tr("Y"), PropertyFloat);
|
||||||
|
@ -1553,7 +1465,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
|
||||||
|
|
||||||
mWidgetMode = LC_PROPERTY_WIDGET_LIGHT;
|
mWidgetMode = LC_PROPERTY_WIDGET_LIGHT;
|
||||||
mLightType = LightType;
|
mLightType = LightType;
|
||||||
mPOVRayLight = POVRayLight;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mFocus = Light;
|
mFocus = Light;
|
||||||
|
@ -1607,9 +1518,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
|
||||||
mLightAttenuationPowerItem->setData(0, PropertyValueRole, AttenuationPower);
|
mLightAttenuationPowerItem->setData(0, PropertyValueRole, AttenuationPower);
|
||||||
mLightAttenuationPowerItem->setData(0, PropertyRangeRole, QPointF(0.0, FLT_MAX));
|
mLightAttenuationPowerItem->setData(0, PropertyRangeRole, QPointF(0.0, FLT_MAX));
|
||||||
|
|
||||||
lightFormat->setText(1, Format);
|
|
||||||
lightFormat->setData(0, PropertyValueRole, FormatIndex);
|
|
||||||
|
|
||||||
mLightTypeItem->setText(1, lcLight::GetLightTypeString(LightType));
|
mLightTypeItem->setText(1, lcLight::GetLightTypeString(LightType));
|
||||||
mLightTypeItem->setData(0, PropertyValueRole, static_cast<int>(LightType));
|
mLightTypeItem->setData(0, PropertyValueRole, static_cast<int>(LightType));
|
||||||
|
|
||||||
|
@ -1625,10 +1533,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus)
|
||||||
mLightSizeYItem->setData(0, PropertyValueRole, LightSize[1]);
|
mLightSizeYItem->setData(0, PropertyValueRole, LightSize[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
lightExponent->setText(1, lcFormatValueLocalized(Exponent));
|
|
||||||
lightExponent->setData(0, PropertyValueRole, Exponent);
|
|
||||||
lightExponent->setToolTip(1, ExponentToolTip);
|
|
||||||
|
|
||||||
switch (LightType)
|
switch (LightType)
|
||||||
{
|
{
|
||||||
case lcLightType::Point:
|
case lcLightType::Point:
|
||||||
|
|
|
@ -49,7 +49,6 @@ public:
|
||||||
PropertyStep,
|
PropertyStep,
|
||||||
PropertyString,
|
PropertyString,
|
||||||
PropertyStringList,
|
PropertyStringList,
|
||||||
PropertyLightFormat,
|
|
||||||
PropertyColor,
|
PropertyColor,
|
||||||
PropertyPieceColor,
|
PropertyPieceColor,
|
||||||
PropertyPart
|
PropertyPart
|
||||||
|
@ -78,7 +77,6 @@ protected:
|
||||||
void SetMultiple();
|
void SetMultiple();
|
||||||
|
|
||||||
lcLightType mLightType;
|
lcLightType mLightType;
|
||||||
bool mPOVRayLight;
|
|
||||||
|
|
||||||
lcPropertyWidgetMode mWidgetMode;
|
lcPropertyWidgetMode mWidgetMode;
|
||||||
lcObject* mFocus;
|
lcObject* mFocus;
|
||||||
|
@ -115,11 +113,9 @@ protected:
|
||||||
QTreeWidgetItem* cameraFar;
|
QTreeWidgetItem* cameraFar;
|
||||||
QTreeWidgetItem* mCameraNameItem;
|
QTreeWidgetItem* mCameraNameItem;
|
||||||
|
|
||||||
QTreeWidgetItem* lightConfiguration;
|
|
||||||
QTreeWidgetItem* mLightColorItem;
|
QTreeWidgetItem* mLightColorItem;
|
||||||
QTreeWidgetItem* mLightPowerItem;
|
QTreeWidgetItem* mLightPowerItem;
|
||||||
QTreeWidgetItem* mLightAttributesItem;
|
QTreeWidgetItem* mLightAttributesItem;
|
||||||
QTreeWidgetItem* lightExponent;
|
|
||||||
QTreeWidgetItem* mLightTypeItem;
|
QTreeWidgetItem* mLightTypeItem;
|
||||||
QTreeWidgetItem* mLightAttenuationDistanceItem;
|
QTreeWidgetItem* mLightAttenuationDistanceItem;
|
||||||
QTreeWidgetItem* mLightAttenuationPowerItem;
|
QTreeWidgetItem* mLightAttenuationPowerItem;
|
||||||
|
@ -132,7 +128,6 @@ protected:
|
||||||
QTreeWidgetItem* mLightSizeXItem;
|
QTreeWidgetItem* mLightSizeXItem;
|
||||||
QTreeWidgetItem* mLightSizeYItem;
|
QTreeWidgetItem* mLightSizeYItem;
|
||||||
QTreeWidgetItem* mLightNameItem;
|
QTreeWidgetItem* mLightNameItem;
|
||||||
QTreeWidgetItem* lightFormat;
|
|
||||||
QTreeWidgetItem* mLightCastShadowItem;
|
QTreeWidgetItem* mLightCastShadowItem;
|
||||||
|
|
||||||
QTreeWidgetItem* mPositionItem;
|
QTreeWidgetItem* mPositionItem;
|
||||||
|
|
Loading…
Reference in a new issue