void Text::formatForDebugger(char *buffer, unsigned length) const { String result; String s; s = nodeName(); if (s.length() > 0) { result += s; } s = nodeValue(); if (s.length() > 0) { if (result.length() > 0) result += "; "; result += "value="; result += s; } strncpy(buffer, result.deprecatedString().latin1(), length - 1); }
void FeedFetcher::handleAtomXml(QDomNode node) { QList<Tweet*> tweets; QDomNodeList children = node.childNodes(); QDateTime startDate = QDateTime::currentDateTime(); // QMessageBox::information(0,"Bleugh",nodeName(node)); for (int x=0;x<children.count();x++) { QDomNode item = children.at(x); // QMessageBox::information(0,"Bleugh",item.nodeName()); if (nodeName(item)=="title") { emit feedTitle(item.firstChild().nodeValue()); } else if (nodeName(item)=="entry") { FeedItem *tweet = new FeedItem(); tweet->created_at=startDate.addSecs(-x); tweet->feed_item_date="";//tweet->created_at.toString(); tweet->sourceUrl=url; QDomNodeList children2 = item.childNodes(); for (int y=0;y<children2.count();y++) { QDomNode childItem = children2.at(y); if (nodeName(childItem)=="title") { tweet->message=childItem.firstChild().nodeValue(); } else if (nodeName(childItem)=="id") { tweet->id=childItem.firstChild().nodeValue(); } else if (nodeName(childItem)=="summary") { tweet->content=childItem.firstChild().nodeValue(); } else if (nodeName(childItem)=="link") { tweet->url=childItem.attributes().namedItem("href").nodeValue(); if (tweet->id=="") tweet->id=tweet->url; } else if (nodeName(childItem)=="updated") { //Thu Feb 19 00:20:20 +0000 2009 QString date = childItem.firstChild().nodeValue(); // tweet->feed_item_date = childItem.firstChild().nodeValue(); // QString hour = dateStr.mid(20,5); // dateStr=dateStr.left(20)+dateStr.right(4); // tweet->created_at=QDateTime::fromString(dateStr,"ddd MMM dd HH:mm:ss +0000 yyyy"); // 2009-09-04T22:29:51Z tweet->created_at=QDateTime::fromString(date.left(19),"yyyy-MM-ddTHH:mm:ss"); } } tweets.append(tweet); } } emit haveTweets(tweets); }
void Text::formatForDebugger(char *buffer, unsigned length) const { String result; String s; s = nodeName(); if (s.length() > 0) { result += s; } s = data(); if (s.length() > 0) { if (result.length() > 0) result += "; "; result += "value="; result += s; } strncpy(buffer, result.utf8().data(), length - 1); }
AST_expr* remapIfExp(AST_IfExp* node) { std::string rtn_name = nodeName(node); AST_expr* test = remapExpr(node->test); CFGBlock *starting_block = curblock; AST_Branch *br = new AST_Branch(); br->col_offset = node->col_offset; br->lineno = node->lineno; br->test = node->test; push_back(br); CFGBlock* iftrue = cfg->addBlock(); iftrue->info = "iftrue"; br->iftrue = iftrue; starting_block->connectTo(iftrue); curblock = iftrue; push_back(makeAssign(rtn_name, remapExpr(node->body))); AST_Jump* jtrue = new AST_Jump(); push_back(jtrue); CFGBlock* endtrue = curblock; CFGBlock* iffalse = cfg->addBlock(); iffalse->info = "iffalse"; br->iffalse = iffalse; starting_block->connectTo(iffalse); curblock = iffalse; push_back(makeAssign(rtn_name, remapExpr(node->orelse))); AST_Jump* jfalse = new AST_Jump(); push_back(jfalse); CFGBlock* endfalse = curblock; CFGBlock* exit_block = cfg->addBlock(); jtrue->target = exit_block; endtrue->connectTo(exit_block); jfalse->target = exit_block; endfalse->connectTo(exit_block); curblock = exit_block; return makeName(rtn_name, AST_TYPE::Load); }
void Animation:: ReadNodeHeirarchy(int frameIdx, const aiNode* pNode, const glm::mat4& parTf) { std::string nodeName(pNode->mName.data); if (mBoneIdx.find(nodeName) == mBoneIdx.end()) return; uint32 boneIdx = mBoneIdx[nodeName]; const aiNodeAnim* pAnim = mBoneAnim[boneIdx]; aiVectorKey& sc= pAnim->mScalingKeys[frameIdx % pAnim->mNumScalingKeys]; aiMatrix4x4 matScale; aiMatrix4x4::Scaling(sc.mValue, matScale); aiQuatKey& qt = pAnim->mRotationKeys[frameIdx % pAnim->mNumRotationKeys]; aiMatrix4x4 matRotat(qt.mValue.GetMatrix()); aiVectorKey& tr = pAnim->mPositionKeys[frameIdx % pAnim->mNumPositionKeys]; aiMatrix4x4 matTrans; aiMatrix4x4::Translation(tr.mValue, matTrans); // Convert from aiMatrix4x4 to glm::mat4 glm::mat4 nodeTf; CopyMat(matTrans * matRotat * matScale, nodeTf); glm::mat4 globalTf= parTf * nodeTf; glm::mat4 finalTf = globalTf * mBoneOffsets[boneIdx]; mBoneFinalTf[boneIdx] = finalTf; // Print out info // cout << nodeName << endl; // pprintMat4x4(finalTf); // pprintScQtTr(sc.mValue, qt.mValue, tr.mValue); // pprintMat16(nodeTf); for(uint i=0; i< pNode->mNumChildren; ++i) ReadNodeHeirarchy(frameIdx, pNode->mChildren[i], globalTf); }
void Text::formatForDebugger(char* buffer, unsigned length) const { StringBuilder result; String s; result.append(nodeName()); s = data(); if (s.length() > 0) { if (result.length()) result.appendLiteral("; "); result.appendLiteral("length="); result.appendNumber(s.length()); result.appendLiteral("; value=\""); result.append(s); result.append('"'); } strncpy(buffer, result.toString().utf8().data(), length - 1); buffer[length - 1] = '\0'; }
void FeedFetcher::handleRssXml(QDomNode node) { QList<Tweet*> tweets; QDomNodeList children = node.firstChild().childNodes(); QDateTime startDate = QDateTime::currentDateTime(); for (int x=0;x<children.count();x++) { QDomNode item = children.at(x); // QMessageBox::information(0,"Bleugh",item.nodeName()); if (nodeName(item)=="title") { emit feedTitle(item.firstChild().nodeValue()); } else if (nodeName(item)=="item") { FeedItem *tweet = new FeedItem(); tweet->created_at=startDate.addSecs(-x); tweet->feed_item_date="";//tweet->created_at.toString(); tweet->sourceUrl=url; QDomNodeList children2 = item.childNodes(); for (int y=0;y<children2.count();y++) { QDomNode childItem = children2.at(y); if (nodeName(childItem)=="title") { tweet->message=childItem.firstChild().nodeValue(); } else if (nodeName(childItem)=="guid") { tweet->id=childItem.firstChild().nodeValue(); } else if (nodeName(childItem)=="description") { tweet->content=childItem.firstChild().nodeValue(); } else if (nodeName(childItem)=="link") { tweet->url=childItem.firstChild().nodeValue(); if (tweet->id=="") tweet->id=tweet->url; } else if (nodeName(childItem)=="pubDate") { //Thu Feb 19 00:20:20 +0000 2009 QString date = childItem.firstChild().nodeValue(); // tweet->feed_item_date = childItem.firstChild().nodeValue().left(26); // QString hour = dateStr.mid(20,5); // dateStr=dateStr.left(20)+dateStr.right(4); // tweet->created_at=QDateTime::fromString(dateStr,"ddd MMM dd HH:mm:ss +0000 yyyy"); // Sat, 05 Sep 2009 14:51:00 GMT tweet->created_at=parseRssDate(date); } } tweets.append(tweet); } } emit haveTweets(tweets); }
// ----------------------------------------------------------------------------- // CCFScript::ParseL // ----------------------------------------------------------------------------- // CCFOperationNode* CCFScript::ParseL( CCFOperationNode* aParent, CMDXMLNode& aNode ) { FUNC_LOG; TUid providerUid = KNullUid; CCFOperationNode* opNode = iPlugInOperation.ParseL( aParent, aNode, *this, providerUid ); if ( opNode ) { // Node found, add dependency AddDependencyL( providerUid ); } else { TPtrC nodeName( aNode.NodeName() ); ERROR_GEN_1( "Unknown node name: %S" , &nodeName ); } return opNode; }
void AssimpNode::update( float timeElapsed_s, glm::mat4 parent, Animator* boneManager, GLint activeAnimation) { std::string nodeName(mName); Animation* a = boneManager->getAnimation(activeAnimation); if (nullptr == a) { return; } glm::mat4 transformation = mTransformation; Channel* channel = boneManager->findChannel(a, nodeName); if (channel) { glm::vec3 scaling = boneManager->getCurrentScale(timeElapsed_s, channel); glm::mat4 scale = glm::scale(glm::mat4(1.0), scaling); glm::quat rotation = boneManager->getCurrentRotation(timeElapsed_s, channel); glm::mat4 rotate = glm::mat4_cast(rotation); glm::vec3 translation = boneManager->getCurrentTranslation(timeElapsed_s, channel); glm::mat4 translate = glm::translate(glm::mat4(1.0), translation); transformation = translate * rotate * scale; } glm::mat4 m = parent * transformation; if (mBone) { mBone->setGlobalOffsetMatrix(m * mBone->getOffsetMatrix()); } for (auto& it : mChildren) { it->update(timeElapsed_s, m, boneManager, activeAnimation); } }
/********************************************************************************** Snapshot mode, give animation and frame indices directly *********************************************************************************/ void Mesh::UpdateBoneTfDisc(uint frame_index, std::vector<glm::mat4>& Tfs, uint anim_index) { aiNode* pNode = _pSceneMesh->mRootNode; std::string nodeName (pNode->mName.data); while (_b2i_map.find(nodeName) == _b2i_map.end()) { pNode = pNode->mChildren[0]; // printf("Root Node: %s\n", pNode->mName.data); nodeName = std::string(pNode->mName.data); } glm::mat4 identity = glm::mat4(1.0f); ReadNodeHeirarchyDisc(frame_index, pNode, identity, anim_index); Tfs.resize(_numBone); for (unsigned int i=0; i< _numBone; i++) { Tfs[i] = _boneTfs[i].FinalTf; } }
std::string Lval::_dotFormat() { std::string r = ptrToStr(this); std::string name = nodeName(); switch (v) { case ID_T: name += " ID " + id; r += " [label=\"" + name + "\" shape=rect style=solid];\n"; break; case DOT_T: name += " DOT " + id; r += " [label=\"" + name + "\" shape=rect style=solid];\n"; r += lval->_dotFormat(); r += ptrToStr(this) + " -> " + ptrToStr(lval) + ";\n"; break; case ACC_T: name += " -> " + id; r += " [label=\"" + name + "\" shape=rect style=solid];\n"; r += lval->_dotFormat(); r += ptrToStr(this) + " -> " + ptrToStr(lval) + ";\n"; break; case DEREF_T: name += " DEREF"; r += " [label=\"" + name + "\" shape=rect style=solid];\n"; r += lval->_dotFormat(); r += ptrToStr(this) + " -> " + ptrToStr(lval) + ";\n"; break; case SUBSC_T: name += " SUBSC"; r += " [label=\"" + name + "\" shape=rect style=solid];\n"; r += lval->_dotFormat(); r += ptrToStr(this) + " -> " + ptrToStr(lval) + ";\n"; r += exp->_dotFormat(); r += ptrToStr(this) + " -> " + ptrToStr(exp) + ";\n"; break; } return r; }
String Element::openTagStartToString() const { String result = "<" + nodeName(); NamedAttrMap *attrMap = attributes(true); if (attrMap) { unsigned numAttrs = attrMap->length(); for (unsigned i = 0; i < numAttrs; i++) { result += " "; Attribute *attribute = attrMap->attributeItem(i); result += attribute->name().toString(); if (!attribute->value().isNull()) { result += "=\""; // FIXME: substitute entities for any instances of " or ' result += attribute->value(); result += "\""; } } } return result; }
int main(int argc, char **argv){ // (when V-REP launches this executable, V-REP will also provide the argument list) // Se reciben 9 argumentos if (argc>=1) { Npata_arg=atoi(argv[1]); } else { ROS_ERROR("Nodo 2: Indique argumentos!\n"); sleep(5000); return 0; } /*Inicio nodo de ROS*/ std::string nodeName("Nodo2_Parametrizacion_pata"); std::string Id(boost::lexical_cast<std::string>(Npata_arg)); nodeName+=Id; ros::init(argc,argv,nodeName.c_str()); ros::NodeHandle n; //ROS_INFO("Nodo2_Parametrizacion just started\n"); //Topicos susbcritos y publicados chatter_pub = n.advertise<camina::AngulosMotor>("DatosDeMotores", 100); ros::Subscriber sub = n.subscribe("datosTrayectoriaPataSalida", 100, datosCallback); ros::Subscriber subInfo=n.subscribe("/vrep/info",1,infoCallback); while (ros::ok() && simulationRunning) { ros::spinOnce(); } //ROS_INFO("Adios2!"); ros::shutdown(); return 0; }
const std::string NodeBinaryOpArithSubtract::prettyNodeName() { return nodeName(__PRETTY_FUNCTION__); }
const std::string NodeStatements::prettyNodeName() { return nodeName(__PRETTY_FUNCTION__); }
const std::string NodeAtomof::prettyNodeName() { return nodeName(__PRETTY_FUNCTION__); }
AppConfig::AppConfig(std::string& xmlfile) : analyticsEnabled(true), updateMonitorEnabled(true) { systemProperties = new PropertiesBinding(); xmlParserCtxtPtr context = xmlNewParserCtxt(); xmlDocPtr document = xmlCtxtReadFile(context, xmlfile.c_str(), NULL, 0); if (!document) { std::ostringstream error; if (context->lastError.code != XML_IO_LOAD_ERROR) { error << context->lastError.file << "[Line "; error << context->lastError.line << "] "; } error << context->lastError.message; GetLogger()->Error(error.str()); xmlFreeParserCtxt(context); xmlCleanupParser(); return; } xmlNodePtr root = xmlDocGetRootElement(document); xmlNodePtr node = root->children; while (node) { if (node->type != XML_ELEMENT_NODE) { node = node->next; continue; } // This should always be a UTF-8, so we can just cast // the node name here to a char* std::string nodeName(reinterpret_cast<char*>( const_cast<xmlChar*>(node->name))); if (nodeName == "name") { appName = ConfigUtils::GetNodeValue(node); } else if (nodeName == "id") { appID = ConfigUtils::GetNodeValue(node); } else if (nodeName == "description") { description = ConfigUtils::GetNodeValue(node); } else if (nodeName == "copyright") { copyright = ConfigUtils::GetNodeValue(node); } else if (nodeName == "url") { url = ConfigUtils::GetNodeValue(node); } else if (nodeName == "version") { version = ConfigUtils::GetNodeValue(node); } else if (nodeName == "publisher") { publisher = ConfigUtils::GetNodeValue(node); } else if (nodeName == "window") { this->windows.push_back(WindowConfig::FromXMLNode(node)); } else if (nodeName == "analytics") { std::string nodeValue(ConfigUtils::GetNodeValue(node)); analyticsEnabled = ConfigUtils::StringToBool(nodeValue); } else if (nodeName == "update-monitor") { std::string nodeValue(ConfigUtils::GetNodeValue(node)); updateMonitorEnabled = ConfigUtils::StringToBool(nodeValue); } else if (nodeName == "icon") { icon = ConfigUtils::GetNodeValue(node); } else if (nodeName == "property") { ParsePropertyNode(node, systemProperties->GetConfig()); } else if (nodeName == "title") { appTitle = ConfigUtils::GetNodeValue(node); } node = node->next; } xmlFreeDoc(document); xmlFreeParserCtxt(context); xmlCleanupParser(); }
/* static */ bool PxrUsdMayaTranslatorCurves::Create( const UsdGeomCurves& curves, MObject parentNode, const PxrUsdMayaPrimReaderArgs& args, PxrUsdMayaPrimReaderContext* context) { if (not curves) { return false; } const UsdPrim& prim = curves.GetPrim(); MStatus status; // Create node (transform) MObject mayaNodeTransformObj; if (not PxrUsdMayaTranslatorUtil::CreateTransformNode(prim, parentNode, args, context, &status, &mayaNodeTransformObj)) { return false; } VtArray<GfVec3f> points; VtArray<int> curveOrder; VtArray<int> curveVertexCounts; VtArray<float> curveWidths; VtArray<GfVec2d> curveRanges; VtArray<double> curveKnots; // LIMITATION: xxx REVISIT xxx // Non-animated Attrs // Assuming that a number of these USD attributes are assumed to not be animated // Some we may want to expose as animatable later. // curves.GetCurveVertexCountsAttr().Get(&curveVertexCounts); // not animatable // XXX: // Only supporting single curve for now. // Sanity Checks if (curveVertexCounts.size() == 0) { MGlobal::displayError( TfStringPrintf("VertexCount arrays is empty on NURBS curves <%s>. Skipping...", prim.GetPath().GetText()).c_str()); return false; // No verts for the curve, so exit } else if (curveVertexCounts.size() > 1) { MGlobal::displayWarning( TfStringPrintf("Multiple curves in <%s>. Reading first one...", prim.GetPath().GetText()).c_str()); } int curveIndex = 0; curves.GetWidthsAttr().Get(&curveWidths); // not animatable // Gather points. If args.GetReadAnimData() is TRUE, // pick the first avaiable sample or default UsdTimeCode pointsTimeSample=UsdTimeCode::EarliestTime(); std::vector<double> pointsTimeSamples; size_t numTimeSamples = 0; if (args.GetReadAnimData()) { curves.GetPointsAttr().GetTimeSamples(&pointsTimeSamples); numTimeSamples = pointsTimeSamples.size(); if (numTimeSamples>0) { pointsTimeSample = pointsTimeSamples[0]; } } curves.GetPointsAttr().Get(&points, pointsTimeSample); if (points.size() == 0) { MGlobal::displayError( TfStringPrintf("Points arrays is empty on NURBS curves <%s>. Skipping...", prim.GetPath().GetText()).c_str()); return false; // invalid nurbscurves, so exit } if (UsdGeomNurbsCurves nurbsSchema = UsdGeomNurbsCurves(prim)) { nurbsSchema.GetOrderAttr().Get(&curveOrder); // not animatable nurbsSchema.GetKnotsAttr().Get(&curveKnots); // not animatable nurbsSchema.GetRangesAttr().Get(&curveRanges); // not animatable } else { // Handle basis curves originally modelled in Maya as nurbs. curveOrder.resize(1); UsdGeomBasisCurves basisSchema = UsdGeomBasisCurves(prim); TfToken typeToken; basisSchema.GetTypeAttr().Get(&typeToken); if (typeToken == UsdGeomTokens->linear) { curveOrder[0] = 2; curveKnots.resize(points.size()); for (size_t i=0; i < curveKnots.size(); ++i) { curveKnots[i] = i; } } else { curveOrder[0] = 4; // Strip off extra end points; assuming this is non-periodic. VtArray<GfVec3f> tmpPts(points.size() - 2); std::copy(points.begin() + 1, points.end() - 1, tmpPts.begin()); points.swap(tmpPts); // Cubic curves in Maya have numSpans + 2*3 - 1, and for geometry // that came in as basis curves, we have numCV's - 3 spans. See the // MFnNurbsCurve documentation and the nurbs curve export // implementation in mojitoplugmaya for more details. curveKnots.resize(points.size() -3 + 5); int knotIdx = 0; for (size_t i=0; i < curveKnots.size(); ++i) { if (i < 3) { curveKnots[i] = 0.0; } else { if (i <= curveKnots.size() - 3) { ++knotIdx; } curveKnots[i] = double(knotIdx); } } } } // == Convert data size_t mayaNumVertices = points.size(); MPointArray mayaPoints(mayaNumVertices); for (size_t i=0; i < mayaNumVertices; i++) { mayaPoints.set( i, points[i][0], points[i][1], points[i][2] ); } double *knots=curveKnots.data(); MDoubleArray mayaKnots( knots, curveKnots.size()); int mayaDegree = curveOrder[curveIndex] - 1; MFnNurbsCurve::Form mayaCurveForm = MFnNurbsCurve::kOpen; // HARDCODED bool mayaCurveCreate2D = false; bool mayaCurveCreateRational = true; // == Create NurbsCurve Shape Node MFnNurbsCurve curveFn; MObject curveObj = curveFn.create(mayaPoints, mayaKnots, mayaDegree, mayaCurveForm, mayaCurveCreate2D, mayaCurveCreateRational, mayaNodeTransformObj, &status ); if (status != MS::kSuccess) { return false; } MString nodeName( prim.GetName().GetText() ); nodeName += "Shape"; curveFn.setName(nodeName, false, &status); std::string nodePath( prim.GetPath().GetText() ); nodePath += "/"; nodePath += nodeName.asChar(); if (context) { context->RegisterNewMayaNode( nodePath, curveObj ); // used for undo/redo } // == Animate points == // Use blendShapeDeformer so that all the points for a frame are contained in a single node // Almost identical code as used with MayaMeshReader.cpp // if (numTimeSamples > 0) { MPointArray mayaPoints(mayaNumVertices); MObject curveAnimObj; MFnBlendShapeDeformer blendFn; MObject blendObj = blendFn.create(curveObj); if (context) { context->RegisterNewMayaNode(blendFn.name().asChar(), blendObj ); // used for undo/redo } for (unsigned int ti=0; ti < numTimeSamples; ++ti) { curves.GetPointsAttr().Get(&points, pointsTimeSamples[ti]); for (unsigned int i=0; i < mayaNumVertices; i++) { mayaPoints.set( i, points[i][0], points[i][1], points[i][2] ); } // == Create NurbsCurve Shape Node MFnNurbsCurve curveFn; if ( curveAnimObj.isNull() ) { curveAnimObj = curveFn.create(mayaPoints, mayaKnots, mayaDegree, mayaCurveForm, mayaCurveCreate2D, mayaCurveCreateRational, mayaNodeTransformObj, &status ); if (status != MS::kSuccess) { continue; } } else { // Reuse the already created curve by copying it and then setting the points curveAnimObj = curveFn.copy(curveAnimObj, mayaNodeTransformObj, &status); curveFn.setCVs(mayaPoints); } blendFn.addTarget(curveObj, ti, curveAnimObj, 1.0); curveFn.setIntermediateObject(true); if (context) { context->RegisterNewMayaNode( curveFn.fullPathName().asChar(), curveAnimObj ); // used for undo/redo } } // Animate the weights so that curve0 has a weight of 1 at frame 0, etc. MFnAnimCurve animFn; // Construct the time array to be used for all the keys MTimeArray timeArray; timeArray.setLength(numTimeSamples); for (unsigned int ti=0; ti < numTimeSamples; ++ti) { timeArray.set( MTime(pointsTimeSamples[ti]), ti); } // Key/Animate the weights MPlug plgAry = blendFn.findPlug( "weight" ); if ( !plgAry.isNull() && plgAry.isArray() ) { for (unsigned int ti=0; ti < numTimeSamples; ++ti) { MPlug plg = plgAry.elementByLogicalIndex(ti, &status); MDoubleArray valueArray(numTimeSamples, 0.0); valueArray[ti] = 1.0; // Set the time value where this curve's weight should be 1.0 MObject animObj = animFn.create(plg, NULL, &status); animFn.addKeys(&timeArray, &valueArray); if (context) { context->RegisterNewMayaNode(animFn.name().asChar(), animObj ); // used for undo/redo } } } } return true; }
void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name) { fprintf(stderr, "\n\n"); for (size_t i = 0; i < map.size(); ++i) fprintf(stderr, "%s[%lu]: %s (%p) - [%lu]\n", name.utf8().data(), i, map[i].first ? nodeName(map[i].first->m_node).utf8().data() : "", map[i].first, map[i].second); }
const std::string NodeListClassInit::prettyNodeName() { return nodeName(__PRETTY_FUNCTION__); }
/*static*/ AutoPtr<WindowConfig> WindowConfig::FromXMLNode(xmlNodePtr element) { WindowConfig* config = new WindowConfig(); xmlNodePtr child = element->children; while (child) { if (child->type != XML_ELEMENT_NODE) { child = child->next; continue; } // This should always be a UTF-8, so we can just cast // the node name here to a char* std::string nodeName(reinterpret_cast<char*>( const_cast<xmlChar*>(child->name))); if (nodeName == "id") { config->SetID(ConfigUtils::GetNodeValue(child)); } else if (nodeName == "title") { config->SetTitle(ConfigUtils::GetNodeValue(child)); } else if (nodeName == "url") { config->SetURL(ConfigUtils::GetNodeValue(child)); } else if (nodeName == "url-regex") { config->SetURLRegex(ConfigUtils::GetNodeValue(child)); } else if (nodeName == "maximizable") { config->SetMaximizable(ConfigUtils::GetNodeValueAsBool(child)); } else if (nodeName == "minimizable") { config->SetMinimizable(ConfigUtils::GetNodeValueAsBool(child)); } else if (nodeName == "closeable") { config->SetCloseable(ConfigUtils::GetNodeValueAsBool(child)); } else if (nodeName == "resizable") { config->SetResizable(ConfigUtils::GetNodeValueAsBool(child)); } else if (nodeName == "fullscreen") { config->SetFullscreen(ConfigUtils::GetNodeValueAsBool(child)); } else if (nodeName == "maximized") { config->SetMaximized(ConfigUtils::GetNodeValueAsBool(child)); } else if (nodeName == "minimized") { config->SetMinimized(ConfigUtils::GetNodeValueAsBool(child)); } else if (nodeName == "chrome") { config->SetUsingChrome(ConfigUtils::GetNodeValueAsBool(child)); std::string scrollbars(ConfigUtils::GetPropertyValue(child, "scrollbars")); if (!scrollbars.empty()) { config->SetUsingScrollbars(ConfigUtils::StringToBool(scrollbars)); } } else if (nodeName == "tool-window") { config->SetToolWindow(ConfigUtils::GetNodeValueAsBool(child)); } else if (nodeName == "transparency") { std::string value(ConfigUtils::GetNodeValue(child)); config->SetTransparency((float) atof(value.c_str())); } else if (nodeName == "transparent-background") { config->SetTransparentBackground( ConfigUtils::GetNodeValueAsBool(child)); } else if (nodeName == "x") { std::string value(ConfigUtils::GetNodeValue(child)); config->SetX(atoi(value.c_str())); } else if (nodeName == "y") { std::string value(ConfigUtils::GetNodeValue(child)); config->SetY(atoi(value.c_str())); } else if (nodeName == "width") { std::string value(ConfigUtils::GetNodeValue(child)); config->SetWidth(atoi(value.c_str())); } else if (nodeName == "height") { std::string value(ConfigUtils::GetNodeValue(child)); config->SetHeight(atoi(value.c_str())); } else if (nodeName == "visible") { config->SetVisible(ConfigUtils::GetNodeValueAsBool(child)); } else if (nodeName == "min-width") { std::string value(ConfigUtils::GetNodeValue(child)); config->SetMinWidth(atoi(value.c_str())); } else if (nodeName == "max-width") { std::string value(ConfigUtils::GetNodeValue(child)); config->SetMaxWidth(atoi(value.c_str())); } else if (nodeName == "min-height") { std::string value(ConfigUtils::GetNodeValue(child)); config->SetMinHeight(atoi(value.c_str())); } else if (nodeName == "max-height") { std::string value(ConfigUtils::GetNodeValue(child)); config->SetMaxHeight(atoi(value.c_str())); } else if (nodeName == "top-most") { config->SetTopMost(ConfigUtils::GetNodeValueAsBool(child)); } #ifdef OS_OSX else if (nodeName == "texturedBackground" || nodeName == "textured-background") { config->SetTexturedBackground(ConfigUtils::GetNodeValueAsBool(child)); } #endif child = child->next; } EnforceMaxMinConstraints(config); EnforceTransparentBackgroundSettings(config); return config; }
const std::string NodeVarRefAs::prettyNodeName() { return nodeName(__PRETTY_FUNCTION__); }
const std::string NodeBinaryOpArithRemainder::prettyNodeName() { return nodeName(__PRETTY_FUNCTION__); }
const std::string NodeBinaryOpLogicalOr::prettyNodeName() { return nodeName(__PRETTY_FUNCTION__); }
void HttpInterface::evVariableOrEvent(HttpRequest* req, strings& args) { string nodeName(args[0]); size_t eventPos; if ( ! commonDefinitions.events.contains(UTF8ToWString(args[1]), &eventPos)) { // this is a variable if (req->method.find("POST") == 0 || args.size() >= 3) { // set variable value strings values; if (args.size() >= 3) values.assign(args.begin()+1, args.end()); else { // Parse POST form data values.push_back(args[1]); parse_json_form(req->content, values); } if (values.size() == 0) { finishResponse(req, 404, ""); if (verbose) cerr << req << " evVariableOrEevent 404 can't set variable " << args[0] << ", no values" << endl; return; } sendSetVariable(nodeName, values); finishResponse(req, 200, ""); if (verbose) cerr << req << " evVariableOrEevent 200 set variable " << values[0] << endl; } else { // get variable value strings values; values.assign(args.begin()+1, args.begin()+2); unsigned source, start; if ( ! getNodeAndVarPos(nodeName, values[0], source, start)) { finishResponse(req, 404, ""); if (verbose) cerr << req << " evVariableOrEevent 404 no such variable " << values[0] << endl; return; } sendGetVariables(nodeName, values); pendingVariables[std::make_pair(source,start)].insert(req); if (verbose) cerr << req << " evVariableOrEevent schedule var " << values[0] << "(" << source << "," << start << ") add " << req << " to subscribers" << endl; return; } } else { // this is an event // arguments are args 1..N strings data; data.push_back(args[1]); if (args.size() >= 3) for (size_t i=2; i<args.size(); ++i) data.push_back((args[i].c_str())); else if (req->method.find("POST") == 0) { // Parse POST form data parse_json_form(std::string(req->content, req->content.size()), data); } sendEvent(nodeName, data); finishResponse(req, 200, ""); // or perhaps {"return_value":null,"cmd":"sendEvent","name":nodeName}? return; } }
IPhysical::IPhysical(BaseLib::Obj* baseLib, Type::Enum type, xml_node<>* node) : IPhysical(baseLib, type) { try { for(xml_attribute<>* attr = node->first_attribute(); attr; attr = attr->next_attribute()) { std::string attributeName(attr->name()); if(attributeName == "groupId") groupId = std::string(attr->value()); else _bl->out.printWarning("Warning: Unknown attribute for \"parameter\\physical*\": " + std::string(attr->name())); } for(xml_node<>* subNode = node->first_node(); subNode; subNode = subNode->next_sibling()) { std::string nodeName(subNode->name()); std::string nodeValue(subNode->value()); if(nodeName == "operationType") { if(nodeValue == "command") operationType = OperationType::Enum::command; else if(nodeValue == "centralCommand") operationType = OperationType::Enum::centralCommand; else if(nodeValue == "internal") operationType = OperationType::Enum::internal; else if(nodeValue == "config") operationType = OperationType::Enum::config; else if(nodeValue == "configString") operationType = OperationType::Enum::configString; else if(nodeValue == "store") operationType = OperationType::Enum::store; else if(nodeValue == "memory") operationType = OperationType::Enum::memory; else baseLib->out.printWarning("Warning: Unknown interface for \"parameter\\physical*\": " + nodeValue); } else if(nodeName == "endianess") { if(nodeValue == "little") endianess = Endianess::Enum::little; else if(nodeValue == "big") endianess = Endianess::Enum::big; else baseLib->out.printWarning("Warning: Unknown endianess for \"parameter\\physical*\": " + nodeValue); } else if(nodeName == "list") list = Math::getNumber(nodeValue); else if(nodeName == "index") Math::getDouble(nodeValue); else if(nodeName == "size") { Math::getDouble(nodeValue); sizeDefined = true; } else if(nodeName == "mask") mask = Math::getNumber(nodeValue); else if(nodeName == "memoryIndex") memoryIndex = Math::getDouble(nodeValue); else if(nodeName == "memoryIndexOperation") { if(nodeValue == "none") memoryIndexOperation = MemoryIndexOperation::Enum::none; else if(nodeValue == "addition") memoryIndexOperation = MemoryIndexOperation::Enum::addition; else if(nodeValue == "subtraction") memoryIndexOperation = MemoryIndexOperation::Enum::subtraction; else baseLib->out.printWarning("Warning: Unknown memoryIndexOperation for \"parameter\\physical*\": " + nodeValue); } else if(nodeName == "memoryChannelStep") memoryChannelStep = Math::getDouble(nodeValue); else baseLib->out.printWarning("Warning: Unknown node in \"parameter\\physical*\": " + nodeName); } if(mask != -1 && fmod(index, 1) != 0) baseLib->out.printWarning("Warning: mask combined with unaligned index not supported."); startIndex = std::lround(std::floor(index)); int32_t intDiff = std::lround(std::floor(size)) - 1; if(intDiff < 0) intDiff = 0; endIndex = startIndex + intDiff; } catch(const std::exception& ex) { _bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(const Exception& ex) { _bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(...) { _bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__); } }
const std::string NodeUnaryOpPlus::prettyNodeName() { return nodeName(__PRETTY_FUNCTION__); }
Modifier* createDisplayModifier(std::string modkey, std::string modname, std::vector<AbcProp>& props, INode* pNode) { ESS_PROFILE_FUNC(); //the script assumes a single object is selected std::stringstream evalStream; std::string nodeName("$"); if(pNode){ evalStream<<GET_MAXSCRIPT_NODE(pNode); nodeName = std::string("mynode2113"); } evalStream<<"propModifier = EmptyModifier()"<<"\n"; evalStream<<"propModifier.name = \""<<modkey<<"\""<<"\n"; evalStream<<"modCount = "<<nodeName<<".modifiers.count"<<"\n"; evalStream<<"addmodifier "<<nodeName<<" propModifier before:modCount"<<"\n"; evalStream<<nodeName<<".modifiers[\""<<modkey<<"\"].enabled = false"<<"\n"; evalStream<<"propAttribute = attributes propAttribute"<<"\n"; evalStream<<"("<<"\n"; evalStream<<"parameters propAttributePRM1 rollout:propAttributeRLT1"<<"\n"; evalStream<<"("<<"\n"; for(int i=0; i<props.size(); i++){ std::string& name = props[i].name; std::string& val = props[i].displayVal; bool& bConstant = props[i].bConstant; const AbcA::DataType& datatype = props[i].propHeader.getDataType(); const AbcA::MetaData& metadata = props[i].propHeader.getMetaData(); if(datatype.getPod() == AbcA::kInt32POD && datatype.getExtent() == 1){ evalStream<<name<<" type:#integer animatable:true ui:e"<<name<<" default:"<<val; } else if(datatype.getPod() == AbcA::kFloat32POD && datatype.getExtent() == 1){ evalStream<<name<<" type:#float animatable:true ui:e"<<name<<" default:"<<val; } else if(datatype.getPod() == AbcA::kFloat32POD && datatype.getExtent() == 3){ //if(metadata.get("interpretation") == std::string("rgb")){ // evalStream<<name<<" type:#color animatable:false ui:e"<<name<<" default:(["<<val<<"] as color)"; //} //else{ //evalStream<<name<<" type:#point3 animatable:false ui:e"<<name<<" ["<<val<<"]"; evalStream<<name<<"x type:#float animatable:true ui:e"<<name<<"x default:300\n"; evalStream<<name<<"y type:#float animatable:true ui:e"<<name<<"y default:300\n"; evalStream<<name<<"z type:#float animatable:true ui:e"<<name<<"z default:300\n"; //} } else{ evalStream<<name<<" type:#string animatable:false ui:e"<<name<<" default:\""<<val<<"\""; } evalStream<<"\n"; } evalStream<<")"<<"\n"; evalStream<<"rollout propAttributeRLT1 \""<<modname<<"\""<<"\n"; evalStream<<"("<<"\n"; for(int i=0; i<props.size(); i++){ std::string& name = props[i].name; bool& bConstant = props[i].bConstant; const AbcA::DataType& datatype = props[i].propHeader.getDataType(); const AbcA::MetaData& metadata = props[i].propHeader.getMetaData(); const int nSize = (const int) props[i].displayVal.size(); if(datatype.getPod() == AbcA::kInt32POD && datatype.getExtent() == 1){ evalStream<<"label lbl"<<name<<" \""<<name<<"\" align:#left fieldWidth:140\n"; evalStream<<"spinner e"<<name<<" \"\" type:#integer range:[-9999999,9999999,0] align:#left labelOnTop:true\n"; } else if(datatype.getPod() == AbcA::kFloat32POD && datatype.getExtent() == 1){ evalStream<<"label lbl"<<name<<" \""<<name<<"\" align:#left fieldWidth:140\n"; evalStream<<"spinner e"<<name<<" \"\" type:#float range:[-9999999,9999999,0]align:#left labelOnTop:true\n"; } else if(datatype.getPod() == AbcA::kFloat32POD && datatype.getExtent() == 3){ evalStream<<"label lbl"<<name<<" \""<<name<<"\" align:#left fieldWidth:140\n"; evalStream<<"spinner e"<<name<<"x\"\" across:3 type:#float range:[-9999999,9999999,0] fieldWidth:39 readOnly:true\n"; evalStream<<"spinner e"<<name<<"y\"\" type:#float range:[-9999999,9999999,0] fieldWidth:39\n"; evalStream<<"spinner e"<<name<<"z\"\" type:#float range:[-9999999,9999999,0] fieldWidth:39\n"; } else{ //TODO: better fit for large strings evalStream<<"edittext e"<<name<<" \" "<<name<<"\" fieldWidth:140 "; if(nSize > 140){ evalStream<<"height:54"; } evalStream<<" labelOnTop:true"; if(bConstant) evalStream<<" readOnly:true"; } evalStream<<"\n"; } //evalStream<<"on propAttributePRM1 changed do\n"; //evalStream<<"("<<"\n"; //for(int i=0; i<props.size(); i++){ // std::string& name = props[i].name; // const AbcA::DataType& datatype = props[i].propHeader.getDataType(); // const AbcA::MetaData& metadata = props[i].propHeader.getMetaData(); // evalStream<<"e"<<name<<".text = "<<name<<" as string"; // evalStream<<"\n"; //} //evalStream<<")"<<"\n"; evalStream<<")"<<"\n"; evalStream<<")"<<"\n"; evalStream<<"custattributes.add "<<nodeName<<".modifiers[\""<<modkey<<"\"] propAttribute baseobject:false"<<"\n"; //ESS_LOG_WARNING(evalStream.str()); evalStream<<nodeName<<".modifiers[\""<<modkey<<"\"]\n"; FPValue fpVal; ExecuteMAXScriptScript( EC_UTF8_to_TCHAR((char*)evalStream.str().c_str()), 0, &fpVal); Modifier* pMod = (Modifier*)fpVal.r; return pMod; }
const std::string NodeBinaryOpCompareGreaterThan::prettyNodeName() { return nodeName(__PRETTY_FUNCTION__); }
const std::string NodeBinaryOpShiftLeft::prettyNodeName() { return nodeName(__PRETTY_FUNCTION__); }