//add/remove elements unsigned int SceneTreeNode::addTreeNode(SceneTreeNode childTreeNode) { //check if keep an eventualy active camera or disable it if(childTreeNode.thereIsActiveCameraInSubTree()) { //check if this tree has already an active camera bool treeHasActiveCamera = false; SceneTreeNode *node = this; while (!treeHasActiveCamera && node != 0) { if(node->thereIsActiveCameraInSubTree()) treeHasActiveCamera = true; else node = node->parentTransform; } if(treeHasActiveCamera) //if this tree has already an active camera childTreeNode.deactivateCamera(); } //push transform childTreeNode.parentTransform = this; childTreeNodes.push_back(childTreeNode); //refresh indices refreshCounters(OBJECT + CAMERA + LIGHT); return childTreeNodes.size() - 1; //index of childTransform }
unsigned int SceneTreeNode::addLight(SceneLight childLight) { childLights.push_back(childLight); refreshCounters(LIGHT); return childLights.size() - 1; }
unsigned int SceneTreeNode::addCamera(SceneCamera childCamera) { childCameras.push_back(childCamera); refreshCounters(CAMERA); return childCameras.size() - 1; }
bool SceneTreeNode::removeObject(unsigned int index) { if(tryToRemoveElementFromVector(childObjectsIDs, index)) { refreshCounters(OBJECT); return true; } return false; }
unsigned int SceneTreeNode::addObject(SceneObject childObject) { objectStore->push_back(childObject); childObjectsIDs.push_back(objectStore->size() - 1); //add index of childObject in objectStore refreshCounters(OBJECT); return childObjectsIDs.size() - 1; }
bool SceneTreeNode::removeLight(unsigned int index) { if(tryToRemoveElementFromVector(childLights, index)) { refreshCounters(LIGHT); return true; } return false; }
bool SceneTreeNode::removeTreeNode(unsigned int index) { if(childTreeNodes.size() > index && !childTreeNodes[index].thereIsActiveCameraInSubTree() && tryToRemoveElementFromVector(childTreeNodes, index)) { refreshCounters(OBJECT + CAMERA + LIGHT); return true; } return false; }
bool SceneTreeNode::removeCamera(unsigned int index) { if(indexActiveCamera != index && tryToRemoveElementFromVector(childCameras, index)) { if(index < indexActiveCamera) //if the removed camera is before the active camera indexActiveCamera--; refreshCounters(CAMERA); return true; } return false; }
str << "],\"jids\":[["; for( int j = 0; j < jids.size(); j++) { if( j > 0 ) str << ","; str << jids[j]; } str << "]]}}}"; return af::jsonMsg( str); } void UserAf::v_refresh( time_t currentTime, AfContainer * pointer, MonitorContainer * monitoring) { AFINFA("UserAf::refresh: \"%s\"", getName().toUtf8().data()) bool changed = refreshCounters(); if( changed && monitoring ) monitoring->addEvent( af::Monitor::EVT_users_change, m_id); // Update solving parameters: v_calcNeed(); } bool UserAf::refreshCounters() { int _numjobs = m_jobslist.getCount(); int _numrunningjobs = 0; int _runningtasksnumber = 0; int _runningcapacitytotal = 0;