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