diff --git a/common/lc_global.h b/common/lc_global.h index 53335edb..33fbfa04 100644 --- a/common/lc_global.h +++ b/common/lc_global.h @@ -107,7 +107,6 @@ struct lcMeshSection; struct lcRenderMesh; struct lcObjectSection; struct lcPieceInfoRayTest; -struct lcLightProperties; class lcTexture; class lcScene; class lcViewManipulator; diff --git a/common/lc_model.cpp b/common/lc_model.cpp index 407b1344..6cb9e210 100644 --- a/common/lc_model.cpp +++ b/common/lc_model.cpp @@ -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) { if (Camera->IsOrtho() == Ortho) diff --git a/common/lc_model.h b/common/lc_model.h index 144ee9f8..59bee78c 100644 --- a/common/lc_model.h +++ b/common/lc_model.h @@ -381,7 +381,6 @@ public: void SetLightPower(lcLight* Light, float Power); void SetLightCastShadow(lcLight* Light, bool CastShadow); void SetLightName(lcLight* Light, const QString& Name); - void UpdateLight(lcLight* Light, const lcLightProperties Props, int Property); void ShowPropertiesDialog(); void ShowSelectByNameDialog(); diff --git a/common/light.cpp b/common/light.cpp index 17d3cef6..82ed4288 100644 --- a/common/light.cpp +++ b/common/light.cpp @@ -25,10 +25,6 @@ lcLight::lcLight(const lcVector3& Position, lcLightType LightType) { mWorldMatrix = lcMatrix44Translation(Position); - mPOVRayLight = false; - mSpotExponent = 10.0f; - mPOVRayExponent = 1.0f; - UpdateLightType(); mPositionKeys.ChangeKey(mWorldMatrix.GetTranslation(), 1, true); @@ -42,8 +38,6 @@ lcLight::lcLight(const lcVector3& Position, lcLightType LightType) mSpotTightnessKeys.ChangeKey(mSpotTightness, 1, true); mAreaGridKeys.ChangeKey(mAreaGrid, 1, true); - mSpotExponentKeys.ChangeKey(mSpotExponent, 1, true); - UpdatePosition(1); } @@ -126,9 +120,6 @@ void lcLight::SaveLDraw(QTextStream& Stream) const { const QLatin1String LineEnding("\r\n"); - if (mPOVRayLight) - Stream << QLatin1String("0 !LEOCAD LIGHT POV_RAY") << LineEnding; - if (!mCastShadow) 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, mAttenuationPower, mAttenuationPowerKeys, "LIGHT", "ATTENUATION_POWER"); -// SaveAttribute(Stream, (mPOVRayLight ? mPOVRayExponent : mSpotExponent), mSpotExponentKeys, "LIGHT", "POWER"); - switch (mLightType) { case lcLightType::Count: @@ -169,7 +158,6 @@ void lcLight::SaveLDraw(QTextStream& Stream) const break; case lcLightType::Directional: - SaveAttribute(Stream, mSpotExponent, mSpotExponentKeys, "LIGHT", "STRENGTH"); break; case lcLightType::Area: @@ -316,20 +304,6 @@ bool lcLight::ParseLDrawLine(QTextStream& Stream) } else if (LoadAttribute(Stream, Token, mAreaGrid, mAreaGridKeys, "AREA_GRID")) 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")) { QString Type; @@ -344,16 +318,10 @@ bool lcLight::ParseLDrawLine(QTextStream& Stream) } } } - else if (Token == QLatin1String("POV_RAY")) - { - mPOVRayLight = true; - } else if (Token == QLatin1String("SHADOWLESS")) { mCastShadow = false; } - else if ((Token == QLatin1String("POWER_KEY")) || (Token == QLatin1String("STRENGTH_KEY"))) - mSpotExponentKeys.LoadKeysLDraw(Stream); else if (Token == QLatin1String("NAME")) { mName = Stream.readAll().trimmed(); @@ -376,29 +344,6 @@ void lcLight::CompareBoundingBox(lcVector3& Min, lcVector3& 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 { if (IsPointLight()) @@ -679,8 +624,6 @@ void lcLight::InsertTime(lcStep Start, lcStep Time) mPowerKeys.InsertTime(Start, Time); mAttenuationDistanceKeys.InsertTime(Start, Time); mAttenuationPowerKeys.InsertTime(Start, Time); - - mSpotExponentKeys.InsertTime(Start, Time); } void lcLight::RemoveTime(lcStep Start, lcStep Time) @@ -696,8 +639,6 @@ void lcLight::RemoveTime(lcStep Start, lcStep Time) mPowerKeys.RemoveTime(Start, Time); mAttenuationDistanceKeys.RemoveTime(Start, Time); mAttenuationPowerKeys.RemoveTime(Start, Time); - - mSpotExponentKeys.RemoveTime(Start, Time); } void lcLight::UpdatePosition(lcStep Step) @@ -724,8 +665,6 @@ void lcLight::UpdatePosition(lcStep Step) mPower = mPowerKeys.CalculateKey(Step); mAttenuationDistance = mAttenuationDistanceKeys.CalculateKey(Step); mAttenuationPower = mAttenuationPowerKeys.CalculateKey(Step); - - mSpotExponent = mSpotExponentKeys.CalculateKey(Step); } void lcLight::DrawInterface(lcContext* Context, const lcScene& Scene) const @@ -1170,9 +1109,6 @@ void lcLight::RemoveKeyFrames() mAttenuationPowerKeys.RemoveAll(); mAttenuationPowerKeys.ChangeKey(mAttenuationPower, 1, true); - - mSpotExponentKeys.RemoveAll(); - mSpotExponentKeys.ChangeKey(mSpotExponent, 1, true); } bool lcLight::Setup(int LightIndex) diff --git a/common/light.h b/common/light.h index 14d598a4..32d80a0a 100644 --- a/common/light.h +++ b/common/light.h @@ -31,18 +31,6 @@ enum class lcLightAreaShape Count }; -enum lcLightProperty -{ - LC_LIGHT_EXPONENT, - LC_LIGHT_POVRAY -}; - -struct lcLightProperties -{ - float mSpotExponent; - bool mPOVRayLight; -}; - class lcLight : public lcObject { public: @@ -326,22 +314,9 @@ public: void Rotate(lcStep Step, bool AddKey, const lcMatrix33& RotationMatrix, const lcVector3& Center, const lcMatrix33& RotationFrame); bool Setup(int LightIndex); void CreateName(const lcArray& Lights); - void UpdateLight(lcStep Step, lcLightProperties Props, int Property); - - lcLightProperties GetLightProperties() const - { - lcLightProperties props; - props.mSpotExponent = mSpotExponent; - props.mPOVRayLight = mPOVRayLight; - return props; - } lcMatrix44 mWorldMatrix; - bool mPOVRayLight; - float mSpotExponent; - float mPOVRayExponent; - protected: void UpdateLightType(); @@ -387,7 +362,5 @@ protected: lcObjectKeyArray mSpotTightnessKeys; lcObjectKeyArray mAreaGridKeys; - lcObjectKeyArray mSpotExponentKeys; - static constexpr float mTargetDistance = 50.0f; }; diff --git a/common/project.cpp b/common/project.cpp index c83c9a4f..56b8c528 100644 --- a/common/project.cpp +++ b/common/project.cpp @@ -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->mPOVRayExponent; + Power = Light->GetPower(); FadeDistance = Light->GetAttenuationDistance(); FadePower = Light->GetAttenuationPower(); diff --git a/qt/lc_qpropertiestree.cpp b/qt/lc_qpropertiestree.cpp index a5ebc50c..c1b89b5e 100644 --- a/qt/lc_qpropertiestree.cpp +++ b/qt/lc_qpropertiestree.cpp @@ -526,25 +526,6 @@ QWidget* lcQPropertiesTree::createEditor(QWidget* Parent, QTreeWidgetItem* Item) 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: { QPushButton *Editor = new QPushButton(Parent); @@ -830,8 +811,6 @@ void lcQPropertiesTree::slotReturnPressed() { if (Light) { - lcLightProperties Props = Light->GetLightProperties(); - if (Item == mLightAttenuationDistanceItem) { float Value = lcParseValueLocalized(Editor->text()); @@ -896,12 +875,6 @@ void lcQPropertiesTree::slotReturnPressed() Model->SetLightPower(Light, Value); } - else if (Item == lightExponent) - { - Props.mSpotExponent = lcParseValueLocalized(Editor->text()); - - Model->UpdateLight(Light, Props, LC_LIGHT_EXPONENT); - } else if (Item == mLightNameItem) { QString Value = Editor->text(); @@ -962,8 +935,6 @@ void lcQPropertiesTree::slotSetValue(int Value) if (Light) { - lcLightProperties Props = Light->GetLightProperties(); - if (Item == mLightTypeItem) { Model->SetLightType(Light, static_cast(Value)); @@ -972,11 +943,6 @@ void lcQPropertiesTree::slotSetValue(int Value) { Model->SetLightAreaShape(Light, static_cast(Value)); } - else if (Item == lightFormat) - { - Props.mPOVRayLight = Value; - Model->UpdateLight(Light, Props, LC_LIGHT_POVRAY); - } } } } @@ -1101,11 +1067,9 @@ void lcQPropertiesTree::SetEmpty() cameraFar = nullptr; mCameraNameItem = nullptr; - lightConfiguration = nullptr; mLightColorItem = nullptr; mLightPowerItem = nullptr; mLightAttributesItem = nullptr; - lightExponent = nullptr; mLightTypeItem = nullptr; mLightNameItem = nullptr; mLightAttenuationDistanceItem = nullptr; @@ -1118,7 +1082,6 @@ void lcQPropertiesTree::SetEmpty() mLightAreaGridYItem = nullptr; mLightSizeXItem = nullptr; mLightSizeYItem = nullptr; - lightFormat = nullptr; mLightCastShadowItem = nullptr; mPositionItem = nullptr; @@ -1365,8 +1328,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus) lcLight* Light = (Focus && Focus->IsLight()) ? (lcLight*)Focus : nullptr; QString Name = tr("Light"); - QString ExponentLabel = tr("Exponent"); - QString Format, ExponentToolTip; lcLightType LightType = lcLightType::Point; lcLightAreaShape LightAreaShape = lcLightAreaShape::Rectangle; lcVector2 LightSize(0.0f, 0.0f); @@ -1374,11 +1335,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus) float Power = 0.0f; float AttenuationDistance = 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; lcVector3 Position(0.0f, 0.0f, 0.0f); QColor Color(Qt::white); @@ -1388,10 +1344,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus) { Name = Light->GetName(); - POVRayLight = Light->mPOVRayLight; - FormatIndex = static_cast(POVRayLight); - Format = POVRayLight ? QLatin1String("POVRay") : QLatin1String("Blender"); - CastShadow = Light->GetCastShadow(); Position = Light->GetPosition(); Color = lcQColorFromVector3(Light->GetColor()); @@ -1400,49 +1352,15 @@ void lcQPropertiesTree::SetLight(lcObject* Focus) AttenuationPower = Light->GetAttenuationPower(); SpotConeAngle = Light->GetSpotConeAngle(); SpotPenumbraAngle = Light->GetSpotPenumbraAngle(); + SpotTightness = Light->GetSpotTightness(); LightType = Light->GetLightType(); LightAreaShape = Light->GetAreaShape(); LightSize = Light->GetSize(); 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) - { - 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) + if (mWidgetMode != LC_PROPERTY_WIDGET_LIGHT || mLightType != LightType) { SetEmpty(); @@ -1455,7 +1373,7 @@ void lcQPropertiesTree::SetLight(lcObject* Focus) mLightColorItem->setToolTip(1, tr("Color of the emitted light.")); 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); @@ -1532,12 +1450,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus) 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); mPositionXItem = addProperty(mPositionItem, tr("X"), PropertyFloat); mPositionYItem = addProperty(mPositionItem, tr("Y"), PropertyFloat); @@ -1553,7 +1465,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus) mWidgetMode = LC_PROPERTY_WIDGET_LIGHT; mLightType = LightType; - mPOVRayLight = POVRayLight; } mFocus = Light; @@ -1607,9 +1518,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus) mLightAttenuationPowerItem->setData(0, PropertyValueRole, AttenuationPower); 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->setData(0, PropertyValueRole, static_cast(LightType)); @@ -1625,10 +1533,6 @@ void lcQPropertiesTree::SetLight(lcObject* Focus) mLightSizeYItem->setData(0, PropertyValueRole, LightSize[1]); } - lightExponent->setText(1, lcFormatValueLocalized(Exponent)); - lightExponent->setData(0, PropertyValueRole, Exponent); - lightExponent->setToolTip(1, ExponentToolTip); - switch (LightType) { case lcLightType::Point: diff --git a/qt/lc_qpropertiestree.h b/qt/lc_qpropertiestree.h index 25eae636..80f75486 100644 --- a/qt/lc_qpropertiestree.h +++ b/qt/lc_qpropertiestree.h @@ -49,7 +49,6 @@ public: PropertyStep, PropertyString, PropertyStringList, - PropertyLightFormat, PropertyColor, PropertyPieceColor, PropertyPart @@ -78,7 +77,6 @@ protected: void SetMultiple(); lcLightType mLightType; - bool mPOVRayLight; lcPropertyWidgetMode mWidgetMode; lcObject* mFocus; @@ -115,11 +113,9 @@ protected: QTreeWidgetItem* cameraFar; QTreeWidgetItem* mCameraNameItem; - QTreeWidgetItem* lightConfiguration; QTreeWidgetItem* mLightColorItem; QTreeWidgetItem* mLightPowerItem; QTreeWidgetItem* mLightAttributesItem; - QTreeWidgetItem* lightExponent; QTreeWidgetItem* mLightTypeItem; QTreeWidgetItem* mLightAttenuationDistanceItem; QTreeWidgetItem* mLightAttenuationPowerItem; @@ -132,7 +128,6 @@ protected: QTreeWidgetItem* mLightSizeXItem; QTreeWidgetItem* mLightSizeYItem; QTreeWidgetItem* mLightNameItem; - QTreeWidgetItem* lightFormat; QTreeWidgetItem* mLightCastShadowItem; QTreeWidgetItem* mPositionItem;