Fixed rotating in the properties widget without a focus object.

This commit is contained in:
Leonardo Zide
2026-03-05 15:53:54 -08:00
parent 8c641bf5a5
commit f7fb61b304
2 changed files with 7 additions and 0 deletions
+5
View File
@@ -330,6 +330,8 @@ void lcPropertiesWidget::ChangeFloatValue(lcObjectPropertyId PropertyId, float V
InitialRotation = lcMatrix44ToEulerAngles(Piece->mModelWorld) * LC_RTOD;
else if (Light)
InitialRotation = lcMatrix44ToEulerAngles(Light->GetWorldMatrix()) * LC_RTOD;
else
InitialRotation = mLastRotation;
lcVector3 Rotation = InitialRotation;
@@ -341,6 +343,8 @@ void lcPropertiesWidget::ChangeFloatValue(lcObjectPropertyId PropertyId, float V
Rotation[2] = Value;
Model->RotateSelectedObjects(Rotation - InitialRotation, true, false, !Dragging);
mLastRotation = Rotation;
}
else if (Piece || Light)
{
@@ -1566,6 +1570,7 @@ void lcPropertiesWidget::Update(const std::vector<lcObject*>& Selection, lcObjec
if (mDisableUpdates)
return;
mLastRotation = lcVector3(0.0f, 0.0f, 0.0f);
mFocusObject = nullptr;
mSelection.clear();
+2
View File
@@ -1,6 +1,7 @@
#pragma once
#include "lc_objectproperty.h"
#include "lc_math.h"
class lcCollapsibleWidgetButton;
class lcKeyFrameWidget;
@@ -131,6 +132,7 @@ protected:
std::vector<lcObject*> mSelection;
lcObject* mFocusObject = nullptr;
bool mDisableUpdates = false;
lcVector3 mLastRotation = lcVector3(0.0f, 0.0f, 0.0f);
std::array<PropertyWidgets, static_cast<int>(lcObjectPropertyId::Count)> mPropertyWidgets = {};
std::array<CategoryWidgets, static_cast<int>(CategoryIndex::Count)> mCategoryWidgets = {};