AL_USDMaya  0.16.6
USD to Maya Bridge
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
NodeHelper.h
1 #pragma once
2 #include "AL/maya/Common.h"
3 
4 #include "maya/MFnNumericAttribute.h"
5 #include "maya/MFnData.h"
6 #include "maya/MTypeId.h"
7 #include "maya/MColor.h"
8 #include "maya/MFloatPoint.h"
9 #include "maya/MFloatVector.h"
10 
11 #include <deque>
12 #include <vector>
13 #include <string>
14 
15 namespace AL {
16 namespace maya {
17 
18 //----------------------------------------------------------------------------------------------------------------------
47 //----------------------------------------------------------------------------------------------------------------------
48 #define AL_DECL_ATTRIBUTE(XX) \
49  private: \
50  static MObject m_##XX; \
51  public: \
52  MPlug XX##Plug() const { return MPlug( thisMObject(), m_##XX ); } \
53  static const MObject& XX () { return m_##XX; }
54 
55 //----------------------------------------------------------------------------------------------------------------------
174 //----------------------------------------------------------------------------------------------------------------------
176 {
177  #ifndef AL_GENERATING_DOCS
178  struct Frame
179  {
180  Frame(const char* frameTitle)
181  : m_title(frameTitle) {}
182 
183  enum AttributeUiType
184  {
185  // deliberately numbered!
186  kLoadFilePath = 0,
187  kSaveFilePath = 1,
188  kDirPathWithFiles = 2,
189  kDirPath = 3,
190  kMultiLoadFilePath = 4,
191  kNormal = 5,
192  kHidden = 6
193  };
194  std::string m_title;
195  std::vector<AttributeUiType> m_attributeTypes;
196  std::vector<std::string> m_attributes;
197  std::vector<std::string> m_fileFilters;
198  };
199 
200  struct InternalData
201  {
202  std::string m_typeBeingRegistered;
203  std::vector<std::string> m_baseTemplates;
204  std::deque<Frame> m_frames;
205  };
206  static InternalData* m_internal;
207  #endif
208 
209 public:
210 
213 
216 
218 
224  static bool inputBoolValue(MDataBlock& dataBlock, const MObject& attribute);
225 
231  static int8_t inputInt8Value(MDataBlock& dataBlock, const MObject& attribute);
232 
238  static int16_t inputInt16Value(MDataBlock& dataBlock, const MObject& attribute);
239 
245  static int32_t inputInt32Value(MDataBlock& dataBlock, const MObject& attribute);
246 
252  static int64_t inputInt64Value(MDataBlock& dataBlock, const MObject& attribute);
253 
259  static float inputFloatValue(MDataBlock& dataBlock, const MObject& attribute);
260 
266  static double inputDoubleValue(MDataBlock& dataBlock, const MObject& attribute);
267 
273  static MMatrix inputMatrixValue(MDataBlock& dataBlock, const MObject& attribute);
274 
280  static MPoint inputPointValue(MDataBlock& dataBlock, const MObject& attribute);
281 
287  static MFloatPoint inputFloatPointValue(MDataBlock& dataBlock, const MObject& attribute);
288 
294  static MVector inputVectorValue(MDataBlock& dataBlock, const MObject& attribute);
295 
301  static MTime inputTimeValue(MDataBlock& dataBlock, const MObject& attribute);
302 
308  static MFloatVector inputFloatVectorValue(MDataBlock& dataBlock, const MObject& attribute);
309 
315  static MColor inputColourValue(MDataBlock& dataBlock, const MObject& attribute);
316 
322  static MString inputStringValue(MDataBlock& dataBlock, const MObject& attribute);
323 
324 
330  static MPxData* inputDataValue(MDataBlock& dataBlock, const MObject& attribute);
331 
337  template<typename MPxDataType>
338  static MPxDataType* inputDataValue(MDataBlock& dataBlock, const MObject& attribute)
339  {
340  MPxData* data = NodeHelper::inputDataValue(dataBlock, attribute);
341  if(data)
342  {
343  return dynamic_cast<MPxDataType*>(data);
344  }
345  return 0;
346  }
347 
349 
355  static MStatus outputBoolValue(MDataBlock& dataBlock, const MObject& attribute, bool value);
356 
362  static MStatus outputInt8Value(MDataBlock& dataBlock, const MObject& attribute, int8_t value);
363 
369  static MStatus outputInt16Value(MDataBlock& dataBlock, const MObject& attribute, int16_t value);
370 
376  static MStatus outputInt32Value(MDataBlock& dataBlock, const MObject& attribute, int32_t value);
377 
383  static MStatus outputInt64Value(MDataBlock& dataBlock, const MObject& attribute, int64_t value);
384 
390  static MStatus outputFloatValue(MDataBlock& dataBlock, const MObject& attribute, float value);
391 
397  static MStatus outputDoubleValue(MDataBlock& dataBlock, const MObject& attribute, double value);
398 
404  static MStatus outputMatrixValue(MDataBlock& dataBlock, const MObject& attribute, const MMatrix& value);
405 
411  static MStatus outputPointValue(MDataBlock& dataBlock, const MObject& attribute, const MPoint& value);
412 
418  static MStatus outputFloatPointValue(MDataBlock& dataBlock, const MObject& attribute, const MFloatPoint& value);
419 
425  static MStatus outputVectorValue(MDataBlock& dataBlock, const MObject& attribute, const MVector& value);
426 
432  static MStatus outputEulerValue(MDataBlock& dataBlock, const MObject& attribute, const MEulerRotation& value);
433 
439  static MStatus outputFloatVectorValue(MDataBlock& dataBlock, const MObject& attribute, const MFloatVector& value);
440 
446  static MStatus outputColourValue(MDataBlock& dataBlock, const MObject& attribute, const MColor& value);
447 
453  static MStatus outputStringValue(MDataBlock& dataBlock, const MObject& attribute, const MString& value);
454 
460  static MStatus outputTimeValue(MDataBlock& dataBlock, const MObject& attribute, const MTime& value);
461 
467  static MStatus outputDataValue(MDataBlock& dataBlock, const MObject& attribute, MPxData* value);
468 
473  static MPxData* createData(const MTypeId& dataTypeId, MObject& data);
474 
479  template<typename MPxDataType>
480  static MPxDataType* createData(const MTypeId& dataTypeId, MObject& data)
481  {
482  MPxData* ptr = NodeHelper::createData(dataTypeId, data);
483  return static_cast<MPxDataType*>(ptr);
484  }
485 
487 
490  {
491  kCached = 1 << 0,
492  kReadable = 1 << 1,
493  kWritable = 1 << 2,
494  kStorable = 1 << 3,
496  kKeyable = 1 << 5,
497  kConnectable = 1 << 6,
498  kArray = 1 << 7,
499  kColour = 1 << 8,
500  kHidden = 1 << 9,
501  kInternal = 1 << 10,
502  kAffectsWorldSpace = 1 << 11,
504  kDontAddToNode = 1 << 30,
505  kDynamic = 1 << 31
506  };
507 
509  enum FileMode
510  {
511  kSave = 0,
512  kLoad = 1,
516  };
517 
518 
521  static void setNodeType(const MString& typeName);
522 
526  static void addFrame(const char* frameTitle);
527 
533  static MObject addCompoundAttr(const char* longName, const char* shortName, uint32_t flags, std::initializer_list<MObject> list);
534 
542  static MObject addEnumAttr(const char* longName, const char* shortName, uint32_t flags, const char* const* strings, const int16_t* values);
543 
550  static MObject addStringAttr(const char* longName, const char* shortName, uint32_t flags, bool forceShow = false);
551 
560  static MObject addFilePathAttr(const char* longName, const char* shortName, uint32_t flags, FileMode fileMode, const char* fileFilter = "");
561 
568  static MObject addInt8Attr(const char* longName, const char* shortName, int8_t defaultValue, uint32_t flags);
569 
576  static MObject addInt16Attr(const char* longName, const char* shortName, int16_t defaultValue, uint32_t flags);
577 
584  static MObject addInt32Attr(const char* longName, const char* shortName, int32_t defaultValue, uint32_t flags);
585 
592  static MObject addInt64Attr(const char* longName, const char* shortName, int64_t defaultValue, uint32_t flags);
593 
600  static MObject addFloatAttr(const char* longName, const char* shortName, float defaultValue, uint32_t flags);
601 
608  static MObject addDoubleAttr(const char* longName, const char* shortName, double defaultValue, uint32_t flags);
609 
616  static MObject addTimeAttr(const char* longName, const char* shortName, const MTime& defaultValue, uint32_t flags);
617 
624  static MObject addDistanceAttr(const char* longName, const char* shortName, const MDistance& defaultValue, uint32_t flags);
625 
632  static MObject addAngleAttr(const char* longName, const char* shortName, const MAngle& defaultValue, uint32_t flags);
633 
640  static MObject addBoolAttr(const char* longName, const char* shortName, bool defaultValue, uint32_t flags);
641 
650  static MObject addFloat3Attr(const char* longName, const char* shortName, float defaultX, float defaultY, float defaultZ, uint32_t flags);
651 
660  static MObject addAngle3Attr(const char* longName, const char* shortName, float defaultX, float defaultY, float defaultZ, uint32_t flags);
661 
669  static MObject addDistance3Attr(const char* longName, const char* shortName, float defaultX, float defaultY, float defaultZ, uint32_t flags);
670 
677  static MObject addPointAttr(const char* longName, const char* shortName, const MPoint& defaultValue, uint32_t flags);
678 
685  static MObject addFloatPointAttr(const char* longName, const char* shortName, const MFloatPoint& defaultValue, uint32_t flags)
686  { return addFloat3Attr(longName, shortName, defaultValue.x, defaultValue.y, defaultValue.z, flags); }
687 
694  static MObject addVectorAttr(const char* longName, const char* shortName, const MVector& defaultValue, uint32_t flags);
695 
702  static MObject addFloatVectorAttr(const char* longName, const char* shortName, const MFloatVector& defaultValue, uint32_t flags)
703  { return addFloat3Attr(longName, shortName, defaultValue.x, defaultValue.y, defaultValue.z, flags); }
704 
711  static MObject addColourAttr(const char* longName, const char* shortName, const MColor& defaultValue, uint32_t flags)
712  { return addFloat3Attr(longName, shortName, defaultValue.r, defaultValue.g, defaultValue.b, flags | kColour); }
713 
720  static MObject addMatrix2x2Attr(const char* longName, const char* shortName, const float defaultValue[2][2], uint32_t flags);
721 
728  static MObject addMatrix3x3Attr(const char* longName, const char* shortName, const float defaultValue[3][3], uint32_t flags);
729 
736  static MObject addMatrixAttr(const char* longName, const char* shortName, const MMatrix& defaultValue, uint32_t flags);
737 
745  static MObject addDataAttr(const char* longName, const char* shortName, MFnData::Type type, uint32_t flags, MFnAttribute::DisconnectBehavior behaviour = MFnAttribute::kNothing);
746 
754  static MObject addDataAttr(const char* longName, const char* shortName, const MTypeId& type, uint32_t flags, MFnAttribute::DisconnectBehavior behaviour = MFnAttribute::kNothing);
755 
761  static MObject addMessageAttr(const char* longName, const char* shortName, uint32_t flags);
762 
768  static MObject addVec2hAttr(const char* longName, const char* shortName, uint32_t flags)
769  { return addVec2fAttr(longName, shortName, flags); }
770 
776  static MObject addVec2fAttr(const char* longName, const char* shortName, uint32_t flags);
777 
783  static MObject addVec2iAttr(const char* longName, const char* shortName, uint32_t flags);
784 
790  static MObject addVec2dAttr(const char* longName, const char* shortName, uint32_t flags);
791 
797  static MObject addVec3hAttr(const char* longName, const char* shortName, uint32_t flags)
798  { return addVec3fAttr(longName, shortName, flags); }
799 
805  static MObject addVec3fAttr(const char* longName, const char* shortName, uint32_t flags);
806 
812  static MObject addVec3iAttr(const char* longName, const char* shortName, uint32_t flags);
813 
819  static MObject addVec3dAttr(const char* longName, const char* shortName, uint32_t flags);
820 
826  static MObject addVec4hAttr(const char* longName, const char* shortName, uint32_t flags)
827  { return addVec4fAttr(longName, shortName, flags); }
828 
834  static MObject addVec4fAttr(const char* longName, const char* shortName, uint32_t flags);
835 
841  static MObject addVec4iAttr(const char* longName, const char* shortName, uint32_t flags);
842 
848  static MObject addVec4dAttr(const char* longName, const char* shortName, uint32_t flags);
849 
854  template<typename datatype>
855  static void setMinMax(MObject obj, datatype minimum, datatype maximum)
856  {
857  MFnNumericAttribute fn(obj);
858  fn.setMin(minimum);
859  fn.setMax(maximum);
860  }
861 
868  template<typename datatype>
869  static void setMinMax(MObject obj, datatype minimum, datatype maximum, datatype softmin, datatype softmax)
870  {
871  MFnNumericAttribute fn(obj);
872  fn.setMin(minimum);
873  fn.setMax(maximum);
874  fn.setSoftMin(softmin);
875  fn.setSoftMax(softmax);
876  }
877 
881  static void addBaseTemplate(const std::string& baseTemplate)
882  {
883  if(!baseTemplate.empty())
884  m_internal->m_baseTemplates.push_back(baseTemplate);
885  }
886 
890  static void generateAETemplate();
891 
892  //--------------------------------------------------------------------------------------------------------------------
894  //--------------------------------------------------------------------------------------------------------------------
895 
904  static MStatus addStringAttr(const MObject& node, const char* longName, const char* shortName, uint32_t flags, bool forceShow = false, MObject* attribute = 0);
905 
916  static MStatus addFilePathAttr(const MObject& node, const char* longName, const char* shortName, uint32_t flags, FileMode fileMode, const char* fileFilter = "", MObject* attribute = 0);
917 
926  static MStatus addInt8Attr(const MObject& node, const char* longName, const char* shortName, int8_t defaultValue, uint32_t flags, MObject* attribute = 0);
927 
936  static MStatus addInt16Attr(const MObject& node, const char* longName, const char* shortName, int16_t defaultValue, uint32_t flags, MObject* attribute = 0);
937 
946  static MStatus addInt32Attr(const MObject& node, const char* longName, const char* shortName, int32_t defaultValue, uint32_t flags, MObject* attribute = 0);
947 
956  static MStatus addInt64Attr(const MObject& node, const char* longName, const char* shortName, int64_t defaultValue, uint32_t flags, MObject* attribute = 0);
957 
966  static MStatus addFloatAttr(const MObject& node, const char* longName, const char* shortName, float defaultValue, uint32_t flags, MObject* attribute = 0);
967 
976  static MStatus addDoubleAttr(const MObject& node, const char* longName, const char* shortName, double defaultValue, uint32_t flags, MObject* attribute = 0);
977 
986  static MStatus addTimeAttr(const MObject& node, const char* longName, const char* shortName, const MTime& defaultValue, uint32_t flags, MObject* attribute = 0);
987 
996  static MStatus addDistanceAttr(const MObject& node, const char* longName, const char* shortName, const MDistance& defaultValue, uint32_t flags, MObject* attribute = 0);
997 
1006  static MStatus addAngleAttr(const MObject& node, const char* longName, const char* shortName, const MAngle& defaultValue, uint32_t flags, MObject* attribute = 0);
1007 
1016  static MStatus addBoolAttr(const MObject& node, const char* longName, const char* shortName, bool defaultValue, uint32_t flags, MObject* attribute = 0);
1017 
1027  static MStatus addFloat3Attr(const MObject& node, const char* longName, const char* shortName, float defaultX, float defaultY, float defaultZ, uint32_t flags, MObject* attribute = 0);
1028 
1038  static MStatus addAngle3Attr(const MObject& node, const char* longName, const char* shortName, float defaultX, float defaultY, float defaultZ, uint32_t flags, MObject* attribute = 0);
1039 
1048  static MStatus addPointAttr(const MObject& node, const char* longName, const char* shortName, const MPoint& defaultValue, uint32_t flags, MObject* attribute = 0);
1049 
1058  static MStatus addFloatPointAttr(const MObject& node, const char* longName, const char* shortName, const MFloatPoint& defaultValue, uint32_t flags, MObject* attribute = 0)
1059  { return addFloat3Attr(node, longName, shortName, defaultValue.x, defaultValue.y, defaultValue.z, flags, attribute); }
1060 
1069  static MStatus addVectorAttr(const MObject& node, const char* longName, const char* shortName, const MVector& defaultValue, uint32_t flags, MObject* attribute = 0);
1070 
1079  static MStatus addFloatVectorAttr(const MObject& node, const char* longName, const char* shortName, const MFloatVector& defaultValue, uint32_t flags, MObject* attribute = 0)
1080  { return addFloat3Attr(node, longName, shortName, defaultValue.x, defaultValue.y, defaultValue.z, flags); }
1081 
1090  static MStatus addColourAttr(const MObject& node, const char* longName, const char* shortName, const MColor& defaultValue, uint32_t flags, MObject* attribute = 0)
1091  { return addFloat3Attr(node, longName, shortName, defaultValue.r, defaultValue.g, defaultValue.b, flags | kColour, attribute); }
1092 
1101  static MStatus addMatrixAttr(const MObject& node, const char* longName, const char* shortName, const MMatrix& defaultValue, uint32_t flags, MObject* attribute = 0);
1102 
1111  static MStatus addMatrix2x2Attr(const MObject& node, const char* longName, const char* shortName, const float defaultValue[2][2], uint32_t flags, MObject* attribute = 0);
1112 
1121  static MStatus addMatrix3x3Attr(const MObject& node, const char* longName, const char* shortName, const float defaultValue[3][3], uint32_t flags, MObject* attribute = 0);
1122 
1132  static MStatus addDataAttr(const MObject& node, const char* longName, const char* shortName, MFnData::Type type, uint32_t flags, MFnAttribute::DisconnectBehavior behaviour = MFnAttribute::kNothing, MObject* attribute = 0);
1133 
1143  static MStatus addDataAttr(const MObject& node, const char* longName, const char* shortName, const MTypeId& type, uint32_t flags, MFnAttribute::DisconnectBehavior behaviour = MFnAttribute::kNothing, MObject* attribute = 0);
1144 
1152  static MStatus addMessageAttr(const MObject& node, const char* longName, const char* shortName, uint32_t flags, MObject* attribute = 0);
1153 
1161  static MStatus addVec2hAttr(const MObject& node, const char* longName, const char* shortName, uint32_t flags, MObject* attribute = 0)
1162  { return addVec2fAttr(node, longName, shortName, flags); }
1163 
1171  static MStatus addVec2fAttr(const MObject& node, const char* longName, const char* shortName, uint32_t flags, MObject* attribute = 0);
1172 
1180  static MStatus addVec2iAttr(const MObject& node, const char* longName, const char* shortName, uint32_t flags, MObject* attribute = 0);
1181 
1189  static MStatus addVec2dAttr(const MObject& node, const char* longName, const char* shortName, uint32_t flags, MObject* attribute = 0);
1190 
1198  static MStatus addVec3hAttr(const MObject& node, const char* longName, const char* shortName, uint32_t flags, MObject* attribute = 0)
1199  { return addVec3fAttr(node, longName, shortName, flags, attribute); }
1200 
1208  static MStatus addVec3fAttr(const MObject& node, const char* longName, const char* shortName, uint32_t flags, MObject* attribute = 0);
1209 
1217  static MStatus addVec3iAttr(const MObject& node, const char* longName, const char* shortName, uint32_t flags, MObject* attribute = 0);
1218 
1226  static MStatus addVec3dAttr(const MObject& node, const char* longName, const char* shortName, uint32_t flags, MObject* attribute = 0);
1227 
1235  static MStatus addVec4hAttr(const MObject& node, const char* longName, const char* shortName, uint32_t flags, MObject* attribute = 0)
1236  { return addVec4fAttr(node, longName, shortName, flags, attribute); }
1237 
1245  static MStatus addVec4fAttr(const MObject& node, const char* longName, const char* shortName, uint32_t flags, MObject* attribute = 0);
1246 
1254  static MStatus addVec4iAttr(const MObject& node, const char* longName, const char* shortName, uint32_t flags, MObject* attribute = 0);
1255 
1263  static MStatus addVec4dAttr(const MObject& node, const char* longName, const char* shortName, uint32_t flags, MObject* attribute = 0);
1264 
1265 private:
1266  static MStatus applyAttributeFlags(MFnAttribute& fn, uint32_t flags);
1267 };
1268 
1269 //----------------------------------------------------------------------------------------------------------------------
1270 } // usdmaya
1271 } // AL
1272 //----------------------------------------------------------------------------------------------------------------------
1273 
static MObject addCompoundAttr(const char *longName, const char *shortName, uint32_t flags, std::initializer_list< MObject > list)
add a new compound attribute to this node type
static void addFrame(const char *frameTitle)
Add a new frame control into the AE template.
static int32_t inputInt32Value(MDataBlock &dataBlock, const MObject &attribute)
get an input 32 bit integer value from the dataBlock from the specified attribute ...
static MObject addMatrix3x3Attr(const char *longName, const char *shortName, const float defaultValue[3][3], uint32_t flags)
add a new matrix attribute to this node type.
static MObject addVec3hAttr(const char *longName, const char *shortName, uint32_t flags)
add a new 3D vector attribute to this node type.
Definition: NodeHelper.h:797
static MObject addFloatAttr(const char *longName, const char *shortName, float defaultValue, uint32_t flags)
add a new floating point attribute to this node type.
static MStatus outputTimeValue(MDataBlock &dataBlock, const MObject &attribute, const MTime &value)
Set the output value of the specified attribute in the datablock.
static int64_t inputInt64Value(MDataBlock &dataBlock, const MObject &attribute)
get an input 64 bit integer value from the dataBlock from the specified attribute ...
static MObject addVec3dAttr(const char *longName, const char *shortName, uint32_t flags)
add a new 3D vector attribute to this node type.
static MObject addDistanceAttr(const char *longName, const char *shortName, const MDistance &defaultValue, uint32_t flags)
add a new time attribute to this node type.
static MStatus addFloatVectorAttr(const MObject &node, const char *longName, const char *shortName, const MFloatVector &defaultValue, uint32_t flags, MObject *attribute=0)
add a new float vector attribute to this node type.
Definition: NodeHelper.h:1079
The array can be resized via an array data builder.
Definition: NodeHelper.h:503
static MObject addEnumAttr(const char *longName, const char *shortName, uint32_t flags, const char *const *strings, const int16_t *values)
add a new enum attribute to this node type
the attribute affects the appearance of a shape
Definition: NodeHelper.h:495
static bool inputBoolValue(MDataBlock &dataBlock, const MObject &attribute)
get an input boolean value from the dataBlock from the specified attribute
static MStatus addVec3hAttr(const MObject &node, const char *longName, const char *shortName, uint32_t flags, MObject *attribute=0)
add a new 3D floating point vector attribute to this node type.
Definition: NodeHelper.h:1198
a directory dialog
Definition: NodeHelper.h:514
static MObject addMessageAttr(const char *longName, const char *shortName, uint32_t flags)
add a new message attribute to this node type.
The attribute can be animated.
Definition: NodeHelper.h:496
static MObject addVec4fAttr(const char *longName, const char *shortName, uint32_t flags)
add a new 4D vector attribute to this node type.
prevent the attribute from being added to the current node type
Definition: NodeHelper.h:504
static MObject addFloatPointAttr(const char *longName, const char *shortName, const MFloatPoint &defaultValue, uint32_t flags)
add a new float point attribute to this node type.
Definition: NodeHelper.h:685
static MObject addFilePathAttr(const char *longName, const char *shortName, uint32_t flags, FileMode fileMode, const char *fileFilter="")
add a new file path attribute to this node type.
static MStatus outputDoubleValue(MDataBlock &dataBlock, const MObject &attribute, double value)
Set the output value of the specified attribute in the datablock.
a save file dialog
Definition: NodeHelper.h:511
static MObject addVec2iAttr(const char *longName, const char *shortName, uint32_t flags)
add a new 2D vector attribute to this node type.
static MStatus outputPointValue(MDataBlock &dataBlock, const MObject &attribute, const MPoint &value)
Set the output value of the specified attribute in the datablock.
static MStatus addVec4hAttr(const MObject &node, const char *longName, const char *shortName, uint32_t flags, MObject *attribute=0)
add a new 4D floating point vector attribute to this node type.
Definition: NodeHelper.h:1235
static MStatus outputInt8Value(MDataBlock &dataBlock, const MObject &attribute, int8_t value)
Set the output value of the specified attribute in the datablock.
static int16_t inputInt16Value(MDataBlock &dataBlock, const MObject &attribute)
get an input 16 bit integer value from the dataBlock from the specified attribute ...
static MFloatVector inputFloatVectorValue(MDataBlock &dataBlock, const MObject &attribute)
get an input vector value from the dataBlock from the specified attribute
static MObject addFloatVectorAttr(const char *longName, const char *shortName, const MFloatVector &defaultValue, uint32_t flags)
add a new float vector attribute to this node type.
Definition: NodeHelper.h:702
The attribute should be cached.
Definition: NodeHelper.h:491
static MObject addInt32Attr(const char *longName, const char *shortName, int32_t defaultValue, uint32_t flags)
add a new integer attribute to this node type.
static MStatus addVec2hAttr(const MObject &node, const char *longName, const char *shortName, uint32_t flags, MObject *attribute=0)
add a new 2D floating point vector attribute to this node type.
Definition: NodeHelper.h:1161
multiple input files
Definition: NodeHelper.h:515
static MObject addFloat3Attr(const char *longName, const char *shortName, float defaultX, float defaultY, float defaultZ, uint32_t flags)
add a new float3 attribute to this node type.
static MObject addVec4hAttr(const char *longName, const char *shortName, uint32_t flags)
add a new 4D vector attribute to this node type.
Definition: NodeHelper.h:826
static MStatus outputStringValue(MDataBlock &dataBlock, const MObject &attribute, const MString &value)
Set the output value of the specified attribute in the datablock.
static MObject addDoubleAttr(const char *longName, const char *shortName, double defaultValue, uint32_t flags)
add a new double attribute to this node type.
static MObject addTimeAttr(const char *longName, const char *shortName, const MTime &defaultValue, uint32_t flags)
add a new time attribute to this node type.
static MStatus outputColourValue(MDataBlock &dataBlock, const MObject &attribute, const MColor &value)
Set the output value of the specified attribute in the datablock.
static MObject addPointAttr(const char *longName, const char *shortName, const MPoint &defaultValue, uint32_t flags)
add a new point attribute to this node type.
static MObject addVec3fAttr(const char *longName, const char *shortName, uint32_t flags)
add a new 3D vector attribute to this node type.
static void generateAETemplate()
This method will construct up the MEL script code for the attribute editor template for your node...
FileMode
Specify the type of file/dir path when adding file path attributes. See addFilePathAttr.
Definition: NodeHelper.h:509
static MStatus outputFloatValue(MDataBlock &dataBlock, const MObject &attribute, float value)
Set the output value of the specified attribute in the datablock.
static MStatus outputVectorValue(MDataBlock &dataBlock, const MObject &attribute, const MVector &value)
Set the output value of the specified attribute in the datablock.
static MObject addVec2hAttr(const char *longName, const char *shortName, uint32_t flags)
add a new 2D vector attribute to this node type.
Definition: NodeHelper.h:768
static MVector inputVectorValue(MDataBlock &dataBlock, const MObject &attribute)
get an input vector value from the dataBlock from the specified attribute
static MObject addMatrixAttr(const char *longName, const char *shortName, const MMatrix &defaultValue, uint32_t flags)
add a new matrix attribute to this node type.
static MColor inputColourValue(MDataBlock &dataBlock, const MObject &attribute)
get an input colour value from the dataBlock from the specified attribute
static void setNodeType(const MString &typeName)
Sets the node type name you are adding attributes. Please call this before adding any frames! ...
static MObject addVec3iAttr(const char *longName, const char *shortName, uint32_t flags)
add a new 3D vector attribute to this node type.
static MMatrix inputMatrixValue(MDataBlock &dataBlock, const MObject &attribute)
get an input matrix value from the dataBlock from the specified attribute
static MObject addAngleAttr(const char *longName, const char *shortName, const MAngle &defaultValue, uint32_t flags)
add a new time attribute to this node type.
static MStatus outputInt32Value(MDataBlock &dataBlock, const MObject &attribute, int32_t value)
Set the output value of the specified attribute in the datablock.
static MObject addVec4dAttr(const char *longName, const char *shortName, uint32_t flags)
add a new 4D vector attribute to this node type.
static void addBaseTemplate(const std::string &baseTemplate)
used to add additional references to AETemplate calls for standard types, e.g. "AEsurfaceShapeTemplat...
Definition: NodeHelper.h:881
static MStatus outputEulerValue(MDataBlock &dataBlock, const MObject &attribute, const MEulerRotation &value)
Set the output value of the specified attribute in the datablock.
static MObject addStringAttr(const char *longName, const char *shortName, uint32_t flags, bool forceShow=false)
add a new string attribute to this node type.
static MStatus addFloatPointAttr(const MObject &node, const char *longName, const char *shortName, const MFloatPoint &defaultValue, uint32_t flags, MObject *attribute=0)
add a new float point attribute to this node type.
Definition: NodeHelper.h:1058
static MObject addAngle3Attr(const char *longName, const char *shortName, float defaultX, float defaultY, float defaultZ, uint32_t flags)
add a new float3 attribute to this node type.
The attribute affects the world space matrix of a custom transform node.
Definition: NodeHelper.h:502
static MObject addVectorAttr(const char *longName, const char *shortName, const MVector &defaultValue, uint32_t flags)
add a new vector attribute to this node type.
static MObject addInt16Attr(const char *longName, const char *shortName, int16_t defaultValue, uint32_t flags)
add a new integer attribute to this node type.
static MObject addInt64Attr(const char *longName, const char *shortName, int64_t defaultValue, uint32_t flags)
add a new integer attribute to this node type.
static MObject addInt8Attr(const char *longName, const char *shortName, int8_t defaultValue, uint32_t flags)
add a new integer attribute to this node type.
static MPoint inputPointValue(MDataBlock &dataBlock, const MObject &attribute)
get an input point value from the dataBlock from the specified attribute
The attribute should be writable (input)
Definition: NodeHelper.h:493
static MObject addDataAttr(const char *longName, const char *shortName, MFnData::Type type, uint32_t flags, MFnAttribute::DisconnectBehavior behaviour=MFnAttribute::kNothing)
add a new data attribute to this node type.
static void setMinMax(MObject obj, datatype minimum, datatype maximum, datatype softmin, datatype softmax)
set the min/max/softmax values on a numeric attribute
Definition: NodeHelper.h:869
~NodeHelper()
dtor
Definition: NodeHelper.h:215
The attribute value will be stored as a member variable, and getInternalValueInContext / setInternalV...
Definition: NodeHelper.h:501
static MObject addDistance3Attr(const char *longName, const char *shortName, float defaultX, float defaultY, float defaultZ, uint32_t flags)
add a new float3 attribute to this node type.
static MObject addMatrix2x2Attr(const char *longName, const char *shortName, const float defaultValue[2][2], uint32_t flags)
add a new matrix attribute to this node type.
The attribute is hidden.
Definition: NodeHelper.h:500
AttributeFlags
A set of bit flags you can apply to an attribute.
Definition: NodeHelper.h:489
a directory dialog, but displays files.
Definition: NodeHelper.h:513
static MFloatPoint inputFloatPointValue(MDataBlock &dataBlock, const MObject &attribute)
get an input point value from the dataBlock from the specified attribute
The attribute is a dynamic attribute added at runtime (and not during a plug-in node initialization) ...
Definition: NodeHelper.h:505
static MObject addVec2dAttr(const char *longName, const char *shortName, uint32_t flags)
add a new 2D vector attribute to this node type.
NodeHelper()
ctor
Definition: NodeHelper.h:212
static MStatus outputInt16Value(MDataBlock &dataBlock, const MObject &attribute, int16_t value)
Set the output value of the specified attribute in the datablock.
static MObject addBoolAttr(const char *longName, const char *shortName, bool defaultValue, uint32_t flags)
add a new boolean attribute to this node type.
static MObject addVec4iAttr(const char *longName, const char *shortName, uint32_t flags)
add a new 4D vector attribute to this node type.
static MStatus addColourAttr(const MObject &node, const char *longName, const char *shortName, const MColor &defaultValue, uint32_t flags, MObject *attribute=0)
add a new colour attribute to this node type.
Definition: NodeHelper.h:1090
static MPxData * inputDataValue(MDataBlock &dataBlock, const MObject &attribute)
get an input data value from the dataBlock from the specified attribute
static float inputFloatValue(MDataBlock &dataBlock, const MObject &attribute)
get an input float value from the dataBlock from the specified attribute
static MObject addVec2fAttr(const char *longName, const char *shortName, uint32_t flags)
add a new 2D vector attribute to this node type.
static MStatus outputDataValue(MDataBlock &dataBlock, const MObject &attribute, MPxData *value)
Set the output value of the specified attribute in the datablock.
static MObject addColourAttr(const char *longName, const char *shortName, const MColor &defaultValue, uint32_t flags)
add a new colour attribute to this node type.
Definition: NodeHelper.h:711
static MStatus outputFloatPointValue(MDataBlock &dataBlock, const MObject &attribute, const MFloatPoint &value)
Set the output value of the specified attribute in the datablock.
static int8_t inputInt8Value(MDataBlock &dataBlock, const MObject &attribute)
get an input 8 bit integer value from the dataBlock from the specified attribute
The attribute should be stored in a maya file.
Definition: NodeHelper.h:494
The attribute can be connected to another attr.
Definition: NodeHelper.h:497
static MPxDataType * createData(const MTypeId &dataTypeId, MObject &data)
helper method to create new data objects of the specified data type
Definition: NodeHelper.h:480
static MPxData * createData(const MTypeId &dataTypeId, MObject &data)
helper method to create new data objects of the specified data type
a load file dialog
Definition: NodeHelper.h:512
static MStatus outputMatrixValue(MDataBlock &dataBlock, const MObject &attribute, const MMatrix &value)
Set the output value of the specified attribute in the datablock.
static double inputDoubleValue(MDataBlock &dataBlock, const MObject &attribute)
get an input double value from the dataBlock from the specified attribute
static MStatus outputBoolValue(MDataBlock &dataBlock, const MObject &attribute, bool value)
Set the output value of the specified attribute in the datablock.
static MPxDataType * inputDataValue(MDataBlock &dataBlock, const MObject &attribute)
get an input data value from the dataBlock from the specified attribute
Definition: NodeHelper.h:338
The attribute is an array.
Definition: NodeHelper.h:498
static MTime inputTimeValue(MDataBlock &dataBlock, const MObject &attribute)
get an input time value from the dataBlock from the specified attribute
static MStatus outputFloatVectorValue(MDataBlock &dataBlock, const MObject &attribute, const MFloatVector &value)
Set the output value of the specified attribute in the datablock.
This is a little helper object designed to reduce the amount of boilerplate GUI code you need to jump...
Definition: NodeHelper.h:175
static void setMinMax(MObject obj, datatype minimum, datatype maximum)
set the min/max values on a numeric attribute
Definition: NodeHelper.h:855
static MStatus outputInt64Value(MDataBlock &dataBlock, const MObject &attribute, int64_t value)
Set the output value of the specified attribute in the datablock.
static MString inputStringValue(MDataBlock &dataBlock, const MObject &attribute)
get an input string value from the dataBlock from the specified attribute
The attribute should be readable (output)
Definition: NodeHelper.h:492
The attribute is a colour (UI will display a colour picker in the GUI)
Definition: NodeHelper.h:499