예제 #1
0
bool GetSubmitterNameFromJob(const PROC_ID &id, MyString &name)
{
	if (GetAttributeString(id.cluster, id.proc,
						   ATTR_USER, name) < 0) {
		return false;
	}

	SanitizeSubmitterName(name);
	return true;
}
예제 #2
0
	//--------------------------------------------------------------------------------
	std::string Serializer::ReadLevel()
	{
		LoadFirstItem();
		
		std::string levelscript;

		do {
			if(CheckAttribute("type", "gameobject") || CheckAttribute("type", "archetype"))
				g_FACTORY->Create(*this, GetElementName());
			else if(CheckAttribute("type", "script"))
				levelscript = GetAttributeString("name");
		} while(NextNode());

		return levelscript;
	}
예제 #3
0
//-------------------------------------------------------------
VCNAnimJoint* VCNAnimLoader::LoadJointXML( XMLNodePtr jointNode )
{
	VCNAnimJoint* animJoint = new VCNAnimJoint();

	// Read the name of the target for the joint and store it
	VCNString tmpString;
	if( GetAttributeString(jointNode, kAttrAnimJointTarget, tmpString) )
	{
		animJoint->SetTargetName( tmpString );
	}

	// Temp variables for lecture
	VCNFloat fTime;
	Vector3 tmpVector;
	VCNQuat tmpQuat;
	VCNUInt count;
	VCNBool readSuccess;

	// Get the number of rotation frames
	GetAttributeUInt(jointNode, kAttrAnimJointPosCount, count);

	// Lets load up all the positions!
	XMLNodeListPtr posNodes;
	jointNode->selectNodes( (VCNTChar*)kNodeAnimJointPosition, &posNodes );
	VCNLong posNodeCount;
	posNodes->get_length( &posNodeCount );
	VCN_ASSERT( (long)count == posNodeCount );
	for( VCNLong i=0; i<posNodeCount; i++ )
	{
		// Get the mesh's node
		XMLNodePtr posNode;
		posNodes->get_item( i, &posNode );

		// Get the frame time for this position
		GetAttributeFloat(posNode, kAttrAnimJointPosFrameTime, fTime);

		// Get the x position
		GetAttributeFloat(posNode, kAttrAnimJointFramePosX, tmpVector.x);

		// Get the y position
		GetAttributeFloat(posNode, kAttrAnimJointFramePosY, tmpVector.y);

		// Get the z position
		GetAttributeFloat(posNode, kAttrAnimJointFramePosZ, tmpVector.z);

		// Add it to the joint
		animJoint->AddPosFrame( fTime, tmpVector );
	}

	// Get the number of rotation frames
	GetAttributeUInt(jointNode, kAttrAnimJointRotCount, count);

	// Lets load up all the rotations!
	XMLNodeListPtr rotNodes;
	jointNode->selectNodes( (VCNTChar*)kNodeAnimJointRotation, &rotNodes );
	VCNLong rotNodeCount;
	rotNodes->get_length( &rotNodeCount );
	VCN_ASSERT( (long)count == rotNodeCount );
	for( VCNLong i=0; i<rotNodeCount; i++ )
	{
		// Get the mesh's node
		XMLNodePtr rotNode;
		rotNodes->get_item( i, &rotNode );

		// Get the frame time for this position
		readSuccess = GetAttributeFloat(rotNode, kAttrAnimJointPosFrameTime, fTime);
		VCN_ASSERT(readSuccess);

		// Get the x of the quat
		readSuccess = GetAttributeFloat(rotNode, kAttrAnimJointFrameRotX, tmpQuat.x);
		VCN_ASSERT(readSuccess);

		// Get the y of the quat
		readSuccess = GetAttributeFloat(rotNode, kAttrAnimJointFrameRotY, tmpQuat.y);
		VCN_ASSERT(readSuccess);

		// Get the z of the quat
		readSuccess = GetAttributeFloat(rotNode, kAttrAnimJointFrameRotZ, tmpQuat.z);
		VCN_ASSERT(readSuccess);

		// Get the w of the quat
		readSuccess = GetAttributeFloat(rotNode, kAttrAnimJointFrameRotW, tmpQuat.w);
		VCN_ASSERT(readSuccess);

		// Add it to the joint
		animJoint->AddRotFrame( fTime, tmpQuat );
	}

	// Get the number of scale frames
	GetAttributeUInt(jointNode, kAttrAnimJointScaleCount, count);


	// Lets load up all the scales!
	XMLNodeListPtr scaleNodes;
	jointNode->selectNodes( (VCNTChar*)kNodeAnimJointScale, &scaleNodes );
	VCNLong scaleNodeCount;
	scaleNodes->get_length( &scaleNodeCount );
	VCN_ASSERT( (long)count == scaleNodeCount );
	for( VCNLong i=0; i<scaleNodeCount; i++ )
	{
		// Get the mesh's node
		XMLNodePtr scaleNode;
		scaleNodes->get_item( i, &scaleNode );

		// Get the frame time for this position
		readSuccess = GetAttributeFloat(scaleNode, kAttrAnimJointScaleFrameTime, fTime);
		VCN_ASSERT(readSuccess);

		// Get the x of the quat
		readSuccess = GetAttributeFloat(scaleNode, kAttrAnimJointFrameScaleX, tmpVector.x);
		VCN_ASSERT(readSuccess);

		// Get the y of the quat
		readSuccess = GetAttributeFloat(scaleNode, kAttrAnimJointFrameScaleY, tmpVector.y);
		VCN_ASSERT(readSuccess);

		// Get the z of the quat
		readSuccess = GetAttributeFloat(scaleNode, kAttrAnimJointFrameScaleZ, tmpVector.z);
		VCN_ASSERT(readSuccess);

		// Add it to the joint
		animJoint->AddScaleFrame( fTime, tmpVector );
	}

	// Return the joint
	return animJoint;
}