mirror of
https://github.com/leozide/leocad
synced 2025-01-14 08:01:45 +01:00
Added model class.
This commit is contained in:
parent
4e1a08c4fb
commit
e20907fbdd
15 changed files with 403 additions and 472 deletions
|
@ -1,51 +1,38 @@
|
||||||
// Piece group
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "lc_global.h"
|
#include "lc_global.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "lc_file.h"
|
#include "lc_file.h"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
lcGroup::lcGroup()
|
||||||
// Group construction/destruction
|
|
||||||
|
|
||||||
Group::Group()
|
|
||||||
{
|
{
|
||||||
m_pGroup = NULL;
|
mGroup = NULL;
|
||||||
m_pNext = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Group::~Group()
|
lcGroup::~lcGroup()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Group* Group::GetTopGroup()
|
void lcGroup::SetGroup(lcGroup* Group)
|
||||||
{
|
{
|
||||||
return m_pGroup ? m_pGroup->GetTopGroup() : this;
|
if (Group == this)
|
||||||
}
|
|
||||||
|
|
||||||
void Group::SetGroup(Group* pGroup)
|
|
||||||
{
|
|
||||||
if (pGroup == this)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_pGroup != NULL && m_pGroup != (Group*)-1)
|
if (mGroup != NULL && mGroup != (lcGroup*)-1)
|
||||||
m_pGroup->SetGroup(pGroup);
|
mGroup->SetGroup(Group);
|
||||||
else
|
else
|
||||||
m_pGroup = pGroup;
|
mGroup = Group;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Group::UnGroup(Group* pGroup)
|
void lcGroup::UnGroup(lcGroup* Group)
|
||||||
{
|
{
|
||||||
if (m_pGroup == pGroup)
|
if (mGroup == Group)
|
||||||
m_pGroup = NULL;
|
mGroup = NULL;
|
||||||
else
|
else if (mGroup != NULL)
|
||||||
if (m_pGroup != NULL)
|
mGroup->UnGroup(Group);
|
||||||
m_pGroup->UnGroup(pGroup);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Group::FileLoad(lcFile* file)
|
void lcGroup::FileLoad(lcFile* file)
|
||||||
{
|
{
|
||||||
lcuint8 version;
|
lcuint8 version;
|
||||||
lcint32 i;
|
lcint32 i;
|
||||||
|
@ -54,28 +41,17 @@ void Group::FileLoad(lcFile* file)
|
||||||
file->ReadBuffer(m_strName, 65);
|
file->ReadBuffer(m_strName, 65);
|
||||||
file->ReadFloats(m_fCenter, 3);
|
file->ReadFloats(m_fCenter, 3);
|
||||||
file->ReadS32(&i, 1);
|
file->ReadS32(&i, 1);
|
||||||
m_pGroup = (Group*)(long)i;
|
mGroup = (lcGroup*)(long)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Group::FileSave(lcFile* file, Group* pGroups)
|
void lcGroup::FileSave(lcFile* file, const lcArray<lcGroup*>& Groups)
|
||||||
{
|
{
|
||||||
lcuint8 version = 1; // LeoCAD 0.60
|
lcuint8 version = 1; // LeoCAD 0.60
|
||||||
lcint32 i = 0;
|
|
||||||
|
|
||||||
file->WriteU8(&version, 1);
|
file->WriteU8(&version, 1);
|
||||||
file->WriteBuffer(m_strName, 65);
|
file->WriteBuffer(m_strName, 65);
|
||||||
file->WriteFloats(m_fCenter, 3);
|
file->WriteFloats(m_fCenter, 3);
|
||||||
|
|
||||||
if (m_pGroup == NULL)
|
lcint32 GroupIndex = Groups.FindIndex(mGroup);
|
||||||
i = -1;
|
file->WriteS32(&GroupIndex, 1);
|
||||||
else
|
|
||||||
{
|
|
||||||
for (; pGroups; pGroups = pGroups->m_pNext)
|
|
||||||
if (pGroups == m_pGroup)
|
|
||||||
break;
|
|
||||||
else
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
file->WriteS32(&i, 1);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
#ifndef _GROUP_H_
|
#ifndef _GROUP_H_
|
||||||
#define _GROUP_H_
|
#define _GROUP_H_
|
||||||
|
|
||||||
|
#include "lc_array.h"
|
||||||
|
|
||||||
#define LC_MAX_GROUP_NAME 64
|
#define LC_MAX_GROUP_NAME 64
|
||||||
|
|
||||||
class Group
|
class lcGroup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// void DoSaveLoad(CArchive& ar, CCADDoc* pDoc);
|
lcGroup();
|
||||||
Group();
|
~lcGroup();
|
||||||
~Group();
|
|
||||||
|
|
||||||
void SetGroup(Group* pGroup);
|
lcGroup* GetTopGroup()
|
||||||
void UnGroup(Group* pGroup);
|
{
|
||||||
Group* GetTopGroup();
|
return mGroup ? mGroup->GetTopGroup() : this;
|
||||||
|
}
|
||||||
|
|
||||||
Group* m_pNext;
|
void SetGroup(lcGroup* Group);
|
||||||
Group* m_pGroup;
|
void UnGroup(lcGroup* Group);
|
||||||
|
|
||||||
|
lcGroup* mGroup;
|
||||||
|
|
||||||
void FileLoad(lcFile* file);
|
void FileLoad(lcFile* file);
|
||||||
void FileSave(lcFile* file, Group* pGroups);
|
void FileSave(lcFile* file, const lcArray<lcGroup*>& Groups);
|
||||||
|
|
||||||
char m_strName[LC_MAX_GROUP_NAME + 1];
|
char m_strName[LC_MAX_GROUP_NAME + 1];
|
||||||
float m_fCenter[3];
|
float m_fCenter[3];
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
#include "lc_shortcuts.h"
|
#include "lc_shortcuts.h"
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
|
|
||||||
class Group;
|
|
||||||
|
|
||||||
#define LC_OK 1
|
#define LC_OK 1
|
||||||
#define LC_CANCEL 2
|
#define LC_CANCEL 2
|
||||||
#define LC_ABORT 3
|
#define LC_ABORT 3
|
||||||
|
|
|
@ -14,11 +14,13 @@ class lcObject;
|
||||||
class lcPiece;
|
class lcPiece;
|
||||||
class lcCamera;
|
class lcCamera;
|
||||||
class lcLight;
|
class lcLight;
|
||||||
|
class lcGroup;
|
||||||
|
|
||||||
typedef lcObject Object;
|
typedef lcObject Object;
|
||||||
typedef lcPiece Piece;
|
typedef lcPiece Piece;
|
||||||
typedef lcCamera Camera;
|
typedef lcCamera Camera;
|
||||||
typedef lcLight Light;
|
typedef lcLight Light;
|
||||||
|
typedef lcGroup Group;
|
||||||
|
|
||||||
class lcVector2;
|
class lcVector2;
|
||||||
class lcVector3;
|
class lcVector3;
|
||||||
|
|
47
common/lc_model.cpp
Normal file
47
common/lc_model.cpp
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
#include "lc_global.h"
|
||||||
|
#include "lc_model.h"
|
||||||
|
#include "piece.h"
|
||||||
|
#include "camera.h"
|
||||||
|
#include "light.h"
|
||||||
|
#include "lc_mainwindow.h"
|
||||||
|
#include "lc_profile.h"
|
||||||
|
|
||||||
|
void lcModelProperties::LoadDefaults()
|
||||||
|
{
|
||||||
|
mAuthor = lcGetProfileString(LC_PROFILE_DEFAULT_AUTHOR_NAME);
|
||||||
|
|
||||||
|
mBackgroundType = (lcBackgroundType)lcGetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_TYPE);
|
||||||
|
mBackgroundSolidColor = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_COLOR));
|
||||||
|
mBackgroundGradientColor1 = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_GRADIENT_COLOR1));
|
||||||
|
mBackgroundGradientColor2 = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_GRADIENT_COLOR2));
|
||||||
|
mBackgroundImage = lcGetProfileString(LC_PROFILE_DEFAULT_BACKGROUND_TEXTURE);
|
||||||
|
mBackgroundImageTile = lcGetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_TILE);
|
||||||
|
|
||||||
|
mFogEnabled = lcGetProfileInt(LC_PROFILE_DEFAULT_FOG_ENABLED);
|
||||||
|
mFogDensity = lcGetProfileFloat(LC_PROFILE_DEFAULT_FOG_DENSITY);
|
||||||
|
mFogColor = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_FOG_COLOR));
|
||||||
|
mAmbientColor = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_AMBIENT_COLOR));
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcModelProperties::SaveDefaults()
|
||||||
|
{
|
||||||
|
lcSetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_TYPE, mBackgroundType);
|
||||||
|
lcSetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_COLOR, lcColorFromVector3(mBackgroundSolidColor));
|
||||||
|
lcSetProfileInt(LC_PROFILE_DEFAULT_GRADIENT_COLOR1, lcColorFromVector3(mBackgroundGradientColor1));
|
||||||
|
lcSetProfileInt(LC_PROFILE_DEFAULT_GRADIENT_COLOR2, lcColorFromVector3(mBackgroundGradientColor2));
|
||||||
|
lcSetProfileString(LC_PROFILE_DEFAULT_BACKGROUND_TEXTURE, mBackgroundImage);
|
||||||
|
lcSetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_TILE, mBackgroundImageTile);
|
||||||
|
|
||||||
|
lcSetProfileInt(LC_PROFILE_DEFAULT_FOG_ENABLED, mFogEnabled);
|
||||||
|
lcSetProfileFloat(LC_PROFILE_DEFAULT_FOG_DENSITY, mFogDensity);
|
||||||
|
lcSetProfileInt(LC_PROFILE_DEFAULT_FOG_COLOR, lcColorFromVector3(mFogColor));
|
||||||
|
lcSetProfileInt(LC_PROFILE_DEFAULT_AMBIENT_COLOR, lcColorFromVector3(mAmbientColor));
|
||||||
|
}
|
||||||
|
|
||||||
|
lcModel::lcModel()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
lcModel::~lcModel()
|
||||||
|
{
|
||||||
|
}
|
90
common/lc_model.h
Normal file
90
common/lc_model.h
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
#ifndef _LC_MODEL_H_
|
||||||
|
#define _LC_MODEL_H_
|
||||||
|
|
||||||
|
#include "lc_math.h"
|
||||||
|
#include "str.h"
|
||||||
|
#include "object.h"
|
||||||
|
|
||||||
|
enum lcBackgroundType
|
||||||
|
{
|
||||||
|
LC_BACKGROUND_SOLID,
|
||||||
|
LC_BACKGROUND_GRADIENT,
|
||||||
|
LC_BACKGROUND_IMAGE
|
||||||
|
};
|
||||||
|
|
||||||
|
class lcModelProperties
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void LoadDefaults();
|
||||||
|
void SaveDefaults();
|
||||||
|
|
||||||
|
bool operator==(const lcModelProperties& Properties)
|
||||||
|
{
|
||||||
|
if (mName != Properties.mName || mAuthor != Properties.mAuthor ||
|
||||||
|
mDescription != Properties.mDescription || mComments != Properties.mComments)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (mBackgroundType != Properties.mBackgroundType || mBackgroundSolidColor != Properties.mBackgroundSolidColor ||
|
||||||
|
mBackgroundGradientColor1 != Properties.mBackgroundGradientColor1 || mBackgroundGradientColor2 != Properties.mBackgroundGradientColor2 ||
|
||||||
|
mBackgroundImage != Properties.mBackgroundImage || mBackgroundImageTile != Properties.mBackgroundImageTile)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (mFogEnabled != Properties.mFogEnabled || mFogDensity != Properties.mFogDensity ||
|
||||||
|
mFogColor != Properties.mFogColor || mAmbientColor != Properties.mAmbientColor)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
String mName;
|
||||||
|
String mAuthor;
|
||||||
|
String mDescription;
|
||||||
|
String mComments;
|
||||||
|
|
||||||
|
lcBackgroundType mBackgroundType;
|
||||||
|
lcVector3 mBackgroundSolidColor;
|
||||||
|
lcVector3 mBackgroundGradientColor1;
|
||||||
|
lcVector3 mBackgroundGradientColor2;
|
||||||
|
String mBackgroundImage;
|
||||||
|
bool mBackgroundImageTile;
|
||||||
|
|
||||||
|
bool mFogEnabled;
|
||||||
|
float mFogDensity;
|
||||||
|
lcVector3 mFogColor;
|
||||||
|
lcVector3 mAmbientColor;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum lcTool
|
||||||
|
{
|
||||||
|
LC_TOOL_INSERT,
|
||||||
|
LC_TOOL_LIGHT,
|
||||||
|
LC_TOOL_SPOTLIGHT,
|
||||||
|
LC_TOOL_CAMERA,
|
||||||
|
LC_TOOL_SELECT,
|
||||||
|
LC_TOOL_MOVE,
|
||||||
|
LC_TOOL_ROTATE,
|
||||||
|
LC_TOOL_ERASER,
|
||||||
|
LC_TOOL_PAINT,
|
||||||
|
LC_TOOL_ZOOM,
|
||||||
|
LC_TOOL_PAN,
|
||||||
|
LC_TOOL_ROTATE_VIEW,
|
||||||
|
LC_TOOL_ROLL,
|
||||||
|
LC_TOOL_ZOOM_REGION
|
||||||
|
};
|
||||||
|
|
||||||
|
class lcModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
lcModel();
|
||||||
|
~lcModel();
|
||||||
|
|
||||||
|
public:
|
||||||
|
lcModelProperties mProperties;
|
||||||
|
|
||||||
|
lcArray<lcPiece*> mPieces;
|
||||||
|
lcArray<lcCamera*> mCameras;
|
||||||
|
lcArray<lcLight*> mLights;
|
||||||
|
lcArray<lcGroup*> mGroups;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _LC_MODEL_H_
|
|
@ -265,22 +265,8 @@ void lcPiece::FileSave(lcFile& file) const
|
||||||
file.WriteBuffer(m_strName, Length);
|
file.WriteBuffer(m_strName, Length);
|
||||||
|
|
||||||
// version 7
|
// version 7
|
||||||
lcint32 i;
|
lcint32 GroupIndex = lcGetActiveProject()->GetGroupIndex(m_pGroup);
|
||||||
|
file.WriteS32(GroupIndex);
|
||||||
if (m_pGroup != NULL)
|
|
||||||
{
|
|
||||||
Group* pGroups = lcGetActiveProject()->m_pGroups;
|
|
||||||
for (i = 0; pGroups; pGroups = pGroups->m_pNext)
|
|
||||||
{
|
|
||||||
if (m_pGroup == pGroups)
|
|
||||||
break;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
i = -1;
|
|
||||||
|
|
||||||
file.WriteS32(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcPiece::Initialize(float x, float y, float z, unsigned char nStep)
|
void lcPiece::Initialize(float x, float y, float z, unsigned char nStep)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef _PIECE_H_
|
#ifndef _PIECE_H_
|
||||||
#define _PIECE_H_
|
#define _PIECE_H_
|
||||||
|
|
||||||
class Group;
|
|
||||||
class PieceInfo;
|
class PieceInfo;
|
||||||
|
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
|
|
|
@ -29,47 +29,11 @@
|
||||||
#include "lc_context.h"
|
#include "lc_context.h"
|
||||||
#include "preview.h"
|
#include "preview.h"
|
||||||
|
|
||||||
void lcModelProperties::LoadDefaults()
|
|
||||||
{
|
|
||||||
mAuthor = lcGetProfileString(LC_PROFILE_DEFAULT_AUTHOR_NAME);
|
|
||||||
|
|
||||||
mBackgroundType = (lcBackgroundType)lcGetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_TYPE);
|
|
||||||
mBackgroundSolidColor = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_COLOR));
|
|
||||||
mBackgroundGradientColor1 = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_GRADIENT_COLOR1));
|
|
||||||
mBackgroundGradientColor2 = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_GRADIENT_COLOR2));
|
|
||||||
mBackgroundImage = lcGetProfileString(LC_PROFILE_DEFAULT_BACKGROUND_TEXTURE);
|
|
||||||
mBackgroundImageTile = lcGetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_TILE);
|
|
||||||
|
|
||||||
mFogEnabled = lcGetProfileInt(LC_PROFILE_DEFAULT_FOG_ENABLED);
|
|
||||||
mFogDensity = lcGetProfileFloat(LC_PROFILE_DEFAULT_FOG_DENSITY);
|
|
||||||
mFogColor = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_FOG_COLOR));
|
|
||||||
mAmbientColor = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_AMBIENT_COLOR));
|
|
||||||
}
|
|
||||||
|
|
||||||
void lcModelProperties::SaveDefaults()
|
|
||||||
{
|
|
||||||
lcSetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_TYPE, mBackgroundType);
|
|
||||||
lcSetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_COLOR, lcColorFromVector3(mBackgroundSolidColor));
|
|
||||||
lcSetProfileInt(LC_PROFILE_DEFAULT_GRADIENT_COLOR1, lcColorFromVector3(mBackgroundGradientColor1));
|
|
||||||
lcSetProfileInt(LC_PROFILE_DEFAULT_GRADIENT_COLOR2, lcColorFromVector3(mBackgroundGradientColor2));
|
|
||||||
lcSetProfileString(LC_PROFILE_DEFAULT_BACKGROUND_TEXTURE, mBackgroundImage);
|
|
||||||
lcSetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_TILE, mBackgroundImageTile);
|
|
||||||
|
|
||||||
lcSetProfileInt(LC_PROFILE_DEFAULT_FOG_ENABLED, mFogEnabled);
|
|
||||||
lcSetProfileFloat(LC_PROFILE_DEFAULT_FOG_DENSITY, mFogDensity);
|
|
||||||
lcSetProfileInt(LC_PROFILE_DEFAULT_FOG_COLOR, lcColorFromVector3(mFogColor));
|
|
||||||
lcSetProfileInt(LC_PROFILE_DEFAULT_AMBIENT_COLOR, lcColorFromVector3(mAmbientColor));
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Project construction/destruction
|
|
||||||
|
|
||||||
Project::Project()
|
Project::Project()
|
||||||
{
|
{
|
||||||
m_bModified = false;
|
m_bModified = false;
|
||||||
m_nTracking = LC_TRACK_NONE;
|
m_nTracking = LC_TRACK_NONE;
|
||||||
mDropPiece = NULL;
|
mDropPiece = NULL;
|
||||||
m_pGroups = NULL;
|
|
||||||
m_pUndoList = NULL;
|
m_pUndoList = NULL;
|
||||||
m_pRedoList = NULL;
|
m_pRedoList = NULL;
|
||||||
mTransformType = LC_TRANSFORM_RELATIVE_TRANSLATION;
|
mTransformType = LC_TRANSFORM_RELATIVE_TRANSLATION;
|
||||||
|
@ -91,10 +55,6 @@ Project::~Project()
|
||||||
delete m_pScreenFont;
|
delete m_pScreenFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Project attributes, general services
|
|
||||||
|
|
||||||
void Project::UpdateInterface()
|
void Project::UpdateInterface()
|
||||||
{
|
{
|
||||||
// Update all user interface elements.
|
// Update all user interface elements.
|
||||||
|
@ -133,8 +93,6 @@ void Project::SetTitle(const char* Title)
|
||||||
|
|
||||||
void Project::DeleteContents(bool bUndo)
|
void Project::DeleteContents(bool bUndo)
|
||||||
{
|
{
|
||||||
Group* pGroup;
|
|
||||||
|
|
||||||
mProperties.LoadDefaults();
|
mProperties.LoadDefaults();
|
||||||
|
|
||||||
if (!bUndo)
|
if (!bUndo)
|
||||||
|
@ -178,13 +136,7 @@ void Project::DeleteContents(bool bUndo)
|
||||||
|
|
||||||
mCameras.DeleteAll();
|
mCameras.DeleteAll();
|
||||||
mLights.DeleteAll();
|
mLights.DeleteAll();
|
||||||
|
mGroups.DeleteAll();
|
||||||
while (m_pGroups)
|
|
||||||
{
|
|
||||||
pGroup = m_pGroups;
|
|
||||||
m_pGroups = m_pGroups->m_pNext;
|
|
||||||
delete pGroup;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only call after DeleteContents()
|
// Only call after DeleteContents()
|
||||||
|
@ -435,39 +387,27 @@ bool Project::FileLoad(lcFile* file, bool bUndo, bool bMerge)
|
||||||
|
|
||||||
if (fv >= 0.5f)
|
if (fv >= 0.5f)
|
||||||
{
|
{
|
||||||
|
int NumGroups = mGroups.GetSize();
|
||||||
|
|
||||||
file->ReadS32(&count, 1);
|
file->ReadS32(&count, 1);
|
||||||
|
|
||||||
Group* pGroup;
|
|
||||||
Group* pLastGroup = NULL;
|
|
||||||
for (pGroup = m_pGroups; pGroup; pGroup = pGroup->m_pNext)
|
|
||||||
pLastGroup = pGroup;
|
|
||||||
|
|
||||||
pGroup = pLastGroup;
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
mGroups.Add(new lcGroup());
|
||||||
if (pGroup)
|
|
||||||
{
|
|
||||||
pGroup->m_pNext = new Group();
|
|
||||||
pGroup = pGroup->m_pNext;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
m_pGroups = pGroup = new Group();
|
|
||||||
}
|
|
||||||
pLastGroup = pLastGroup ? pLastGroup->m_pNext : m_pGroups;
|
|
||||||
|
|
||||||
for (pGroup = pLastGroup; pGroup; pGroup = pGroup->m_pNext)
|
for (int GroupIdx = NumGroups; GroupIdx < mGroups.GetSize(); GroupIdx++)
|
||||||
{
|
{
|
||||||
|
lcGroup* Group = mGroups[GroupIdx];
|
||||||
|
|
||||||
if (fv < 1.0f)
|
if (fv < 1.0f)
|
||||||
{
|
{
|
||||||
file->ReadBuffer(pGroup->m_strName, 65);
|
file->ReadBuffer(Group->m_strName, 65);
|
||||||
file->ReadBuffer(&ch, 1);
|
file->ReadBuffer(&ch, 1);
|
||||||
pGroup->m_fCenter[0] = 0;
|
Group->m_fCenter[0] = 0;
|
||||||
pGroup->m_fCenter[1] = 0;
|
Group->m_fCenter[1] = 0;
|
||||||
pGroup->m_fCenter[2] = 0;
|
Group->m_fCenter[2] = 0;
|
||||||
pGroup->m_pGroup = (Group*)-1;
|
Group->mGroup = (lcGroup*)-1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pGroup->FileLoad(file);
|
Group->FileLoad(file);
|
||||||
|
|
||||||
if (bMerge)
|
if (bMerge)
|
||||||
{
|
{
|
||||||
|
@ -476,36 +416,29 @@ bool Project::FileLoad(lcFile* file, bool bUndo, bool bMerge)
|
||||||
int max = -1;
|
int max = -1;
|
||||||
String baseName;
|
String baseName;
|
||||||
|
|
||||||
for (Group* pExisting = m_pGroups; pExisting && (pExisting != pGroup); pExisting = pExisting->m_pNext)
|
for (int Existing = 0; Existing < GroupIdx; Existing++)
|
||||||
max = lcMax(max, InstanceOfName(pExisting->m_strName, pGroup->m_strName, baseName));
|
max = lcMax(max, InstanceOfName(mGroups[Existing]->m_strName, Group->m_strName, baseName));
|
||||||
|
|
||||||
if (max > -1)
|
if (max > -1)
|
||||||
{
|
{
|
||||||
int baseReserve = sizeof(pGroup->m_strName) - 5; // space, #, 2-digits, and terminating 0
|
int baseReserve = sizeof(Group->m_strName) - 5; // space, #, 2-digits, and terminating 0
|
||||||
for (int num = max; (num > 99); num /= 10) { baseReserve--; }
|
for (int num = max; (num > 99); num /= 10) { baseReserve--; }
|
||||||
sprintf(pGroup->m_strName, "%s #%.2d", (const char*)(baseName.Left(baseReserve)), max+1);
|
sprintf(Group->m_strName, "%s #%.2d", (const char*)(baseName.Left(baseReserve)), max+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (pGroup = pLastGroup; pGroup; pGroup = pGroup->m_pNext)
|
for (int GroupIdx = NumGroups; GroupIdx < mGroups.GetSize(); GroupIdx++)
|
||||||
{
|
{
|
||||||
i = LC_POINTER_TO_INT(pGroup->m_pGroup);
|
lcGroup* Group = mGroups[GroupIdx];
|
||||||
pGroup->m_pGroup = NULL;
|
|
||||||
|
i = LC_POINTER_TO_INT(Group->mGroup);
|
||||||
|
Group->mGroup = NULL;
|
||||||
|
|
||||||
if (i > 0xFFFF || i == -1)
|
if (i > 0xFFFF || i == -1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (Group* g2 = pLastGroup; g2; g2 = g2->m_pNext)
|
Group->mGroup = mGroups[NumGroups + i];
|
||||||
{
|
|
||||||
if (i == 0)
|
|
||||||
{
|
|
||||||
pGroup->m_pGroup = g2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int PieceIdx = FirstNewPiece; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
for (int PieceIdx = FirstNewPiece; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||||
|
@ -518,16 +451,7 @@ bool Project::FileLoad(lcFile* file, bool bUndo, bool bMerge)
|
||||||
if (i > 0xFFFF || i == -1)
|
if (i > 0xFFFF || i == -1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (pGroup = pLastGroup; pGroup; pGroup = pGroup->m_pNext)
|
Piece->SetGroup(mGroups[NumGroups + i]);
|
||||||
{
|
|
||||||
if (i == 0)
|
|
||||||
{
|
|
||||||
Piece->SetGroup(pGroup);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveEmptyGroups();
|
RemoveEmptyGroups();
|
||||||
|
@ -758,13 +682,11 @@ void Project::FileSave(lcFile* file, bool bUndo)
|
||||||
file->WriteBuffer(&ch, 1);
|
file->WriteBuffer(&ch, 1);
|
||||||
file->WriteBuffer(Comments, ch);
|
file->WriteBuffer(Comments, ch);
|
||||||
|
|
||||||
Group* pGroup;
|
i = mGroups.GetSize();
|
||||||
for (i = 0, pGroup = m_pGroups; pGroup; pGroup = pGroup->m_pNext)
|
|
||||||
i++;
|
|
||||||
file->WriteS32(&i, 1);
|
file->WriteS32(&i, 1);
|
||||||
|
|
||||||
for (pGroup = m_pGroups; pGroup; pGroup = pGroup->m_pNext)
|
for (int GroupIdx = 0; GroupIdx < mGroups.GetSize(); GroupIdx++)
|
||||||
pGroup->FileSave(file, m_pGroups);
|
mGroups[GroupIdx]->FileSave(file, mGroups);
|
||||||
|
|
||||||
lcuint8 ViewportMode = 0, ActiveViewport = 0;
|
lcuint8 ViewportMode = 0, ActiveViewport = 0;
|
||||||
file->WriteU8(&ViewportMode, 1);
|
file->WriteU8(&ViewportMode, 1);
|
||||||
|
@ -4211,7 +4133,6 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
lcMemFile* Clipboard = new lcMemFile();
|
lcMemFile* Clipboard = new lcMemFile();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
Group* pGroup;
|
|
||||||
// Light* pLight;
|
// Light* pLight;
|
||||||
|
|
||||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||||
|
@ -4227,12 +4148,11 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
Piece->FileSave(*Clipboard);
|
Piece->FileSave(*Clipboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0, pGroup = m_pGroups; pGroup; pGroup = pGroup->m_pNext)
|
i = mGroups.GetSize();
|
||||||
i++;
|
|
||||||
Clipboard->WriteBuffer(&i, sizeof(i));
|
Clipboard->WriteBuffer(&i, sizeof(i));
|
||||||
|
|
||||||
for (pGroup = m_pGroups; pGroup; pGroup = pGroup->m_pNext)
|
for (int GroupIdx = 0; GroupIdx < mGroups.GetSize(); GroupIdx++)
|
||||||
pGroup->FileSave(Clipboard, m_pGroups);
|
mGroups[GroupIdx]->FileSave(Clipboard, mGroups);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
for (int CameraIdx = 0; CameraIdx < mCameras.GetSize(); CameraIdx++)
|
for (int CameraIdx = 0; CameraIdx < mCameras.GetSize(); CameraIdx++)
|
||||||
|
@ -4272,7 +4192,6 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
|
|
||||||
case LC_EDIT_PASTE:
|
case LC_EDIT_PASTE:
|
||||||
{
|
{
|
||||||
int i, j;
|
|
||||||
lcFile* file = g_App->mClipboard;
|
lcFile* file = g_App->mClipboard;
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
break;
|
break;
|
||||||
|
@ -4280,85 +4199,96 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
SelectAndFocusNone(false);
|
SelectAndFocusNone(false);
|
||||||
|
|
||||||
lcArray<Piece*> PastedPieces;
|
lcArray<Piece*> PastedPieces;
|
||||||
file->ReadBuffer(&i, sizeof(i));
|
int NumPieces;
|
||||||
while (i--)
|
file->ReadBuffer(&NumPieces, sizeof(NumPieces));
|
||||||
|
|
||||||
|
while (NumPieces--)
|
||||||
{
|
{
|
||||||
Piece* piece = new Piece(NULL);
|
lcPiece* Piece = new lcPiece(NULL);
|
||||||
piece->FileLoad(*file);
|
Piece->FileLoad(*file);
|
||||||
PastedPieces.Add(piece);
|
PastedPieces.Add(Piece);
|
||||||
}
|
}
|
||||||
|
|
||||||
file->ReadBuffer(&i, sizeof(i));
|
lcArray<lcGroup*> Groups;
|
||||||
Group** groups = (Group**)malloc(i*sizeof(Group**));
|
int NumGroups;
|
||||||
for (j = 0; j < i; j++)
|
file->ReadBuffer(&NumGroups, sizeof(NumGroups));
|
||||||
|
|
||||||
|
while (NumGroups--)
|
||||||
{
|
{
|
||||||
groups[j] = new Group();
|
lcGroup* Group = new lcGroup();
|
||||||
groups[j]->FileLoad(file);
|
Group->FileLoad(file);
|
||||||
|
Groups.Add(Group);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int PieceIdx = 0; PieceIdx < PastedPieces.GetSize(); PieceIdx++)
|
for (int PieceIdx = 0; PieceIdx < PastedPieces.GetSize(); PieceIdx++)
|
||||||
{
|
{
|
||||||
Piece* Piece = PastedPieces[PieceIdx];
|
lcPiece* Piece = PastedPieces[PieceIdx];
|
||||||
Piece->CreateName(mPieces);
|
Piece->CreateName(mPieces);
|
||||||
Piece->SetStepShow(m_nCurStep);
|
Piece->SetStepShow(m_nCurStep);
|
||||||
mPieces.Add(Piece);
|
mPieces.Add(Piece);
|
||||||
Piece->SetSelected(true);
|
Piece->SetSelected(true);
|
||||||
|
|
||||||
j = LC_POINTER_TO_INT(Piece->GetGroup());
|
int GroupIndex = LC_POINTER_TO_INT(Piece->GetGroup());
|
||||||
if (j != -1)
|
if (GroupIndex != -1)
|
||||||
Piece->SetGroup(groups[j]);
|
Piece->SetGroup(Groups[GroupIndex]);
|
||||||
else
|
else
|
||||||
Piece->UnGroup(NULL);
|
Piece->UnGroup(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < i; j++)
|
for (int GroupIdx = 0; GroupIdx < Groups.GetSize(); GroupIdx++)
|
||||||
{
|
{
|
||||||
int g = LC_POINTER_TO_INT(groups[j]->m_pGroup);
|
lcGroup* Group = Groups[GroupIdx];
|
||||||
groups[j]->m_pGroup = (g != -1) ? groups[g] : NULL;
|
int GroupIndex = LC_POINTER_TO_INT(Group->mGroup);
|
||||||
|
Group->mGroup = (GroupIndex != -1) ? Groups[GroupIndex] : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < i; j++)
|
for (int GroupIdx = 0; GroupIdx < Groups.GetSize(); GroupIdx++)
|
||||||
{
|
{
|
||||||
Group* pGroup;
|
lcGroup* Group = Groups[GroupIdx];
|
||||||
bool add = false;
|
bool Add = false;
|
||||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
|
||||||
{
|
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
|
||||||
|
|
||||||
for (pGroup = Piece->GetGroup(); pGroup; pGroup = pGroup->m_pGroup)
|
for (int PieceIdx = 0; PieceIdx < PastedPieces.GetSize(); PieceIdx++)
|
||||||
if (pGroup == groups[j])
|
{
|
||||||
|
lcPiece* Piece = PastedPieces[PieceIdx];
|
||||||
|
|
||||||
|
for (lcGroup* PieceGroup = Piece->GetGroup(); PieceGroup; PieceGroup = PieceGroup->mGroup)
|
||||||
|
{
|
||||||
|
if (PieceGroup == Group)
|
||||||
{
|
{
|
||||||
add = true;
|
Add = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (add)
|
if (Add)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (add)
|
if (Add)
|
||||||
{
|
{
|
||||||
int a, max = 0;
|
int a, max = 0;
|
||||||
|
|
||||||
for (pGroup = m_pGroups; pGroup; pGroup = pGroup->m_pNext)
|
for (int SearchGroupIdx = 0; SearchGroupIdx < mGroups.GetSize(); SearchGroupIdx++)
|
||||||
if (strncmp("Pasted Group #", pGroup->m_strName, 14) == 0)
|
{
|
||||||
if (sscanf(pGroup->m_strName + 14, "%d", &a) == 1)
|
lcGroup* SearchGroup = mGroups[SearchGroupIdx];
|
||||||
|
|
||||||
|
if (strncmp("Pasted Group #", SearchGroup ->m_strName, 14) == 0)
|
||||||
|
if (sscanf(SearchGroup ->m_strName + 14, "%d", &a) == 1)
|
||||||
if (a > max)
|
if (a > max)
|
||||||
max = a;
|
max = a;
|
||||||
|
}
|
||||||
|
|
||||||
sprintf(groups[j]->m_strName, "Pasted Group #%.2d", max+1);
|
sprintf(Group->m_strName, "Pasted Group #%.2d", max+1);
|
||||||
groups[j]->m_pNext = m_pGroups;
|
mGroups.Add(Group);
|
||||||
m_pGroups = groups[j];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
delete groups[j];
|
delete Group;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(groups);
|
int NumCameras;
|
||||||
|
file->ReadBuffer(&NumCameras, sizeof(NumCameras));
|
||||||
|
|
||||||
file->ReadBuffer(&i, sizeof(i));
|
while (NumCameras--)
|
||||||
|
|
||||||
while (i--)
|
|
||||||
{
|
{
|
||||||
Camera* pCamera = new Camera(false);
|
Camera* pCamera = new Camera(false);
|
||||||
pCamera->FileLoad(*file);
|
pCamera->FileLoad(*file);
|
||||||
|
@ -4737,36 +4667,29 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
SystemPieceComboAdd(Minifig.Parts[i]->m_strDescription);
|
SystemPieceComboAdd(Minifig.Parts[i]->m_strDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
float bs[6] = { 10000, 10000, 10000, -10000, -10000, -10000 };
|
int Max = 0;
|
||||||
int max = 0;
|
|
||||||
|
|
||||||
Group* pGroup;
|
for (int GroupIdx = 0; GroupIdx < mGroups.GetSize(); GroupIdx++)
|
||||||
for (pGroup = m_pGroups; pGroup; pGroup = pGroup->m_pNext)
|
{
|
||||||
if (strncmp (pGroup->m_strName, "Minifig #", 9) == 0)
|
lcGroup* Group = mGroups[GroupIdx];
|
||||||
if (sscanf(pGroup->m_strName, "Minifig #%d", &i) == 1)
|
|
||||||
if (i > max)
|
|
||||||
max = i;
|
|
||||||
pGroup = new Group;
|
|
||||||
sprintf(pGroup->m_strName, "Minifig #%.2d", max+1);
|
|
||||||
|
|
||||||
pGroup->m_pNext = m_pGroups;
|
if (strncmp(Group->m_strName, "Minifig #", 9) == 0)
|
||||||
m_pGroups = pGroup;
|
if (sscanf(Group->m_strName, "Minifig #%d", &i) == 1)
|
||||||
|
if (i > Max)
|
||||||
|
Max = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
lcGroup* Group = AddGroup(NULL);
|
||||||
|
sprintf(Group->m_strName, "Minifig #%.2d", Max+1);
|
||||||
|
|
||||||
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->IsSelected())
|
if (Piece->IsSelected())
|
||||||
{
|
Piece->SetGroup(Group);
|
||||||
Piece->SetGroup(pGroup);
|
|
||||||
Piece->CompareBoundingBox(bs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pGroup->m_fCenter[0] = (bs[0]+bs[3])/2;
|
|
||||||
pGroup->m_fCenter[1] = (bs[1]+bs[4])/2;
|
|
||||||
pGroup->m_fCenter[2] = (bs[2]+bs[5])/2;
|
|
||||||
|
|
||||||
gMainWindow->UpdateFocusObject(GetFocusObject());
|
gMainWindow->UpdateFocusObject(GetFocusObject());
|
||||||
UpdateSelection();
|
UpdateSelection();
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
|
@ -4895,7 +4818,7 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
case LC_PIECE_GROUP:
|
case LC_PIECE_GROUP:
|
||||||
{
|
{
|
||||||
Group* pGroup;
|
Group* pGroup;
|
||||||
int i, max = 0;
|
int i, Max = 0;
|
||||||
char name[65];
|
char name[65];
|
||||||
int Selected = 0;
|
int Selected = 0;
|
||||||
|
|
||||||
|
@ -4916,96 +4839,77 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (pGroup = m_pGroups; pGroup; pGroup = pGroup->m_pNext)
|
for (int GroupIdx = 0; GroupIdx < mGroups.GetSize(); GroupIdx++)
|
||||||
if (strncmp (pGroup->m_strName, "Group #", 7) == 0)
|
{
|
||||||
if (sscanf(pGroup->m_strName, "Group #%d", &i) == 1)
|
lcGroup* Group = mGroups[GroupIdx];
|
||||||
if (i > max)
|
|
||||||
max = i;
|
if (strncmp(Group->m_strName, "Group #", 7) == 0)
|
||||||
sprintf(name, "Group #%.2d", max+1);
|
if (sscanf(Group->m_strName, "Group #%d", &i) == 1)
|
||||||
|
if (i > Max)
|
||||||
|
Max = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(name, "Group #%.2d", Max + 1);
|
||||||
|
|
||||||
if (!gMainWindow->DoDialog(LC_DIALOG_PIECE_GROUP, name))
|
if (!gMainWindow->DoDialog(LC_DIALOG_PIECE_GROUP, name))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
pGroup = new Group();
|
pGroup = new Group();
|
||||||
strcpy(pGroup->m_strName, name);
|
strcpy(pGroup->m_strName, name);
|
||||||
pGroup->m_pNext = m_pGroups;
|
mGroups.Add(pGroup);
|
||||||
m_pGroups = pGroup;
|
|
||||||
float bs[6] = { 10000, 10000, 10000, -10000, -10000, -10000 };
|
|
||||||
|
|
||||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
|
||||||
{
|
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
|
||||||
|
|
||||||
if (Piece->IsSelected())
|
|
||||||
{
|
|
||||||
Piece->DoGroup(pGroup);
|
|
||||||
Piece->CompareBoundingBox(bs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pGroup->m_fCenter[0] = (bs[0]+bs[3])/2;
|
|
||||||
pGroup->m_fCenter[1] = (bs[1]+bs[4])/2;
|
|
||||||
pGroup->m_fCenter[2] = (bs[2]+bs[5])/2;
|
|
||||||
|
|
||||||
RemoveEmptyGroups();
|
|
||||||
SetModifiedFlag(true);
|
|
||||||
CheckPoint("Grouping");
|
|
||||||
} break;
|
|
||||||
|
|
||||||
case LC_PIECE_UNGROUP:
|
|
||||||
{
|
|
||||||
Group* pList = NULL;
|
|
||||||
Group* pGroup;
|
|
||||||
Group* tmp;
|
|
||||||
|
|
||||||
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->IsSelected())
|
||||||
|
Piece->DoGroup(pGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoveEmptyGroups();
|
||||||
|
SetModifiedFlag(true);
|
||||||
|
CheckPoint("Grouping");
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case LC_PIECE_UNGROUP:
|
||||||
|
{
|
||||||
|
lcArray<lcGroup*> Groups;
|
||||||
|
|
||||||
|
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||||
|
{
|
||||||
|
lcPiece* Piece = mPieces[PieceIdx];
|
||||||
|
|
||||||
if (Piece->IsSelected())
|
if (Piece->IsSelected())
|
||||||
{
|
{
|
||||||
pGroup = Piece->GetTopGroup();
|
lcGroup* Group = Piece->GetTopGroup();
|
||||||
|
|
||||||
// Check if we already removed the group
|
if (Groups.FindIndex(Group) == -1)
|
||||||
for (tmp = pList; tmp; tmp = tmp->m_pNext)
|
|
||||||
if (pGroup == tmp)
|
|
||||||
pGroup = NULL;
|
|
||||||
|
|
||||||
if (pGroup != NULL)
|
|
||||||
{
|
{
|
||||||
// First remove the group from the array
|
mGroups.Remove(Group);
|
||||||
for (tmp = m_pGroups; tmp->m_pNext; tmp = tmp->m_pNext)
|
Groups.Add(Group);
|
||||||
if (tmp->m_pNext == pGroup)
|
|
||||||
{
|
|
||||||
tmp->m_pNext = pGroup->m_pNext;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pGroup == m_pGroups)
|
|
||||||
m_pGroups = pGroup->m_pNext;
|
|
||||||
|
|
||||||
// Now add it to the list of top groups
|
|
||||||
pGroup->m_pNext = pList;
|
|
||||||
pList = pGroup;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (pList)
|
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||||
{
|
{
|
||||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
lcPiece* Piece = mPieces[PieceIdx];
|
||||||
{
|
lcGroup* Group = Piece->GetGroup();
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
|
||||||
|
|
||||||
if (Piece->IsSelected())
|
if (Groups.FindIndex(Group) != -1)
|
||||||
Piece->UnGroup(pList);
|
Piece->SetGroup(NULL);
|
||||||
}
|
|
||||||
|
|
||||||
pGroup = pList;
|
|
||||||
pList = pList->m_pNext;
|
|
||||||
delete pGroup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int GroupIdx = 0; GroupIdx < mGroups.GetSize(); GroupIdx++)
|
||||||
|
{
|
||||||
|
lcGroup* Group = mGroups[GroupIdx];
|
||||||
|
|
||||||
|
if (Groups.FindIndex(Group->mGroup) != -1)
|
||||||
|
Group->mGroup = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Groups.DeleteAll();
|
||||||
|
|
||||||
RemoveEmptyGroups();
|
RemoveEmptyGroups();
|
||||||
SetModifiedFlag(true);
|
SetModifiedFlag(true);
|
||||||
CheckPoint("Ungrouping");
|
CheckPoint("Ungrouping");
|
||||||
|
@ -5071,8 +4975,8 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||||
Options.PieceParents.Add(mPieces[PieceIdx]->GetGroup());
|
Options.PieceParents.Add(mPieces[PieceIdx]->GetGroup());
|
||||||
|
|
||||||
for (Group* pGroup = m_pGroups; pGroup; pGroup = pGroup->m_pNext)
|
for (int GroupIdx = 0; GroupIdx < mGroups.GetSize(); GroupIdx++)
|
||||||
Options.GroupParents.Add(pGroup->m_pGroup);
|
Options.GroupParents.Add(mGroups[GroupIdx]->mGroup);
|
||||||
|
|
||||||
if (!gMainWindow->DoDialog(LC_DIALOG_EDIT_GROUPS, &Options))
|
if (!gMainWindow->DoDialog(LC_DIALOG_EDIT_GROUPS, &Options))
|
||||||
break;
|
break;
|
||||||
|
@ -5080,9 +4984,8 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||||
mPieces[PieceIdx]->SetGroup(Options.PieceParents[PieceIdx]);
|
mPieces[PieceIdx]->SetGroup(Options.PieceParents[PieceIdx]);
|
||||||
|
|
||||||
int GroupIdx = 0;
|
for (int GroupIdx = 0; GroupIdx < mGroups.GetSize(); GroupIdx++)
|
||||||
for (Group* pGroup = m_pGroups; pGroup; pGroup = pGroup->m_pNext)
|
mGroups[GroupIdx]->mGroup = Options.GroupParents[GroupIdx];
|
||||||
pGroup->m_pGroup = Options.GroupParents[GroupIdx++];
|
|
||||||
|
|
||||||
RemoveEmptyGroups();
|
RemoveEmptyGroups();
|
||||||
SelectAndFocusNone(false);
|
SelectAndFocusNone(false);
|
||||||
|
@ -5764,98 +5667,87 @@ void Project::HandleCommand(LC_COMMANDS id)
|
||||||
// Remove unused groups
|
// Remove unused groups
|
||||||
void Project::RemoveEmptyGroups()
|
void Project::RemoveEmptyGroups()
|
||||||
{
|
{
|
||||||
bool recurse = false;
|
bool Removed;
|
||||||
Group *g1, *g2;
|
|
||||||
int ref;
|
|
||||||
|
|
||||||
for (g1 = m_pGroups; g1;)
|
do
|
||||||
{
|
{
|
||||||
ref = 0;
|
Removed = false;
|
||||||
|
|
||||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
for (int GroupIdx = 0; GroupIdx < mGroups.GetSize();)
|
||||||
if (mPieces[PieceIdx]->GetGroup() == g1)
|
|
||||||
ref++;
|
|
||||||
|
|
||||||
for (g2 = m_pGroups; g2; g2 = g2->m_pNext)
|
|
||||||
if (g2->m_pGroup == g1)
|
|
||||||
ref++;
|
|
||||||
|
|
||||||
if (ref < 2)
|
|
||||||
{
|
{
|
||||||
if (ref != 0)
|
lcGroup* Group = mGroups[GroupIdx];
|
||||||
|
int Ref = 0;
|
||||||
|
|
||||||
|
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||||
|
if (mPieces[PieceIdx]->GetGroup() == Group)
|
||||||
|
Ref++;
|
||||||
|
|
||||||
|
for (int ParentIdx = 0; ParentIdx < mGroups.GetSize(); ParentIdx++)
|
||||||
|
if (mGroups[ParentIdx]->mGroup == Group)
|
||||||
|
Ref++;
|
||||||
|
|
||||||
|
if (Ref > 1)
|
||||||
|
{
|
||||||
|
GroupIdx++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Ref != 0)
|
||||||
{
|
{
|
||||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||||
{
|
{
|
||||||
Piece* Piece = mPieces[PieceIdx];
|
lcPiece* Piece = mPieces[PieceIdx];
|
||||||
|
|
||||||
if (Piece->GetGroup() == g1)
|
if (Piece->GetGroup() == Group)
|
||||||
Piece->SetGroup(g1->m_pGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (g2 = m_pGroups; g2; g2 = g2->m_pNext)
|
|
||||||
if (g2->m_pGroup == g1)
|
|
||||||
g2->m_pGroup = g1->m_pGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g1 == m_pGroups)
|
|
||||||
{
|
|
||||||
m_pGroups = g1->m_pNext;
|
|
||||||
delete g1;
|
|
||||||
g1 = m_pGroups;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (g2 = m_pGroups; g2; g2 = g2->m_pNext)
|
|
||||||
if (g2->m_pNext == g1)
|
|
||||||
{
|
{
|
||||||
g2->m_pNext = g1->m_pNext;
|
Piece->SetGroup(Group->mGroup);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
delete g1;
|
for (int ParentIdx = 0; ParentIdx < mGroups.GetSize(); ParentIdx++)
|
||||||
g1 = g2->m_pNext;
|
{
|
||||||
|
if (mGroups[ParentIdx]->mGroup == Group)
|
||||||
|
{
|
||||||
|
mGroups[ParentIdx]->mGroup = Group->mGroup;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
recurse = true;
|
mGroups.RemoveIndex(GroupIdx);
|
||||||
|
delete Group;
|
||||||
|
Removed = true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
g1 = g1->m_pNext;
|
|
||||||
}
|
}
|
||||||
|
while (Removed);
|
||||||
if (recurse)
|
|
||||||
RemoveEmptyGroups();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Group* Project::AddGroup (const char* name, Group* pParent, float x, float y, float z)
|
lcGroup* Project::AddGroup(lcGroup* Parent)
|
||||||
{
|
{
|
||||||
Group *pNewGroup = new Group();
|
lcGroup* NewGroup = new lcGroup();
|
||||||
|
|
||||||
if (name == NULL)
|
int i, Max = 0;
|
||||||
{
|
|
||||||
int i, max = 0;
|
|
||||||
char str[65];
|
|
||||||
|
|
||||||
for (Group *pGroup = m_pGroups; pGroup; pGroup = pGroup->m_pNext)
|
for (int GroupIdx = 0; GroupIdx < mGroups.GetSize(); GroupIdx++)
|
||||||
if (strncmp (pGroup->m_strName, "Group #", 7) == 0)
|
{
|
||||||
if (sscanf(pGroup->m_strName, "Group #%d", &i) == 1)
|
lcGroup* Group = mGroups[GroupIdx];
|
||||||
if (i > max)
|
|
||||||
max = i;
|
|
||||||
sprintf (str, "Group #%.2d", max+1);
|
|
||||||
|
|
||||||
strcpy (pNewGroup->m_strName, str);
|
if (strncmp(Group->m_strName, "Group #", 7) == 0)
|
||||||
}
|
if (sscanf(Group->m_strName, "Group #%d", &i) == 1)
|
||||||
else
|
if (i > Max)
|
||||||
strcpy (pNewGroup->m_strName, name);
|
Max = i;
|
||||||
|
}
|
||||||
|
|
||||||
pNewGroup->m_pNext = m_pGroups;
|
sprintf(NewGroup->m_strName, "Group #%.2d", Max + 1);
|
||||||
m_pGroups = pNewGroup;
|
mGroups.Add(NewGroup);
|
||||||
|
|
||||||
pNewGroup->m_fCenter[0] = x;
|
NewGroup->m_fCenter[0] = 0.0f;
|
||||||
pNewGroup->m_fCenter[1] = y;
|
NewGroup->m_fCenter[1] = 0.0f;
|
||||||
pNewGroup->m_fCenter[2] = z;
|
NewGroup->m_fCenter[2] = 0.0f;
|
||||||
pNewGroup->m_pGroup = pParent;
|
NewGroup->mGroup = Parent;
|
||||||
|
|
||||||
return pNewGroup;
|
return NewGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::SelectAndFocusNone(bool FocusOnly)
|
void Project::SelectAndFocusNone(bool FocusOnly)
|
||||||
|
|
|
@ -49,55 +49,6 @@
|
||||||
#define LC_SEL_FOCUSGROUP 0x200 // focused piece is grouped
|
#define LC_SEL_FOCUSGROUP 0x200 // focused piece is grouped
|
||||||
#define LC_SEL_CANGROUP 0x400 // can make a new group
|
#define LC_SEL_CANGROUP 0x400 // can make a new group
|
||||||
|
|
||||||
enum lcBackgroundType
|
|
||||||
{
|
|
||||||
LC_BACKGROUND_SOLID,
|
|
||||||
LC_BACKGROUND_GRADIENT,
|
|
||||||
LC_BACKGROUND_IMAGE
|
|
||||||
};
|
|
||||||
|
|
||||||
class lcModelProperties
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void LoadDefaults();
|
|
||||||
void SaveDefaults();
|
|
||||||
|
|
||||||
bool operator==(const lcModelProperties& Properties)
|
|
||||||
{
|
|
||||||
if (mName != Properties.mName || mAuthor != Properties.mAuthor ||
|
|
||||||
mDescription != Properties.mDescription || mComments != Properties.mComments)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (mBackgroundType != Properties.mBackgroundType || mBackgroundSolidColor != Properties.mBackgroundSolidColor ||
|
|
||||||
mBackgroundGradientColor1 != Properties.mBackgroundGradientColor1 || mBackgroundGradientColor2 != Properties.mBackgroundGradientColor2 ||
|
|
||||||
mBackgroundImage != Properties.mBackgroundImage || mBackgroundImageTile != Properties.mBackgroundImageTile)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (mFogEnabled != Properties.mFogEnabled || mFogDensity != Properties.mFogDensity ||
|
|
||||||
mFogColor != Properties.mFogColor || mAmbientColor != Properties.mAmbientColor)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
String mName;
|
|
||||||
String mAuthor;
|
|
||||||
String mDescription;
|
|
||||||
String mComments;
|
|
||||||
|
|
||||||
lcBackgroundType mBackgroundType;
|
|
||||||
lcVector3 mBackgroundSolidColor;
|
|
||||||
lcVector3 mBackgroundGradientColor1;
|
|
||||||
lcVector3 mBackgroundGradientColor2;
|
|
||||||
String mBackgroundImage;
|
|
||||||
bool mBackgroundImageTile;
|
|
||||||
|
|
||||||
bool mFogEnabled;
|
|
||||||
float mFogDensity;
|
|
||||||
lcVector3 mFogColor;
|
|
||||||
lcVector3 mAmbientColor;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum LC_TRANSFORM_TYPE
|
enum LC_TRANSFORM_TYPE
|
||||||
{
|
{
|
||||||
LC_TRANSFORM_ABSOLUTE_TRANSLATION,
|
LC_TRANSFORM_ABSOLUTE_TRANSLATION,
|
||||||
|
@ -113,7 +64,6 @@ enum LC_MOUSE_TRACK
|
||||||
LC_TRACK_RIGHT
|
LC_TRACK_RIGHT
|
||||||
};
|
};
|
||||||
|
|
||||||
class Group;
|
|
||||||
class Terrain;
|
class Terrain;
|
||||||
class PieceInfo;
|
class PieceInfo;
|
||||||
class View;
|
class View;
|
||||||
|
@ -171,25 +121,9 @@ enum lcObjectProperty
|
||||||
LC_CAMERA_PROPERTY_NAME
|
LC_CAMERA_PROPERTY_NAME
|
||||||
};
|
};
|
||||||
|
|
||||||
enum lcTool
|
#include "lc_model.h"
|
||||||
{
|
|
||||||
LC_TOOL_INSERT,
|
|
||||||
LC_TOOL_LIGHT,
|
|
||||||
LC_TOOL_SPOTLIGHT,
|
|
||||||
LC_TOOL_CAMERA,
|
|
||||||
LC_TOOL_SELECT,
|
|
||||||
LC_TOOL_MOVE,
|
|
||||||
LC_TOOL_ROTATE,
|
|
||||||
LC_TOOL_ERASER,
|
|
||||||
LC_TOOL_PAINT,
|
|
||||||
LC_TOOL_ZOOM,
|
|
||||||
LC_TOOL_PAN,
|
|
||||||
LC_TOOL_ROTATE_VIEW,
|
|
||||||
LC_TOOL_ROLL,
|
|
||||||
LC_TOOL_ZOOM_REGION
|
|
||||||
};
|
|
||||||
|
|
||||||
class Project
|
class Project : public lcModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Project();
|
Project();
|
||||||
|
@ -260,6 +194,11 @@ public:
|
||||||
*to = 255;
|
*to = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetGroupIndex(lcGroup* Group) const
|
||||||
|
{
|
||||||
|
return mGroups.FindIndex(Group);
|
||||||
|
}
|
||||||
|
|
||||||
void ConvertToUserUnits(lcVector3& Value) const;
|
void ConvertToUserUnits(lcVector3& Value) const;
|
||||||
void ConvertFromUserUnits(lcVector3& Value) const;
|
void ConvertFromUserUnits(lcVector3& Value) const;
|
||||||
lcMatrix44 GetRelativeRotation() const;
|
lcMatrix44 GetRelativeRotation() const;
|
||||||
|
@ -286,16 +225,11 @@ public:
|
||||||
bool GetFocusPosition(lcVector3& Position) const;
|
bool GetFocusPosition(lcVector3& Position) const;
|
||||||
Object* GetFocusObject() const;
|
Object* GetFocusObject() const;
|
||||||
bool AnyObjectsSelected(bool PiecesOnly) const;
|
bool AnyObjectsSelected(bool PiecesOnly) const;
|
||||||
Group* AddGroup (const char* name, Group* pParent, float x, float y, float z);
|
lcGroup* AddGroup(lcGroup* Parent);
|
||||||
void TransformSelectedObjects(LC_TRANSFORM_TYPE Type, const lcVector3& Transform);
|
void TransformSelectedObjects(LC_TRANSFORM_TYPE Type, const lcVector3& Transform);
|
||||||
void ModifyObject(Object* Object, lcObjectProperty Property, void* Value);
|
void ModifyObject(Object* Object, lcObjectProperty Property, void* Value);
|
||||||
void ZoomActiveView(int Amount);
|
void ZoomActiveView(int Amount);
|
||||||
|
|
||||||
// Objects
|
|
||||||
lcArray<lcPiece*> mPieces;
|
|
||||||
lcArray<lcCamera*> mCameras;
|
|
||||||
lcArray<lcLight*> mLights;
|
|
||||||
Group* m_pGroups;
|
|
||||||
Terrain* m_pTerrain;
|
Terrain* m_pTerrain;
|
||||||
|
|
||||||
char m_strTitle[LC_MAXPATH];
|
char m_strTitle[LC_MAXPATH];
|
||||||
|
@ -373,8 +307,6 @@ protected:
|
||||||
char m_strFooter[256];
|
char m_strFooter[256];
|
||||||
char m_strHeader[256];
|
char m_strHeader[256];
|
||||||
|
|
||||||
lcModelProperties mProperties;
|
|
||||||
|
|
||||||
lcTexture* m_pBackground;
|
lcTexture* m_pBackground;
|
||||||
lcTexture* mGridTexture;
|
lcTexture* mGridTexture;
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,7 @@ SOURCES += common/view.cpp \
|
||||||
common/lc_library.cpp \
|
common/lc_library.cpp \
|
||||||
common/lc_mainwindow.cpp \
|
common/lc_mainwindow.cpp \
|
||||||
common/lc_mesh.cpp \
|
common/lc_mesh.cpp \
|
||||||
|
common/lc_model.cpp \
|
||||||
common/lc_profile.cpp \
|
common/lc_profile.cpp \
|
||||||
common/lc_shortcuts.cpp \
|
common/lc_shortcuts.cpp \
|
||||||
common/lc_texture.cpp \
|
common/lc_texture.cpp \
|
||||||
|
@ -165,6 +166,7 @@ HEADERS += \
|
||||||
common/lc_mainwindow.h \
|
common/lc_mainwindow.h \
|
||||||
common/lc_math.h \
|
common/lc_math.h \
|
||||||
common/lc_mesh.h \
|
common/lc_mesh.h \
|
||||||
|
common/lc_model.h \
|
||||||
common/lc_profile.h \
|
common/lc_profile.h \
|
||||||
common/lc_shortcuts.h \
|
common/lc_shortcuts.h \
|
||||||
common/lc_texture.h \
|
common/lc_texture.h \
|
||||||
|
|
|
@ -48,7 +48,7 @@ void lcQEditGroupsDialog::on_newGroup_clicked()
|
||||||
currentItem = ui->treeWidget->invisibleRootItem();
|
currentItem = ui->treeWidget->invisibleRootItem();
|
||||||
|
|
||||||
Group *parentGroup = (Group*)currentItem->data(0, GroupRole).value<uintptr_t>();
|
Group *parentGroup = (Group*)currentItem->data(0, GroupRole).value<uintptr_t>();
|
||||||
Group *newGroup = lcGetActiveProject()->AddGroup(NULL, parentGroup, 0, 0, 0);
|
Group *newGroup = lcGetActiveProject()->AddGroup(parentGroup);
|
||||||
options->GroupParents.Add(NULL);
|
options->GroupParents.Add(NULL);
|
||||||
|
|
||||||
QTreeWidgetItem *groupItem = new QTreeWidgetItem(currentItem, QStringList(newGroup->m_strName));
|
QTreeWidgetItem *groupItem = new QTreeWidgetItem(currentItem, QStringList(newGroup->m_strName));
|
||||||
|
@ -116,12 +116,13 @@ void lcQEditGroupsDialog::updateParents(QTreeWidgetItem *parentItem, Group *pare
|
||||||
strncpy(itemGroup->m_strName, childItem->text(0).toLocal8Bit(), sizeof(itemGroup->m_strName));
|
strncpy(itemGroup->m_strName, childItem->text(0).toLocal8Bit(), sizeof(itemGroup->m_strName));
|
||||||
itemGroup->m_strName[sizeof(itemGroup->m_strName) - 1] = 0;
|
itemGroup->m_strName[sizeof(itemGroup->m_strName) - 1] = 0;
|
||||||
|
|
||||||
int groupIndex = 0;
|
for (int groupIdx = 0; groupIdx < project->mGroups.GetSize(); groupIdx++)
|
||||||
for (Group *group = project->m_pGroups; group; group = group->m_pNext, groupIndex++)
|
|
||||||
{
|
{
|
||||||
|
lcGroup *group = project->mGroups[groupIdx];
|
||||||
|
|
||||||
if (itemGroup == group)
|
if (itemGroup == group)
|
||||||
{
|
{
|
||||||
options->GroupParents[groupIndex] = parentGroup;
|
options->GroupParents[groupIdx] = parentGroup;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,9 +136,11 @@ void lcQEditGroupsDialog::addChildren(QTreeWidgetItem *parentItem, Group *parent
|
||||||
{
|
{
|
||||||
Project *project = lcGetActiveProject();
|
Project *project = lcGetActiveProject();
|
||||||
|
|
||||||
for (Group *group = project->m_pGroups; group; group = group->m_pNext)
|
for (int groupIdx = 0; groupIdx < project->mGroups.GetSize(); groupIdx++)
|
||||||
{
|
{
|
||||||
if (group->m_pGroup != parentGroup)
|
lcGroup *group = project->mGroups[groupIdx];
|
||||||
|
|
||||||
|
if (group->mGroup != parentGroup)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QTreeWidgetItem *groupItem = new QTreeWidgetItem(parentItem, QStringList(group->m_strName));
|
QTreeWidgetItem *groupItem = new QTreeWidgetItem(parentItem, QStringList(group->m_strName));
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
struct lcEditGroupsDialogOptions;
|
struct lcEditGroupsDialogOptions;
|
||||||
class Group;
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class lcQEditGroupsDialog;
|
class lcQEditGroupsDialog;
|
||||||
|
|
|
@ -150,9 +150,11 @@ void lcQSelectDialog::addChildren(QTreeWidgetItem *parentItem, Group *parentGrou
|
||||||
{
|
{
|
||||||
Project *project = lcGetActiveProject();
|
Project *project = lcGetActiveProject();
|
||||||
|
|
||||||
for (Group *group = project->m_pGroups; group; group = group->m_pNext)
|
for (int groupIdx = 0; groupIdx < project->mGroups.GetSize(); groupIdx++)
|
||||||
{
|
{
|
||||||
if (group->m_pGroup != parentGroup)
|
lcGroup* group = project->mGroups[groupIdx];
|
||||||
|
|
||||||
|
if (group->mGroup != parentGroup)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QTreeWidgetItem *groupItem = new QTreeWidgetItem(parentItem, QStringList(group->m_strName));
|
QTreeWidgetItem *groupItem = new QTreeWidgetItem(parentItem, QStringList(group->m_strName));
|
||||||
|
@ -164,7 +166,7 @@ void lcQSelectDialog::addChildren(QTreeWidgetItem *parentItem, Group *parentGrou
|
||||||
|
|
||||||
for (int pieceIdx = 0; pieceIdx < project->mPieces.GetSize(); pieceIdx++, numObjects++)
|
for (int pieceIdx = 0; pieceIdx < project->mPieces.GetSize(); pieceIdx++, numObjects++)
|
||||||
{
|
{
|
||||||
Piece *piece = project->mPieces[pieceIdx];
|
lcPiece *piece = project->mPieces[pieceIdx];
|
||||||
|
|
||||||
if (piece->GetGroup() != parentGroup)
|
if (piece->GetGroup() != parentGroup)
|
||||||
continue;
|
continue;
|
||||||
|
@ -181,7 +183,7 @@ void lcQSelectDialog::addChildren(QTreeWidgetItem *parentItem, Group *parentGrou
|
||||||
{
|
{
|
||||||
for (int cameraIdx = 0; cameraIdx < project->mCameras.GetSize(); cameraIdx++, numObjects++)
|
for (int cameraIdx = 0; cameraIdx < project->mCameras.GetSize(); cameraIdx++, numObjects++)
|
||||||
{
|
{
|
||||||
Camera *camera = project->mCameras[cameraIdx];
|
lcCamera *camera = project->mCameras[cameraIdx];
|
||||||
|
|
||||||
if (!camera->IsVisible())
|
if (!camera->IsVisible())
|
||||||
continue;
|
continue;
|
||||||
|
@ -193,7 +195,7 @@ void lcQSelectDialog::addChildren(QTreeWidgetItem *parentItem, Group *parentGrou
|
||||||
|
|
||||||
for (int lightIdx = 0; lightIdx < project->mLights.GetSize(); lightIdx++, numObjects++)
|
for (int lightIdx = 0; lightIdx < project->mLights.GetSize(); lightIdx++, numObjects++)
|
||||||
{
|
{
|
||||||
Light* light = project->mLights[lightIdx];
|
lcLight* light = project->mLights[lightIdx];
|
||||||
|
|
||||||
if (!light->IsVisible())
|
if (!light->IsVisible())
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
struct lcSelectDialogOptions;
|
struct lcSelectDialogOptions;
|
||||||
class Group;
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class lcQSelectDialog;
|
class lcQSelectDialog;
|
||||||
|
|
Loading…
Reference in a new issue