Example #1
0
bool ElMaxPlugin::ExportSkeletalAnim(LPCTSTR filename)
{
	// Open the stream
	outfile.open(filename);
	if (!outfile.good())
		return false;

	// Set format of the stream
	outfile << setprecision(4) << setiosflags(ios::fixed);

	// Export global info
	ExportGlobalInfo();

	// Add bones to out bone list
	boneList.Clear();
	PreProcess(ip->GetRootNode());

	// Export list of animation
	ExportSkeletalAnim();

	// Close the stream
	outfile.close();

	return true;
}
Example #2
0
bool ElMaxPlugin::ExportMeshAnim(LPCTSTR filename)
{
	// Open the stream
	outfile.open(filename);
	if (!outfile.good())
		return false;

	// Set format of the stream
	outfile << setprecision(4) << setiosflags(ios::fixed);

	// Add bones to out bone list, in case some bone be
	// exported as GeomObject
	boneList.Clear();
	PreProcess(ip->GetRootNode());

	// Export global info
	ExportGlobalInfo();

	// Export animation of each object found in the scene
	nodeEnumForAnim(ip->GetRootNode());

	// Close the stream
	outfile.close();

	return true;
}
Example #3
0
// Start the exporter!
// This is the real entrypoint to the exporter. After the user has selected
// the filename (and he's prompted for overwrite etc.) this method is called.
//
int XsiExp::DoExport( const TCHAR * name, ExpInterface * ei, Interface * i, BOOL suppressPrompts, DWORD options) 
{
	// Set a global prompt display switch
	showPrompts = suppressPrompts ? FALSE : TRUE;
	exportSelected = (options & SCENE_EXPORT_SELECTED) ? TRUE : FALSE;

	// Grab the interface pointer.
	ip = i;

	int numChildren = ip->GetRootNode()->NumberOfChildren();
  if (!numChildren)
  {
    return 1;
  }

	// Get the options the user selected the last time
	ReadConfig();

	if(showPrompts)
  {
		// Prompt the user with our dialogbox, and get all the options.
		if (!DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_EXPORT_DLG),
			ip->GetMAXHWnd(), ExportDlgProc, (LPARAM)this))
    {
			return 1;
		}
	}
	else
  {	// Set default parameters here
  	bIncludeAnim = TRUE;
		bIncludeVertexColors = FALSE;

    bAlwaysSample = FALSE;
		nKeyFrameStep = 5;
		nMeshFrameStep = 5;
		nPrecision = 4;
		nStaticFrame = 0;
	}
	
	sprintf(szFmtStr, "%%4.%df", nPrecision);

	// Open the stream
	pStream = _tfopen(name,_T("wt"));
	if (!pStream)
  {
		return 0;
	}
	
	// Startup the progress bar.
	ip->ProgressStart(GetString(IDS_PROGRESS_MSG), TRUE, fn, NULL);

	// Get a total node count by traversing the scene
	// We don't really need to do this, but it doesn't take long, and
	// it is nice to have an accurate progress bar.
	nTotalNodeCount = 0;
	nCurNode = 0;
	PreProcess(ip->GetRootNode(), nTotalNodeCount);
	
	// First we write out a file header with global information. 
	ExportGlobalInfo();

  // export meshes
	for (int idx = 0; idx < numChildren; idx++)
  {
		if (ip->GetCancel())
    {
			break;
    }
		nodeEnumMesh( ip->GetRootNode()->GetChildNode(idx), 0);
	}
	for (idx = 0; idx < numChildren; idx++)
  {
		if (ip->GetCancel())
    {
			break;
    }
		nodeEnumBone( ip->GetRootNode()->GetChildNode(idx), 0);
	}
  // close brace for hierarchy
 	fprintf(pStream,"}\n\n");

  if (bIncludeAnim)
  {
    int animHit = FALSE;    // write anim list head only the first time
	  for (idx = 0; idx < numChildren; idx++)
    {
		  if (ip->GetCancel())
      {
			  break;
      }
		  nodeEnumAnim( ip->GetRootNode()->GetChildNode(idx), animHit);
	  }

    if (animHit)
    {
  	  fprintf(pStream,"}\n\n");
    }
  }

	for (idx = 0; idx < numChildren; idx++)
  {
		if (ip->GetCancel())
    {
			break;
    }
    nodeEnumSkin( ip->GetRootNode()->GetChildNode(idx));
  }

	// We're done. Finish the progress bar.
	ip->ProgressEnd();

	// Close the stream
	fclose(pStream);

	// Write the current options to be used next time around.
	WriteConfig();

	return 1;
}
Example #4
0
// Start the exporter!
// This is the real entrypoint to the exporter. After the user has selected
// the filename (and he's prompted for overwrite etc.) this method is called.
int AscOut::DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts, DWORD options) 
{
	// Set a global prompt display switch
	showPrompts = suppressPrompts ? FALSE : TRUE;
	exportSelected = (options & SCENE_EXPORT_SELECTED) ? TRUE : FALSE;

	// Grab the interface pointer.
	ip = i;

	// Get the options the user selected the last time
	ReadConfig();

	if(showPrompts) {
		// Prompt the user with our dialogbox, and get all the options.
		if (!DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_ASCOUT_DLG),
			ip->GetMAXHWnd(), ExportDlgProc, (LPARAM)this)) {
			return 1;
		}
	}
	
	sprintf(szFmtStr, "%%4.%df", nPrecision);

	// Open the stream
	pStream = _tfopen(name,_T("wt"));
	if (!pStream) {
		return 0;
	}
	
	// Startup the progress bar.
	ip->ProgressStart(GetString(IDS_PROGRESS_MSG), TRUE, fn, NULL);

	// Get a total node count by traversing the scene
	// We don't really need to do this, but it doesn't take long, and
	// it is nice to have an accurate progress bar.
	nTotalNodeCount = 0;
	nCurNode = 0;
	PreProcess(ip->GetRootNode(), nTotalNodeCount);
	
	// First we write out a file header with global information. 
	ExportGlobalInfo();

	int numChildren = ip->GetRootNode()->NumberOfChildren();
	
	// Call our node enumerator.
	// The nodeEnum function will recurse into itself and 
	// export each object found in the scene.
	
	for (int idx=0; idx<numChildren; idx++) {
		if (ip->GetCancel())
			break;
		nodeEnum(ip->GetRootNode()->GetChildNode(idx), 0);
	}

	// We're done. Finish the progress bar.
	ip->ProgressEnd();

	// Close the stream
	fclose(pStream);

	// Write the current options to be used next time around.
	WriteConfig();

	return 1;
}