Fixes and improvements

This commit is contained in:
Wojciech Figat
2021-11-18 11:21:30 +01:00
parent 2a2b70f83f
commit cdcb2f8f7a
15 changed files with 46 additions and 48 deletions

View File

@@ -48,7 +48,7 @@ public:
public:
ShaderGraphBox* FirstConnection() const
FORCE_INLINE ShaderGraphBox* FirstConnection() const
{
return (ShaderGraphBox*)Connections[0];
}

View File

@@ -1323,18 +1323,3 @@ void VisjectExecutor::ProcessGroupCollections(Box* box, Node* node, Value& value
}
}
}
VisjectExecutor::Value VisjectExecutor::tryGetValue(Box* box, int32 defaultValueBoxIndex, const Value& defaultValue)
{
const auto parentNode = box->GetParent<Node>();
if (box->HasConnection())
return eatBox(parentNode, box->FirstConnection());
if (parentNode->Values.Count() > defaultValueBoxIndex)
return Value(parentNode->Values[defaultValueBoxIndex]);
return defaultValue;
}
VisjectExecutor::Value VisjectExecutor::tryGetValue(Box* box, const Value& defaultValue)
{
return box && box->HasConnection() ? eatBox(box->GetParent<Node>(), box->FirstConnection()) : defaultValue;
}

View File

@@ -262,6 +262,19 @@ protected:
virtual Value eatBox(Node* caller, Box* box) = 0;
virtual Graph* GetCurrentGraph() const = 0;
Value tryGetValue(Box* box, int32 defaultValueBoxIndex, const Value& defaultValue);
Value tryGetValue(Box* box, const Value& defaultValue);
FORCE_INLINE Value tryGetValue(Box* box, int32 defaultValueBoxIndex, const Value& defaultValue)
{
const auto parentNode = box->GetParent<Node>();
if (box->HasConnection())
return eatBox(parentNode, box->FirstConnection());
if (parentNode->Values.Count() > defaultValueBoxIndex)
return Value(parentNode->Values[defaultValueBoxIndex]);
return defaultValue;
}
FORCE_INLINE Value tryGetValue(Box* box, const Value& defaultValue)
{
return box && box->HasConnection() ? eatBox(box->GetParent<Node>(), box->FirstConnection()) : defaultValue;
}
};