Fixed changing camera transform with the properties widget.
This commit is contained in:
+6
-3
@@ -397,16 +397,19 @@ void lcCamera::MoveSelected(lcStep Step, bool AddKey, const lcVector3& Distance)
|
||||
if (IsSimple())
|
||||
AddKey = false;
|
||||
|
||||
if (IsSelected(LC_CAMERA_SECTION_POSITION))
|
||||
const quint32 FocusSection = GetFocusSection();
|
||||
|
||||
if (FocusSection == LC_CAMERA_SECTION_POSITION || FocusSection == LC_CAMERA_SECTION_INVALID)
|
||||
{
|
||||
mPosition.ChangeKey(mPosition + Distance, Step, AddKey);
|
||||
}
|
||||
|
||||
if (IsSelected(LC_CAMERA_SECTION_TARGET))
|
||||
if (FocusSection == LC_CAMERA_SECTION_TARGET || FocusSection == LC_CAMERA_SECTION_INVALID)
|
||||
{
|
||||
mTargetPosition.ChangeKey(mTargetPosition + Distance, Step, AddKey);
|
||||
}
|
||||
else if (IsSelected(LC_CAMERA_SECTION_UPVECTOR))
|
||||
|
||||
if (FocusSection == LC_CAMERA_SECTION_UPVECTOR)
|
||||
{
|
||||
mUpVector.ChangeKey(lcNormalize(mUpVector + Distance), Step, AddKey);
|
||||
}
|
||||
|
||||
+6
-6
@@ -181,23 +181,23 @@ public:
|
||||
{
|
||||
case LC_CAMERA_SECTION_POSITION:
|
||||
if (Focus)
|
||||
mState |= LC_CAMERA_POSITION_SELECTED | LC_CAMERA_POSITION_FOCUSED;
|
||||
mState |= LC_CAMERA_SELECTION_MASK | LC_CAMERA_POSITION_FOCUSED;
|
||||
else
|
||||
mState &= ~(LC_CAMERA_POSITION_SELECTED | LC_CAMERA_POSITION_FOCUSED);
|
||||
mState &= ~LC_CAMERA_POSITION_FOCUSED;
|
||||
break;
|
||||
|
||||
case LC_CAMERA_SECTION_TARGET:
|
||||
if (Focus)
|
||||
mState |= LC_CAMERA_TARGET_SELECTED | LC_CAMERA_TARGET_FOCUSED;
|
||||
mState |= LC_CAMERA_SELECTION_MASK | LC_CAMERA_TARGET_FOCUSED;
|
||||
else
|
||||
mState &= ~(LC_CAMERA_TARGET_SELECTED | LC_CAMERA_TARGET_FOCUSED);
|
||||
mState &= ~LC_CAMERA_TARGET_FOCUSED;
|
||||
break;
|
||||
|
||||
case LC_CAMERA_SECTION_UPVECTOR:
|
||||
if (Focus)
|
||||
mState |= LC_CAMERA_UPVECTOR_SELECTED | LC_CAMERA_UPVECTOR_FOCUSED;
|
||||
mState |= LC_CAMERA_SELECTION_MASK | LC_CAMERA_UPVECTOR_FOCUSED;
|
||||
else
|
||||
mState &= ~(LC_CAMERA_UPVECTOR_SELECTED | LC_CAMERA_UPVECTOR_FOCUSED);
|
||||
mState &= ~LC_CAMERA_UPVECTOR_FOCUSED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,51 +311,114 @@ void lcPropertiesWidget::FloatChanged()
|
||||
|
||||
if (PropertyId == lcObjectPropertyId::CameraPositionX || PropertyId == lcObjectPropertyId::CameraPositionY || PropertyId == lcObjectPropertyId::CameraPositionZ)
|
||||
{
|
||||
lcVector3 Center = Camera->mPosition;
|
||||
lcVector3 Position = Center;
|
||||
quint32 FocusSection = LC_CAMERA_SECTION_INVALID;
|
||||
lcVector3 Start;
|
||||
|
||||
if (Camera)
|
||||
{
|
||||
FocusSection = Camera->GetFocusSection();
|
||||
Camera->SetFocused(FocusSection, false);
|
||||
Camera->SetFocused(LC_CAMERA_SECTION_POSITION, true);
|
||||
|
||||
Start = Camera->mPosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
Start = lcVector3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
lcVector3 End = Start;
|
||||
|
||||
if (PropertyId == lcObjectPropertyId::CameraPositionX)
|
||||
Position[0] = Value;
|
||||
End[0] = Value;
|
||||
else if (PropertyId == lcObjectPropertyId::CameraPositionY)
|
||||
Position[1] = Value;
|
||||
End[1] = Value;
|
||||
else if (PropertyId == lcObjectPropertyId::CameraPositionZ)
|
||||
Position[2] = Value;
|
||||
End[2] = Value;
|
||||
|
||||
lcVector3 Distance = Position - Center;
|
||||
lcVector3 Distance = End - Start;
|
||||
|
||||
Model->MoveSelectedObjects(Distance, false, false, true, true, true);
|
||||
|
||||
if (Camera)
|
||||
{
|
||||
Camera->SetFocused(LC_CAMERA_SECTION_POSITION, false);
|
||||
Camera->SetFocused(FocusSection, true);
|
||||
}
|
||||
}
|
||||
else if (PropertyId == lcObjectPropertyId::CameraTargetX || PropertyId == lcObjectPropertyId::CameraTargetY || PropertyId == lcObjectPropertyId::CameraTargetZ)
|
||||
{
|
||||
lcVector3 Center = Camera->mTargetPosition;
|
||||
lcVector3 Position = Center;
|
||||
quint32 FocusSection = LC_CAMERA_SECTION_INVALID;
|
||||
lcVector3 Start;
|
||||
|
||||
if (Camera)
|
||||
{
|
||||
FocusSection = Camera->GetFocusSection();
|
||||
Camera->SetFocused(FocusSection, false);
|
||||
Camera->SetFocused(LC_CAMERA_SECTION_TARGET, true);
|
||||
|
||||
Start = Camera->mTargetPosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
Start = lcVector3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
lcVector3 End = Start;
|
||||
|
||||
if (PropertyId == lcObjectPropertyId::CameraTargetX)
|
||||
Position[0] = Value;
|
||||
End[0] = Value;
|
||||
else if (PropertyId == lcObjectPropertyId::CameraTargetY)
|
||||
Position[1] = Value;
|
||||
End[1] = Value;
|
||||
else if (PropertyId == lcObjectPropertyId::CameraTargetZ)
|
||||
Position[2] = Value;
|
||||
End[2] = Value;
|
||||
|
||||
lcVector3 Distance = Position - Center;
|
||||
lcVector3 Distance = End - Start;
|
||||
|
||||
Model->MoveSelectedObjects(Distance, false, false, true, true, true);
|
||||
|
||||
if (Camera)
|
||||
{
|
||||
Camera->SetFocused(LC_CAMERA_SECTION_TARGET, false);
|
||||
Camera->SetFocused(FocusSection, true);
|
||||
}
|
||||
}
|
||||
else if (PropertyId == lcObjectPropertyId::CameraUpX || PropertyId == lcObjectPropertyId::CameraUpY || PropertyId == lcObjectPropertyId::CameraUpZ)
|
||||
{
|
||||
lcVector3 Center = Camera->mUpVector;
|
||||
lcVector3 Position = Center;
|
||||
quint32 FocusSection = LC_CAMERA_SECTION_INVALID;
|
||||
lcVector3 Start;
|
||||
|
||||
if (Camera)
|
||||
{
|
||||
FocusSection = Camera->GetFocusSection();
|
||||
Camera->SetFocused(FocusSection, false);
|
||||
Camera->SetFocused(LC_CAMERA_SECTION_UPVECTOR, true);
|
||||
|
||||
Start = Camera->mUpVector;
|
||||
}
|
||||
else
|
||||
{
|
||||
Start = lcVector3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
lcVector3 End = Start;
|
||||
|
||||
if (PropertyId == lcObjectPropertyId::CameraUpX)
|
||||
Position[0] = Value;
|
||||
End[0] = Value;
|
||||
else if (PropertyId == lcObjectPropertyId::CameraUpY)
|
||||
Position[1] = Value;
|
||||
End[1] = Value;
|
||||
else if (PropertyId == lcObjectPropertyId::CameraUpZ)
|
||||
Position[2] = Value;
|
||||
End[2] = Value;
|
||||
|
||||
lcVector3 Distance = Position - Center;
|
||||
lcVector3 Distance = End - Start;
|
||||
|
||||
Model->MoveSelectedObjects(Distance, false, false, true, true, true);
|
||||
|
||||
if (Camera)
|
||||
{
|
||||
Camera->SetFocused(LC_CAMERA_SECTION_UPVECTOR, false);
|
||||
Camera->SetFocused(FocusSection, true);
|
||||
}
|
||||
}
|
||||
else if (Camera)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user