diff --git a/common/camera.cpp b/common/camera.cpp index a5bfa74b..2c0610ad 100644 --- a/common/camera.cpp +++ b/common/camera.cpp @@ -58,6 +58,33 @@ lcCamera::~lcCamera() { } +QString lcCamera::GetCameraTypeString(lcCameraType CameraType) +{ + switch (CameraType) + { + case lcCameraType::Perspective: + return QT_TRANSLATE_NOOP("Camera Type", "Perspective"); + + case lcCameraType::Orthographic: + return QT_TRANSLATE_NOOP("Camera Type", "Orthographic"); + + case lcCameraType::Count: + break; + } + + return QString(); +} + +QStringList lcCamera::GetCameraTypeStrings() +{ + QStringList CameraType; + + for (int CameraTypeIndex = 0; CameraTypeIndex < static_cast(lcCameraType::Count); CameraTypeIndex++) + CameraType.push_back(GetCameraTypeString(static_cast(CameraTypeIndex))); + + return CameraType; +} + lcViewpoint lcCamera::GetViewpoint(const QString& ViewpointName) { const QLatin1String ViewpointNames[] = @@ -132,6 +159,19 @@ void lcCamera::CreateName(const lcArray& Cameras) mName = Prefix + QString::number(MaxCameraNumber + 1); } +bool lcCamera::SetCameraType(lcCameraType CameraType) +{ + if (static_cast(CameraType) < 0 || CameraType >= lcCameraType::Count) + return false; + + if (GetCameraType() == CameraType) + return false; + + SetOrtho(CameraType == lcCameraType::Orthographic); + + return true; +} + void lcCamera::SaveLDraw(QTextStream& Stream) const { const QLatin1String LineEnding("\r\n"); @@ -575,7 +615,11 @@ QVariant lcCamera::GetPropertyValue(lcObjectPropertyId PropertyId) const case lcObjectPropertyId::PieceStepShow: case lcObjectPropertyId::PieceStepHide: case lcObjectPropertyId::CameraName: + break; + case lcObjectPropertyId::CameraType: + return static_cast(GetCameraType()); + case lcObjectPropertyId::CameraFOV: case lcObjectPropertyId::CameraNear: case lcObjectPropertyId::CameraFar: @@ -633,7 +677,11 @@ bool lcCamera::SetPropertyValue(lcObjectPropertyId PropertyId, lcStep Step, bool case lcObjectPropertyId::PieceStepShow: case lcObjectPropertyId::PieceStepHide: case lcObjectPropertyId::CameraName: + break; + case lcObjectPropertyId::CameraType: + return SetCameraType(static_cast(Value.toInt())); + case lcObjectPropertyId::CameraFOV: case lcObjectPropertyId::CameraNear: case lcObjectPropertyId::CameraFar: diff --git a/common/camera.h b/common/camera.h index 89af7b95..418e1140 100644 --- a/common/camera.h +++ b/common/camera.h @@ -29,6 +29,13 @@ enum class lcViewpoint Count }; +enum class lcCameraType +{ + Perspective, + Orthographic, + Count +}; + enum lcCameraSection { LC_CAMERA_SECTION_POSITION, @@ -48,6 +55,8 @@ public: lcCamera& operator=(const lcCamera&) = delete; lcCamera& operator=(lcCamera&&) = delete; + static QString GetCameraTypeString(lcCameraType CameraType); + static QStringList GetCameraTypeStrings(); static lcViewpoint GetViewpoint(const QString& ViewpointName); QString GetName() const override @@ -63,6 +72,13 @@ public: return (mState & LC_CAMERA_SIMPLE) != 0; } + lcCameraType GetCameraType() const + { + return ((mState & LC_CAMERA_ORTHO) == 0) ? lcCameraType::Perspective : lcCameraType::Orthographic; + } + + bool SetCameraType(lcCameraType CameraType); + bool IsOrtho() const { return (mState & LC_CAMERA_ORTHO) != 0; diff --git a/common/lc_model.cpp b/common/lc_model.cpp index ede50e46..01b160a5 100644 --- a/common/lc_model.cpp +++ b/common/lc_model.cpp @@ -3172,18 +3172,6 @@ void lcModel::SetCameraName(lcCamera* Camera, const QString& Name) gMainWindow->UpdateCameraMenu(); } -void lcModel::SetLightType(lcLight* Light, lcLightType LightType) -{ - if (!Light->SetLightType(LightType)) - return; - - Light->UpdatePosition(mCurrentStep); - - SaveCheckpoint(tr("Changing Light Type")); - gMainWindow->UpdateSelectedObjects(false); - UpdateAllViews(); -} - void lcModel::SetLightAttenuationDistance(lcLight* Light, float Distance) { Light->SetAttenuationDistance(Distance, mCurrentStep, gMainWindow->GetAddKeys()); @@ -3234,30 +3222,6 @@ void lcModel::SetSpotLightTightness(lcLight* Light, float Tightness) UpdateAllViews(); } -void lcModel::SetLightAreaShape(lcLight* Light, lcLightAreaShape LightAreaShape) -{ - if (!Light->SetAreaShape(LightAreaShape)) - return; - - Light->UpdatePosition(mCurrentStep); - - SaveCheckpoint(tr("Changing Area Light Shape")); - gMainWindow->UpdateSelectedObjects(false); - UpdateAllViews(); -} - -void lcModel::SetLightAreaGrid(lcLight* Light, lcVector2i AreaGrid) -{ - if (!Light->SetAreaGrid(AreaGrid, mCurrentStep, gMainWindow->GetAddKeys())) - return; - - Light->UpdatePosition(mCurrentStep); - - SaveCheckpoint(tr("Changing Area Light Size")); - gMainWindow->UpdateSelectedObjects(false); - UpdateAllViews(); -} - void lcModel::SetLightSize(lcLight* Light, lcVector2 LightAreaSize) { Light->SetSize(LightAreaSize, mCurrentStep, gMainWindow->GetAddKeys()); diff --git a/common/lc_model.h b/common/lc_model.h index f1d0b34f..b7544e7d 100644 --- a/common/lc_model.h +++ b/common/lc_model.h @@ -373,14 +373,11 @@ public: void SetCameraZFar(lcCamera* Camera, float ZFar); void SetCameraName(lcCamera* Camera, const QString& Name); - void SetLightType(lcLight* Light, lcLightType LightType); void SetLightAttenuationDistance(lcLight* Light, float Distance); void SetLightAttenuationPower(lcLight* Light, float Power); void SetSpotLightConeAngle(lcLight* Light, float Angle); void SetSpotLightPenumbraAngle(lcLight* Light, float Angle); void SetSpotLightTightness(lcLight* Light, float Tightness); - void SetLightAreaShape(lcLight* Light, lcLightAreaShape LightAreaShape); - void SetLightAreaGrid(lcLight* Light, lcVector2i AreaGrid); void SetLightSize(lcLight* Light, lcVector2 LightAreaSize); void SetLightPower(lcLight* Light, float Power); void SetLightName(lcLight* Light, const QString& Name); diff --git a/common/lc_propertieswidget.cpp b/common/lc_propertieswidget.cpp index 007300b0..c758056e 100644 --- a/common/lc_propertieswidget.cpp +++ b/common/lc_propertieswidget.cpp @@ -155,6 +155,37 @@ void lcPropertiesWidget::AddKeyFrameWidget(lcObjectPropertyId PropertyId) mPropertyWidgets[static_cast(PropertyId)].KeyFrame = Widget; } +std::pair lcPropertiesWidget::GetUpdateValue(lcObjectPropertyId PropertyId, QVariant DefaultValue) +{ + QVariant Value = DefaultValue; + bool Partial = false; + + if (mFocusObject) + Value = mFocusObject->GetPropertyValue(PropertyId); + else + { + bool First = true; + + for (const lcObject* Object : mSelection) + { + const QVariant ObjectValue = Object->GetPropertyValue(PropertyId); + + if (First) + { + Value = ObjectValue; + First = false; + } + else if (Value != ObjectValue) + { + Partial = true; + break; + } + } + } + + return { Value, Partial }; +} + void lcPropertiesWidget::BoolChanged() { QCheckBox* Widget = qobject_cast(sender()); @@ -180,36 +211,15 @@ void lcPropertiesWidget::UpdateBool(lcObjectPropertyId PropertyId, bool DefaultV return; QSignalBlocker Blocker(CheckBox); - bool Value = DefaultValue; - bool Partial = false; + QVariant Value; + bool Partial; - if (mFocusObject) - Value = mFocusObject->GetPropertyValue(PropertyId).toBool(); - else - { - bool First = true; - - for (const lcObject* Object : mSelection) - { - const bool ObjectValue = Object->GetPropertyValue(PropertyId).toBool(); - - if (First) - { - Value = ObjectValue; - First = false; - } - else if (Value != ObjectValue) - { - Partial = true; - break; - } - } - } + std::tie(Value, Partial) = GetUpdateValue(PropertyId, DefaultValue); if (Partial) CheckBox->setCheckState(Qt::PartiallyChecked); else - CheckBox->setCheckState(Value ? Qt::Checked : Qt::Unchecked); + CheckBox->setCheckState(Value.toBool() ? Qt::Checked : Qt::Unchecked); UpdateKeyFrameWidget(PropertyId); } @@ -441,8 +451,9 @@ void lcPropertiesWidget::AddFloatProperty(lcObjectPropertyId PropertyId, const Q void lcPropertiesWidget::IntegerChanged() { - QLineEdit* Widget = qobject_cast(sender()); - lcObjectPropertyId PropertyId = GetEditorWidgetPropertyId(Widget); + // todo: switch to spinner and support mouse drag + QLineEdit* LineEdit = qobject_cast(sender()); + lcObjectPropertyId PropertyId = GetEditorWidgetPropertyId(LineEdit); if (PropertyId == lcObjectPropertyId::Count) return; @@ -452,39 +463,32 @@ void lcPropertiesWidget::IntegerChanged() if (!Model) return; - lcLight* Light = dynamic_cast(mFocusObject); - int Value = Widget->text().toInt(); - - // todo: mouse drag - - if (Light) - { - if (PropertyId == lcObjectPropertyId::LightAreaGridX) - { - lcVector2i AreaGrid = Light->GetAreaGrid(); - AreaGrid.x = Value; - - Model->SetLightAreaGrid(Light, AreaGrid); - } - else if (PropertyId == lcObjectPropertyId::LightAreaGridY) - { - lcVector2i AreaGrid = Light->GetAreaGrid(); - AreaGrid.y = Value; - - Model->SetLightAreaGrid(Light, AreaGrid); - } - } + const int Value = LineEdit->text().toInt(); + Model->SetObjectsProperty(mFocusObject ? lcArray{ mFocusObject } : mSelection, PropertyId, Value); } -void lcPropertiesWidget::UpdateInteger(lcObjectPropertyId PropertyId, int Value) +void lcPropertiesWidget::UpdateInteger(lcObjectPropertyId PropertyId, int DefaultValue) { - QLineEdit* Widget = qobject_cast(mPropertyWidgets[static_cast(PropertyId)].Editor); + QLineEdit* LineEdit = qobject_cast(mPropertyWidgets[static_cast(PropertyId)].Editor); - if (Widget) + if (!LineEdit) + return; + + QSignalBlocker Blocker(LineEdit); + QVariant Value; + bool Partial; + + std::tie(Value, Partial) = GetUpdateValue(PropertyId, DefaultValue); + + if (Partial) { - QSignalBlocker Blocker(Widget); - - Widget->setText(lcFormatValueLocalized(Value)); + LineEdit->clear(); + LineEdit->setPlaceholderText(tr("Multiple Values")); + } + else + { + LineEdit->setText(QString::number(Value.toInt())); + LineEdit->setPlaceholderText(QString()); } UpdateKeyFrameWidget(PropertyId); @@ -646,8 +650,8 @@ void lcPropertiesWidget::AddStringProperty(lcObjectPropertyId PropertyId, const void lcPropertiesWidget::StringListChanged(int Value) { - QComboBox* Widget = qobject_cast(sender()); - lcObjectPropertyId PropertyId = GetEditorWidgetPropertyId(Widget); + QComboBox* ComboBox = qobject_cast(sender()); + lcObjectPropertyId PropertyId = GetEditorWidgetPropertyId(ComboBox); if (PropertyId == lcObjectPropertyId::Count) return; @@ -657,38 +661,36 @@ void lcPropertiesWidget::StringListChanged(int Value) if (!Model) return; - lcCamera* Camera = dynamic_cast(mFocusObject); - lcLight* Light = dynamic_cast(mFocusObject); - - if (Camera) - { - if (PropertyId == lcObjectPropertyId::CameraType) - { - Model->SetCameraOrthographic(Camera, Value == 1); - } - } - else if (Light) - { - if (PropertyId == lcObjectPropertyId::LightType) - { - Model->SetLightType(Light, static_cast(Value)); - } - else if (PropertyId == lcObjectPropertyId::LightAreaShape) - { - Model->SetLightAreaShape(Light, static_cast(Value)); - } - } + Model->SetObjectsProperty(mFocusObject ? lcArray{ mFocusObject } : mSelection, PropertyId, Value); } -void lcPropertiesWidget::UpdateStringList(lcObjectPropertyId PropertyId, int ListIndex) +void lcPropertiesWidget::UpdateStringList(lcObjectPropertyId PropertyId, int DefaultValue) { - QComboBox* Widget = qobject_cast(mPropertyWidgets[static_cast(PropertyId)].Editor); + QComboBox* ComboBox = qobject_cast(mPropertyWidgets[static_cast(PropertyId)].Editor); - if (Widget) + if (!ComboBox) + return; + + QSignalBlocker Blocker(ComboBox); + QVariant Value; + bool Partial; + + std::tie(Value, Partial) = GetUpdateValue(PropertyId, DefaultValue); + bool HasMultiple = (ComboBox->itemText(ComboBox->count() - 1) == tr("Multiple Values")); + + if (Partial) { - QSignalBlocker Blocker(Widget); + if (!HasMultiple) + ComboBox->addItem(tr("Multiple Values")); - Widget->setCurrentIndex(ListIndex); + ComboBox->setCurrentIndex(ComboBox->count() - 1); + } + else + { + if (HasMultiple) + ComboBox->removeItem(ComboBox->count() - 1); + + ComboBox->setCurrentIndex(Value.toInt()); } UpdateKeyFrameWidget(PropertyId); @@ -751,36 +753,12 @@ void lcPropertiesWidget::UpdateColor(lcObjectPropertyId PropertyId, const lcVect return; QSignalBlocker Blocker(ColorButton); - lcVector3 Value = DefaultValue; - bool Partial = false; + QVariant Value; + bool Partial; - if (mFocusObject) - Value = mFocusObject->GetPropertyValue(PropertyId).value(); - else - { - bool First = true; + std::tie(Value, Partial) = GetUpdateValue(PropertyId, QVariant::fromValue(DefaultValue)); - for (const lcObject* Object : mSelection) - { - const lcVector3 ObjectValue = Object->GetPropertyValue(PropertyId).value(); - - if (First) - { - Value = ObjectValue; - First = false; - } - else if (Value != ObjectValue) - { - Partial = true; - break; - } - } - } - - if (Partial) - Value = lcVector3(0.5f, 0.5f, 0.5f); - - QColor Color = lcQColorFromVector3(Value); + QColor Color = Partial ? QColor(128, 128, 128) : lcQColorFromVector3(Value.value()); QPixmap Pixmap(14, 14); Pixmap.fill(Color); @@ -991,7 +969,7 @@ void lcPropertiesWidget::CreateWidgets() AddCategory(CategoryIndex::Camera, tr("Camera")); AddStringProperty(lcObjectPropertyId::CameraName, tr("Name"), tr("Camera name"), false); - AddStringListProperty(lcObjectPropertyId::CameraType, tr("Type"), tr("Camera type"), false, { tr("Perspective"), tr("Orthographic") }); + AddStringListProperty(lcObjectPropertyId::CameraType, tr("Type"), tr("Camera type"), false, lcCamera::GetCameraTypeStrings()); AddSpacing(); @@ -1218,7 +1196,7 @@ void lcPropertiesWidget::SetCamera(const lcArray& Selection, lcObject lcVector3 Position(0.0f, 0.0f, 0.0f); lcVector3 Target(0.0f, 0.0f, 0.0f); lcVector3 UpVector(0.0f, 0.0f, 0.0f); - bool Ortho = false; + lcCameraType CameraType = lcCameraType::Perspective; float FoV = 60.0f; float ZNear = 1.0f; float ZFar = 100.0f; @@ -1230,7 +1208,7 @@ void lcPropertiesWidget::SetCamera(const lcArray& Selection, lcObject Target = Camera->mTargetPosition; UpVector = Camera->mUpVector; - Ortho = Camera->IsOrtho(); + CameraType = Camera->GetCameraType(); FoV = Camera->m_fovy; ZNear = Camera->m_zNear; ZFar = Camera->m_zFar; @@ -1238,7 +1216,7 @@ void lcPropertiesWidget::SetCamera(const lcArray& Selection, lcObject } UpdateString(lcObjectPropertyId::CameraName, Name); - UpdateStringList(lcObjectPropertyId::CameraType, Ortho ? 1 : 0); + UpdateStringList(lcObjectPropertyId::CameraType, static_cast(CameraType)); UpdateFloat(lcObjectPropertyId::CameraFOV, FoV); UpdateFloat(lcObjectPropertyId::CameraNear, ZNear); @@ -1266,10 +1244,9 @@ void lcPropertiesWidget::SetLight(const lcArray& Selection, lcObject* mFocusObject = Light; QString Name; - lcLightType LightType = lcLightType::Point; - lcLightAreaShape LightAreaShape = lcLightAreaShape::Rectangle; + lcLightType LightType = lcLightType::Count; + lcLightAreaShape LightAreaShape = lcLightAreaShape::Count; lcVector2 LightSize(0.0f, 0.0f); - lcVector2i AreaGrid(2, 2); float Power = 0.0f; float AttenuationDistance = 0.0f; float AttenuationPower = 0.0f; @@ -1281,6 +1258,7 @@ void lcPropertiesWidget::SetLight(const lcArray& Selection, lcObject* { Name = Light->GetName(); LightType = Light->GetLightType(); + LightAreaShape = Light->GetAreaShape(); Position = Light->GetPosition(); Rotation = lcMatrix44ToEulerAngles(Light->GetWorldMatrix()) * LC_RTOD; @@ -1290,14 +1268,45 @@ void lcPropertiesWidget::SetLight(const lcArray& Selection, lcObject* SpotConeAngle = Light->GetSpotConeAngle(); SpotPenumbraAngle = Light->GetSpotPenumbraAngle(); SpotTightness = Light->GetSpotTightness(); - - LightAreaShape = Light->GetAreaShape(); LightSize = Light->GetSize(); - AreaGrid = Light->GetAreaGrid(); + } + else + { + bool First = true; + bool PartialLightType = false, PartialAreaShape = false; + + for (const lcObject* Object : mSelection) + { + const lcLight* CurrentLight = dynamic_cast(Object); + + if (!CurrentLight) + continue; + + if (First) + { + LightType = CurrentLight->GetLightType(); + LightAreaShape = CurrentLight->GetAreaShape(); + First = false; + } + else + { + if (LightType != CurrentLight->GetLightType()) + PartialLightType = true; + + if (LightAreaShape != CurrentLight->GetAreaShape()) + PartialAreaShape = true; + } + } + + if (PartialLightType) + LightType = lcLightType::Count; + + if (PartialAreaShape) + LightAreaShape = lcLightAreaShape::Count; } UpdateString(lcObjectPropertyId::LightName, Name); - UpdateStringList(lcObjectPropertyId::LightType, static_cast(LightType)); + UpdateStringList(lcObjectPropertyId::LightType, 0); UpdateColor(lcObjectPropertyId::LightColor, lcVector3(1.0f, 1.0f, 1.0f)); UpdateFloat(lcObjectPropertyId::LightPower, Power); @@ -1306,13 +1315,13 @@ void lcPropertiesWidget::SetLight(const lcArray& Selection, lcObject* UpdateFloat(lcObjectPropertyId::LightAttenuationDistance, AttenuationDistance); UpdateFloat(lcObjectPropertyId::LightAttenuationPower, AttenuationPower); - const bool IsPointLight = Light && Light->IsPointLight(); + const bool IsPointLight = (LightType == lcLightType::Point); SetPropertyVisible(lcObjectPropertyId::LightPointSize, IsPointLight); if (IsPointLight) UpdateFloat(lcObjectPropertyId::LightPointSize, LightSize.x); - const bool IsSpotLight = Light && Light->IsSpotLight(); + const bool IsSpotLight = (LightType == lcLightType::Spot); SetPropertyVisible(lcObjectPropertyId::LightSpotSize, IsSpotLight); SetPropertyVisible(lcObjectPropertyId::LightSpotConeAngle, IsSpotLight); SetPropertyVisible(lcObjectPropertyId::LightSpotPenumbraAngle, IsSpotLight); @@ -1326,19 +1335,19 @@ void lcPropertiesWidget::SetLight(const lcArray& Selection, lcObject* UpdateFloat(lcObjectPropertyId::LightSpotTightness, SpotTightness); } - const bool IsDirectionalLight = Light && Light->IsDirectionalLight(); + const bool IsDirectionalLight = (LightType == lcLightType::Directional); SetPropertyVisible(lcObjectPropertyId::LightDirectionalSize, IsDirectionalLight); if (IsDirectionalLight) UpdateFloat(lcObjectPropertyId::LightDirectionalSize, LightSize.x); - const bool IsAreaLight = Light && Light->IsAreaLight(); + const bool IsAreaLight = (LightType == lcLightType::Area); SetPropertyVisible(lcObjectPropertyId::LightAreaShape, IsAreaLight); - const bool IsSquare = IsAreaLight && (LightAreaShape == lcLightAreaShape::Square || LightAreaShape == lcLightAreaShape::Disk); - SetPropertyVisible(lcObjectPropertyId::LightAreaSize, IsSquare); - SetPropertyVisible(lcObjectPropertyId::LightAreaSizeX, !IsSquare); - SetPropertyVisible(lcObjectPropertyId::LightAreaSizeY, !IsSquare); + const bool IsSquare = (LightAreaShape == lcLightAreaShape::Square || LightAreaShape == lcLightAreaShape::Disk); + SetPropertyVisible(lcObjectPropertyId::LightAreaSize, IsAreaLight && IsSquare); + SetPropertyVisible(lcObjectPropertyId::LightAreaSizeX, IsAreaLight && !IsSquare); + SetPropertyVisible(lcObjectPropertyId::LightAreaSizeY, IsAreaLight && !IsSquare); SetPropertyVisible(lcObjectPropertyId::LightAreaGridX, IsAreaLight); SetPropertyVisible(lcObjectPropertyId::LightAreaGridY, IsAreaLight); @@ -1349,8 +1358,8 @@ void lcPropertiesWidget::SetLight(const lcArray& Selection, lcObject* UpdateFloat(lcObjectPropertyId::LightAreaSize, LightSize.x); UpdateFloat(lcObjectPropertyId::LightAreaSizeX, LightSize.x); UpdateFloat(lcObjectPropertyId::LightAreaSizeY, LightSize.y); - UpdateInteger(lcObjectPropertyId::LightAreaGridX, AreaGrid.x); - UpdateInteger(lcObjectPropertyId::LightAreaGridY, AreaGrid.y); + UpdateInteger(lcObjectPropertyId::LightAreaGridX, 0); + UpdateInteger(lcObjectPropertyId::LightAreaGridY, 0); } UpdateFloat(lcObjectPropertyId::ObjectPositionX, Position[0]); diff --git a/common/lc_propertieswidget.h b/common/lc_propertieswidget.h index b2f6ce71..0c3852a7 100644 --- a/common/lc_propertieswidget.h +++ b/common/lc_propertieswidget.h @@ -95,13 +95,15 @@ protected: void AddPieceColorProperty(lcObjectPropertyId PropertyId, const QString& Text, const QString& ToolTip, bool SupportsKeyFrames); void AddPieceIdProperty(lcObjectPropertyId PropertyId, const QString& Text, const QString& ToolTip, bool SupportsKeyFrames); + std::pair GetUpdateValue(lcObjectPropertyId PropertyId, QVariant DefaultValue); + void UpdateKeyFrameWidget(lcObjectPropertyId PropertyId); void UpdateBool(lcObjectPropertyId PropertyId, bool DefaultValue); void UpdateFloat(lcObjectPropertyId PropertyId, float Value); - void UpdateInteger(lcObjectPropertyId PropertyId, int Value); + void UpdateInteger(lcObjectPropertyId PropertyId, int DefaultValue); void UpdateStepNumber(lcObjectPropertyId PropertyId, lcStep Step, lcStep Min, lcStep Max); void UpdateString(lcObjectPropertyId PropertyId, const QString& Text); - void UpdateStringList(lcObjectPropertyId PropertyId, int ListIndex); + void UpdateStringList(lcObjectPropertyId PropertyId, int DefaultValue); void UpdateColor(lcObjectPropertyId PropertyId, const lcVector3& DefaultValue); void UpdatePieceColor(lcObjectPropertyId PropertyId, int ColorIndex); void UpdatePieceId(lcObjectPropertyId PropertyId, const QString& Name); diff --git a/common/light.cpp b/common/light.cpp index 5073bd9a..e7d89451 100644 --- a/common/light.cpp +++ b/common/light.cpp @@ -1061,9 +1061,11 @@ QVariant lcLight::GetPropertyValue(lcObjectPropertyId PropertyId) const case lcObjectPropertyId::CameraUpY: case lcObjectPropertyId::CameraUpZ: case lcObjectPropertyId::LightName: - case lcObjectPropertyId::LightType: break; + case lcObjectPropertyId::LightType: + return static_cast(GetLightType()); + case lcObjectPropertyId::LightColor: return QVariant::fromValue(GetColor()); @@ -1084,9 +1086,17 @@ QVariant lcLight::GetPropertyValue(lcObjectPropertyId PropertyId) const case lcObjectPropertyId::LightSpotConeAngle: case lcObjectPropertyId::LightSpotPenumbraAngle: case lcObjectPropertyId::LightSpotTightness: + break; + case lcObjectPropertyId::LightAreaShape: + return static_cast(GetAreaShape()); + case lcObjectPropertyId::LightAreaGridX: + return GetAreaGrid().x; + case lcObjectPropertyId::LightAreaGridY: + return GetAreaGrid().y; + case lcObjectPropertyId::ObjectPositionX: case lcObjectPropertyId::ObjectPositionY: case lcObjectPropertyId::ObjectPositionZ: @@ -1123,9 +1133,11 @@ bool lcLight::SetPropertyValue(lcObjectPropertyId PropertyId, lcStep Step, bool case lcObjectPropertyId::CameraUpY: case lcObjectPropertyId::CameraUpZ: case lcObjectPropertyId::LightName: - case lcObjectPropertyId::LightType: break; + case lcObjectPropertyId::LightType: + return SetLightType(static_cast(Value.toInt())); + case lcObjectPropertyId::LightColor: return SetColor(Value.value(), Step, AddKey); @@ -1146,9 +1158,17 @@ bool lcLight::SetPropertyValue(lcObjectPropertyId PropertyId, lcStep Step, bool case lcObjectPropertyId::LightSpotConeAngle: case lcObjectPropertyId::LightSpotPenumbraAngle: case lcObjectPropertyId::LightSpotTightness: + break; + case lcObjectPropertyId::LightAreaShape: + return SetAreaShape(static_cast(Value.toInt())); + case lcObjectPropertyId::LightAreaGridX: + return SetAreaGrid(lcVector2i(Value.toInt(), GetAreaGrid().y), Step, AddKey); + case lcObjectPropertyId::LightAreaGridY: + return SetAreaGrid(lcVector2i(GetAreaGrid().x, Value.toInt()), Step, AddKey); + case lcObjectPropertyId::ObjectPositionX: case lcObjectPropertyId::ObjectPositionY: case lcObjectPropertyId::ObjectPositionZ: diff --git a/common/object.cpp b/common/object.cpp index 16174402..93a26e1c 100644 --- a/common/object.cpp +++ b/common/object.cpp @@ -19,7 +19,11 @@ QString lcObject::GetCheckpointString(lcObjectPropertyId PropertyId) case lcObjectPropertyId::PieceStepShow: case lcObjectPropertyId::PieceStepHide: case lcObjectPropertyId::CameraName: + break; + case lcObjectPropertyId::CameraType: + return QT_TRANSLATE_NOOP("Checkpoint", "Changing Camera Type"); + case lcObjectPropertyId::CameraFOV: case lcObjectPropertyId::CameraNear: case lcObjectPropertyId::CameraFar: @@ -33,9 +37,11 @@ QString lcObject::GetCheckpointString(lcObjectPropertyId PropertyId) case lcObjectPropertyId::CameraUpY: case lcObjectPropertyId::CameraUpZ: case lcObjectPropertyId::LightName: - case lcObjectPropertyId::LightType: break; + case lcObjectPropertyId::LightType: + return QT_TRANSLATE_NOOP("Checkpoint", "Changing Light Type"); + case lcObjectPropertyId::LightColor: return QT_TRANSLATE_NOOP("Checkpoint", "Changing Light Color"); @@ -56,9 +62,15 @@ QString lcObject::GetCheckpointString(lcObjectPropertyId PropertyId) case lcObjectPropertyId::LightSpotConeAngle: case lcObjectPropertyId::LightSpotPenumbraAngle: case lcObjectPropertyId::LightSpotTightness: + break; + case lcObjectPropertyId::LightAreaShape: + return QT_TRANSLATE_NOOP("Checkpoint", "Changing Area Light Shape"); + case lcObjectPropertyId::LightAreaGridX: case lcObjectPropertyId::LightAreaGridY: + return QT_TRANSLATE_NOOP("Checkpoint", "Changing Area Light Grid"); + case lcObjectPropertyId::ObjectPositionX: case lcObjectPropertyId::ObjectPositionY: case lcObjectPropertyId::ObjectPositionZ: diff --git a/qt/qtmain.cpp b/qt/qtmain.cpp index db9d884c..3663c7f9 100644 --- a/qt/qtmain.cpp +++ b/qt/qtmain.cpp @@ -179,6 +179,8 @@ int main(int argc, char *argv[]) #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qRegisterMetaTypeStreamOperators >("QList"); #endif + qRegisterMetaType("lcVector3"); + QMetaType::registerComparators(); QList> LibraryPaths;