created enum for more node data types
This commit is contained in:
+1
-3
@@ -1,9 +1,7 @@
|
||||
#ifndef MEDIANODE_H
|
||||
#define MEDIANODE_H
|
||||
|
||||
#include "node.h"
|
||||
|
||||
class MediaNode : public Node
|
||||
class MediaNode
|
||||
{
|
||||
public:
|
||||
MediaNode();
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
#include "nodedatatypes.h"
|
||||
|
||||
QString olive::nodes::DataTypeToString(DataType type) {
|
||||
switch (type) {
|
||||
case kFloat:
|
||||
return "DOUBLE";
|
||||
case kVec2:
|
||||
return "VEC2";
|
||||
case kVec3:
|
||||
return "VEC3";
|
||||
case kVec4:
|
||||
return "VEC4";
|
||||
case kArray:
|
||||
return "ARRAY";
|
||||
case kColor:
|
||||
return "COLOR";
|
||||
case kString:
|
||||
return "STRING";
|
||||
case kBoolean:
|
||||
return "BOOL";
|
||||
case kCombo:
|
||||
return "COMBO";
|
||||
case kFont:
|
||||
return "FONT";
|
||||
case kFile:
|
||||
return "FILE";
|
||||
case kInteger:
|
||||
return "INTEGER";
|
||||
case kTexture:
|
||||
return "TEXTURE";
|
||||
case kMatrix:
|
||||
return "MATRIX";
|
||||
case kUI:
|
||||
return "UI";
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
olive::nodes::DataType olive::nodes::StringToDataType(const QString &s)
|
||||
{
|
||||
if (s == "DOUBLE") {
|
||||
return kFloat;
|
||||
} else if (s == "VEC2") {
|
||||
return kVec2;
|
||||
} else if (s == "VEC3") {
|
||||
return kVec3;
|
||||
} else if (s == "VEC4") {
|
||||
return kVec4;
|
||||
} else if (s == "ARRAY") {
|
||||
return kArray;
|
||||
} else if (s == "COLOR") {
|
||||
return kColor;
|
||||
} else if (s == "STRING") {
|
||||
return kString;
|
||||
} else if (s == "BOOL") {
|
||||
return kBoolean;
|
||||
} else if (s == "COMBO") {
|
||||
return kCombo;
|
||||
} else if (s == "FONT") {
|
||||
return kFont;
|
||||
} else if (s == "FILE") {
|
||||
return kFile;
|
||||
} else if (s == "INTEGER") {
|
||||
return kInteger;
|
||||
} else if (s == "TEXTURE") {
|
||||
return kTexture;
|
||||
} else if (s == "MATRIX") {
|
||||
return kMatrix;
|
||||
} else if (s == "UI") {
|
||||
return kUI;
|
||||
}
|
||||
return kInvalid;
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
#ifndef NODEDATATYPES_H
|
||||
#define NODEDATATYPES_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace olive {
|
||||
namespace nodes {
|
||||
|
||||
/**
|
||||
* @brief The EffectFieldType enum
|
||||
*
|
||||
* Predetermined types of fields. Used throughout Olive to identify what kind of data to expect from GetValueAt().
|
||||
*
|
||||
* This enum is also currently used to match an external XML effect's fields with the correct derived class (e.g.
|
||||
* EFFECT_FIELD_DOUBLE matches to DoubleField).
|
||||
*/
|
||||
enum DataType {
|
||||
/** Invalid data type. Used only for error handling. */
|
||||
kInvalid,
|
||||
|
||||
/** Values are doubles. Also corresponds to DoubleField. */
|
||||
kFloat,
|
||||
|
||||
/** Value is an 2-component vector of floats. */
|
||||
kVec2,
|
||||
|
||||
/** Value is an 3-component vector of floats. */
|
||||
kVec3,
|
||||
|
||||
/** Value is an 4-component vector of floats. */
|
||||
kVec4,
|
||||
|
||||
/** Value is an array of floats. This cannot be an input field, and can only be passed between nodes. */
|
||||
kArray,
|
||||
|
||||
/** Values are colors. Equivalent to kVec4 but represents as a color. Corresponds to ColorField. */
|
||||
kColor,
|
||||
|
||||
/** Values are strings. Also corresponds to StringField. */
|
||||
kString,
|
||||
|
||||
/** Values are booleans. Also corresponds to BoolField. */
|
||||
kBoolean,
|
||||
|
||||
/** Values are arbitrary data. Also corresponds to ComboField. */
|
||||
kCombo,
|
||||
|
||||
/** Values are font family names (in string). Also corresponds to FontField. */
|
||||
kFont,
|
||||
|
||||
/** Values are filenames (in string). Also corresponds to FileField. */
|
||||
kFile,
|
||||
|
||||
/** Values are integers. */
|
||||
kInteger,
|
||||
|
||||
/** Value is a texture. This cannot be an input field, and can only be passed between nodes. */
|
||||
kTexture,
|
||||
|
||||
/** Value is a 4x4 matrix. This cannot be an input field, and can only be passed between nodes. */
|
||||
kMatrix,
|
||||
|
||||
/** Values is a UI object with no data. Corresponds to nothing. */
|
||||
kUI,
|
||||
|
||||
/** Total count of valid node data types. Never use this as an actual data type. */
|
||||
kDataTypeCount
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Convert a node data type to a unique string that can be saved to an XML file
|
||||
*
|
||||
* @param type
|
||||
*
|
||||
* The data type to convert to string
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* The unique string identifier for this data type.
|
||||
*/
|
||||
QString DataTypeToString(DataType type);
|
||||
|
||||
/**
|
||||
* @brief Convert a string to a node data type.
|
||||
*
|
||||
* Generally this string should be a string that was received from DataTypeToString() to ensure compatibility and
|
||||
* correctness.
|
||||
*
|
||||
* @param s
|
||||
*
|
||||
* The string to convert to a data type
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* The data type that this string represents
|
||||
*/
|
||||
DataType StringToDataType(const QString& s);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // NODEDATATYPES_H
|
||||
Reference in New Issue
Block a user