void DemoKeeper::notifyConnectPoint(wraps::BaseGraphView* _sender, wraps::BaseGraphConnection* _from, wraps::BaseGraphConnection* _to) { BaseAnimationNode* node_from = dynamic_cast<BaseAnimationNode*>(_from->getOwnerNode()); const std::string& name_from = _from->getName(); BaseAnimationNode* node_to = dynamic_cast<BaseAnimationNode*>(_to->getOwnerNode()); const std::string& name_to = _to->getName(); connectPoints(node_from, node_to, name_from, name_to); }
Array HHVM_METHOD(ZMQSocket, getEndpoints) { auto sock = Native::data<ZMQSocket>(this_); PackedArrayInit bindPoints(sock->socket->bind.size()); for (auto s : sock->socket->bind) { bindPoints.append(s); } PackedArrayInit connectPoints(sock->socket->connect.size()); for (auto s : sock->socket->connect) { connectPoints.append(s); } Array ret = Array::Create(); ret.add(s_connect, connectPoints.toVariant()); ret.add(s_bind, bindPoints.toVariant()); return ret; }
void DemoKeeper::loadFromFile(const std::string& _filename) { MyGUI::xml::Document doc; if (!doc.open(_filename)) return; MyGUI::xml::ElementPtr root = doc.getRoot(); if (root == nullptr || root->getName() != "AnimationGraph") return; MyGUI::xml::ElementEnumerator node = root->getElementEnumerator(); while (node.next()) { if (node->getName() == "Node") { BaseAnimationNode* anim_node = createNode(node->findAttribute("type"), node->findAttribute("name")); anim_node->deserialization(node.current()); } else if (node->getName() == "Connections") { MyGUI::xml::ElementEnumerator conn = node->getElementEnumerator(); BaseAnimationNode* anim_node = getNodeByName(node.current()->findAttribute("node")); if (anim_node) { while (conn.next("Connection")) { BaseAnimationNode* anim_node2 = getNodeByName(conn.current()->findAttribute("node")); if (anim_node2) { //соединить точки в ноде const std::string& from_point = conn.current()->findAttribute("from"); const std::string& to_point = conn.current()->findAttribute("to"); wraps::BaseGraphConnection* from_conn = anim_node->getConnectionByName(from_point, "EventOut"); if (!from_conn) from_conn = anim_node->getConnectionByName(from_point, "PositionOut"); if (!from_conn) from_conn = anim_node->getConnectionByName(from_point, "WeightOut"); wraps::BaseGraphConnection* to_conn = anim_node2->getConnectionByName(to_point, "EventIn"); if (!to_conn) to_conn = anim_node2->getConnectionByName(to_point, "PositionIn"); if (!to_conn) to_conn = anim_node2->getConnectionByName(to_point, "WeightIn"); if (from_conn && to_conn) { from_conn->addConnectionPoint(to_conn); connectPoints(anim_node, anim_node2, from_point, to_point); } } } } } else if (node->getName() == "EditorData") { MyGUI::xml::ElementEnumerator item_data = node->getElementEnumerator(); while (item_data.next("Node")) { BaseAnimationNode* anim_node = getNodeByName(item_data.current()->findAttribute("name")); if (anim_node) { anim_node->setCoord(MyGUI::IntCoord::parse(item_data.current()->findAttribute("coord"))); } } } } }