MCPcopy Create free account
hub / github.com/MyGUI/mygui / loadFromFile

Method loadFromFile

UnitTests/UnitTest_GraphView/DemoKeeper.cpp:386–455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384 }
385
386 void DemoKeeper::loadFromFile(const std::string& _filename)
387 {
388 MyGUI::xml::Document doc;
389
390 if (!doc.open(_filename))
391 return;
392
393 MyGUI::xml::ElementPtr root = doc.getRoot();
394 if (root == nullptr || root->getName() != "AnimationGraph")
395 return;
396
397 MyGUI::xml::ElementEnumerator node = root->getElementEnumerator();
398 while (node.next())
399 {
400 if (node->getName() == "Node")
401 {
402 BaseAnimationNode* anim_node = createNode(node->findAttribute("type"), node->findAttribute("name"));
403 anim_node->deserialization(node.current());
404 }
405 else if (node->getName() == "Connections")
406 {
407 MyGUI::xml::ElementEnumerator conn = node->getElementEnumerator();
408 BaseAnimationNode* anim_node = getNodeByName(node.current()->findAttribute("node"));
409 if (anim_node)
410 {
411 while (conn.next("Connection"))
412 {
413 BaseAnimationNode* anim_node2 = getNodeByName(conn.current()->findAttribute("node"));
414 if (anim_node2)
415 {
416 //соединить точки в ноде
417 std::string_view from_point = conn.current()->findAttribute("from");
418 std::string_view to_point = conn.current()->findAttribute("to");
419
420 wraps::BaseGraphConnection* from_conn =
421 anim_node->getConnectionByName(from_point, "EventOut");
422 if (!from_conn)
423 from_conn = anim_node->getConnectionByName(from_point, "PositionOut");
424 if (!from_conn)
425 from_conn = anim_node->getConnectionByName(from_point, "WeightOut");
426
427 wraps::BaseGraphConnection* to_conn = anim_node2->getConnectionByName(to_point, "EventIn");
428 if (!to_conn)
429 to_conn = anim_node2->getConnectionByName(to_point, "PositionIn");
430 if (!to_conn)
431 to_conn = anim_node2->getConnectionByName(to_point, "WeightIn");
432
433 if (from_conn && to_conn)
434 {
435 from_conn->addConnectionPoint(to_conn);
436 connectPoints(anim_node, anim_node2, from_point, to_point);
437 }
438 }
439 }
440 }
441 }
442 else if (node->getName() == "EditorData")
443 {

Callers 3

loadMethod · 0.45
loadTextureMethod · 0.45

Calls 11

getElementEnumeratorMethod · 0.80
findAttributeMethod · 0.80
getConnectionByNameMethod · 0.80
addConnectionPointMethod · 0.80
parseFunction · 0.50
openMethod · 0.45
getRootMethod · 0.45
nextMethod · 0.45
deserializationMethod · 0.45
currentMethod · 0.45
setCoordMethod · 0.45

Tested by

no test coverage detected