#include "metadataBase.h"
#include "metadataPluginStrings.h"
#include <maya/MArgList.h>
#include <maya/MSyntax.h>
#include <maya/MSelectionList.h>
#include <maya/MFileObject.h>
#include <maya/adskDataAssociationsSerializer.h>
static const char* flagFile ( "-f" );
static const char* flagFileLong ( "-file" );
static const char* flagMetadataFormat ( "-mf" );
static const char* flagMetadataFormatLong ( "-metadataFormat" );
{
return syntax;
}
metadataBase::metadataBase()
: fMode(kCreate)
, fObjects()
{
}
metadataBase::~metadataBase()
{
delete fFile;
}
bool metadataBase::isUndoable() const
{
return false;
}
bool metadataBase::hasSyntax() const
{
return true;
}
{
{
{
displayError(msg);
}
fMode = kEdit;
}
{
fMode = kQuery;
}
fFileFlag.parse(argsDb, flagFile);
if( !fFileFlag.isModeValid(fMode) )
{
displayError(msg);
}
if( fFileFlag.isSet() )
{
if( ! fFileFlag.isArgValid() )
{
msg.
format( fmt, flagFileLong );
displayError(msg);
}
fFile->setRawFullName( fFileFlag.arg() );
}
fMetadataFormatFlag.parse(argsDb, flagMetadataFormat);
if( !fMetadataFormatFlag.isModeValid(fMode) )
{
displayError(msg);
}
formatType = fMetadataFormatFlag.arg( rawFormatType );
fSerializer = AssociationsSerializer::formatByName( formatType.
asChar() );
if( ! fSerializer )
{
displayError(msg);
}
fObjects.clear();
MStatError(status, "argsDb.getObjects()");
for (
unsigned int i = 0; i<objects.
length(); ++i)
{
MStatError(status, "objects.getDependNode()");
fObjects.append( dgNode );
}
if( (fObjects.length() == 0) && (fMode != kQuery) )
{
displayError(msg);
}
return status;
}
{
status = checkArgs(argsDb);
{
clearResult();
switch (fMode)
{
case kCreate: status = doCreate(); break;
case kEdit: status = doEdit(); break;
case kQuery: status = doQuery(); break;
}
}
return status;
}
{
}
{
}
{
}
{
}
{
}