void QFileSystemModelDialog::setViews(QTreeView* dirView, QListView* fileView) { m_DirView = dirView; m_FileView = fileView; attachViews(); m_DirView->hideColumn( 1 ); m_DirView->hideColumn( 2 ); m_DirView->hideColumn( 3 ); // Directory model stuff // Set filter dirModel->setFilter(QDir::NoDotAndDotDot | QDir::AllDirs); // QFileSystemModel -requires- root path QString startPath("./assets/Objects"); dirModel->setRootPath(startPath); QModelIndex ind = dirModel->index(startPath); m_DirView->setRootIndex(ind); //File model stuff // Set filter fileModel->setFilter(QDir::NoDotAndDotDot | QDir::Files); // QFileSystemModel requires root path fileModel->setRootPath(startPath); ind = fileModel->index(startPath); m_FileView->setRootIndex(ind); }
void MLMenu::buildIndex() { mRoot->renumberItems(); std::string startPath(""); mRoot->buildFullNameIndex(mFullNamesByIndex, startPath); mHasIndex = true; }
void InterpolatedVector::updatePath(float dt) { InterpolatedVectorData *data = ensureData(); if (data->pathTimer > data->pathTime) { Vector value = data->path.getPathNode(data->path.getNumPathNodes()-1)->value; this->x = value.x; this->y = value.y; this->z = value.z; if (data->loopType != 0) { if (data->loopType > 0) data->loopType -= 1; int oldLoopType = data->loopType; if (data->pingPong) { // flip path data->path.flip(); startPath(data->pathTime); data->loopType = oldLoopType; } else { startPath(data->pathTime); data->loopType = oldLoopType; } } else { stopPath(); } } else { data->pathTimer += dt * data->pathTimeMultiplier; float perc = data->pathTimer/data->pathTime; Vector value = data->path.getValue(perc); this->x = value.x; this->y = value.y; this->z = value.z; } }
Position PathMemory::moveOnPath(Position current, Position next, Position end) { if (!currentPath) { if (existsPath(current, end)) { currentPath = getMemory(current, end); } else { startPath(current, end); } } else { if (current == end) { currentPath->path.push_back(current); currentPath->pathComplete = true; currentPath = NULL; return current; } if (currentPath->pathComplete) { return getPrevPosition(); } else if (pathMap[next] == VISITED) { pathMap[current] = VISITED; if (currentPath->path.size() >= 2) { Position pos = *(currentPath->path.end() - 1); currentPath->path.erase(currentPath->path.end() - 1); return pos; } return currentPath->start; } else { currentPath->path.push_back(current); pathMap[current] = VISITED; return next; } } return next; }
void InterpolatedVector::updatePath(float dt) { if (!speedPath) { if (pathTimer > pathTime) { Vector value = path.getPathNode(path.getNumPathNodes()-1)->value; this->x = value.x; this->y = value.y; this->z = value.z; if (loopType != 0) { if (loopType > 0) loopType -= 1; int oldLoopType = loopType; if (pingPong) { // flip path path.flip(); startPath(pathTime); loopType = oldLoopType; } else { startPath(pathTime); loopType = oldLoopType; } } else { stopPath(); endOfPathEvent.call(); } } else { pathTimer += dt * pathTimeMultiplier; // ;//dt*timeSpeedMultiplier; float perc = pathTimer/pathTime; Vector value = path.getValue(perc); this->x = value.x; this->y = value.y; this->z = value.z; /* std::ostringstream os; os << "nodes: " << path.getNumPathNodes() << " pathTimer: " << pathTimer << " pathTime: " << pathTime << " perc: " << perc << " p(" << x << ", " << y << ")"; debugLog(os.str()); */ /* float diff = pathTime - pathTimer; if (timeSpeedEase > 0) { float secs = 1.0/timeSpeedEase; if (diff <= secs) { timeSpeedMultiplier -= dt*timeSpeedEase; if (timeSpeedMultiplier < 0.1) timeSpeedMultiplier = 0.1; } } if (timeSpeedMultiplier < 1) { timeSpeedMultiplier += dt*timeSpeedEase; if (timeSpeedMultiplier >= 1) timeSpeedMultiplier = 1; } */ } } else { if (!isInterpolating()) { currentPathNode++; VectorPathNode *node = path.getPathNode(currentPathNode); /* if (node) { } else { stopPath(); endOfPathEvent.call(); } */ if (node) { interpolateTo(node->value, (node->value - Vector(this->x, this->y, this->z)).getLength3D()*(1.0/pathSpeed)); } else { // handle looping etc stopPath(); endOfPathEvent.call(); } } } }