Simpler conversion SocketType <-> Strings.
parent
73e7a60875
commit
2f646bc5ec
|
@ -16,31 +16,12 @@ using json = nlohmann::json;
|
||||||
// Socket <-> json
|
// Socket <-> json
|
||||||
//
|
//
|
||||||
std::string sSocketTypeToStr(SocketType pin_type) {
|
std::string sSocketTypeToStr(SocketType pin_type) {
|
||||||
std::string result = "unknown";
|
if (pin_type < SocketType::SocketTypeUndefined
|
||||||
switch (pin_type) {
|
|| pin_type >= SocketType::SocketTypeLast) {
|
||||||
case SocketType::SocketTypeBool:
|
return "Unknown";
|
||||||
result = "Bool";
|
|
||||||
break;
|
|
||||||
case SocketType::SocketTypeAnimation:
|
|
||||||
result = "Animation";
|
|
||||||
break;
|
|
||||||
case SocketType::SocketTypeFloat:
|
|
||||||
result = "Float";
|
|
||||||
break;
|
|
||||||
case SocketType::SocketTypeVec3:
|
|
||||||
result = "Vec3";
|
|
||||||
break;
|
|
||||||
case SocketType::SocketTypeQuat:
|
|
||||||
result = "Quat";
|
|
||||||
break;
|
|
||||||
case SocketType::SocketTypeString:
|
|
||||||
result = "String";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
result = "Unknown";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return SocketTypeNames[static_cast<int>(pin_type)];
|
||||||
}
|
}
|
||||||
|
|
||||||
json sSocketToJson(const Socket& socket) {
|
json sSocketToJson(const Socket& socket) {
|
||||||
|
|
|
@ -49,13 +49,18 @@ SplitOutputAttributeId(int attribute_id, int* node_id, int* output_index) {
|
||||||
|
|
||||||
|
|
||||||
enum class SocketType {
|
enum class SocketType {
|
||||||
SocketTypeUndefined,
|
SocketTypeUndefined = 0,
|
||||||
SocketTypeBool,
|
SocketTypeBool,
|
||||||
SocketTypeAnimation,
|
SocketTypeAnimation,
|
||||||
SocketTypeFloat,
|
SocketTypeFloat,
|
||||||
SocketTypeVec3,
|
SocketTypeVec3,
|
||||||
SocketTypeQuat,
|
SocketTypeQuat,
|
||||||
SocketTypeString
|
SocketTypeString,
|
||||||
|
SocketTypeLast
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char* SocketTypeNames[] = {
|
||||||
|
"", "Bool", "Animation", "Float", "Vec3", "Quat", "String"
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SocketFlags { SocketFlagAffectsTime = 1 };
|
enum SocketFlags { SocketFlagAffectsTime = 1 };
|
||||||
|
|
Loading…
Reference in New Issue