mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Keep camera name as a c string for now.
This commit is contained in:
parent
d7275358d6
commit
f024007157
4 changed files with 13 additions and 9 deletions
|
@ -341,11 +341,11 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
|
||||||
// Load project.
|
// Load project.
|
||||||
if (ProjectName && gMainWindow->OpenProject(ProjectName))
|
if (ProjectName && gMainWindow->OpenProject(ProjectName))
|
||||||
{
|
{
|
||||||
if(ModelName)
|
if (ModelName)
|
||||||
lcGetActiveProject()->SetActiveModel(QString::fromUtf8(ModelName));
|
lcGetActiveProject()->SetActiveModel(QString::fromUtf8(ModelName));
|
||||||
|
|
||||||
if(CameraName)
|
if (CameraName)
|
||||||
gMainWindow->GetActiveView()->SetCamera(QString::fromUtf8(CameraName));
|
gMainWindow->GetActiveView()->SetCamera(CameraName);
|
||||||
|
|
||||||
if (SaveImage)
|
if (SaveImage)
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,8 +71,10 @@ void Project::SetActiveModel(int ModelIndex)
|
||||||
|
|
||||||
void Project::SetActiveModel(const QString& ModelName)
|
void Project::SetActiveModel(const QString& ModelName)
|
||||||
{
|
{
|
||||||
for (int ModelIdx = 0; ModelIdx < mModels.GetSize(); ModelIdx++) {
|
for (int ModelIdx = 0; ModelIdx < mModels.GetSize(); ModelIdx++)
|
||||||
if(ModelName.compare(mModels[ModelIdx]->GetName(), Qt::CaseInsensitive) == 0) {
|
{
|
||||||
|
if (ModelName.compare(mModels[ModelIdx]->GetName(), Qt::CaseInsensitive) == 0)
|
||||||
|
{
|
||||||
SetActiveModel(ModelIdx);
|
SetActiveModel(ModelIdx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,12 +240,14 @@ void View::SetCamera(lcCamera* Camera, bool ForceCopy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::SetCamera(const QString& CameraName)
|
void View::SetCamera(const char* CameraName)
|
||||||
{
|
{
|
||||||
const lcArray<lcCamera*>& Cameras = mModel->GetCameras();
|
const lcArray<lcCamera*>& Cameras = mModel->GetCameras();
|
||||||
|
|
||||||
for (int CameraIdx = 0; CameraIdx < Cameras.GetSize(); CameraIdx++) {
|
for (int CameraIdx = 0; CameraIdx < Cameras.GetSize(); CameraIdx++)
|
||||||
if(CameraName.compare(QString::fromUtf8(Cameras[CameraIdx]->m_strName), Qt::CaseInsensitive) == 0) {
|
{
|
||||||
|
if (qstricmp(CameraName, Cameras[CameraIdx]->m_strName) == 0)
|
||||||
|
{
|
||||||
SetCameraIndex(CameraIdx);
|
SetCameraIndex(CameraIdx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ public:
|
||||||
|
|
||||||
void RemoveCamera();
|
void RemoveCamera();
|
||||||
void SetCamera(lcCamera* Camera, bool ForceCopy);
|
void SetCamera(lcCamera* Camera, bool ForceCopy);
|
||||||
void SetCamera(const QString& CameraName);
|
void SetCamera(const char* CameraName);
|
||||||
void SetCameraIndex(int Index);
|
void SetCameraIndex(int Index);
|
||||||
void SetViewpoint(lcViewpoint Viewpoint);
|
void SetViewpoint(lcViewpoint Viewpoint);
|
||||||
void SetDefaultCamera();
|
void SetDefaultCamera();
|
||||||
|
|
Loading…
Reference in a new issue