Example #1
0
//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
}
Example #2
0
unsigned int SceneTreeNode::addLight(SceneLight childLight)
{
	childLights.push_back(childLight);
	
	refreshCounters(LIGHT);

	return childLights.size() - 1;
}
Example #3
0
unsigned int SceneTreeNode::addCamera(SceneCamera childCamera)
{
	childCameras.push_back(childCamera);
	
	refreshCounters(CAMERA);

	return childCameras.size() - 1;
}
Example #4
0
bool SceneTreeNode::removeObject(unsigned int index)
{
	if(tryToRemoveElementFromVector(childObjectsIDs, index))
	{
		refreshCounters(OBJECT);
		return true;
	}
	return false;
}
Example #5
0
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;
}
Example #6
0
bool SceneTreeNode::removeLight(unsigned int index)
{
	if(tryToRemoveElementFromVector(childLights, index))
	{
		refreshCounters(LIGHT);
		return true;
	}
	return false;
}
Example #7
0
bool SceneTreeNode::removeTreeNode(unsigned int index)
{
	if(childTreeNodes.size() > index &&
		!childTreeNodes[index].thereIsActiveCameraInSubTree() &&
		tryToRemoveElementFromVector(childTreeNodes, index))
	{
		refreshCounters(OBJECT + CAMERA + LIGHT);
		return true;
	}
	return false;
}
Example #8
0
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;
}
Example #9
0
	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;