mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Support more than 255 steps.
This commit is contained in:
parent
1b79096bd4
commit
109ec00f5f
19 changed files with 516 additions and 501 deletions
|
@ -269,7 +269,7 @@ void lcCamera::FileSave(lcFile& file) const
|
||||||
|
|
||||||
Object::FileSave(file);
|
Object::FileSave(file);
|
||||||
|
|
||||||
lcuint8 ch = (unsigned char)strlen(m_strName);
|
lcuint8 ch = (lcuint8)strlen(m_strName);
|
||||||
file.WriteU8(ch);
|
file.WriteU8(ch);
|
||||||
file.WriteBuffer(m_strName, ch);
|
file.WriteBuffer(m_strName, ch);
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ void lcCamera::FileSave(lcFile& file) const
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Camera operations
|
// Camera operations
|
||||||
|
|
||||||
void lcCamera::Move(unsigned short nTime, bool AddKey, const lcVector3& Distance)
|
void lcCamera::Move(lcStep Step, bool AddKey, const lcVector3& Distance)
|
||||||
{
|
{
|
||||||
if (IsSimple())
|
if (IsSimple())
|
||||||
AddKey = false;
|
AddKey = false;
|
||||||
|
@ -293,20 +293,20 @@ void lcCamera::Move(unsigned short nTime, bool AddKey, const lcVector3& Distance
|
||||||
{
|
{
|
||||||
mPosition += Distance;
|
mPosition += Distance;
|
||||||
lcAlign(mOrthoTarget, mPosition, mTargetPosition);
|
lcAlign(mOrthoTarget, mPosition, mTargetPosition);
|
||||||
ChangeKey(nTime, AddKey, mPosition, LC_CK_EYE);
|
ChangeKey(Step, AddKey, mPosition, LC_CK_EYE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsSelected(LC_CAMERA_SECTION_TARGET))
|
if (IsSelected(LC_CAMERA_SECTION_TARGET))
|
||||||
{
|
{
|
||||||
mTargetPosition += Distance;
|
mTargetPosition += Distance;
|
||||||
ChangeKey(nTime, AddKey, mTargetPosition, LC_CK_TARGET);
|
ChangeKey(Step, AddKey, mTargetPosition, LC_CK_TARGET);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsSelected(LC_CAMERA_SECTION_UPVECTOR))
|
if (IsSelected(LC_CAMERA_SECTION_UPVECTOR))
|
||||||
{
|
{
|
||||||
mUpVector += Distance;
|
mUpVector += Distance;
|
||||||
mUpVector.Normalize();
|
mUpVector.Normalize();
|
||||||
ChangeKey(nTime, AddKey, mTargetPosition, LC_CK_UP);
|
ChangeKey(Step, AddKey, mTargetPosition, LC_CK_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcVector3 FrontVector(mTargetPosition - mPosition);
|
lcVector3 FrontVector(mTargetPosition - mPosition);
|
||||||
|
@ -319,9 +319,9 @@ void lcCamera::Move(unsigned short nTime, bool AddKey, const lcVector3& Distance
|
||||||
mUpVector.Normalize();
|
mUpVector.Normalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcCamera::UpdatePosition(unsigned short nTime)
|
void lcCamera::UpdatePosition(lcStep Step)
|
||||||
{
|
{
|
||||||
CalculateKeys(nTime);
|
CalculateKeys(Step);
|
||||||
|
|
||||||
lcVector3 FrontVector(mPosition - mTargetPosition);
|
lcVector3 FrontVector(mPosition - mTargetPosition);
|
||||||
lcVector3 SideVector = lcCross(FrontVector, mUpVector);
|
lcVector3 SideVector = lcCross(FrontVector, mUpVector);
|
||||||
|
@ -592,7 +592,7 @@ void lcCamera::BoxTest(lcObjectBoxTest& ObjectBoxTest) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcCamera::ZoomExtents(View* view, const lcVector3& Center, const lcVector3* Points, int NumPoints, unsigned short nTime, bool bAddKey)
|
void lcCamera::ZoomExtents(View* view, const lcVector3& Center, const lcVector3* Points, int NumPoints, lcStep Step, bool AddKey)
|
||||||
{
|
{
|
||||||
int Viewport[4] = { 0, 0, view->mWidth, view->mHeight };
|
int Viewport[4] = { 0, 0, view->mWidth, view->mHeight };
|
||||||
|
|
||||||
|
@ -607,15 +607,15 @@ void lcCamera::ZoomExtents(View* view, const lcVector3& Center, const lcVector3*
|
||||||
mOrthoTarget = mTargetPosition;
|
mOrthoTarget = mTargetPosition;
|
||||||
|
|
||||||
if (IsSimple())
|
if (IsSimple())
|
||||||
bAddKey = false;
|
AddKey = false;
|
||||||
|
|
||||||
ChangeKey(nTime, bAddKey, mPosition, LC_CK_EYE);
|
ChangeKey(Step, AddKey, mPosition, LC_CK_EYE);
|
||||||
ChangeKey(nTime, bAddKey, mTargetPosition, LC_CK_TARGET);
|
ChangeKey(Step, AddKey, mTargetPosition, LC_CK_TARGET);
|
||||||
|
|
||||||
UpdatePosition(nTime);
|
UpdatePosition(Step);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcCamera::ZoomRegion(const lcVector3* Points, float RatioX, float RatioY, unsigned short nTime, bool bAddKey)
|
void lcCamera::ZoomRegion(const lcVector3* Points, float RatioX, float RatioY, lcStep Step, bool AddKey)
|
||||||
{
|
{
|
||||||
// Center camera.
|
// Center camera.
|
||||||
lcVector3 Eye = mPosition;
|
lcVector3 Eye = mPosition;
|
||||||
|
@ -633,15 +633,15 @@ void lcCamera::ZoomRegion(const lcVector3* Points, float RatioX, float RatioY, u
|
||||||
|
|
||||||
// Change the camera and redraw.
|
// Change the camera and redraw.
|
||||||
if (IsSimple())
|
if (IsSimple())
|
||||||
bAddKey = false;
|
AddKey = false;
|
||||||
|
|
||||||
ChangeKey(nTime, bAddKey, mPosition, LC_CK_EYE);
|
ChangeKey(Step, AddKey, mPosition, LC_CK_EYE);
|
||||||
ChangeKey(nTime, bAddKey, mTargetPosition, LC_CK_TARGET);
|
ChangeKey(Step, AddKey, mTargetPosition, LC_CK_TARGET);
|
||||||
|
|
||||||
UpdatePosition(nTime);
|
UpdatePosition(Step);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcCamera::Zoom(float Distance, unsigned short nTime, bool bAddKey)
|
void lcCamera::Zoom(float Distance, lcStep Step, bool AddKey)
|
||||||
{
|
{
|
||||||
lcVector3 FrontVector(mPosition - mTargetPosition);
|
lcVector3 FrontVector(mPosition - mTargetPosition);
|
||||||
FrontVector.Normalize();
|
FrontVector.Normalize();
|
||||||
|
@ -658,15 +658,15 @@ void lcCamera::Zoom(float Distance, unsigned short nTime, bool bAddKey)
|
||||||
mTargetPosition += FrontVector;
|
mTargetPosition += FrontVector;
|
||||||
|
|
||||||
if (IsSimple())
|
if (IsSimple())
|
||||||
bAddKey = false;
|
AddKey = false;
|
||||||
|
|
||||||
ChangeKey(nTime, bAddKey, mPosition, LC_CK_EYE);
|
ChangeKey(Step, AddKey, mPosition, LC_CK_EYE);
|
||||||
ChangeKey(nTime, bAddKey, mTargetPosition, LC_CK_TARGET);
|
ChangeKey(Step, AddKey, mTargetPosition, LC_CK_TARGET);
|
||||||
|
|
||||||
UpdatePosition(nTime);
|
UpdatePosition(Step);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcCamera::Pan(float DistanceX, float DistanceY, unsigned short nTime, bool bAddKey)
|
void lcCamera::Pan(float DistanceX, float DistanceY, lcStep Step, bool AddKey)
|
||||||
{
|
{
|
||||||
lcVector3 FrontVector(mPosition - mTargetPosition);
|
lcVector3 FrontVector(mPosition - mTargetPosition);
|
||||||
lcVector3 SideVector = lcNormalize(lcCross(FrontVector, mUpVector));
|
lcVector3 SideVector = lcNormalize(lcCross(FrontVector, mUpVector));
|
||||||
|
@ -677,15 +677,15 @@ void lcCamera::Pan(float DistanceX, float DistanceY, unsigned short nTime, bool
|
||||||
mOrthoTarget += MoveVec;
|
mOrthoTarget += MoveVec;
|
||||||
|
|
||||||
if (IsSimple())
|
if (IsSimple())
|
||||||
bAddKey = false;
|
AddKey = false;
|
||||||
|
|
||||||
ChangeKey(nTime, bAddKey, mPosition, LC_CK_EYE);
|
ChangeKey(Step, AddKey, mPosition, LC_CK_EYE);
|
||||||
ChangeKey(nTime, bAddKey, mTargetPosition, LC_CK_TARGET);
|
ChangeKey(Step, AddKey, mTargetPosition, LC_CK_TARGET);
|
||||||
|
|
||||||
UpdatePosition(nTime);
|
UpdatePosition(Step);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcCamera::Orbit(float DistanceX, float DistanceY, const lcVector3& CenterPosition, unsigned short nTime, bool bAddKey)
|
void lcCamera::Orbit(float DistanceX, float DistanceY, const lcVector3& CenterPosition, lcStep Step, bool AddKey)
|
||||||
{
|
{
|
||||||
lcVector3 FrontVector(mPosition - mTargetPosition);
|
lcVector3 FrontVector(mPosition - mTargetPosition);
|
||||||
|
|
||||||
|
@ -709,16 +709,16 @@ void lcCamera::Orbit(float DistanceX, float DistanceY, const lcVector3& CenterPo
|
||||||
mUpVector = lcMul31(mUpVector, transform);
|
mUpVector = lcMul31(mUpVector, transform);
|
||||||
|
|
||||||
if (IsSimple())
|
if (IsSimple())
|
||||||
bAddKey = false;
|
AddKey = false;
|
||||||
|
|
||||||
ChangeKey(nTime, bAddKey, mPosition, LC_CK_EYE);
|
ChangeKey(Step, AddKey, mPosition, LC_CK_EYE);
|
||||||
ChangeKey(nTime, bAddKey, mTargetPosition, LC_CK_TARGET);
|
ChangeKey(Step, AddKey, mTargetPosition, LC_CK_TARGET);
|
||||||
ChangeKey(nTime, bAddKey, mUpVector, LC_CK_UP);
|
ChangeKey(Step, AddKey, mUpVector, LC_CK_UP);
|
||||||
|
|
||||||
UpdatePosition(nTime);
|
UpdatePosition(Step);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcCamera::Roll(float Distance, unsigned short nTime, bool bAddKey)
|
void lcCamera::Roll(float Distance, lcStep Step, bool AddKey)
|
||||||
{
|
{
|
||||||
lcVector3 FrontVector(mPosition - mTargetPosition);
|
lcVector3 FrontVector(mPosition - mTargetPosition);
|
||||||
lcMatrix44 Rotation = lcMatrix44FromAxisAngle(FrontVector, Distance);
|
lcMatrix44 Rotation = lcMatrix44FromAxisAngle(FrontVector, Distance);
|
||||||
|
@ -726,27 +726,27 @@ void lcCamera::Roll(float Distance, unsigned short nTime, bool bAddKey)
|
||||||
mUpVector = lcMul30(mUpVector, Rotation);
|
mUpVector = lcMul30(mUpVector, Rotation);
|
||||||
|
|
||||||
if (IsSimple())
|
if (IsSimple())
|
||||||
bAddKey = false;
|
AddKey = false;
|
||||||
|
|
||||||
ChangeKey(nTime, bAddKey, mUpVector, LC_CK_UP);
|
ChangeKey(Step, AddKey, mUpVector, LC_CK_UP);
|
||||||
|
|
||||||
UpdatePosition(nTime);
|
UpdatePosition(Step);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcCamera::Center(lcVector3& point, unsigned short nTime, bool bAddKey)
|
void lcCamera::Center(lcVector3& point, lcStep Step, bool AddKey)
|
||||||
{
|
{
|
||||||
lcAlign(mTargetPosition, mPosition, point);
|
lcAlign(mTargetPosition, mPosition, point);
|
||||||
|
|
||||||
if (IsSimple())
|
if (IsSimple())
|
||||||
bAddKey = false;
|
AddKey = false;
|
||||||
|
|
||||||
ChangeKey(nTime, bAddKey, mPosition, LC_CK_EYE);
|
ChangeKey(Step, AddKey, mPosition, LC_CK_EYE);
|
||||||
ChangeKey(nTime, bAddKey, mTargetPosition, LC_CK_TARGET);
|
ChangeKey(Step, AddKey, mTargetPosition, LC_CK_TARGET);
|
||||||
|
|
||||||
UpdatePosition(nTime);
|
UpdatePosition(Step);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcCamera::SetViewpoint(LC_VIEWPOINT Viewpoint, unsigned short nTime, bool bAddKey)
|
void lcCamera::SetViewpoint(LC_VIEWPOINT Viewpoint, lcStep Step, bool AddKey)
|
||||||
{
|
{
|
||||||
lcVector3 Positions[] =
|
lcVector3 Positions[] =
|
||||||
{
|
{
|
||||||
|
@ -776,13 +776,13 @@ void lcCamera::SetViewpoint(LC_VIEWPOINT Viewpoint, unsigned short nTime, bool b
|
||||||
mUpVector = Ups[Viewpoint];
|
mUpVector = Ups[Viewpoint];
|
||||||
|
|
||||||
if (IsSimple())
|
if (IsSimple())
|
||||||
bAddKey = false;
|
AddKey = false;
|
||||||
|
|
||||||
ChangeKey(nTime, bAddKey, mPosition, LC_CK_EYE);
|
ChangeKey(Step, AddKey, mPosition, LC_CK_EYE);
|
||||||
ChangeKey(nTime, bAddKey, mTargetPosition, LC_CK_TARGET);
|
ChangeKey(Step, AddKey, mTargetPosition, LC_CK_TARGET);
|
||||||
ChangeKey(nTime, bAddKey, mUpVector, LC_CK_UP);
|
ChangeKey(Step, AddKey, mUpVector, LC_CK_UP);
|
||||||
|
|
||||||
UpdatePosition(nTime);
|
UpdatePosition(Step);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcCamera::StartTiledRendering(int tw, int th, int iw, int ih, float AspectRatio)
|
void lcCamera::StartTiledRendering(int tw, int th, int iw, int ih, float AspectRatio)
|
||||||
|
@ -828,7 +828,7 @@ bool lcCamera::EndTile()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcCamera::SetFocalPoint(const lcVector3& focus, unsigned short nTime, bool bAddKey)
|
void lcCamera::SetFocalPoint(const lcVector3& focus, lcStep Step, bool AddKey)
|
||||||
{
|
{
|
||||||
if (IsOrtho())
|
if (IsOrtho())
|
||||||
{
|
{
|
||||||
|
@ -846,10 +846,10 @@ void lcCamera::SetFocalPoint(const lcVector3& focus, unsigned short nTime, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsSimple())
|
if (IsSimple())
|
||||||
bAddKey = false;
|
AddKey = false;
|
||||||
|
|
||||||
ChangeKey(nTime, bAddKey, mPosition, LC_CK_EYE);
|
ChangeKey(Step, AddKey, mPosition, LC_CK_EYE);
|
||||||
ChangeKey(nTime, bAddKey, mTargetPosition, LC_CK_TARGET);
|
ChangeKey(Step, AddKey, mTargetPosition, LC_CK_TARGET);
|
||||||
|
|
||||||
UpdatePosition(nTime);
|
UpdatePosition(Step);
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,20 +252,20 @@ public:
|
||||||
void Select(bool bSelecting, bool bFocus, bool bMultiple);
|
void Select(bool bSelecting, bool bFocus, bool bMultiple);
|
||||||
|
|
||||||
|
|
||||||
void UpdatePosition(unsigned short nTime);
|
void UpdatePosition(lcStep Step);
|
||||||
void CopyPosition(const Camera* camera);
|
void CopyPosition(const Camera* camera);
|
||||||
void Render(View* View);
|
void Render(View* View);
|
||||||
|
|
||||||
void ZoomExtents(View* view, const lcVector3& Center, const lcVector3* Points, int NumPoints, unsigned short nTime, bool bAddKey);
|
void ZoomExtents(View* view, const lcVector3& Center, const lcVector3* Points, int NumPoints, lcStep Step, bool AddKey);
|
||||||
void ZoomRegion(const lcVector3* Points, float RatioX, float RatioY, unsigned short nTime, bool bAddKey);
|
void ZoomRegion(const lcVector3* Points, float RatioX, float RatioY, lcStep Step, bool AddKey);
|
||||||
void Zoom(float Distance, unsigned short nTime, bool bAddKey);
|
void Zoom(float Distance, lcStep Step, bool AddKey);
|
||||||
void Pan(float DistanceX, float DistanceY, unsigned short nTime, bool bAddKey);
|
void Pan(float DistanceX, float DistanceY, lcStep Step, bool AddKey);
|
||||||
void Orbit(float DistanceX, float DistanceY, const lcVector3& CenterPosition, unsigned short nTime, bool bAddKey);
|
void Orbit(float DistanceX, float DistanceY, const lcVector3& CenterPosition, lcStep Step, bool AddKey);
|
||||||
void Roll(float Distance, unsigned short nTime, bool bAddKey);
|
void Roll(float Distance, lcStep Step, bool AddKey);
|
||||||
void Center(lcVector3& point, unsigned short nTime, bool bAddKey);
|
void Center(lcVector3& point, lcStep Step, bool AddKey);
|
||||||
void Move(unsigned short nTime, bool AddKey, const lcVector3& Distance);
|
void Move(lcStep Step, bool AddKey, const lcVector3& Distance);
|
||||||
void SetViewpoint(LC_VIEWPOINT Viewpoint, unsigned short nTime, bool bAddKey);
|
void SetViewpoint(LC_VIEWPOINT Viewpoint, lcStep Step, bool AddKey);
|
||||||
void SetFocalPoint(const lcVector3& focus, unsigned short nTime, bool bAddKey);
|
void SetFocalPoint(const lcVector3& focus, lcStep Step, bool AddKey);
|
||||||
|
|
||||||
void StartTiledRendering(int tw, int th, int iw, int ih, float fAspect);
|
void StartTiledRendering(int tw, int th, int iw, int ih, float fAspect);
|
||||||
void GetTileInfo(int* row, int* col, int* width, int* height);
|
void GetTileInfo(int* row, int* col, int* width, int* height);
|
||||||
|
|
|
@ -132,6 +132,7 @@ void lcApplication::ParseIntegerArgument(int* CurArg, int argc, char* argv[], in
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
*Value = 0;
|
||||||
printf("Not enough parameters for the %s argument.", argv[(*CurArg) - 1]);
|
printf("Not enough parameters for the %s argument.", argv[(*CurArg) - 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,8 +159,8 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
|
||||||
bool ImageHighlight = false;
|
bool ImageHighlight = false;
|
||||||
int ImageWidth = lcGetProfileInt(LC_PROFILE_IMAGE_WIDTH);
|
int ImageWidth = lcGetProfileInt(LC_PROFILE_IMAGE_WIDTH);
|
||||||
int ImageHeight = lcGetProfileInt(LC_PROFILE_IMAGE_HEIGHT);
|
int ImageHeight = lcGetProfileInt(LC_PROFILE_IMAGE_HEIGHT);
|
||||||
int ImageStart = 0;
|
lcStep ImageStart = 0;
|
||||||
int ImageEnd = 0;
|
lcStep ImageEnd = 0;
|
||||||
char* ImageName = NULL;
|
char* ImageName = NULL;
|
||||||
|
|
||||||
// File to open.
|
// File to open.
|
||||||
|
@ -196,11 +197,15 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
|
||||||
}
|
}
|
||||||
else if ((strcmp(Param, "-f") == 0) || (strcmp(Param, "--from") == 0))
|
else if ((strcmp(Param, "-f") == 0) || (strcmp(Param, "--from") == 0))
|
||||||
{
|
{
|
||||||
ParseIntegerArgument(&i, argc, argv, &ImageStart);
|
int Step;
|
||||||
|
ParseIntegerArgument(&i, argc, argv, &Step);
|
||||||
|
ImageStart = Step;
|
||||||
}
|
}
|
||||||
else if ((strcmp(Param, "-t") == 0) || (strcmp(Param, "--to") == 0))
|
else if ((strcmp(Param, "-t") == 0) || (strcmp(Param, "--to") == 0))
|
||||||
{
|
{
|
||||||
ParseIntegerArgument(&i, argc, argv, &ImageEnd);
|
int Step;
|
||||||
|
ParseIntegerArgument(&i, argc, argv, &Step);
|
||||||
|
ImageEnd = Step;
|
||||||
}
|
}
|
||||||
else if (strcmp(Param, "--highlight") == 0)
|
else if (strcmp(Param, "--highlight") == 0)
|
||||||
ImageHighlight = true;
|
ImageHighlight = true;
|
||||||
|
@ -323,7 +328,7 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
|
||||||
|
|
||||||
if ((ImageStart == 0) && (ImageEnd == 0))
|
if ((ImageStart == 0) && (ImageEnd == 0))
|
||||||
{
|
{
|
||||||
ImageStart = ImageEnd = mProject->GetCurrentTime();
|
ImageStart = ImageEnd = mProject->GetCurrentStep();
|
||||||
}
|
}
|
||||||
else if ((ImageStart == 0) && (ImageEnd != 0))
|
else if ((ImageStart == 0) && (ImageEnd != 0))
|
||||||
{
|
{
|
||||||
|
@ -343,14 +348,14 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
|
||||||
Image* images = new Image[ImageEnd - ImageStart + 1];
|
Image* images = new Image[ImageEnd - ImageStart + 1];
|
||||||
mProject->CreateImages(images, ImageWidth, ImageHeight, ImageStart, ImageEnd, ImageHighlight);
|
mProject->CreateImages(images, ImageWidth, ImageHeight, ImageStart, ImageEnd, ImageHighlight);
|
||||||
|
|
||||||
for (int i = 0; i <= ImageEnd - ImageStart; i++)
|
for (lcStep Step = 0; Step <= ImageEnd - ImageStart; Step++)
|
||||||
{
|
{
|
||||||
char idx[256];
|
char idx[256];
|
||||||
String Frame;
|
String Frame;
|
||||||
|
|
||||||
if (ImageStart != ImageEnd)
|
if (ImageStart != ImageEnd)
|
||||||
{
|
{
|
||||||
sprintf(idx, "%02d", i+1);
|
sprintf(idx, "%02d", Step + 1);
|
||||||
int Ext = FileName.ReverseFind('.');
|
int Ext = FileName.ReverseFind('.');
|
||||||
|
|
||||||
Frame = FileName.Left(Ext) + idx + FileName.Right(FileName.GetLength() - Ext);
|
Frame = FileName.Left(Ext) + idx + FileName.Right(FileName.GetLength() - Ext);
|
||||||
|
@ -358,7 +363,7 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
|
||||||
else
|
else
|
||||||
Frame = FileName;
|
Frame = FileName;
|
||||||
|
|
||||||
images[i].FileSave(Frame, ImageFormat, ImageTransparent);
|
images[Step].FileSave(Frame, ImageFormat, ImageTransparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete []images;
|
delete []images;
|
||||||
|
|
|
@ -60,7 +60,7 @@ class lcMainWindow : public lcBaseWindow
|
||||||
void UpdateSelectedObjects(int Flags, int SelectedCount, Object* Focus);
|
void UpdateSelectedObjects(int Flags, int SelectedCount, Object* Focus);
|
||||||
void UpdateAction(int NewAction);
|
void UpdateAction(int NewAction);
|
||||||
void UpdatePaste(bool Enabled);
|
void UpdatePaste(bool Enabled);
|
||||||
void UpdateTime(int CurrentTime, int TotalTime);
|
void UpdateCurrentStep();
|
||||||
void SetAddKeys(bool AddKeys);
|
void SetAddKeys(bool AddKeys);
|
||||||
void UpdateLockSnap(lcuint32 Snap);
|
void UpdateLockSnap(lcuint32 Snap);
|
||||||
void UpdateSnap();
|
void UpdateSnap();
|
||||||
|
|
|
@ -46,3 +46,13 @@ lcModel::lcModel()
|
||||||
lcModel::~lcModel()
|
lcModel::~lcModel()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lcStep lcModel::GetLastStep() const
|
||||||
|
{
|
||||||
|
lcStep Step = 1;
|
||||||
|
|
||||||
|
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||||
|
Step = lcMax(Step, mPieces[PieceIdx]->GetStepShow());
|
||||||
|
|
||||||
|
return Step;
|
||||||
|
}
|
||||||
|
|
|
@ -85,6 +85,11 @@ public:
|
||||||
lcModel();
|
lcModel();
|
||||||
~lcModel();
|
~lcModel();
|
||||||
|
|
||||||
|
bool IsModified() const
|
||||||
|
{
|
||||||
|
return mSavedHistory != mUndoHistory[0];
|
||||||
|
}
|
||||||
|
|
||||||
const lcArray<lcPiece*>& GetPieces() const
|
const lcArray<lcPiece*>& GetPieces() const
|
||||||
{
|
{
|
||||||
return mPieces;
|
return mPieces;
|
||||||
|
@ -105,9 +110,17 @@ public:
|
||||||
return mGroups;
|
return mGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lcStep GetLastStep() const;
|
||||||
|
lcStep GetCurrentStep() const
|
||||||
|
{
|
||||||
|
return mCurrentStep;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
lcModelProperties mProperties;
|
lcModelProperties mProperties;
|
||||||
|
|
||||||
|
lcStep mCurrentStep;
|
||||||
|
|
||||||
lcArray<lcPiece*> mPieces;
|
lcArray<lcPiece*> mPieces;
|
||||||
lcArray<lcCamera*> mCameras;
|
lcArray<lcCamera*> mCameras;
|
||||||
lcArray<lcLight*> mLights;
|
lcArray<lcLight*> mLights;
|
||||||
|
|
|
@ -214,26 +214,26 @@ void lcLight::BoxTest(lcObjectBoxTest& ObjectBoxTest) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcLight::Move(unsigned short nTime, bool AddKey, const lcVector3& Distance)
|
void lcLight::Move(lcStep Step, bool AddKey, const lcVector3& Distance)
|
||||||
{
|
{
|
||||||
if (IsSelected(LC_LIGHT_SECTION_POSITION))
|
if (IsSelected(LC_LIGHT_SECTION_POSITION))
|
||||||
{
|
{
|
||||||
mPosition += Distance;
|
mPosition += Distance;
|
||||||
|
|
||||||
ChangeKey(nTime, AddKey, mPosition, LC_LK_POSITION);
|
ChangeKey(Step, AddKey, mPosition, LC_LK_POSITION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsSelected(LC_LIGHT_SECTION_TARGET))
|
if (IsSelected(LC_LIGHT_SECTION_TARGET))
|
||||||
{
|
{
|
||||||
mTargetPosition += Distance;
|
mTargetPosition += Distance;
|
||||||
|
|
||||||
ChangeKey(nTime, AddKey, mTargetPosition, LC_LK_TARGET);
|
ChangeKey(Step, AddKey, mTargetPosition, LC_LK_TARGET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcLight::UpdatePosition(unsigned short nTime)
|
void lcLight::UpdatePosition(lcStep Step)
|
||||||
{
|
{
|
||||||
CalculateKeys(nTime);
|
CalculateKeys(Step);
|
||||||
|
|
||||||
if (IsPointLight())
|
if (IsPointLight())
|
||||||
{
|
{
|
||||||
|
|
|
@ -203,8 +203,8 @@ public:
|
||||||
void RenderTarget();
|
void RenderTarget();
|
||||||
void RenderSphere();
|
void RenderSphere();
|
||||||
|
|
||||||
void UpdatePosition(unsigned short nTime);
|
void UpdatePosition(lcStep Step);
|
||||||
void Move(unsigned short nTime, bool AddKey, const lcVector3& Distance);
|
void Move(lcStep Step, bool AddKey, const lcVector3& Distance);
|
||||||
bool Setup(int LightIndex);
|
bool Setup(int LightIndex);
|
||||||
void CreateName(const lcArray<Light*>& Lights);
|
void CreateName(const lcArray<Light*>& Lights);
|
||||||
bool FileLoad(lcFile& file);
|
bool FileLoad(lcFile& file);
|
||||||
|
|
|
@ -59,29 +59,30 @@ bool lcObject::FileLoad(lcFile& file)
|
||||||
|
|
||||||
void lcObject::FileSave(lcFile& file) const
|
void lcObject::FileSave(lcFile& file) const
|
||||||
{
|
{
|
||||||
LC_OBJECT_KEY *node;
|
LC_OBJECT_KEY *node;
|
||||||
lcuint32 n;
|
lcuint32 n;
|
||||||
|
|
||||||
file.WriteU8(LC_KEY_SAVE_VERSION);
|
file.WriteU8(LC_KEY_SAVE_VERSION);
|
||||||
|
|
||||||
for (n = 0, node = m_pInstructionKeys; node; node = node->next)
|
for (n = 0, node = m_pInstructionKeys; node; node = node->next)
|
||||||
n++;
|
n++;
|
||||||
file.WriteU32(n);
|
file.WriteU32(n);
|
||||||
|
|
||||||
for (node = m_pInstructionKeys; node; node = node->next)
|
for (node = m_pInstructionKeys; node; node = node->next)
|
||||||
{
|
{
|
||||||
file.WriteU16(node->time);
|
lcuint16 Step = lcMin(node->Step, 0xFFFFU);
|
||||||
file.WriteFloats(node->param, 4);
|
file.WriteU16(Step);
|
||||||
file.WriteU8(node->type);
|
file.WriteFloats(node->param, 4);
|
||||||
}
|
file.WriteU8(node->type);
|
||||||
|
}
|
||||||
|
|
||||||
file.WriteU32(0);
|
file.WriteU32(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// Key handling
|
// Key handling
|
||||||
|
|
||||||
static LC_OBJECT_KEY* AddNode(LC_OBJECT_KEY *node, unsigned short nTime, unsigned char nType)
|
static LC_OBJECT_KEY* AddNode(LC_OBJECT_KEY *node, lcStep Step, unsigned char nType)
|
||||||
{
|
{
|
||||||
LC_OBJECT_KEY* newnode = (LC_OBJECT_KEY*)malloc(sizeof(LC_OBJECT_KEY));
|
LC_OBJECT_KEY* newnode = (LC_OBJECT_KEY*)malloc(sizeof(LC_OBJECT_KEY));
|
||||||
|
|
||||||
|
@ -94,7 +95,7 @@ static LC_OBJECT_KEY* AddNode(LC_OBJECT_KEY *node, unsigned short nTime, unsigne
|
||||||
newnode->next = NULL;
|
newnode->next = NULL;
|
||||||
|
|
||||||
newnode->type = nType;
|
newnode->type = nType;
|
||||||
newnode->time = nTime;
|
newnode->Step = Step;
|
||||||
newnode->param[0] = newnode->param[1] = newnode->param[2] = newnode->param[3] = 0;
|
newnode->param[0] = newnode->param[1] = newnode->param[2] = newnode->param[3] = 0;
|
||||||
|
|
||||||
return newnode;
|
return newnode;
|
||||||
|
@ -130,163 +131,112 @@ void lcObject::RemoveKeys()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcObject::ChangeKey(unsigned short nTime, bool bAddKey, const float *param, unsigned char nKeyType)
|
void lcObject::ChangeKey(lcStep Step, bool AddKey, const float *param, unsigned char nKeyType)
|
||||||
{
|
{
|
||||||
LC_OBJECT_KEY *node, *poskey = NULL, *newpos = NULL;
|
LC_OBJECT_KEY *node, *poskey = NULL, *newpos = NULL;
|
||||||
node = m_pInstructionKeys;
|
|
||||||
|
|
||||||
while (node)
|
|
||||||
{
|
|
||||||
if ((node->time <= nTime) &&
|
|
||||||
(node->type == nKeyType))
|
|
||||||
poskey = node;
|
|
||||||
|
|
||||||
node = node->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bAddKey)
|
|
||||||
{
|
|
||||||
if (poskey)
|
|
||||||
{
|
|
||||||
if (poskey->time != nTime)
|
|
||||||
newpos = AddNode(poskey, nTime, nKeyType);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
newpos = AddNode(poskey, nTime, nKeyType);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newpos == NULL)
|
|
||||||
newpos = poskey;
|
|
||||||
|
|
||||||
for (int i = 0; i < m_pKeyInfo[nKeyType].size; i++)
|
|
||||||
newpos->param[i] = param[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
void lcObject::CalculateKeys(unsigned short nTime)
|
|
||||||
{
|
|
||||||
// LC_OBJECT_KEY *next[m_nKeyInfoCount], *prev[m_nKeyInfoCount], *node;
|
|
||||||
LC_OBJECT_KEY *next[32], *prev[32], *node;
|
|
||||||
int i, empty = m_nKeyInfoCount;
|
|
||||||
|
|
||||||
for (i = 0; i < m_nKeyInfoCount; i++)
|
|
||||||
next[i] = NULL;
|
|
||||||
|
|
||||||
node = m_pInstructionKeys;
|
|
||||||
|
|
||||||
// Get the previous and next keys for each variable
|
|
||||||
while (node && empty)
|
|
||||||
{
|
|
||||||
if (node->time <= nTime)
|
|
||||||
{
|
|
||||||
prev[node->type] = node;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (next[node->type] == NULL)
|
|
||||||
{
|
|
||||||
next[node->type] = node;
|
|
||||||
empty--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
node = node->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: USE KEY IN/OUT WEIGHTS
|
|
||||||
for (i = 0; i < m_nKeyInfoCount; i++)
|
|
||||||
{
|
|
||||||
LC_OBJECT_KEY *p = prev[i];
|
|
||||||
|
|
||||||
for (int j = 0; j < m_pKeyInfo[i].size; j++)
|
|
||||||
m_pKeyValues[i][j] = p->param[j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void lcObject::CalculateSingleKey(unsigned short nTime, int keytype, float *value) const
|
|
||||||
{
|
|
||||||
LC_OBJECT_KEY *prev = NULL, *node;
|
|
||||||
|
|
||||||
node = m_pInstructionKeys;
|
node = m_pInstructionKeys;
|
||||||
|
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
if (node->type == keytype)
|
if ((node->Step <= Step) && (node->type == nKeyType))
|
||||||
{
|
poskey = node;
|
||||||
if (node->time <= nTime)
|
|
||||||
prev = node;
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
node = node->next;
|
node = node->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < m_pKeyInfo[keytype].size; j++)
|
if (AddKey)
|
||||||
value[j] = prev->param[j];
|
{
|
||||||
|
if (poskey)
|
||||||
|
{
|
||||||
|
if (poskey->Step != Step)
|
||||||
|
newpos = AddNode(poskey, Step, nKeyType);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
newpos = AddNode(poskey, Step, nKeyType);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newpos == NULL)
|
||||||
|
newpos = poskey;
|
||||||
|
|
||||||
|
for (int i = 0; i < m_pKeyInfo[nKeyType].size; i++)
|
||||||
|
newpos->param[i] = param[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcObject::InsertTime(unsigned short start, unsigned short time)
|
void lcObject::CalculateKeys(lcStep Step)
|
||||||
{
|
{
|
||||||
LC_OBJECT_KEY *node, *prev = NULL;
|
LC_OBJECT_KEY* prev[32];
|
||||||
unsigned short last;
|
|
||||||
bool end[32];
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < m_nKeyInfoCount; i++)
|
for (LC_OBJECT_KEY* node = m_pInstructionKeys; node; node = node->next)
|
||||||
end[i] = false;
|
if (node->Step <= Step)
|
||||||
|
prev[node->type] = node;
|
||||||
|
|
||||||
node = m_pInstructionKeys;
|
for (int i = 0; i < m_nKeyInfoCount; i++)
|
||||||
last = 255;
|
{
|
||||||
|
LC_OBJECT_KEY *p = prev[i];
|
||||||
|
|
||||||
for (; node != NULL; prev = node, node = node->next)
|
for (int j = 0; j < m_pKeyInfo[i].size; j++)
|
||||||
{
|
m_pKeyValues[i][j] = p->param[j];
|
||||||
// skip everything before the start time
|
}
|
||||||
if ((node->time < start) || (node->time == 1))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// there's already a key at the end, delete this one
|
|
||||||
if (end[node->type])
|
|
||||||
{
|
|
||||||
prev->next = node->next;
|
|
||||||
free(node);
|
|
||||||
node = prev;
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
node->time += time;
|
|
||||||
if (node->time >= last)
|
|
||||||
{
|
|
||||||
node->time = last;
|
|
||||||
end[node->type] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcObject::RemoveTime(unsigned short start, unsigned short time)
|
void lcObject::InsertTime(lcStep Start, lcStep Time)
|
||||||
{
|
{
|
||||||
LC_OBJECT_KEY *node, *prev = NULL;
|
LC_OBJECT_KEY *node, *prev = NULL;
|
||||||
|
bool end[32];
|
||||||
|
|
||||||
node = m_pInstructionKeys;
|
for (int i = 0; i < m_nKeyInfoCount; i++)
|
||||||
|
end[i] = false;
|
||||||
|
|
||||||
for (; node != NULL; prev = node, node = node->next)
|
node = m_pInstructionKeys;
|
||||||
{
|
|
||||||
// skip everything before the start time
|
|
||||||
if ((node->time < start) || (node->time == 1))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (node->time < (start + time))
|
for (; node != NULL; prev = node, node = node->next)
|
||||||
{
|
{
|
||||||
// delete this key
|
// skip everything before the start time
|
||||||
prev->next = node->next;
|
if ((node->Step < Start) || (node->Step == 1))
|
||||||
free(node);
|
continue;
|
||||||
node = prev;
|
|
||||||
|
|
||||||
continue;
|
// there's already a key at the end, delete this one
|
||||||
}
|
if (end[node->type])
|
||||||
|
{
|
||||||
|
prev->next = node->next;
|
||||||
|
free(node);
|
||||||
|
node = prev;
|
||||||
|
|
||||||
node->time -= time;
|
continue;
|
||||||
if (node->time < 1)
|
}
|
||||||
node->time = 1;
|
|
||||||
}
|
if (node->Step >= LC_STEP_MAX - Time)
|
||||||
|
{
|
||||||
|
node->Step = LC_STEP_MAX;
|
||||||
|
end[node->type] = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
node->Step += Time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcObject::RemoveTime(lcStep Start, lcStep Time)
|
||||||
|
{
|
||||||
|
LC_OBJECT_KEY *node = m_pInstructionKeys, *prev = NULL;
|
||||||
|
|
||||||
|
for (; node != NULL; prev = node, node = node->next)
|
||||||
|
{
|
||||||
|
// skip everything before the start time
|
||||||
|
if ((node->Step < Start) || (node->Step == 1))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (node->Step < Start + Time)
|
||||||
|
{
|
||||||
|
// delete this key
|
||||||
|
prev->next = node->next;
|
||||||
|
free(node);
|
||||||
|
node = prev;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
node->Step -= Time;
|
||||||
|
if (node->Step < 1)
|
||||||
|
node->Step = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
#include "lc_math.h"
|
#include "lc_math.h"
|
||||||
#include "lc_array.h"
|
#include "lc_array.h"
|
||||||
|
|
||||||
|
typedef lcuint32 lcStep;
|
||||||
|
#define LC_STEP_MAX 0xffffffff
|
||||||
|
|
||||||
enum lcObjectType
|
enum lcObjectType
|
||||||
{
|
{
|
||||||
LC_OBJECT_PIECE,
|
LC_OBJECT_PIECE,
|
||||||
|
@ -14,7 +17,7 @@ enum lcObjectType
|
||||||
// key handling
|
// key handling
|
||||||
struct LC_OBJECT_KEY
|
struct LC_OBJECT_KEY
|
||||||
{
|
{
|
||||||
unsigned short time;
|
lcStep Step;
|
||||||
float param[4];
|
float param[4];
|
||||||
unsigned char type;
|
unsigned char type;
|
||||||
LC_OBJECT_KEY* next;
|
LC_OBJECT_KEY* next;
|
||||||
|
@ -87,7 +90,7 @@ public:
|
||||||
virtual lcuint32 GetFocusSection() const = 0;
|
virtual lcuint32 GetFocusSection() const = 0;
|
||||||
|
|
||||||
virtual lcVector3 GetSectionPosition(lcuint32 Section) const = 0;
|
virtual lcVector3 GetSectionPosition(lcuint32 Section) const = 0;
|
||||||
virtual void Move(unsigned short nTime, bool AddKey, const lcVector3& Distance) = 0;
|
virtual void Move(lcStep Step, bool AddKey, const lcVector3& Distance) = 0;
|
||||||
virtual void RayTest(lcObjectRayTest& ObjectRayTest) const = 0;
|
virtual void RayTest(lcObjectRayTest& ObjectRayTest) const = 0;
|
||||||
virtual void BoxTest(lcObjectBoxTest& ObjectBoxTest) const = 0;
|
virtual void BoxTest(lcObjectBoxTest& ObjectBoxTest) const = 0;
|
||||||
virtual const char* GetName() const = 0;
|
virtual const char* GetName() const = 0;
|
||||||
|
@ -97,10 +100,9 @@ protected:
|
||||||
virtual void FileSave(lcFile& file) const;
|
virtual void FileSave(lcFile& file) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void CalculateSingleKey(unsigned short nTime, int keytype, float *value) const;
|
void ChangeKey(lcStep Step, bool AddKey, const float *param, unsigned char keytype);
|
||||||
void ChangeKey(unsigned short time, bool addkey, const float *param, unsigned char keytype);
|
virtual void InsertTime(lcStep Start, lcStep Time);
|
||||||
virtual void InsertTime(unsigned short start, unsigned short time);
|
virtual void RemoveTime(lcStep Start, lcStep Time);
|
||||||
virtual void RemoveTime(unsigned short start, unsigned short time);
|
|
||||||
|
|
||||||
int GetKeyTypeCount() const
|
int GetKeyTypeCount() const
|
||||||
{
|
{
|
||||||
|
@ -119,7 +121,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void RegisterKeys(float *values[], LC_OBJECT_KEY_INFO* info, int count);
|
void RegisterKeys(float *values[], LC_OBJECT_KEY_INFO* info, int count);
|
||||||
void CalculateKeys(unsigned short nTime);
|
void CalculateKeys(lcStep Step);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void RemoveKeys();
|
void RemoveKeys();
|
||||||
|
|
107
common/piece.cpp
107
common/piece.cpp
|
@ -34,8 +34,8 @@ lcPiece::lcPiece(PieceInfo* pPieceInfo)
|
||||||
mState = 0;
|
mState = 0;
|
||||||
mColorIndex = 0;
|
mColorIndex = 0;
|
||||||
mColorCode = 0;
|
mColorCode = 0;
|
||||||
m_nStepShow = 1;
|
mStepShow = 1;
|
||||||
m_nStepHide = 255;
|
mStepHide = LC_STEP_MAX;
|
||||||
memset(m_strName, 0, sizeof(m_strName));
|
memset(m_strName, 0, sizeof(m_strName));
|
||||||
mGroup = NULL;
|
mGroup = NULL;
|
||||||
|
|
||||||
|
@ -193,11 +193,16 @@ bool lcPiece::FileLoad(lcFile& file)
|
||||||
file.ReadU32(&mColorCode, 1);
|
file.ReadU32(&mColorCode, 1);
|
||||||
mColorIndex = lcGetColorIndex(mColorCode);
|
mColorIndex = lcGetColorIndex(mColorCode);
|
||||||
|
|
||||||
file.ReadU8(&m_nStepShow, 1);
|
lcuint8 Step;
|
||||||
|
file.ReadU8(&Step, 1);
|
||||||
|
mStepShow = Step;
|
||||||
if (version > 1)
|
if (version > 1)
|
||||||
file.ReadU8(&m_nStepHide, 1);
|
{
|
||||||
|
file.ReadU8(&Step, 1);
|
||||||
|
mStepHide = Step == 255 ? LC_STEP_MAX : Step;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
m_nStepHide = 255;
|
mStepHide = LC_STEP_MAX;
|
||||||
|
|
||||||
if (version > 5)
|
if (version > 5)
|
||||||
{
|
{
|
||||||
|
@ -252,8 +257,8 @@ void lcPiece::FileSave(lcFile& file) const
|
||||||
|
|
||||||
file.WriteBuffer(mPieceInfo->m_strName, LC_PIECE_NAME_LEN);
|
file.WriteBuffer(mPieceInfo->m_strName, LC_PIECE_NAME_LEN);
|
||||||
file.WriteU32(mColorCode);
|
file.WriteU32(mColorCode);
|
||||||
file.WriteU8(m_nStepShow);
|
file.WriteU8(lcMin(mStepShow, 254U));
|
||||||
file.WriteU8(m_nStepHide);
|
file.WriteU8(lcMin(mStepHide, 255U));
|
||||||
file.WriteU16(1); // m_nFrameShow
|
file.WriteU16(1); // m_nFrameShow
|
||||||
file.WriteU16(100); // m_nFrameHide
|
file.WriteU16(100); // m_nFrameHide
|
||||||
|
|
||||||
|
@ -269,9 +274,9 @@ void lcPiece::FileSave(lcFile& file) const
|
||||||
file.WriteS32(GroupIndex);
|
file.WriteS32(GroupIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcPiece::Initialize(float x, float y, float z, unsigned char nStep)
|
void lcPiece::Initialize(float x, float y, float z, lcStep Step)
|
||||||
{
|
{
|
||||||
m_nStepShow = nStep;
|
mStepShow = Step;
|
||||||
|
|
||||||
float pos[3] = { x, y, z }, rot[4] = { 0, 0, 1, 0 };
|
float pos[3] = { x, y, z }, rot[4] = { 0, 0, 1, 0 };
|
||||||
ChangeKey(1, true, pos, LC_PK_POSITION);
|
ChangeKey(1, true, pos, LC_PK_POSITION);
|
||||||
|
@ -298,26 +303,68 @@ void lcPiece::CreateName(const lcArray<Piece*>& Pieces)
|
||||||
m_strName[sizeof(m_strName) - 1] = 0;
|
m_strName[sizeof(m_strName) - 1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcPiece::InsertTime(unsigned short start, unsigned short time)
|
void lcPiece::InsertTime(lcStep Start, lcStep Time)
|
||||||
{
|
{
|
||||||
if (m_nStepShow >= start)
|
if (mStepShow >= Start)
|
||||||
m_nStepShow = lcMin(m_nStepShow + time, 255);
|
{
|
||||||
|
if (mStepShow < LC_STEP_MAX - Time)
|
||||||
|
mStepShow += Time;
|
||||||
|
else
|
||||||
|
mStepShow = LC_STEP_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_nStepHide >= start)
|
if (mStepHide >= Start)
|
||||||
m_nStepHide = lcMin(m_nStepHide + time, 255);
|
{
|
||||||
|
if (mStepHide < LC_STEP_MAX - Time)
|
||||||
|
mStepHide += Time;
|
||||||
|
else
|
||||||
|
mStepHide = LC_STEP_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
Object::InsertTime(start, time);
|
if (mStepShow >= mStepHide)
|
||||||
|
{
|
||||||
|
if (mStepShow != LC_STEP_MAX)
|
||||||
|
mStepHide = mStepShow + 1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mStepShow = LC_STEP_MAX - 1;
|
||||||
|
mStepHide = LC_STEP_MAX;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object::InsertTime(Start, Time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcPiece::RemoveTime (unsigned short start, unsigned short time)
|
void lcPiece::RemoveTime(lcStep Start, lcStep Time)
|
||||||
{
|
{
|
||||||
if (m_nStepShow >= start)
|
if (mStepShow >= Start)
|
||||||
m_nStepShow = lcMax(m_nStepShow - time, 1);
|
{
|
||||||
|
if (mStepShow > Time)
|
||||||
|
mStepShow -= Time;
|
||||||
|
else
|
||||||
|
mStepShow = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_nStepHide != 255)
|
if (mStepHide != LC_STEP_MAX)
|
||||||
m_nStepHide = lcMax(m_nStepHide - time, 1);
|
{
|
||||||
|
if (mStepHide > Time)
|
||||||
|
mStepHide -= Time;
|
||||||
|
else
|
||||||
|
mStepHide = 1;
|
||||||
|
}
|
||||||
|
|
||||||
Object::RemoveTime(start, time);
|
if (mStepShow >= mStepHide)
|
||||||
|
{
|
||||||
|
if (mStepShow != LC_STEP_MAX)
|
||||||
|
mStepHide = mStepShow + 1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mStepShow = LC_STEP_MAX - 1;
|
||||||
|
mStepHide = LC_STEP_MAX;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object::RemoveTime(Start, Time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcPiece::RayTest(lcObjectRayTest& ObjectRayTest) const
|
void lcPiece::RayTest(lcObjectRayTest& ObjectRayTest) const
|
||||||
|
@ -402,27 +449,21 @@ void lcPiece::BoxTest(lcObjectBoxTest& ObjectBoxTest) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcPiece::Move(unsigned short nTime, bool AddKey, const lcVector3& Distance)
|
void lcPiece::Move(lcStep Step, bool AddKey, const lcVector3& Distance)
|
||||||
{
|
{
|
||||||
mPosition += Distance;
|
mPosition += Distance;
|
||||||
|
|
||||||
ChangeKey(nTime, AddKey, mPosition, LC_PK_POSITION);
|
ChangeKey(Step, AddKey, mPosition, LC_PK_POSITION);
|
||||||
|
|
||||||
mModelWorld.SetTranslation(mPosition);
|
mModelWorld.SetTranslation(mPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lcPiece::IsVisible(unsigned short nTime)
|
bool lcPiece::IsVisible(lcStep Step)
|
||||||
{
|
{
|
||||||
if (mState & LC_PIECE_HIDDEN)
|
if (mState & LC_PIECE_HIDDEN)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (m_nStepShow > nTime)
|
return (mStepShow <= Step) && (mStepHide > Step);
|
||||||
return false;
|
|
||||||
|
|
||||||
if ((m_nStepHide == 255) || (m_nStepHide > nTime))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcPiece::CompareBoundingBox(float box[6])
|
void lcPiece::CompareBoundingBox(float box[6])
|
||||||
|
@ -457,9 +498,9 @@ lcGroup* lcPiece::GetTopGroup()
|
||||||
return mGroup ? mGroup->GetTopGroup() : NULL;
|
return mGroup ? mGroup->GetTopGroup() : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcPiece::UpdatePosition(unsigned short nTime)
|
void lcPiece::UpdatePosition(lcStep Step)
|
||||||
{
|
{
|
||||||
CalculateKeys(nTime);
|
CalculateKeys(Step);
|
||||||
|
|
||||||
mModelWorld = lcMatrix44FromAxisAngle(lcVector3(mRotation[0], mRotation[1], mRotation[2]), mRotation[3] * LC_DTOR);
|
mModelWorld = lcMatrix44FromAxisAngle(lcVector3(mRotation[0], mRotation[1], mRotation[2]), mRotation[3] * LC_DTOR);
|
||||||
mModelWorld.SetTranslation(mPosition);
|
mModelWorld.SetTranslation(mPosition);
|
||||||
|
|
|
@ -98,8 +98,8 @@ public:
|
||||||
virtual void RayTest(lcObjectRayTest& ObjectRayTest) const;
|
virtual void RayTest(lcObjectRayTest& ObjectRayTest) const;
|
||||||
virtual void BoxTest(lcObjectBoxTest& ObjectBoxTest) const;
|
virtual void BoxTest(lcObjectBoxTest& ObjectBoxTest) const;
|
||||||
|
|
||||||
virtual void InsertTime(unsigned short start, unsigned short time);
|
virtual void InsertTime(lcStep Start, lcStep Time);
|
||||||
virtual void RemoveTime(unsigned short start, unsigned short time);
|
virtual void RemoveTime(lcStep Start, lcStep Time);
|
||||||
|
|
||||||
bool IsHidden()
|
bool IsHidden()
|
||||||
{
|
{
|
||||||
|
@ -119,16 +119,16 @@ public:
|
||||||
return m_strName;
|
return m_strName;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsVisible(unsigned short nTime);
|
bool IsVisible(lcStep Step);
|
||||||
void Initialize(float x, float y, float z, unsigned char nStep);
|
void Initialize(float x, float y, float z, lcStep Step);
|
||||||
void CreateName(const lcArray<Piece*>& Pieces);
|
void CreateName(const lcArray<Piece*>& Pieces);
|
||||||
void CompareBoundingBox(float box[6]);
|
void CompareBoundingBox(float box[6]);
|
||||||
void SetPieceInfo(PieceInfo* pPieceInfo);
|
void SetPieceInfo(PieceInfo* pPieceInfo);
|
||||||
bool FileLoad(lcFile& file);
|
bool FileLoad(lcFile& file);
|
||||||
void FileSave(lcFile& file) const;
|
void FileSave(lcFile& file) const;
|
||||||
|
|
||||||
void UpdatePosition(unsigned short nTime);
|
void UpdatePosition(lcStep Step);
|
||||||
void Move(unsigned short nTime, bool AddKey, const lcVector3& Distance);
|
void Move(lcStep Step, bool AddKey, const lcVector3& Distance);
|
||||||
|
|
||||||
lcGroup* GetTopGroup();
|
lcGroup* GetTopGroup();
|
||||||
|
|
||||||
|
@ -146,14 +146,26 @@ public:
|
||||||
{ strcpy(m_strName, name); }
|
{ strcpy(m_strName, name); }
|
||||||
const char* GetName()
|
const char* GetName()
|
||||||
{ return m_strName; }
|
{ return m_strName; }
|
||||||
void SetStepShow(unsigned char step)
|
|
||||||
{ m_nStepShow = step; }
|
lcStep GetStepShow() const
|
||||||
unsigned char GetStepShow()
|
{
|
||||||
{ return m_nStepShow; }
|
return mStepShow;
|
||||||
void SetStepHide(unsigned char step)
|
}
|
||||||
{ m_nStepHide = step; }
|
|
||||||
unsigned char GetStepHide()
|
lcStep GetStepHide() const
|
||||||
{ return (unsigned char)m_nStepHide; }
|
{
|
||||||
|
return mStepHide;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetStepHide(lcStep Step)
|
||||||
|
{
|
||||||
|
mStepHide = Step;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetStepShow(lcStep Step)
|
||||||
|
{
|
||||||
|
mStepShow = Step;
|
||||||
|
}
|
||||||
|
|
||||||
void SetColorCode(lcuint32 ColorCode)
|
void SetColorCode(lcuint32 ColorCode)
|
||||||
{
|
{
|
||||||
|
@ -181,8 +193,8 @@ protected:
|
||||||
// Atributes
|
// Atributes
|
||||||
Group* mGroup;
|
Group* mGroup;
|
||||||
|
|
||||||
lcuint8 m_nStepShow;
|
lcStep mStepShow;
|
||||||
lcuint8 m_nStepHide;
|
lcStep mStepHide;
|
||||||
|
|
||||||
lcuint8 mState;
|
lcuint8 mState;
|
||||||
char m_strName[81];
|
char m_strName[81];
|
||||||
|
|
|
@ -67,7 +67,7 @@ void Project::UpdateInterface()
|
||||||
gMainWindow->UpdatePerspective();
|
gMainWindow->UpdatePerspective();
|
||||||
|
|
||||||
UpdateSelection();
|
UpdateSelection();
|
||||||
gMainWindow->UpdateTime(m_nCurStep, 255);
|
gMainWindow->UpdateCurrentStep();
|
||||||
|
|
||||||
const lcArray<View*> Views = gMainWindow->GetViews();
|
const lcArray<View*> Views = gMainWindow->GetViews();
|
||||||
for (int i = 0; i < Views.GetSize(); i++)
|
for (int i = 0; i < Views.GetSize(); i++)
|
||||||
|
@ -135,8 +135,8 @@ void Project::LoadDefaults(bool cameras)
|
||||||
gMainWindow->UpdateLockSnap(m_nSnap);
|
gMainWindow->UpdateLockSnap(m_nSnap);
|
||||||
m_nMoveSnap = 0x0304;
|
m_nMoveSnap = 0x0304;
|
||||||
gMainWindow->UpdateSnap();
|
gMainWindow->UpdateSnap();
|
||||||
m_nCurStep = 1;
|
mCurrentStep = 1;
|
||||||
gMainWindow->UpdateTime(1, 255);
|
gMainWindow->UpdateCurrentStep();
|
||||||
strcpy(m_strHeader, "");
|
strcpy(m_strHeader, "");
|
||||||
strcpy(m_strFooter, "Page &P");
|
strcpy(m_strFooter, "Page &P");
|
||||||
m_pTerrain->LoadDefaults(true);
|
m_pTerrain->LoadDefaults(true);
|
||||||
|
@ -239,7 +239,7 @@ bool Project::FileLoad(lcFile* file, bool bUndo, bool bMerge)
|
||||||
file->ReadS32(&i, 1); //m_nCurGroup = i;
|
file->ReadS32(&i, 1); //m_nCurGroup = i;
|
||||||
file->ReadS32(&i, 1); //m_nCurColor = i;
|
file->ReadS32(&i, 1); //m_nCurColor = i;
|
||||||
file->ReadS32(&i, 1); //action = i;
|
file->ReadS32(&i, 1); //action = i;
|
||||||
file->ReadS32(&i, 1); m_nCurStep = i;
|
file->ReadS32(&i, 1); mCurrentStep = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fv > 0.8f)
|
if (fv > 0.8f)
|
||||||
|
@ -605,7 +605,7 @@ bool Project::FileLoad(lcFile* file, bool bUndo, bool bMerge)
|
||||||
gMainWindow->UpdateSnap();
|
gMainWindow->UpdateSnap();
|
||||||
gMainWindow->UpdateCameraMenu();
|
gMainWindow->UpdateCameraMenu();
|
||||||
UpdateSelection();
|
UpdateSelection();
|
||||||
gMainWindow->UpdateTime(m_nCurStep, 255);
|
gMainWindow->UpdateCurrentStep();
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -637,7 +637,7 @@ void Project::FileSave(lcFile* file, bool bUndo)
|
||||||
i = 0;//i = m_nCurColor;
|
i = 0;//i = m_nCurColor;
|
||||||
file->WriteS32(&i, 1);
|
file->WriteS32(&i, 1);
|
||||||
i = 0; file->WriteS32(&i, 1); // m_nCurAction
|
i = 0; file->WriteS32(&i, 1); // m_nCurAction
|
||||||
i = m_nCurStep; file->WriteS32(&i, 1);
|
i = mCurrentStep; file->WriteS32(&i, 1);
|
||||||
file->WriteU32(0);//m_nScene
|
file->WriteU32(0);//m_nScene
|
||||||
|
|
||||||
file->WriteS32(mPieces.GetSize());
|
file->WriteS32(mPieces.GetSize());
|
||||||
|
@ -733,8 +733,7 @@ void Project::FileSave(lcFile* file, bool bUndo)
|
||||||
opts.transparent = false;
|
opts.transparent = false;
|
||||||
opts.format = LC_IMAGE_GIF;
|
opts.format = LC_IMAGE_GIF;
|
||||||
|
|
||||||
i = m_bAnimation ? m_nCurFrame : m_nCurStep;
|
CreateImages(image, 120, 100, mCurrentStep, mCurrentStep, false);
|
||||||
CreateImages(image, 120, 100, i, i, false);
|
|
||||||
image[0].FileSave (*file, &opts);
|
image[0].FileSave (*file, &opts);
|
||||||
delete []image;
|
delete []image;
|
||||||
}
|
}
|
||||||
|
@ -1021,7 +1020,6 @@ bool Project::DoSave(const char* FileName)
|
||||||
|
|
||||||
if ((strcmp(ext, "dat") == 0) || (strcmp(ext, "ldr") == 0))
|
if ((strcmp(ext, "dat") == 0) || (strcmp(ext, "ldr") == 0))
|
||||||
{
|
{
|
||||||
int i, steps = GetLastStep();
|
|
||||||
char buf[256];
|
char buf[256];
|
||||||
|
|
||||||
ptr = strrchr(m_strPathName, '\\');
|
ptr = strrchr(m_strPathName, '\\');
|
||||||
|
@ -1032,8 +1030,7 @@ bool Project::DoSave(const char* FileName)
|
||||||
else
|
else
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
sprintf(buf, "0 Model exported from LeoCAD\r\n"
|
sprintf(buf, "0 Model exported from LeoCAD\r\n0 Original name: %s\r\n", ptr);
|
||||||
"0 Original name: %s\r\n", ptr);
|
|
||||||
if (!mProperties.mAuthor.IsEmpty())
|
if (!mProperties.mAuthor.IsEmpty())
|
||||||
{
|
{
|
||||||
strcat(buf, "0 Author: ");
|
strcat(buf, "0 Author: ");
|
||||||
|
@ -1045,13 +1042,14 @@ bool Project::DoSave(const char* FileName)
|
||||||
|
|
||||||
const char* OldLocale = setlocale(LC_NUMERIC, "C");
|
const char* OldLocale = setlocale(LC_NUMERIC, "C");
|
||||||
|
|
||||||
for (i = 1; i <= steps; i++)
|
lcStep LastStep = GetLastStep();
|
||||||
|
for (lcStep Step = 1; Step <= LastStep; Step++)
|
||||||
{
|
{
|
||||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||||
{
|
{
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
Piece* Piece = mPieces[PieceIdx];
|
||||||
|
|
||||||
if ((Piece->IsVisible(i)) && (Piece->GetStepShow() == i))
|
if ((Piece->IsVisible(Step)) && (Piece->GetStepShow() == Step))
|
||||||
{
|
{
|
||||||
const float* f = Piece->mModelWorld;
|
const float* f = Piece->mModelWorld;
|
||||||
sprintf (buf, "1 %d %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %s.DAT\r\n",
|
sprintf (buf, "1 %d %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %s.DAT\r\n",
|
||||||
|
@ -1060,7 +1058,7 @@ bool Project::DoSave(const char* FileName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i != steps)
|
if (Step != LastStep)
|
||||||
file.WriteBuffer("0 STEP\r\n", 8);
|
file.WriteBuffer("0 STEP\r\n", 8);
|
||||||
}
|
}
|
||||||
file.WriteBuffer("0\r\n", 3);
|
file.WriteBuffer("0\r\n", 3);
|
||||||
|
@ -1220,8 +1218,8 @@ bool Project::OnOpenDocument(const char* lpszPathName)
|
||||||
else
|
else
|
||||||
FileReadLDraw(&file, mat, &ok, 16, &step, FileArray);
|
FileReadLDraw(&file, mat, &ok, 16, &step, FileArray);
|
||||||
|
|
||||||
m_nCurStep = step;
|
mCurrentStep = step;
|
||||||
gMainWindow->UpdateTime(m_nCurStep, 255);
|
gMainWindow->UpdateCurrentStep();
|
||||||
gMainWindow->UpdateFocusObject(GetFocusObject());
|
gMainWindow->UpdateFocusObject(GetFocusObject());
|
||||||
UpdateSelection();
|
UpdateSelection();
|
||||||
CalculateStep();
|
CalculateStep();
|
||||||
|
@ -1460,7 +1458,7 @@ void Project::RenderScenePieces(View* view, bool DrawInterface)
|
||||||
{
|
{
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
Piece* Piece = mPieces[PieceIdx];
|
||||||
|
|
||||||
if (!Piece->IsVisible(m_nCurStep))
|
if (!Piece->IsVisible(mCurrentStep))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
PieceInfo* Info = Piece->mPieceInfo;
|
PieceInfo* Info = Piece->mPieceInfo;
|
||||||
|
@ -1506,7 +1504,7 @@ void Project::RenderScenePieces(View* view, bool DrawInterface)
|
||||||
{
|
{
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
Piece* Piece = mPieces[PieceIdx];
|
||||||
|
|
||||||
if (!Piece->IsVisible(m_nCurStep) || !Piece->IsSelected())
|
if (!Piece->IsVisible(mCurrentStep) || !Piece->IsSelected())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
PieceInfo* PieceInfo = Piece->mPieceInfo;
|
PieceInfo* PieceInfo = Piece->mPieceInfo;
|
||||||
|
@ -1626,7 +1624,7 @@ void Project::RenderSceneObjects(View* view)
|
||||||
{
|
{
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
Piece* Piece = mPieces[PieceIdx];
|
||||||
|
|
||||||
if (Piece->IsVisible(m_nCurStep))
|
if (Piece->IsVisible(mCurrentStep))
|
||||||
Piece->CompareBoundingBox(bs);
|
Piece->CompareBoundingBox(bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1989,11 +1987,11 @@ void Project::CalculateStep()
|
||||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||||
{
|
{
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
Piece* Piece = mPieces[PieceIdx];
|
||||||
Piece->UpdatePosition(m_nCurStep);
|
Piece->UpdatePosition(mCurrentStep);
|
||||||
|
|
||||||
if (Piece->IsSelected())
|
if (Piece->IsSelected())
|
||||||
{
|
{
|
||||||
if (!Piece->IsVisible(m_nCurStep))
|
if (!Piece->IsVisible(mCurrentStep))
|
||||||
Piece->SetSelected(false);
|
Piece->SetSelected(false);
|
||||||
else
|
else
|
||||||
SelectGroup(Piece->GetTopGroup(), true);
|
SelectGroup(Piece->GetTopGroup(), true);
|
||||||
|
@ -2001,10 +1999,10 @@ void Project::CalculateStep()
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int CameraIdx = 0; CameraIdx < mCameras.GetSize(); CameraIdx++)
|
for (int CameraIdx = 0; CameraIdx < mCameras.GetSize(); CameraIdx++)
|
||||||
mCameras[CameraIdx]->UpdatePosition(m_nCurStep);
|
mCameras[CameraIdx]->UpdatePosition(mCurrentStep);
|
||||||
|
|
||||||
for (int LightIdx = 0; LightIdx < mLights.GetSize(); LightIdx++)
|
for (int LightIdx = 0; LightIdx < mLights.GetSize(); LightIdx++)
|
||||||
mLights[LightIdx]->UpdatePosition(m_nCurStep);
|
mLights[LightIdx]->UpdatePosition(mCurrentStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Project::RemoveSelectedObjects()
|
bool Project::RemoveSelectedObjects()
|
||||||
|
@ -2199,15 +2197,6 @@ void Project::CheckAutoSave()
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char Project::GetLastStep()
|
|
||||||
{
|
|
||||||
unsigned char last = 1;
|
|
||||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
|
||||||
last = lcMax(last, mPieces[PieceIdx]->GetStepShow());
|
|
||||||
|
|
||||||
return last;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Project::FindPiece(bool FindFirst, bool SearchForward)
|
void Project::FindPiece(bool FindFirst, bool SearchForward)
|
||||||
{
|
{
|
||||||
if (mPieces.IsEmpty())
|
if (mPieces.IsEmpty())
|
||||||
|
@ -2220,7 +2209,7 @@ void Project::FindPiece(bool FindFirst, bool SearchForward)
|
||||||
{
|
{
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
Piece* Piece = mPieces[PieceIdx];
|
||||||
|
|
||||||
if (Piece->IsFocused() && Piece->IsVisible(m_nCurStep))
|
if (Piece->IsFocused() && Piece->IsVisible(mCurrentStep))
|
||||||
{
|
{
|
||||||
StartIdx = PieceIdx;
|
StartIdx = PieceIdx;
|
||||||
break;
|
break;
|
||||||
|
@ -2248,7 +2237,7 @@ void Project::FindPiece(bool FindFirst, bool SearchForward)
|
||||||
|
|
||||||
Piece* Current = mPieces[CurrentIdx];
|
Piece* Current = mPieces[CurrentIdx];
|
||||||
|
|
||||||
if (!Current->IsVisible(m_nCurStep))
|
if (!Current->IsVisible(mCurrentStep))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((!mSearchOptions.MatchInfo || Current->mPieceInfo == mSearchOptions.Info) &&
|
if ((!mSearchOptions.MatchInfo || Current->mPieceInfo == mSearchOptions.Info) &&
|
||||||
|
@ -2274,7 +2263,7 @@ void Project::ZoomExtents(int FirstView, int LastView)
|
||||||
{
|
{
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
Piece* Piece = mPieces[PieceIdx];
|
||||||
|
|
||||||
if (Piece->IsVisible(m_nCurStep))
|
if (Piece->IsVisible(mCurrentStep))
|
||||||
Piece->CompareBoundingBox(bs);
|
Piece->CompareBoundingBox(bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2297,7 +2286,7 @@ void Project::ZoomExtents(int FirstView, int LastView)
|
||||||
{
|
{
|
||||||
View* view = Views[vp];
|
View* view = Views[vp];
|
||||||
|
|
||||||
view->mCamera->ZoomExtents(view, Center, Points, 8, m_nCurStep, gMainWindow->GetAddKeys());
|
view->mCamera->ZoomExtents(view, Center, Points, 8, mCurrentStep, gMainWindow->GetAddKeys());
|
||||||
}
|
}
|
||||||
|
|
||||||
gMainWindow->UpdateFocusObject(GetFocusObject());
|
gMainWindow->UpdateFocusObject(GetFocusObject());
|
||||||
|
@ -2336,7 +2325,7 @@ void Project::GetPiecesUsed(lcArray<lcPiecesUsedEntry>& PiecesUsed) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a series of pictures
|
// Create a series of pictures
|
||||||
void Project::CreateImages(Image* images, int width, int height, unsigned short from, unsigned short to, bool hilite)
|
void Project::CreateImages(Image* images, int width, int height, lcStep from, lcStep to, bool hilite)
|
||||||
{
|
{
|
||||||
if (!GL_BeginRenderToTexture(width, height))
|
if (!GL_BeginRenderToTexture(width, height))
|
||||||
{
|
{
|
||||||
|
@ -2344,9 +2333,8 @@ void Project::CreateImages(Image* images, int width, int height, unsigned short
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short oldtime;
|
lcStep CurrentStep = mCurrentStep;
|
||||||
unsigned char* buf = (unsigned char*)malloc (width*height*3);
|
unsigned char* buf = (unsigned char*)malloc(width*height*3);
|
||||||
oldtime = m_nCurStep;
|
|
||||||
|
|
||||||
View view(this);
|
View view(this);
|
||||||
view.SetCamera(gMainWindow->GetActiveView()->mCamera, false);
|
view.SetCamera(gMainWindow->GetActiveView()->mCamera, false);
|
||||||
|
@ -2359,9 +2347,9 @@ void Project::CreateImages(Image* images, int width, int height, unsigned short
|
||||||
|
|
||||||
RenderInitialize();
|
RenderInitialize();
|
||||||
|
|
||||||
for (int i = from; i <= to; i++)
|
for (lcStep i = from; i <= to; i++)
|
||||||
{
|
{
|
||||||
m_nCurStep = i;
|
mCurrentStep = i;
|
||||||
|
|
||||||
if (hilite)
|
if (hilite)
|
||||||
{
|
{
|
||||||
|
@ -2380,14 +2368,13 @@ void Project::CreateImages(Image* images, int width, int height, unsigned short
|
||||||
if (hilite)
|
if (hilite)
|
||||||
SelectAndFocusNone(false);
|
SelectAndFocusNone(false);
|
||||||
|
|
||||||
m_nCurStep = (unsigned char)oldtime;
|
SetCurrentStep(CurrentStep);
|
||||||
CalculateStep();
|
free(buf);
|
||||||
free (buf);
|
|
||||||
|
|
||||||
GL_EndRenderToTexture();
|
GL_EndRenderToTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::CreateHTMLPieceList(FILE* f, int nStep, bool bImages, const char* ext)
|
void Project::CreateHTMLPieceList(FILE* f, lcStep Step, bool bImages, const char* ext)
|
||||||
{
|
{
|
||||||
int* ColorsUsed = new int[gColorList.GetSize()];
|
int* ColorsUsed = new int[gColorList.GetSize()];
|
||||||
memset(ColorsUsed, 0, sizeof(ColorsUsed[0]) * gColorList.GetSize());
|
memset(ColorsUsed, 0, sizeof(ColorsUsed[0]) * gColorList.GetSize());
|
||||||
|
@ -2398,7 +2385,7 @@ void Project::CreateHTMLPieceList(FILE* f, int nStep, bool bImages, const char*
|
||||||
{
|
{
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
Piece* Piece = mPieces[PieceIdx];
|
||||||
|
|
||||||
if ((Piece->GetStepShow() == nStep) || (nStep == 0))
|
if ((Piece->GetStepShow() == Step) || (Step == 0))
|
||||||
ColorsUsed[Piece->mColorIndex]++;
|
ColorsUsed[Piece->mColorIndex]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2427,7 +2414,7 @@ void Project::CreateHTMLPieceList(FILE* f, int nStep, bool bImages, const char*
|
||||||
{
|
{
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
Piece* Piece = mPieces[PieceIdx];
|
||||||
|
|
||||||
if ((Piece->mPieceInfo == pInfo) && ((Piece->GetStepShow() == nStep) || (nStep == 0)))
|
if ((Piece->mPieceInfo == pInfo) && ((Piece->GetStepShow() == Step) || (Step == 0)))
|
||||||
{
|
{
|
||||||
PiecesUsed[Piece->mColorIndex]++;
|
PiecesUsed[Piece->mColorIndex]++;
|
||||||
Add = true;
|
Add = true;
|
||||||
|
@ -3306,8 +3293,8 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Options.Start = m_nCurStep;
|
Options.Start = mCurrentStep;
|
||||||
Options.End = m_nCurStep;
|
Options.End = mCurrentStep;
|
||||||
|
|
||||||
if (!gMainWindow->DoDialog(LC_DIALOG_SAVE_IMAGE, &Options))
|
if (!gMainWindow->DoDialog(LC_DIALOG_SAVE_IMAGE, &Options))
|
||||||
break;
|
break;
|
||||||
|
@ -3461,8 +3448,7 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
FILE* f;
|
FILE* f;
|
||||||
const char *ext, *htmlext;
|
const char *ext, *htmlext;
|
||||||
char fn[LC_MAXPATH];
|
char fn[LC_MAXPATH];
|
||||||
int i;
|
lcStep LastStep = GetLastStep();
|
||||||
unsigned short last = GetLastStep();
|
|
||||||
|
|
||||||
switch (Options.ImageFormat)
|
switch (Options.ImageFormat)
|
||||||
{
|
{
|
||||||
|
@ -3492,13 +3478,13 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
|
|
||||||
fprintf (f, "<HTML>\n<HEAD>\n<TITLE>Instructions for %s</TITLE>\n</HEAD>\n<BR>\n<CENTER>\n", m_strTitle);
|
fprintf (f, "<HTML>\n<HEAD>\n<TITLE>Instructions for %s</TITLE>\n</HEAD>\n<BR>\n<CENTER>\n", m_strTitle);
|
||||||
|
|
||||||
for (i = 1; i <= last; i++)
|
for (lcStep Step = 1; Step <= LastStep; Step++)
|
||||||
{
|
{
|
||||||
fprintf(f, "<IMG SRC=\"%s-%02d%s\" ALT=\"Step %02d\" WIDTH=%d HEIGHT=%d><BR><BR>\n",
|
fprintf(f, "<IMG SRC=\"%s-%02d%s\" ALT=\"Step %02d\" WIDTH=%d HEIGHT=%d><BR><BR>\n",
|
||||||
m_strTitle, i, ext, i, Options.StepImagesWidth, Options.StepImagesHeight);
|
m_strTitle, Step, ext, Step, Options.StepImagesWidth, Options.StepImagesHeight);
|
||||||
|
|
||||||
if (Options.PartsListStep)
|
if (Options.PartsListStep)
|
||||||
CreateHTMLPieceList(f, i, Options.PartsListImages, ext);
|
CreateHTMLPieceList(f, Step, Options.PartsListImages, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Options.PartsListEnd)
|
if (Options.PartsListEnd)
|
||||||
|
@ -3525,8 +3511,8 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
|
|
||||||
fprintf(f, "<HTML>\n<HEAD>\n<TITLE>Instructions for %s</TITLE>\n</HEAD>\n<BR>\n<CENTER>\n", m_strTitle);
|
fprintf(f, "<HTML>\n<HEAD>\n<TITLE>Instructions for %s</TITLE>\n</HEAD>\n<BR>\n<CENTER>\n", m_strTitle);
|
||||||
|
|
||||||
for (i = 1; i <= last; i++)
|
for (lcStep Step = 1; Step <= LastStep; Step++)
|
||||||
fprintf(f, "<A HREF=\"%s-%02d%s\">Step %d<BR>\n</A>", m_strTitle, i, htmlext, i);
|
fprintf(f, "<A HREF=\"%s-%02d%s\">Step %d<BR>\n</A>", m_strTitle, Step, htmlext, Step);
|
||||||
|
|
||||||
if (Options.PartsListEnd)
|
if (Options.PartsListEnd)
|
||||||
fprintf(f, "<A HREF=\"%s-pieces%s\">Pieces Used</A><BR>\n", m_strTitle, htmlext);
|
fprintf(f, "<A HREF=\"%s-pieces%s\">Pieces Used</A><BR>\n", m_strTitle, htmlext);
|
||||||
|
@ -3536,9 +3522,9 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create each step
|
// Create each step
|
||||||
for (i = 1; i <= last; i++)
|
for (lcStep Step = 1; Step <= LastStep; Step++)
|
||||||
{
|
{
|
||||||
sprintf(fn, "%s%s-%02d%s", Options.PathName, m_strTitle, i, htmlext);
|
sprintf(fn, "%s%s-%02d%s", Options.PathName, m_strTitle, Step, htmlext);
|
||||||
f = fopen(fn, "wt");
|
f = fopen(fn, "wt");
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
|
@ -3547,22 +3533,22 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(f, "<HTML>\n<HEAD>\n<TITLE>%s - Step %02d</TITLE>\n</HEAD>\n<BR>\n<CENTER>\n", m_strTitle, i);
|
fprintf(f, "<HTML>\n<HEAD>\n<TITLE>%s - Step %02d</TITLE>\n</HEAD>\n<BR>\n<CENTER>\n", m_strTitle, Step);
|
||||||
fprintf(f, "<IMG SRC=\"%s-%02d%s\" ALT=\"Step %02d\" WIDTH=%d HEIGHT=%d><BR><BR>\n",
|
fprintf(f, "<IMG SRC=\"%s-%02d%s\" ALT=\"Step %02d\" WIDTH=%d HEIGHT=%d><BR><BR>\n",
|
||||||
m_strTitle, i, ext, i, Options.StepImagesWidth, Options.StepImagesHeight);
|
m_strTitle, Step, ext, Step, Options.StepImagesWidth, Options.StepImagesHeight);
|
||||||
|
|
||||||
if (Options.PartsListStep)
|
if (Options.PartsListStep)
|
||||||
CreateHTMLPieceList(f, i, Options.PartsListImages, ext);
|
CreateHTMLPieceList(f, Step, Options.PartsListImages, ext);
|
||||||
|
|
||||||
fputs("</CENTER>\n<BR><HR><BR>", f);
|
fputs("</CENTER>\n<BR><HR><BR>", f);
|
||||||
if (i != 1)
|
if (Step != 1)
|
||||||
fprintf(f, "<A HREF=\"%s-%02d%s\">Previous</A> ", m_strTitle, i-1, htmlext);
|
fprintf(f, "<A HREF=\"%s-%02d%s\">Previous</A> ", m_strTitle, Step - 1, htmlext);
|
||||||
|
|
||||||
if (Options.IndexPage)
|
if (Options.IndexPage)
|
||||||
fprintf(f, "<A HREF=\"%s-index%s\">Index</A> ", m_strTitle, htmlext);
|
fprintf(f, "<A HREF=\"%s-index%s\">Index</A> ", m_strTitle, htmlext);
|
||||||
|
|
||||||
if (i != last)
|
if (Step != LastStep)
|
||||||
fprintf(f, "<A HREF=\"%s-%02d%s\">Next</A>", m_strTitle, i+1, htmlext);
|
fprintf(f, "<A HREF=\"%s-%02d%s\">Next</A>", m_strTitle, Step + 1, htmlext);
|
||||||
else if (Options.PartsListEnd)
|
else if (Options.PartsListEnd)
|
||||||
fprintf(f, "<A HREF=\"%s-pieces%s\">Pieces Used</A>", m_strTitle, htmlext);
|
fprintf(f, "<A HREF=\"%s-pieces%s\">Pieces Used</A>", m_strTitle, htmlext);
|
||||||
|
|
||||||
|
@ -3589,7 +3575,7 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
CreateHTMLPieceList(f, 0, Options.PartsListImages, ext);
|
CreateHTMLPieceList(f, 0, Options.PartsListImages, ext);
|
||||||
|
|
||||||
fputs("</CENTER>\n<BR><HR><BR>", f);
|
fputs("</CENTER>\n<BR><HR><BR>", f);
|
||||||
fprintf(f, "<A HREF=\"%s-%02d%s\">Previous</A> ", m_strTitle, i-1, htmlext);
|
fprintf(f, "<A HREF=\"%s-%02d%s\">Previous</A> ", m_strTitle, LastStep, htmlext);
|
||||||
|
|
||||||
if (Options.IndexPage)
|
if (Options.IndexPage)
|
||||||
fprintf(f, "<A HREF=\"%s-index%s\">Index</A> ", m_strTitle, htmlext);
|
fprintf(f, "<A HREF=\"%s-index%s\">Index</A> ", m_strTitle, htmlext);
|
||||||
|
@ -3600,13 +3586,13 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save step pictures
|
// Save step pictures
|
||||||
Image* images = new Image[last];
|
Image* images = new Image[LastStep];
|
||||||
CreateImages(images, Options.StepImagesWidth, Options.StepImagesHeight, 1, last, Options.HighlightNewParts);
|
CreateImages(images, Options.StepImagesWidth, Options.StepImagesHeight, 1, LastStep, Options.HighlightNewParts);
|
||||||
|
|
||||||
for (i = 0; i < last; i++)
|
for (lcStep Step = 0; Step < LastStep; Step++)
|
||||||
{
|
{
|
||||||
sprintf(fn, "%s%s-%02d%s", Options.PathName, m_strTitle, i+1, ext);
|
sprintf(fn, "%s%s-%02d%s", Options.PathName, m_strTitle, Step + 1, ext);
|
||||||
images[i].FileSave(fn, Options.ImageFormat, Options.TransparentImages);
|
images[Step].FileSave(fn, Options.ImageFormat, Options.TransparentImages);
|
||||||
}
|
}
|
||||||
delete []images;
|
delete []images;
|
||||||
|
|
||||||
|
@ -4131,7 +4117,7 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
{
|
{
|
||||||
lcPiece* Piece = PastedPieces[PieceIdx];
|
lcPiece* Piece = PastedPieces[PieceIdx];
|
||||||
Piece->CreateName(mPieces);
|
Piece->CreateName(mPieces);
|
||||||
Piece->SetStepShow(m_nCurStep);
|
Piece->SetStepShow(mCurrentStep);
|
||||||
mPieces.Add(Piece);
|
mPieces.Add(Piece);
|
||||||
Piece->SetSelected(true);
|
Piece->SetSelected(true);
|
||||||
|
|
||||||
|
@ -4231,7 +4217,7 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
{
|
{
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
Piece* Piece = mPieces[PieceIdx];
|
||||||
|
|
||||||
if (Piece->IsVisible(m_nCurStep))
|
if (Piece->IsVisible(mCurrentStep))
|
||||||
Piece->SetSelected(true);
|
Piece->SetSelected(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4253,7 +4239,7 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
{
|
{
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
Piece* Piece = mPieces[PieceIdx];
|
||||||
|
|
||||||
if (Piece->IsVisible(m_nCurStep))
|
if (Piece->IsVisible(mCurrentStep))
|
||||||
Piece->SetSelected(!Piece->IsSelected());
|
Piece->SetSelected(!Piece->IsSelected());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4370,7 +4356,7 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
{
|
{
|
||||||
lcVector3 FocusVector;
|
lcVector3 FocusVector;
|
||||||
GetSelectionCenter(FocusVector);
|
GetSelectionCenter(FocusVector);
|
||||||
gMainWindow->GetActiveView()->mCamera->SetFocalPoint(FocusVector, m_nCurStep, gMainWindow->GetAddKeys());
|
gMainWindow->GetActiveView()->mCamera->SetFocalPoint(FocusVector, mCurrentStep, gMainWindow->GetAddKeys());
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -4400,13 +4386,13 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
|
|
||||||
GetPieceInsertPosition(Last, Pos, Rot);
|
GetPieceInsertPosition(Last, Pos, Rot);
|
||||||
|
|
||||||
pPiece->Initialize(Pos[0], Pos[1], Pos[2], m_nCurStep);
|
pPiece->Initialize(Pos[0], Pos[1], Pos[2], mCurrentStep);
|
||||||
|
|
||||||
pPiece->ChangeKey(m_nCurStep, false, Rot, LC_PK_ROTATION);
|
pPiece->ChangeKey(mCurrentStep, false, Rot, LC_PK_ROTATION);
|
||||||
pPiece->UpdatePosition(m_nCurStep);
|
pPiece->UpdatePosition(mCurrentStep);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pPiece->Initialize(0, 0, 0, m_nCurStep);
|
pPiece->Initialize(0, 0, 0, mCurrentStep);
|
||||||
|
|
||||||
pPiece->SetColorIndex(gMainWindow->mColorIndex);
|
pPiece->SetColorIndex(gMainWindow->mColorIndex);
|
||||||
pPiece->CreateName(mPieces);
|
pPiece->CreateName(mPieces);
|
||||||
|
@ -4558,14 +4544,14 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
lcVector4& Position = Minifig.Matrices[i][3];
|
lcVector4& Position = Minifig.Matrices[i][3];
|
||||||
lcVector4 Rotation = lcMatrix44ToAxisAngle(Minifig.Matrices[i]);
|
lcVector4 Rotation = lcMatrix44ToAxisAngle(Minifig.Matrices[i]);
|
||||||
Rotation[3] *= LC_RTOD;
|
Rotation[3] *= LC_RTOD;
|
||||||
pPiece->Initialize(Position[0], Position[1], Position[2], m_nCurStep);
|
pPiece->Initialize(Position[0], Position[1], Position[2], mCurrentStep);
|
||||||
pPiece->SetColorIndex(Minifig.Colors[i]);
|
pPiece->SetColorIndex(Minifig.Colors[i]);
|
||||||
pPiece->CreateName(mPieces);
|
pPiece->CreateName(mPieces);
|
||||||
mPieces.Add(pPiece);
|
mPieces.Add(pPiece);
|
||||||
pPiece->SetSelected(true);
|
pPiece->SetSelected(true);
|
||||||
|
|
||||||
pPiece->ChangeKey(1, false, Rotation, LC_PK_ROTATION);
|
pPiece->ChangeKey(1, false, Rotation, LC_PK_ROTATION);
|
||||||
pPiece->UpdatePosition(m_nCurStep);
|
pPiece->UpdatePosition(mCurrentStep);
|
||||||
|
|
||||||
SystemPieceComboAdd(Minifig.Parts[i]->m_strDescription);
|
SystemPieceComboAdd(Minifig.Parts[i]->m_strDescription);
|
||||||
}
|
}
|
||||||
|
@ -4693,7 +4679,7 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
Piece* NewPiece = new Piece(pPiece->mPieceInfo);
|
Piece* NewPiece = new Piece(pPiece->mPieceInfo);
|
||||||
NewPieces.Add(NewPiece);
|
NewPieces.Add(NewPiece);
|
||||||
|
|
||||||
NewPiece->Initialize(Position[0] + Offset[0], Position[1] + Offset[1], Position[2] + Offset[2], m_nCurStep);
|
NewPiece->Initialize(Position[0] + Offset[0], Position[1] + Offset[1], Position[2] + Offset[2], mCurrentStep);
|
||||||
NewPiece->SetColorIndex(pPiece->mColorIndex);
|
NewPiece->SetColorIndex(pPiece->mColorIndex);
|
||||||
NewPiece->ChangeKey(1, false, AxisAngle, LC_PK_ROTATION);
|
NewPiece->ChangeKey(1, false, AxisAngle, LC_PK_ROTATION);
|
||||||
}
|
}
|
||||||
|
@ -4705,7 +4691,7 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
{
|
{
|
||||||
Piece* Piece = NewPieces[PieceIdx];
|
Piece* Piece = NewPieces[PieceIdx];
|
||||||
Piece->CreateName(mPieces);
|
Piece->CreateName(mPieces);
|
||||||
Piece->UpdatePosition(m_nCurStep);
|
Piece->UpdatePosition(mCurrentStep);
|
||||||
mPieces.Add(Piece);
|
mPieces.Add(Piece);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4940,7 +4926,7 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
|
|
||||||
case LC_PIECE_SHOW_EARLIER:
|
case LC_PIECE_SHOW_EARLIER:
|
||||||
{
|
{
|
||||||
bool redraw = false;
|
bool Redraw = false;
|
||||||
|
|
||||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||||
{
|
{
|
||||||
|
@ -4948,25 +4934,27 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
|
|
||||||
if (Piece->IsSelected())
|
if (Piece->IsSelected())
|
||||||
{
|
{
|
||||||
unsigned char t = Piece->GetStepShow();
|
lcStep Step = Piece->GetStepShow();
|
||||||
if (t > 1)
|
|
||||||
|
if (Step > 1)
|
||||||
{
|
{
|
||||||
redraw = true;
|
Redraw = true;
|
||||||
Piece->SetStepShow(t-1);
|
Piece->SetStepShow(Step - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (redraw)
|
if (Redraw)
|
||||||
{
|
{
|
||||||
CheckPoint("Modifying");
|
CheckPoint("Modifying");
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
|
UpdateSelection();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case LC_PIECE_SHOW_LATER:
|
case LC_PIECE_SHOW_LATER:
|
||||||
{
|
{
|
||||||
bool redraw = false;
|
bool Redraw = false;
|
||||||
|
|
||||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||||
{
|
{
|
||||||
|
@ -4974,23 +4962,25 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
|
|
||||||
if (Piece->IsSelected())
|
if (Piece->IsSelected())
|
||||||
{
|
{
|
||||||
unsigned char t = Piece->GetStepShow();
|
lcStep Step = Piece->GetStepShow();
|
||||||
if (t < 255)
|
|
||||||
{
|
|
||||||
redraw = true;
|
|
||||||
Piece->SetStepShow(t+1);
|
|
||||||
|
|
||||||
if (t == m_nCurStep)
|
if (Step < LC_STEP_MAX)
|
||||||
|
{
|
||||||
|
Step++;
|
||||||
|
Redraw = true;
|
||||||
|
Piece->SetStepShow(Step);
|
||||||
|
|
||||||
|
if (Step > mCurrentStep)
|
||||||
Piece->SetSelected(false);
|
Piece->SetSelected(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (redraw)
|
if (Redraw)
|
||||||
{
|
{
|
||||||
CheckPoint("Modifying");
|
CheckPoint("Modifying");
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
UpdateSelection ();
|
UpdateSelection();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
@ -5049,57 +5039,58 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
Center = lcVector3((bs[0] + bs[3]) * 0.5f, (bs[1] + bs[4]) * 0.5f, (bs[2] + bs[5]) * 0.5f);
|
Center = lcVector3((bs[0] + bs[3]) * 0.5f, (bs[1] + bs[4]) * 0.5f, (bs[2] + bs[5]) * 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
gMainWindow->GetActiveView()->mCamera->Center(Center, m_nCurStep, gMainWindow->GetAddKeys());
|
gMainWindow->GetActiveView()->mCamera->Center(Center, mCurrentStep, gMainWindow->GetAddKeys());
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LC_VIEW_TIME_NEXT:
|
case LC_VIEW_TIME_NEXT:
|
||||||
{
|
{
|
||||||
m_nCurStep++;
|
if (mCurrentStep == LC_STEP_MAX)
|
||||||
|
break;
|
||||||
|
|
||||||
|
mCurrentStep++;
|
||||||
|
|
||||||
CalculateStep();
|
CalculateStep();
|
||||||
UpdateSelection();
|
UpdateSelection();
|
||||||
gMainWindow->UpdateFocusObject(GetFocusObject());
|
gMainWindow->UpdateFocusObject(GetFocusObject());
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
|
gMainWindow->UpdateCurrentStep();
|
||||||
gMainWindow->UpdateTime(m_nCurStep, 255);
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case LC_VIEW_TIME_PREVIOUS:
|
case LC_VIEW_TIME_PREVIOUS:
|
||||||
{
|
{
|
||||||
m_nCurStep--;
|
if (mCurrentStep == 1)
|
||||||
|
break;
|
||||||
|
mCurrentStep--;
|
||||||
|
|
||||||
CalculateStep();
|
CalculateStep();
|
||||||
UpdateSelection();
|
UpdateSelection();
|
||||||
gMainWindow->UpdateFocusObject(GetFocusObject());
|
gMainWindow->UpdateFocusObject(GetFocusObject());
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
|
gMainWindow->UpdateCurrentStep();
|
||||||
gMainWindow->UpdateTime(m_nCurStep, 255);
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case LC_VIEW_TIME_FIRST:
|
case LC_VIEW_TIME_FIRST:
|
||||||
{
|
{
|
||||||
m_nCurStep = 1;
|
mCurrentStep = 1;
|
||||||
|
|
||||||
CalculateStep();
|
CalculateStep();
|
||||||
UpdateSelection();
|
UpdateSelection();
|
||||||
gMainWindow->UpdateFocusObject(GetFocusObject());
|
gMainWindow->UpdateFocusObject(GetFocusObject());
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
|
gMainWindow->UpdateCurrentStep();
|
||||||
gMainWindow->UpdateTime(m_nCurStep, 255);
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case LC_VIEW_TIME_LAST:
|
case LC_VIEW_TIME_LAST:
|
||||||
{
|
{
|
||||||
m_nCurStep = GetLastStep ();
|
mCurrentStep = GetLastStep();
|
||||||
|
|
||||||
CalculateStep();
|
CalculateStep();
|
||||||
UpdateSelection();
|
UpdateSelection();
|
||||||
gMainWindow->UpdateFocusObject(GetFocusObject());
|
gMainWindow->UpdateFocusObject(GetFocusObject());
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
|
gMainWindow->UpdateCurrentStep();
|
||||||
gMainWindow->UpdateTime(m_nCurStep, 255);
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case LC_VIEW_TIME_INSERT:
|
case LC_VIEW_TIME_INSERT:
|
||||||
|
@ -5107,16 +5098,16 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||||
{
|
{
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
Piece* Piece = mPieces[PieceIdx];
|
||||||
Piece->InsertTime(m_nCurStep, 1);
|
Piece->InsertTime(mCurrentStep, 1);
|
||||||
if (Piece->IsSelected() && !Piece->IsVisible(m_nCurStep))
|
if (Piece->IsSelected() && !Piece->IsVisible(mCurrentStep))
|
||||||
Piece->SetSelected(false);
|
Piece->SetSelected(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int CameraIdx = 0; CameraIdx < mCameras.GetSize(); CameraIdx++)
|
for (int CameraIdx = 0; CameraIdx < mCameras.GetSize(); CameraIdx++)
|
||||||
mCameras[CameraIdx]->InsertTime(m_nCurStep, 1);
|
mCameras[CameraIdx]->InsertTime(mCurrentStep, 1);
|
||||||
|
|
||||||
for (int LightIdx = 0; LightIdx < mLights.GetSize(); LightIdx++)
|
for (int LightIdx = 0; LightIdx < mLights.GetSize(); LightIdx++)
|
||||||
mLights[LightIdx]->InsertTime(m_nCurStep, 1);
|
mLights[LightIdx]->InsertTime(mCurrentStep, 1);
|
||||||
|
|
||||||
CheckPoint("Adding Step");
|
CheckPoint("Adding Step");
|
||||||
CalculateStep();
|
CalculateStep();
|
||||||
|
@ -5130,16 +5121,16 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||||
{
|
{
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
Piece* Piece = mPieces[PieceIdx];
|
||||||
Piece->RemoveTime(m_nCurStep, 1);
|
Piece->RemoveTime(mCurrentStep, 1);
|
||||||
if (Piece->IsSelected() && !Piece->IsVisible(m_nCurStep))
|
if (Piece->IsSelected() && !Piece->IsVisible(mCurrentStep))
|
||||||
Piece->SetSelected(false);
|
Piece->SetSelected(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int CameraIdx = 0; CameraIdx < mCameras.GetSize(); CameraIdx++)
|
for (int CameraIdx = 0; CameraIdx < mCameras.GetSize(); CameraIdx++)
|
||||||
mCameras[CameraIdx]->RemoveTime(m_nCurStep, 1);
|
mCameras[CameraIdx]->RemoveTime(mCurrentStep, 1);
|
||||||
|
|
||||||
for (int LightIdx = 0; LightIdx < mLights.GetSize(); LightIdx++)
|
for (int LightIdx = 0; LightIdx < mLights.GetSize(); LightIdx++)
|
||||||
mLights[LightIdx]->RemoveTime(m_nCurStep, 1);
|
mLights[LightIdx]->RemoveTime(mCurrentStep, 1);
|
||||||
|
|
||||||
CheckPoint("Removing Step");
|
CheckPoint("Removing Step");
|
||||||
CalculateStep();
|
CalculateStep();
|
||||||
|
@ -5150,49 +5141,49 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
|
|
||||||
case LC_VIEW_VIEWPOINT_FRONT:
|
case LC_VIEW_VIEWPOINT_FRONT:
|
||||||
{
|
{
|
||||||
gMainWindow->GetActiveView()->mCamera->SetViewpoint(LC_VIEWPOINT_FRONT, m_nCurStep, gMainWindow->GetAddKeys());
|
gMainWindow->GetActiveView()->mCamera->SetViewpoint(LC_VIEWPOINT_FRONT, mCurrentStep, gMainWindow->GetAddKeys());
|
||||||
HandleCommand(LC_VIEW_ZOOM_EXTENTS);
|
HandleCommand(LC_VIEW_ZOOM_EXTENTS);
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case LC_VIEW_VIEWPOINT_BACK:
|
case LC_VIEW_VIEWPOINT_BACK:
|
||||||
{
|
{
|
||||||
gMainWindow->GetActiveView()->mCamera->SetViewpoint(LC_VIEWPOINT_BACK, m_nCurStep, gMainWindow->GetAddKeys());
|
gMainWindow->GetActiveView()->mCamera->SetViewpoint(LC_VIEWPOINT_BACK, mCurrentStep, gMainWindow->GetAddKeys());
|
||||||
HandleCommand(LC_VIEW_ZOOM_EXTENTS);
|
HandleCommand(LC_VIEW_ZOOM_EXTENTS);
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case LC_VIEW_VIEWPOINT_TOP:
|
case LC_VIEW_VIEWPOINT_TOP:
|
||||||
{
|
{
|
||||||
gMainWindow->GetActiveView()->mCamera->SetViewpoint(LC_VIEWPOINT_TOP, m_nCurStep, gMainWindow->GetAddKeys());
|
gMainWindow->GetActiveView()->mCamera->SetViewpoint(LC_VIEWPOINT_TOP, mCurrentStep, gMainWindow->GetAddKeys());
|
||||||
HandleCommand(LC_VIEW_ZOOM_EXTENTS);
|
HandleCommand(LC_VIEW_ZOOM_EXTENTS);
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case LC_VIEW_VIEWPOINT_BOTTOM:
|
case LC_VIEW_VIEWPOINT_BOTTOM:
|
||||||
{
|
{
|
||||||
gMainWindow->GetActiveView()->mCamera->SetViewpoint(LC_VIEWPOINT_BOTTOM, m_nCurStep, gMainWindow->GetAddKeys());
|
gMainWindow->GetActiveView()->mCamera->SetViewpoint(LC_VIEWPOINT_BOTTOM, mCurrentStep, gMainWindow->GetAddKeys());
|
||||||
HandleCommand(LC_VIEW_ZOOM_EXTENTS);
|
HandleCommand(LC_VIEW_ZOOM_EXTENTS);
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case LC_VIEW_VIEWPOINT_LEFT:
|
case LC_VIEW_VIEWPOINT_LEFT:
|
||||||
{
|
{
|
||||||
gMainWindow->GetActiveView()->mCamera->SetViewpoint(LC_VIEWPOINT_LEFT, m_nCurStep, gMainWindow->GetAddKeys());
|
gMainWindow->GetActiveView()->mCamera->SetViewpoint(LC_VIEWPOINT_LEFT, mCurrentStep, gMainWindow->GetAddKeys());
|
||||||
HandleCommand(LC_VIEW_ZOOM_EXTENTS);
|
HandleCommand(LC_VIEW_ZOOM_EXTENTS);
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case LC_VIEW_VIEWPOINT_RIGHT:
|
case LC_VIEW_VIEWPOINT_RIGHT:
|
||||||
{
|
{
|
||||||
gMainWindow->GetActiveView()->mCamera->SetViewpoint(LC_VIEWPOINT_RIGHT, m_nCurStep, gMainWindow->GetAddKeys());
|
gMainWindow->GetActiveView()->mCamera->SetViewpoint(LC_VIEWPOINT_RIGHT, mCurrentStep, gMainWindow->GetAddKeys());
|
||||||
HandleCommand(LC_VIEW_ZOOM_EXTENTS);
|
HandleCommand(LC_VIEW_ZOOM_EXTENTS);
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case LC_VIEW_VIEWPOINT_HOME:
|
case LC_VIEW_VIEWPOINT_HOME:
|
||||||
{
|
{
|
||||||
gMainWindow->GetActiveView()->mCamera->SetViewpoint(LC_VIEWPOINT_HOME, m_nCurStep, gMainWindow->GetAddKeys());
|
gMainWindow->GetActiveView()->mCamera->SetViewpoint(LC_VIEWPOINT_HOME, mCurrentStep, gMainWindow->GetAddKeys());
|
||||||
HandleCommand(LC_VIEW_ZOOM_EXTENTS);
|
HandleCommand(LC_VIEW_ZOOM_EXTENTS);
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
} break;
|
} break;
|
||||||
|
@ -5684,7 +5675,7 @@ void Project::SelectGroup(Group* TopGroup, bool Select)
|
||||||
{
|
{
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
Piece* Piece = mPieces[PieceIdx];
|
||||||
|
|
||||||
if (!Piece->IsSelected() && Piece->IsVisible(m_nCurStep) && (Piece->GetTopGroup() == TopGroup))
|
if (!Piece->IsSelected() && Piece->IsVisible(mCurrentStep) && (Piece->GetTopGroup() == TopGroup))
|
||||||
Piece->SetSelected(Select);
|
Piece->SetSelected(Select);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5921,7 +5912,7 @@ void Project::RayTest(lcObjectRayTest& ObjectRayTest) const
|
||||||
{
|
{
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
Piece* Piece = mPieces[PieceIdx];
|
||||||
|
|
||||||
if (Piece->IsVisible(m_nCurStep))
|
if (Piece->IsVisible(mCurrentStep))
|
||||||
Piece->RayTest(ObjectRayTest);
|
Piece->RayTest(ObjectRayTest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5947,7 +5938,7 @@ void Project::BoxTest(lcObjectBoxTest& ObjectBoxTest) const
|
||||||
{
|
{
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
Piece* Piece = mPieces[PieceIdx];
|
||||||
|
|
||||||
if (Piece->IsVisible(m_nCurStep))
|
if (Piece->IsVisible(mCurrentStep))
|
||||||
Piece->BoxTest(ObjectBoxTest);
|
Piece->BoxTest(ObjectBoxTest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6154,8 +6145,8 @@ bool Project::MoveSelectedObjects(lcVector3& Move, lcVector3& Remainder, bool Sn
|
||||||
|
|
||||||
if (Piece->IsSelected())
|
if (Piece->IsSelected())
|
||||||
{
|
{
|
||||||
Piece->Move(m_nCurStep, gMainWindow->GetAddKeys(), TransformedMove);
|
Piece->Move(mCurrentStep, gMainWindow->GetAddKeys(), TransformedMove);
|
||||||
Piece->UpdatePosition(m_nCurStep);
|
Piece->UpdatePosition(mCurrentStep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6165,8 +6156,8 @@ bool Project::MoveSelectedObjects(lcVector3& Move, lcVector3& Remainder, bool Sn
|
||||||
|
|
||||||
if (Camera->IsSelected())
|
if (Camera->IsSelected())
|
||||||
{
|
{
|
||||||
Camera->Move(m_nCurStep, gMainWindow->GetAddKeys(), TransformedMove);
|
Camera->Move(mCurrentStep, gMainWindow->GetAddKeys(), TransformedMove);
|
||||||
Camera->UpdatePosition(m_nCurStep);
|
Camera->UpdatePosition(mCurrentStep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6176,8 +6167,8 @@ bool Project::MoveSelectedObjects(lcVector3& Move, lcVector3& Remainder, bool Sn
|
||||||
|
|
||||||
if (Light->IsSelected())
|
if (Light->IsSelected())
|
||||||
{
|
{
|
||||||
Light->Move(m_nCurStep, gMainWindow->GetAddKeys(), TransformedMove);
|
Light->Move(mCurrentStep, gMainWindow->GetAddKeys(), TransformedMove);
|
||||||
Light->UpdatePosition(m_nCurStep);
|
Light->UpdatePosition(mCurrentStep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6335,7 +6326,7 @@ bool Project::RotateSelectedObjects(lcVector3& Delta, lcVector3& Remainder, bool
|
||||||
pos[1] = Center[1] + Distance[1];
|
pos[1] = Center[1] + Distance[1];
|
||||||
pos[2] = Center[2] + Distance[2];
|
pos[2] = Center[2] + Distance[2];
|
||||||
|
|
||||||
Piece->ChangeKey(m_nCurStep, gMainWindow->GetAddKeys(), pos, LC_PK_POSITION);
|
Piece->ChangeKey(mCurrentStep, gMainWindow->GetAddKeys(), pos, LC_PK_POSITION);
|
||||||
}
|
}
|
||||||
|
|
||||||
rot[0] = NewRotation[0];
|
rot[0] = NewRotation[0];
|
||||||
|
@ -6343,8 +6334,8 @@ bool Project::RotateSelectedObjects(lcVector3& Delta, lcVector3& Remainder, bool
|
||||||
rot[2] = NewRotation[2];
|
rot[2] = NewRotation[2];
|
||||||
rot[3] = NewRotation[3] * LC_RTOD;
|
rot[3] = NewRotation[3] * LC_RTOD;
|
||||||
|
|
||||||
Piece->ChangeKey(m_nCurStep, gMainWindow->GetAddKeys(), rot, LC_PK_ROTATION);
|
Piece->ChangeKey(mCurrentStep, gMainWindow->GetAddKeys(), rot, LC_PK_ROTATION);
|
||||||
Piece->UpdatePosition(m_nCurStep);
|
Piece->UpdatePosition(mCurrentStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -6388,8 +6379,8 @@ void Project::TransformSelectedObjects(LC_TRANSFORM_TYPE Type, const lcVector3&
|
||||||
|
|
||||||
if (pCamera->IsSelected())
|
if (pCamera->IsSelected())
|
||||||
{
|
{
|
||||||
pCamera->Move(m_nCurStep, gMainWindow->GetAddKeys(), Offset);
|
pCamera->Move(mCurrentStep, gMainWindow->GetAddKeys(), Offset);
|
||||||
pCamera->UpdatePosition(m_nCurStep);
|
pCamera->UpdatePosition(mCurrentStep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6399,8 +6390,8 @@ void Project::TransformSelectedObjects(LC_TRANSFORM_TYPE Type, const lcVector3&
|
||||||
|
|
||||||
if (pLight->IsSelected())
|
if (pLight->IsSelected())
|
||||||
{
|
{
|
||||||
pLight->Move(m_nCurStep, gMainWindow->GetAddKeys(), Offset);
|
pLight->Move(mCurrentStep, gMainWindow->GetAddKeys(), Offset);
|
||||||
pLight->UpdatePosition (m_nCurStep);
|
pLight->UpdatePosition (mCurrentStep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6410,8 +6401,8 @@ void Project::TransformSelectedObjects(LC_TRANSFORM_TYPE Type, const lcVector3&
|
||||||
|
|
||||||
if (Piece->IsSelected())
|
if (Piece->IsSelected())
|
||||||
{
|
{
|
||||||
Piece->Move(m_nCurStep, gMainWindow->GetAddKeys(), Offset);
|
Piece->Move(mCurrentStep, gMainWindow->GetAddKeys(), Offset);
|
||||||
Piece->UpdatePosition(m_nCurStep);
|
Piece->UpdatePosition(mCurrentStep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6469,8 +6460,8 @@ void Project::TransformSelectedObjects(LC_TRANSFORM_TYPE Type, const lcVector3&
|
||||||
|
|
||||||
if (Piece->IsSelected())
|
if (Piece->IsSelected())
|
||||||
{
|
{
|
||||||
Piece->ChangeKey(m_nCurStep, gMainWindow->GetAddKeys(), NewRotation, LC_PK_ROTATION);
|
Piece->ChangeKey(mCurrentStep, gMainWindow->GetAddKeys(), NewRotation, LC_PK_ROTATION);
|
||||||
Piece->UpdatePosition(m_nCurStep);
|
Piece->UpdatePosition(mCurrentStep);
|
||||||
nSel++;
|
nSel++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6510,8 +6501,8 @@ void Project::ModifyObject(Object* Object, lcObjectProperty Property, void* Valu
|
||||||
|
|
||||||
if (Part->mPosition != Position)
|
if (Part->mPosition != Position)
|
||||||
{
|
{
|
||||||
Part->ChangeKey(m_nCurStep, gMainWindow->GetAddKeys(), Position, LC_PK_POSITION);
|
Part->ChangeKey(mCurrentStep, gMainWindow->GetAddKeys(), Position, LC_PK_POSITION);
|
||||||
Part->UpdatePosition(m_nCurStep);
|
Part->UpdatePosition(mCurrentStep);
|
||||||
|
|
||||||
CheckPointString = "Moving";
|
CheckPointString = "Moving";
|
||||||
}
|
}
|
||||||
|
@ -6524,8 +6515,8 @@ void Project::ModifyObject(Object* Object, lcObjectProperty Property, void* Valu
|
||||||
|
|
||||||
if (Rotation != Part->mRotation)
|
if (Rotation != Part->mRotation)
|
||||||
{
|
{
|
||||||
Part->ChangeKey(m_nCurStep, gMainWindow->GetAddKeys(), Rotation, LC_PK_ROTATION);
|
Part->ChangeKey(mCurrentStep, gMainWindow->GetAddKeys(), Rotation, LC_PK_ROTATION);
|
||||||
Part->UpdatePosition(m_nCurStep);
|
Part->UpdatePosition(mCurrentStep);
|
||||||
|
|
||||||
CheckPointString = "Rotating";
|
CheckPointString = "Rotating";
|
||||||
}
|
}
|
||||||
|
@ -6533,13 +6524,13 @@ void Project::ModifyObject(Object* Object, lcObjectProperty Property, void* Valu
|
||||||
|
|
||||||
case LC_PIECE_PROPERTY_SHOW:
|
case LC_PIECE_PROPERTY_SHOW:
|
||||||
{
|
{
|
||||||
lcuint32 Show = *(lcuint32*)Value;
|
lcStep Step = *(lcStep*)Value;
|
||||||
Piece* Part = (Piece*)Object;
|
Piece* Part = (Piece*)Object;
|
||||||
|
|
||||||
if (Show != Part->GetStepShow())
|
if (Step != Part->GetStepShow())
|
||||||
{
|
{
|
||||||
Part->SetStepShow(Show);
|
Part->SetStepShow(Step);
|
||||||
if (Part->IsSelected() && !Part->IsVisible(m_nCurStep))
|
if (Part->IsSelected() && !Part->IsVisible(mCurrentStep))
|
||||||
Part->SetSelected(false);
|
Part->SetSelected(false);
|
||||||
|
|
||||||
CheckPointString = "Show";
|
CheckPointString = "Show";
|
||||||
|
@ -6548,12 +6539,12 @@ void Project::ModifyObject(Object* Object, lcObjectProperty Property, void* Valu
|
||||||
|
|
||||||
case LC_PIECE_PROPERTY_HIDE:
|
case LC_PIECE_PROPERTY_HIDE:
|
||||||
{
|
{
|
||||||
lcuint32 Hide = *(lcuint32*)Value;
|
lcStep Step = *(lcuint32*)Value;
|
||||||
Piece* Part = (Piece*)Object;
|
Piece* Part = (Piece*)Object;
|
||||||
|
|
||||||
if (Hide != Part->GetStepHide())
|
if (Step != Part->GetStepHide())
|
||||||
{
|
{
|
||||||
Part->SetStepHide(Hide);
|
Part->SetStepHide(Step);
|
||||||
|
|
||||||
CheckPointString = "Hide";
|
CheckPointString = "Hide";
|
||||||
}
|
}
|
||||||
|
@ -6594,8 +6585,8 @@ void Project::ModifyObject(Object* Object, lcObjectProperty Property, void* Valu
|
||||||
|
|
||||||
if (camera->mPosition != Position)
|
if (camera->mPosition != Position)
|
||||||
{
|
{
|
||||||
camera->ChangeKey(m_nCurStep, gMainWindow->GetAddKeys(), Position, LC_CK_EYE);
|
camera->ChangeKey(mCurrentStep, gMainWindow->GetAddKeys(), Position, LC_CK_EYE);
|
||||||
camera->UpdatePosition(m_nCurStep);
|
camera->UpdatePosition(mCurrentStep);
|
||||||
|
|
||||||
CheckPointString = "Camera";
|
CheckPointString = "Camera";
|
||||||
}
|
}
|
||||||
|
@ -6608,8 +6599,8 @@ void Project::ModifyObject(Object* Object, lcObjectProperty Property, void* Valu
|
||||||
|
|
||||||
if (camera->mTargetPosition != TargetPosition)
|
if (camera->mTargetPosition != TargetPosition)
|
||||||
{
|
{
|
||||||
camera->ChangeKey(m_nCurStep, gMainWindow->GetAddKeys(), TargetPosition, LC_CK_TARGET);
|
camera->ChangeKey(mCurrentStep, gMainWindow->GetAddKeys(), TargetPosition, LC_CK_TARGET);
|
||||||
camera->UpdatePosition(m_nCurStep);
|
camera->UpdatePosition(mCurrentStep);
|
||||||
|
|
||||||
CheckPointString = "Camera";
|
CheckPointString = "Camera";
|
||||||
}
|
}
|
||||||
|
@ -6622,8 +6613,8 @@ void Project::ModifyObject(Object* Object, lcObjectProperty Property, void* Valu
|
||||||
|
|
||||||
if (camera->mUpVector != Up)
|
if (camera->mUpVector != Up)
|
||||||
{
|
{
|
||||||
camera->ChangeKey(m_nCurStep, gMainWindow->GetAddKeys(), Up, LC_CK_UP);
|
camera->ChangeKey(mCurrentStep, gMainWindow->GetAddKeys(), Up, LC_CK_UP);
|
||||||
camera->UpdatePosition(m_nCurStep);
|
camera->UpdatePosition(mCurrentStep);
|
||||||
|
|
||||||
CheckPointString = "Camera";
|
CheckPointString = "Camera";
|
||||||
}
|
}
|
||||||
|
@ -6637,7 +6628,7 @@ void Project::ModifyObject(Object* Object, lcObjectProperty Property, void* Valu
|
||||||
if (camera->IsOrtho() != Ortho)
|
if (camera->IsOrtho() != Ortho)
|
||||||
{
|
{
|
||||||
camera->SetOrtho(Ortho);
|
camera->SetOrtho(Ortho);
|
||||||
camera->UpdatePosition(m_nCurStep);
|
camera->UpdatePosition(mCurrentStep);
|
||||||
|
|
||||||
CheckPointString = "Camera";
|
CheckPointString = "Camera";
|
||||||
}
|
}
|
||||||
|
@ -6651,7 +6642,7 @@ void Project::ModifyObject(Object* Object, lcObjectProperty Property, void* Valu
|
||||||
if (camera->m_fovy != FOV)
|
if (camera->m_fovy != FOV)
|
||||||
{
|
{
|
||||||
camera->m_fovy = FOV;
|
camera->m_fovy = FOV;
|
||||||
camera->UpdatePosition(m_nCurStep);
|
camera->UpdatePosition(mCurrentStep);
|
||||||
|
|
||||||
CheckPointString = "Camera";
|
CheckPointString = "Camera";
|
||||||
}
|
}
|
||||||
|
@ -6665,7 +6656,7 @@ void Project::ModifyObject(Object* Object, lcObjectProperty Property, void* Valu
|
||||||
if (camera->m_zNear != Near)
|
if (camera->m_zNear != Near)
|
||||||
{
|
{
|
||||||
camera->m_zNear= Near;
|
camera->m_zNear= Near;
|
||||||
camera->UpdatePosition(m_nCurStep);
|
camera->UpdatePosition(mCurrentStep);
|
||||||
|
|
||||||
CheckPointString = "Camera";
|
CheckPointString = "Camera";
|
||||||
}
|
}
|
||||||
|
@ -6679,7 +6670,7 @@ void Project::ModifyObject(Object* Object, lcObjectProperty Property, void* Valu
|
||||||
if (camera->m_zFar != Far)
|
if (camera->m_zFar != Far)
|
||||||
{
|
{
|
||||||
camera->m_zFar = Far;
|
camera->m_zFar = Far;
|
||||||
camera->UpdatePosition(m_nCurStep);
|
camera->UpdatePosition(mCurrentStep);
|
||||||
|
|
||||||
CheckPointString = "Camera";
|
CheckPointString = "Camera";
|
||||||
}
|
}
|
||||||
|
@ -6714,7 +6705,7 @@ void Project::ZoomActiveView(int Amount)
|
||||||
{
|
{
|
||||||
float ScaledAmount = 2.0f * Amount / (21 - lcGetProfileInt(LC_PROFILE_MOUSE_SENSITIVITY));
|
float ScaledAmount = 2.0f * Amount / (21 - lcGetProfileInt(LC_PROFILE_MOUSE_SENSITIVITY));
|
||||||
|
|
||||||
gMainWindow->GetActiveView()->mCamera->Zoom(ScaledAmount, m_nCurStep, gMainWindow->GetAddKeys());
|
gMainWindow->GetActiveView()->mCamera->Zoom(ScaledAmount, mCurrentStep, gMainWindow->GetAddKeys());
|
||||||
gMainWindow->UpdateFocusObject(GetFocusObject());
|
gMainWindow->UpdateFocusObject(GetFocusObject());
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
}
|
}
|
||||||
|
@ -6791,10 +6782,10 @@ void Project::EndMouseTool(lcTool Tool, bool Accept)
|
||||||
void Project::InsertPieceToolClicked(const lcVector3& Position, const lcVector4& Rotation)
|
void Project::InsertPieceToolClicked(const lcVector3& Position, const lcVector4& Rotation)
|
||||||
{
|
{
|
||||||
lcPiece* Piece = new lcPiece(m_pCurPiece);
|
lcPiece* Piece = new lcPiece(m_pCurPiece);
|
||||||
Piece->Initialize(Position[0], Position[1], Position[2], m_nCurStep);
|
Piece->Initialize(Position[0], Position[1], Position[2], mCurrentStep);
|
||||||
Piece->SetColorIndex(gMainWindow->mColorIndex);
|
Piece->SetColorIndex(gMainWindow->mColorIndex);
|
||||||
Piece->ChangeKey(m_nCurStep, false, Rotation, LC_PK_ROTATION);
|
Piece->ChangeKey(mCurrentStep, false, Rotation, LC_PK_ROTATION);
|
||||||
Piece->UpdatePosition(m_nCurStep);
|
Piece->UpdatePosition(mCurrentStep);
|
||||||
Piece->CreateName(mPieces);
|
Piece->CreateName(mPieces);
|
||||||
mPieces.Add(Piece);
|
mPieces.Add(Piece);
|
||||||
|
|
||||||
|
@ -6936,14 +6927,14 @@ void Project::PaintToolClicked(lcObject* Object)
|
||||||
|
|
||||||
void Project::UpdateZoomTool(lcCamera* Camera, float Mouse)
|
void Project::UpdateZoomTool(lcCamera* Camera, float Mouse)
|
||||||
{
|
{
|
||||||
Camera->Zoom(Mouse - mMouseToolDistance.x, m_nCurStep, gMainWindow->GetAddKeys());
|
Camera->Zoom(Mouse - mMouseToolDistance.x, mCurrentStep, gMainWindow->GetAddKeys());
|
||||||
mMouseToolDistance.x = Mouse;
|
mMouseToolDistance.x = Mouse;
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::UpdatePanTool(lcCamera* Camera, float MouseX, float MouseY)
|
void Project::UpdatePanTool(lcCamera* Camera, float MouseX, float MouseY)
|
||||||
{
|
{
|
||||||
Camera->Pan(MouseX - mMouseToolDistance.x, MouseY - mMouseToolDistance.y, m_nCurStep, gMainWindow->GetAddKeys());
|
Camera->Pan(MouseX - mMouseToolDistance.x, MouseY - mMouseToolDistance.y, mCurrentStep, gMainWindow->GetAddKeys());
|
||||||
mMouseToolDistance.x = MouseX;
|
mMouseToolDistance.x = MouseX;
|
||||||
mMouseToolDistance.y = MouseY;
|
mMouseToolDistance.y = MouseY;
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
|
@ -6953,7 +6944,7 @@ void Project::UpdateOrbitTool(lcCamera* Camera, float MouseX, float MouseY)
|
||||||
{
|
{
|
||||||
lcVector3 Center;
|
lcVector3 Center;
|
||||||
GetSelectionCenter(Center);
|
GetSelectionCenter(Center);
|
||||||
Camera->Orbit(MouseX - mMouseToolDistance.x, MouseY - mMouseToolDistance.y, Center, m_nCurStep, gMainWindow->GetAddKeys());
|
Camera->Orbit(MouseX - mMouseToolDistance.x, MouseY - mMouseToolDistance.y, Center, mCurrentStep, gMainWindow->GetAddKeys());
|
||||||
mMouseToolDistance.x = MouseX;
|
mMouseToolDistance.x = MouseX;
|
||||||
mMouseToolDistance.y = MouseY;
|
mMouseToolDistance.y = MouseY;
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
|
@ -6961,14 +6952,14 @@ void Project::UpdateOrbitTool(lcCamera* Camera, float MouseX, float MouseY)
|
||||||
|
|
||||||
void Project::UpdateRollTool(lcCamera* Camera, float Mouse)
|
void Project::UpdateRollTool(lcCamera* Camera, float Mouse)
|
||||||
{
|
{
|
||||||
Camera->Roll(Mouse - mMouseToolDistance.x, m_nCurStep, gMainWindow->GetAddKeys());
|
Camera->Roll(Mouse - mMouseToolDistance.x, mCurrentStep, gMainWindow->GetAddKeys());
|
||||||
mMouseToolDistance.x = Mouse;
|
mMouseToolDistance.x = Mouse;
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::ZoomRegionToolClicked(lcCamera* Camera, const lcVector3* Points, float RatioX, float RatioY)
|
void Project::ZoomRegionToolClicked(lcCamera* Camera, const lcVector3* Points, float RatioX, float RatioY)
|
||||||
{
|
{
|
||||||
Camera->ZoomRegion(Points, m_nCurStep, gMainWindow->GetAddKeys(), RatioX, RatioY);
|
Camera->ZoomRegion(Points, mCurrentStep, gMainWindow->GetAddKeys(), RatioX, RatioY);
|
||||||
|
|
||||||
gMainWindow->UpdateFocusObject(GetFocusObject());
|
gMainWindow->UpdateFocusObject(GetFocusObject());
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
|
|
|
@ -160,19 +160,12 @@ protected:
|
||||||
lcVector3 mMouseToolDistance;
|
lcVector3 mMouseToolDistance;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool IsModified() const
|
void SetCurrentStep(lcStep Step)
|
||||||
{
|
{
|
||||||
return mSavedHistory != mUndoHistory[0];
|
mCurrentStep = Step;
|
||||||
}
|
|
||||||
|
|
||||||
unsigned char GetLastStep();
|
|
||||||
unsigned short GetCurrentTime ()
|
|
||||||
{ return m_nCurStep; }
|
|
||||||
void SetCurrentTime(unsigned short Time)
|
|
||||||
{
|
|
||||||
m_nCurStep = (unsigned char)Time;
|
|
||||||
CalculateStep();
|
CalculateStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCurrentPiece(PieceInfo* pInfo)
|
void SetCurrentPiece(PieceInfo* pInfo)
|
||||||
{ m_pCurPiece = pInfo; }
|
{ m_pCurPiece = pInfo; }
|
||||||
float* GetBackgroundColor() // todo: remove
|
float* GetBackgroundColor() // todo: remove
|
||||||
|
@ -182,11 +175,6 @@ public:
|
||||||
void GetSnapIndex(int* SnapXY, int* SnapZ, int* SnapAngle) const;
|
void GetSnapIndex(int* SnapXY, int* SnapZ, int* SnapAngle) const;
|
||||||
void GetSnapText(char* SnapXY, char* SnapZ, char* SnapAngle) const;
|
void GetSnapText(char* SnapXY, char* SnapZ, char* SnapAngle) const;
|
||||||
void GetSnapDistance(float* SnapXY, float* SnapZ) const;
|
void GetSnapDistance(float* SnapXY, float* SnapZ) const;
|
||||||
void GetTimeRange(int* from, int* to)
|
|
||||||
{
|
|
||||||
*from = m_nCurStep;
|
|
||||||
*to = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
int GetGroupIndex(lcGroup* Group) const
|
int GetGroupIndex(lcGroup* Group) const
|
||||||
{
|
{
|
||||||
|
@ -207,7 +195,7 @@ public:
|
||||||
void RenderInitialize();
|
void RenderInitialize();
|
||||||
|
|
||||||
void GetPiecesUsed(lcArray<lcPiecesUsedEntry>& PiecesUsed) const;
|
void GetPiecesUsed(lcArray<lcPiecesUsedEntry>& PiecesUsed) const;
|
||||||
void CreateImages(Image* images, int width, int height, unsigned short from, unsigned short to, bool hilite);
|
void CreateImages(Image* images, int width, int height, lcStep from, lcStep to, bool hilite);
|
||||||
void Render(View* view, bool bToMemory);
|
void Render(View* view, bool bToMemory);
|
||||||
void CheckAutoSave();
|
void CheckAutoSave();
|
||||||
bool GetSelectionCenter(lcVector3& Center) const;
|
bool GetSelectionCenter(lcVector3& Center) const;
|
||||||
|
@ -260,7 +248,7 @@ protected:
|
||||||
void RenderSceneObjects(View* view);
|
void RenderSceneObjects(View* view);
|
||||||
void RenderViewports(View* view);
|
void RenderViewports(View* view);
|
||||||
|
|
||||||
void CreateHTMLPieceList(FILE* f, int nStep, bool bImages, const char* ext);
|
void CreateHTMLPieceList(FILE* f, lcStep Step, bool bImages, const char* ext);
|
||||||
void Export3DStudio();
|
void Export3DStudio();
|
||||||
void ExportPOVRay(lcFile& File);
|
void ExportPOVRay(lcFile& File);
|
||||||
void ZoomExtents(int FirstView, int LastView);
|
void ZoomExtents(int FirstView, int LastView);
|
||||||
|
@ -275,10 +263,8 @@ public:
|
||||||
lcuint32 m_nSnap;
|
lcuint32 m_nSnap;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// State variables
|
|
||||||
int mTransformType;
|
int mTransformType;
|
||||||
PieceInfo* m_pCurPiece;
|
PieceInfo* m_pCurPiece;
|
||||||
unsigned char m_nCurStep;
|
|
||||||
|
|
||||||
lcuint16 m_nMoveSnap;
|
lcuint16 m_nMoveSnap;
|
||||||
lcuint16 m_nAngleSnap;
|
lcuint16 m_nAngleSnap;
|
||||||
|
|
|
@ -819,7 +819,7 @@ void lcQMainWindow::print(QPrinter *printer)
|
||||||
GL_BeginRenderToTexture(tileWidth, tileHeight);
|
GL_BeginRenderToTexture(tileWidth, tileHeight);
|
||||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||||
|
|
||||||
unsigned short previousTime = project->GetCurrentTime();
|
lcStep previousTime = project->GetCurrentStep();
|
||||||
|
|
||||||
QPainter painter(printer);
|
QPainter painter(printer);
|
||||||
lcuint8 *buffer = (lcuint8*)malloc(tileWidth * tileHeight * 4);
|
lcuint8 *buffer = (lcuint8*)malloc(tileWidth * tileHeight * 4);
|
||||||
|
@ -836,7 +836,7 @@ void lcQMainWindow::print(QPrinter *printer)
|
||||||
if (printer->printerState() == QPrinter::Aborted || printer->printerState() == QPrinter::Error)
|
if (printer->printerState() == QPrinter::Aborted || printer->printerState() == QPrinter::Error)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int currentStep = 1 + ((page - 1) * rows * columns);
|
lcStep currentStep = 1 + ((page - 1) * rows * columns);
|
||||||
|
|
||||||
for (int row = 0; row < rows; row++)
|
for (int row = 0; row < rows; row++)
|
||||||
{
|
{
|
||||||
|
@ -845,7 +845,7 @@ void lcQMainWindow::print(QPrinter *printer)
|
||||||
if (currentStep > project->GetLastStep())
|
if (currentStep > project->GetLastStep())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
project->SetCurrentTime(currentStep);
|
project->SetCurrentStep(currentStep);
|
||||||
|
|
||||||
if (stepWidth > tileWidth || stepHeight > tileHeight)
|
if (stepWidth > tileWidth || stepHeight > tileHeight)
|
||||||
{
|
{
|
||||||
|
@ -1001,7 +1001,7 @@ void lcQMainWindow::print(QPrinter *printer)
|
||||||
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
|
||||||
project->SetCurrentTime(previousTime);
|
project->SetCurrentStep(previousTime);
|
||||||
|
|
||||||
GL_EndRenderToTexture();
|
GL_EndRenderToTexture();
|
||||||
}
|
}
|
||||||
|
@ -1135,14 +1135,18 @@ void lcQMainWindow::updatePaste(bool enabled)
|
||||||
action->setEnabled(enabled);
|
action->setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcQMainWindow::updateTime(int currentTime, int totalTime)
|
void lcQMainWindow::updateCurrentStep()
|
||||||
{
|
{
|
||||||
actions[LC_VIEW_TIME_FIRST]->setEnabled(currentTime != 1);
|
Project *project = lcGetActiveProject();
|
||||||
actions[LC_VIEW_TIME_PREVIOUS]->setEnabled(currentTime > 1);
|
lcStep currentStep = project->GetCurrentStep();
|
||||||
actions[LC_VIEW_TIME_NEXT]->setEnabled(currentTime < totalTime);
|
lcStep lastStep = project->GetLastStep();
|
||||||
actions[LC_VIEW_TIME_LAST]->setEnabled(currentTime != totalTime);
|
|
||||||
|
|
||||||
statusTimeLabel->setText(QString(tr(" Step %1 ")).arg(QString::number(currentTime)));
|
actions[LC_VIEW_TIME_FIRST]->setEnabled(currentStep != 1);
|
||||||
|
actions[LC_VIEW_TIME_PREVIOUS]->setEnabled(currentStep > 1);
|
||||||
|
actions[LC_VIEW_TIME_NEXT]->setEnabled(currentStep < LC_STEP_MAX);
|
||||||
|
actions[LC_VIEW_TIME_LAST]->setEnabled(currentStep != lastStep);
|
||||||
|
|
||||||
|
statusTimeLabel->setText(QString(tr("Step %1")).arg(QString::number(currentStep)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcQMainWindow::setAddKeys(bool addKeys)
|
void lcQMainWindow::setAddKeys(bool addKeys)
|
||||||
|
|
|
@ -34,7 +34,7 @@ public:
|
||||||
void updateSelectedObjects(int flags, int selectedCount, Object* focus);
|
void updateSelectedObjects(int flags, int selectedCount, Object* focus);
|
||||||
void updateAction(int newAction);
|
void updateAction(int newAction);
|
||||||
void updatePaste(bool enabled);
|
void updatePaste(bool enabled);
|
||||||
void updateTime(int currentTime, int totalTime);
|
void updateCurrentStep();
|
||||||
void setAddKeys(bool addKeys);
|
void setAddKeys(bool addKeys);
|
||||||
void updateLockSnap(lcuint32 snap);
|
void updateLockSnap(lcuint32 snap);
|
||||||
void updateSnap();
|
void updateSnap();
|
||||||
|
|
|
@ -555,13 +555,13 @@ void lcQPropertiesTree::slotReturnPressed()
|
||||||
}
|
}
|
||||||
else if (item == partShow)
|
else if (item == partShow)
|
||||||
{
|
{
|
||||||
lcuint32 value = editor->text().toUInt();
|
lcStep value = editor->text().toUInt();
|
||||||
|
|
||||||
project->ModifyObject(focusObject, LC_PIECE_PROPERTY_SHOW, &value);
|
project->ModifyObject(focusObject, LC_PIECE_PROPERTY_SHOW, &value);
|
||||||
}
|
}
|
||||||
else if (item == partHide)
|
else if (item == partHide)
|
||||||
{
|
{
|
||||||
lcuint32 value = editor->text().toUInt();
|
lcStep value = editor->text().toUInt();
|
||||||
|
|
||||||
project->ModifyObject(focusObject, LC_PIECE_PROPERTY_HIDE, &value);
|
project->ModifyObject(focusObject, LC_PIECE_PROPERTY_HIDE, &value);
|
||||||
}
|
}
|
||||||
|
@ -805,8 +805,8 @@ void lcQPropertiesTree::setPart(Object *newFocusObject)
|
||||||
partRotationZ->setText(1, QString::number(rotation[2]));
|
partRotationZ->setText(1, QString::number(rotation[2]));
|
||||||
partRotationZ->setData(0, PropertyValueRole, rotation[2]);
|
partRotationZ->setData(0, PropertyValueRole, rotation[2]);
|
||||||
|
|
||||||
lcuint32 show = part->GetStepShow();
|
lcStep show = part->GetStepShow();
|
||||||
lcuint32 hide = part->GetStepHide();
|
lcStep hide = part->GetStepHide();
|
||||||
|
|
||||||
partShow->setText(1, QString::number(show));
|
partShow->setText(1, QString::number(show));
|
||||||
partShow->setData(0, PropertyValueRole, show);
|
partShow->setData(0, PropertyValueRole, show);
|
||||||
|
|
|
@ -166,6 +166,7 @@ void lcQSelectDialog::addChildren(QTreeWidgetItem *parentItem, Group *parentGrou
|
||||||
}
|
}
|
||||||
|
|
||||||
const lcArray<lcPiece*>& pieces = project->GetPieces();
|
const lcArray<lcPiece*>& pieces = project->GetPieces();
|
||||||
|
lcStep currentStep = project->GetCurrentStep();
|
||||||
|
|
||||||
for (int pieceIdx = 0; pieceIdx < pieces.GetSize(); pieceIdx++, numObjects++)
|
for (int pieceIdx = 0; pieceIdx < pieces.GetSize(); pieceIdx++, numObjects++)
|
||||||
{
|
{
|
||||||
|
@ -174,7 +175,7 @@ void lcQSelectDialog::addChildren(QTreeWidgetItem *parentItem, Group *parentGrou
|
||||||
if (piece->GetGroup() != parentGroup)
|
if (piece->GetGroup() != parentGroup)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!piece->IsVisible(project->GetCurrentTime()))
|
if (!piece->IsVisible(currentStep))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QTreeWidgetItem *pieceItem = new QTreeWidgetItem(parentItem, QStringList(piece->GetName()));
|
QTreeWidgetItem *pieceItem = new QTreeWidgetItem(parentItem, QStringList(piece->GetName()));
|
||||||
|
|
|
@ -500,12 +500,12 @@ void lcMainWindow::UpdatePaste(bool Enabled)
|
||||||
window->updatePaste(Enabled);
|
window->updatePaste(Enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcMainWindow::UpdateTime(int CurrentTime, int TotalTime)
|
void lcMainWindow::UpdateCurrentStep()
|
||||||
{
|
{
|
||||||
lcQMainWindow* window = (lcQMainWindow*)mHandle;
|
lcQMainWindow* window = (lcQMainWindow*)mHandle;
|
||||||
|
|
||||||
if (window)
|
if (window)
|
||||||
window->updateTime(CurrentTime, TotalTime);
|
window->updateCurrentStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcMainWindow::SetAddKeys(bool AddKeys)
|
void lcMainWindow::SetAddKeys(bool AddKeys)
|
||||||
|
|
Loading…
Reference in a new issue