#include "geometryCacheFile.h"
#include <maya/MSyntax.h>
#include <maya/MPxCommand.h>
#include <maya/MGlobal.h>
#include <maya/MArgList.h>
#include <maya/MArgDatabase.h>
#include <maya/MFnPlugin.h>
#define LFLAG_TOASCII "-toAscii"
#define SFLAG_TOASCII "-ta"
#define LFLAG_FILE "-file"
#define SFLAG_FILE "-f"
{
public:
convertGeometryCache();
~convertGeometryCache() override;
static void* creator();
};
convertGeometryCache::convertGeometryCache()
{
}
convertGeometryCache::~convertGeometryCache()
{
}
void* convertGeometryCache::creator()
{
return new convertGeometryCache();
}
bool convertGeometryCache::hasSyntax()
{
return true;
}
MSyntax convertGeometryCache::cmdSyntax()
{
return syntax;
}
{
if( !status ) return status;
bool isToAscii = argDb.isFlagSet( SFLAG_TOASCII );
bool hasFile = argDb.isFlagSet( SFLAG_FILE );
if( !isToAscii || !hasFile )
{
"Specify at least one file and format to convert to." );
return status;
}
unsigned int numUses = argDb.numberOfFlagUses( SFLAG_FILE );
for(unsigned int i = 0; i < numUses; i++ )
{
status = argDb.getFlagArgumentList( SFLAG_FILE, i, argList );
if( !status ) return status;
if( !status ) return status;
geometryCacheFile cacheFile( name, &iffFilePtr);
bool readStatus = cacheFile.readCacheFiles();
if( !readStatus ) {
continue;
}
if( isToAscii ) {
bool convertStatus = cacheFile.convertToAscii();
if( !convertStatus )
{
name +
"\" to ASCII");
}
}
}
return status;
}
{
MFnPlugin plugin( obj,
"Autodesk",
"8.0",
"Any");
status = plugin.registerCommand( "convertGeometryCache",
convertGeometryCache::creator,
convertGeometryCache::cmdSyntax );
if (!status) {
status.
perror(
"registerCommand");
return status;
}
return status;
}
{
status = plugin.deregisterCommand( "convertGeometryCache" );
if (!status) {
status.
perror(
"deregisterCommand");
return status;
}
return status;
}