Keep camera name as a c string for now.

This commit is contained in:
Leonardo Zide 2017-06-20 21:43:39 -07:00
parent d7275358d6
commit f024007157
4 changed files with 13 additions and 9 deletions

View file

@ -341,11 +341,11 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
// Load project.
if (ProjectName && gMainWindow->OpenProject(ProjectName))
{
if(ModelName)
if (ModelName)
lcGetActiveProject()->SetActiveModel(QString::fromUtf8(ModelName));
if(CameraName)
gMainWindow->GetActiveView()->SetCamera(QString::fromUtf8(CameraName));
if (CameraName)
gMainWindow->GetActiveView()->SetCamera(CameraName);
if (SaveImage)
{

View file

@ -71,8 +71,10 @@ void Project::SetActiveModel(int ModelIndex)
void Project::SetActiveModel(const QString& ModelName)
{
for (int ModelIdx = 0; ModelIdx < mModels.GetSize(); ModelIdx++) {
if(ModelName.compare(mModels[ModelIdx]->GetName(), Qt::CaseInsensitive) == 0) {
for (int ModelIdx = 0; ModelIdx < mModels.GetSize(); ModelIdx++)
{
if (ModelName.compare(mModels[ModelIdx]->GetName(), Qt::CaseInsensitive) == 0)
{
SetActiveModel(ModelIdx);
return;
}

View file

@ -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();
for (int CameraIdx = 0; CameraIdx < Cameras.GetSize(); CameraIdx++) {
if(CameraName.compare(QString::fromUtf8(Cameras[CameraIdx]->m_strName), Qt::CaseInsensitive) == 0) {
for (int CameraIdx = 0; CameraIdx < Cameras.GetSize(); CameraIdx++)
{
if (qstricmp(CameraName, Cameras[CameraIdx]->m_strName) == 0)
{
SetCameraIndex(CameraIdx);
return;
}

View file

@ -92,7 +92,7 @@ public:
void RemoveCamera();
void SetCamera(lcCamera* Camera, bool ForceCopy);
void SetCamera(const QString& CameraName);
void SetCamera(const char* CameraName);
void SetCameraIndex(int Index);
void SetViewpoint(lcViewpoint Viewpoint);
void SetDefaultCamera();