| 193 | } |
| 194 | |
| 195 | void VisualScriptExecutor::ProcessGroupParameters(Box* box, Node* node, Value& value) |
| 196 | { |
| 197 | switch (node->TypeID) |
| 198 | { |
| 199 | // Get |
| 200 | case 3: |
| 201 | { |
| 202 | int32 paramIndex; |
| 203 | auto& stack = ThreadStacks.Get(); |
| 204 | if (!stack.Stack->Instance) |
| 205 | { |
| 206 | LOG(Error, "Cannot access Visual Script parameter without instance."); |
| 207 | PrintStack(LogType::Error); |
| 208 | break; |
| 209 | } |
| 210 | const auto param = stack.Stack->Script->Graph.GetParameter((Guid)node->Values[0], paramIndex); |
| 211 | ScopeLock lock(stack.Stack->Script->Locker); |
| 212 | const auto instanceParams = stack.Stack->Script->_instances.Find(stack.Stack->Instance->GetID()); |
| 213 | if (param && instanceParams) |
| 214 | { |
| 215 | value = instanceParams->Value.Params[paramIndex]; |
| 216 | } |
| 217 | else |
| 218 | { |
| 219 | LOG(Error, "Failed to access Visual Script parameter for {0}.", stack.Stack->Instance->ToString()); |
| 220 | PrintStack(LogType::Error); |
| 221 | } |
| 222 | break; |
| 223 | } |
| 224 | // Set |
| 225 | case 4: |
| 226 | { |
| 227 | int32 paramIndex; |
| 228 | auto& stack = ThreadStacks.Get(); |
| 229 | if (!stack.Stack->Instance) |
| 230 | { |
| 231 | LOG(Error, "Cannot access Visual Script parameter without instance."); |
| 232 | PrintStack(LogType::Error); |
| 233 | break; |
| 234 | } |
| 235 | const auto param = stack.Stack->Script->Graph.GetParameter((Guid)node->Values[0], paramIndex); |
| 236 | ScopeLock lock(stack.Stack->Script->Locker); |
| 237 | const auto instanceParams = stack.Stack->Script->_instances.Find(stack.Stack->Instance->GetID()); |
| 238 | if (param && instanceParams) |
| 239 | { |
| 240 | instanceParams->Value.Params[paramIndex] = tryGetValue(node->GetBox(1), 1, Value::Zero); |
| 241 | } |
| 242 | else |
| 243 | { |
| 244 | LOG(Error, "Failed to access Visual Script parameter for {0}.", stack.Stack->Instance->ToString()); |
| 245 | PrintStack(LogType::Error); |
| 246 | } |
| 247 | if (box->ID == 0 && node->Boxes[2].HasConnection()) |
| 248 | eatBox(node, node->Boxes[2].FirstConnection()); |
| 249 | break; |
| 250 | } |
| 251 | default: |
| 252 | break; |
nothing calls this directly
no test coverage detected