예제 #1
0
void SelectPathWidgetBase::OpenClicked()
{
	DAVA::FilePath presentPath(text().toStdString());
	DAVA::FilePath dialogString(openDialogDefaultPath);
	if(presentPath.GetDirectory().Exists())//check if file text box clean
	{
		dialogString = presentPath.GetDirectory();
	}
	this->blockSignals(true);
	DAVA::String retString = QtFileDialog::getOpenFileName(this, openFileDialogTitle.c_str(), QString(dialogString.GetAbsolutePathname().c_str()), fileFormatFilter.c_str()).toStdString();
	this->blockSignals(false);

    if(retString.empty())
    {
        return;
    }
    
    DAVA::String projectPath = ProjectManager::Instance()->CurProjectPath().GetAbsolutePathname();

    if(checkForProjectPath && DAVA::String::npos == retString.find(projectPath))
    {
        QMessageBox::warning(NULL, "Wrong file selected", QString(DAVA::Format("Path %s doesn't belong to project.", retString.c_str()).c_str() ), QMessageBox::Ok);
        return;
    }
    
	HandlePathSelected(retString);
}
예제 #2
0
void SceneValidator::ValidateScene(Scene *scene, const DAVA::FilePath &scenePath, Set<String> &errorsLog)
{
    if(scene) 
    {
		DAVA::String tmp = scenePath.GetAbsolutePathname();
		size_t pos = tmp.find("/Data");
		if(pos != String::npos)
		{
			SetPathForChecking(tmp.substr(0, pos + 1));
		}

        ValidateSceneNode(scene, errorsLog);

        for (Set<Entity*>::iterator it = emptyNodesForDeletion.begin(); it != emptyNodesForDeletion.end(); ++it)
        {
            Entity * node = *it;
            if (node->GetParent())
            {
                node->GetParent()->RemoveNode(node);
            }
        }
        

		for (Set<Entity *>::iterator it = emptyNodesForDeletion.begin(); it != emptyNodesForDeletion.end(); ++it)
		{
			Entity *node = *it;
			SafeRelease(node);
		}

        emptyNodesForDeletion.clear();
    }
    else 
    {
        errorsLog.insert(String("Scene in NULL!"));
    }
}