Ejemplo n.º 1
0
void SMDNodeList::AddNode ( XSI::CString in_szName, XSI::CString  in_szParentName,  XSI::Kinematics	l_pHierarchyCompensation, XSI::Kinematics l_pHierarchyCompensation2)
{
	char *pString1 = new char [ in_szName.Length() + 1 ];
	char *pString2 = new char [ in_szParentName.Length() + 1 ];

	W2AHelper ( pString1, in_szName.GetWideString() );
	W2AHelper ( pString2, in_szParentName.GetWideString() );

	AddNode ( pString1, pString2, l_pHierarchyCompensation, l_pHierarchyCompensation2);


	delete [] pString1;
	delete [] pString2;


}
Ejemplo n.º 2
0
bool SMDImporter::Import ( char *in_szFilename )
{

	FILE *f = fopen ( in_szFilename, "rb" );

	if ( !f )
	{
		LPWSTR l_wszModelName;
		DSA2W(&l_wszModelName,in_szFilename);

		XSI::CString cstr = L"SMDImport: Cannot open the file ";
		cstr += l_wszModelName;

		XSILogMessage ( (unsigned short*)cstr.GetWideString(), XSI::siErrorMsg );
		return false;
	}
	
	memset ( m_szActionName, 0, 1024 );
	_splitpath ( in_szFilename, NULL, NULL, m_szActionName, NULL );

	char drive[1024];
	char dirc[1024];

	memset ( m_szDirectory, 0, 1024 );

	if ( strlen(___gTexturePathOverride))
	{
		sprintf ( ___gTexturePathOverride, "%s\\", ___gTexturePathOverride );
		_splitpath ( ___gTexturePathOverride, drive, dirc, NULL, NULL );
		sprintf ( m_szDirectory, "%s\\%s\\", drive, dirc );
	} else {
		_splitpath ( in_szFilename, drive, dirc, NULL, NULL );
		sprintf ( m_szDirectory, "%s\\%s\\", drive, dirc );
	}

	
	bool Success = Parse ( f );

	fclose (f);

	if ( !Success )
	{
		return Success;
	}

	DetectModel();

	CreateHierarchy();

	CreateGeometry();

	WeightGeometry();

	CreateShapeClips();

	CreateAnimationSource();

	return true;
}
Ejemplo n.º 3
0
void SMDNodeList::AddNode ( XSI::CString in_szName, int in_iParentID, XSI::X3DObject in_pModel, XSI::Kinematics	in_pHierarchyCompensation ,XSI::Kinematics	in_pHierarchyCompensation2 )
{

	char *pSzString = new char [ in_szName.Length() + 1 ];
	W2AHelper ( pSzString, in_szName.GetWideString() );
	
	AddNodeS ( pSzString, in_iParentID, in_pModel, in_pHierarchyCompensation ,in_pHierarchyCompensation2 );

	delete [] pSzString;

}
void DependencyExporter::exportUpdateCanvasSize(XSI::CString outputFile, const char *data, unsigned int dataLength){
	std::string htmlData(data,dataLength);

	htmlData = replace(htmlData, "width=\"1000\"", replace("width=\"1000\"","1000", toString(this->width)));
	htmlData = replace(htmlData, "height=\"500\"", replace("height=\"500\"","500", toString(this->height)));
	data = htmlData.c_str();
	dataLength = htmlData.length();
	std::ofstream myFile (outputFile.GetWideString(), std::ios::out | std::ios::binary);
    myFile.write (data, dataLength);
	myFile.close();
}
void DependencyExporter::exportFile(XSI::CString directory, std::string fileName, const char *data, unsigned int dataLength){
	XSI::CString outputFile = directory + fileName.c_str();

	bool updateCanvasSize = fileName.compare("index.html")==0;
	if (updateCanvasSize){
		exportUpdateCanvasSize(outputFile, data, dataLength);
		return;
	}

    std::ofstream myFile (outputFile.GetWideString(), std::ios::out | std::ios::binary);
    myFile.write (data, dataLength);
	myFile.close();
}