Ejemplo n.º 1
0
//-------------------------------------------------------------
VCNMesh* VCNMeshLoader::LoadMeshXML( const VCNString& filename )
{
  VCNMesh* newMesh = NULL;

  // Open the XML document
  XMLElementPtr pRootElem = LoadDocumentRoot( filename );
  VCN_ASSERT( pRootElem!=NULL && "Could not load XML Mesh!" );

  // Go through all the MeshElement nodes
  XMLNodeListPtr elementNodes = 0;
  pRootElem->selectNodes( (VCNTChar*)kNodeMeshElement, &elementNodes );
  VCNLong elementNodeListLength = 0;
  elementNodes->get_length( &elementNodeListLength );
  for( VCNLong i=0; i<elementNodeListLength; i++ )
  {
    // Get the element's node
    XMLNodePtr elementNode = 0;
    elementNodes->get_item( i, &elementNode );

    // Load the mesh element
    newMesh = LoadMeshElementXML( elementNode );
  }

  // Free up the doc memory
  ReleaseDocument();

  // Returns the last mesh we created our of this file
  return newMesh;
}
Ejemplo n.º 2
0
void TransferManagerDownloadCallback::TryDelete()
{
	if (done_listener && done_listener->OnDone(this) == FALSE)
	{
		/* This object is about to be reused for a potential
		 * ui interaction, we need to make sure that we return
		 * to a sane state.
		 */
		ReleaseDocument();
		download_action_mode = DOWNLOAD_UNDECIDED;
		download_context = NULL;
		need_copy_when_downloaded = FALSE;
		keep_loading = FALSE;
		called = FALSE;
		delayed = FALSE;
		cancelled = FALSE;
		current_action_flag.Reset();
		//viewer.Reset(); ??
		dont_add_to_transfers = FALSE;
	}
	else
		OP_DELETE(this);
}
Ejemplo n.º 3
0
//-------------------------------------------------------------
VCNAnim* VCNAnimLoader::LoadAnimXML( const VCNString& filename )
{
	// Create the new mesh to be filled!
	VCNAnim* newAnim = NULL;

	// Open the XML document
	XMLElementPtr pRootElem = LoadDocumentRoot( filename );
	VCN_ASSERT_MSG( pRootElem != NULL, "Could not load XML Animation!" );

	// Go through all the MeshElement nodes
	XMLNodeListPtr elementNodes;
	pRootElem->selectNodes( (VCNTChar*)kAttrAnimNode, &elementNodes );
	VCNLong animNodeCount;
	elementNodes->get_length( &animNodeCount );
	for( VCNLong i=0; i<animNodeCount; i++ )
	{
		// Create the new mesh to be filled!
		newAnim = new VCNAnim();

		// Get the element's node
		XMLNodePtr elementNode;
		elementNodes->get_item( i, &elementNode );

		// Load the base properties
		LoadResourceBaseProperties( elementNode, newAnim );

		// Go through all the joints that compose this anims
		XMLNodeListPtr jointNodes;
		elementNode->selectNodes( (VCNTChar*)kNodeAnimJoint, &jointNodes );
		VCNLong jointNodeCount;
		jointNodes->get_length( &jointNodeCount );
		for( VCNLong i=0; i<jointNodeCount; i++ )
		{
			// Get the mesh's node
			XMLNodePtr jointNode;
			jointNodes->get_item( i, &jointNode );

			// Load the joint
			VCNAnimJoint* animJoint = LoadJointXML( jointNode );

			// The name of the joint will be the name of the anim + the target joint
			animJoint->SetName( newAnim->GetName() + VCNTXT("_") + animJoint->GetTargetName() );

			// Add it to the resource manager
			VCNResID jointID = VCNResourceCore::GetInstance()->AddResource( animJoint->GetName(), animJoint );

			// Add it to the animation
			newAnim->AddJoint( jointID );
		}

		// Make sure we aren't loading it twice
		VCN_ASSERT( !VCNResourceCore::GetInstance()->GetResource<VCNAnim>( newAnim->GetName() ) );

		// Add it
		VCNResourceCore::GetInstance()->AddResource( newAnim->GetName(), newAnim );
	}

	// Free up the doc memory
	ReleaseDocument();

	return newAnim;
}
Ejemplo n.º 4
0
void TransferManagerDownloadCallback::Cancel()
{
	cancelled = TRUE;
	ReleaseDocument();
}