sceneAssembly/adskSceneMetadataCmd.h
#ifndef _adskSceneMetadata_h_
#define _adskSceneMetadata_h_
#include <maya/MPxCommand.h>
#include <maya/MArgDatabase.h>
#include <cassert>
#include <memory>
{
namespace Data
{
class Structure;
class Accessor;
class Associations;
}
}
public:
static const char* name();
static void* creator();
AdskSceneMetadataCmd();
virtual ~AdskSceneMetadataCmd();
private:
enum Mode {
kEdit = 1 << 0,
kQuery = 1 << 1
};
template <class T, Mode ValidModes>
class OptFlag
{
public:
OptFlag() : fIsSet(false), fArg() {}
{
}
bool isModeValid(const Mode currentMode)
{
return !fIsSet || ((currentMode & ValidModes) != 0);
}
bool isSet() const { return fIsSet; }
bool isArgValid() const { return fIsArgValid; }
const T& arg() const { return fArg; }
const T& arg(const T& defValue) const {
if (isSet()) {
assert(isArgValid());
return fArg;
}
else {
return defValue;
}
}
private:
bool fIsSet;
bool fIsArgValid;
T fArg;
};
std::auto_ptr< adsk::Data::Accessor > getAccessorForScene(
MString scenePath );
Mode fMode;
OptFlag<MString, Mode(kEdit|kQuery)> fChannelName;
OptFlag<MString, Mode(kEdit)> fData;
};
#endif // _adskSceneMetadata_h_