void LiveScene::attributeNames( NameList &attrs ) const { if( !m_isRoot && m_dagPath.length() == 0 ) { throw Exception( "IECoreMaya::LiveScene::attributeNames: Dag path no longer exists!" ); } tbb::mutex::scoped_lock l( s_mutex ); attrs.clear(); attrs.push_back( SceneInterface::visibilityName ); // translate attributes with names starting with "ieAttr_": MFnDependencyNode fnNode( m_dagPath.node() ); unsigned int n = fnNode.attributeCount(); for( unsigned int i=0; i<n; i++ ) { MObject attr = fnNode.attribute( i ); MFnAttribute fnAttr( attr ); MString attrName = fnAttr.name(); if( attrName.length() > 7 && ( strstr( attrName.asChar(),"ieAttr_" ) == attrName.asChar() ) ) { attrs.push_back( ( "user:" + attrName.substring( 7, attrName.length()-1 ) ).asChar() ); } } // add attributes from custom readers: for ( std::vector< CustomAttributeReader >::const_iterator it = customAttributeReaders().begin(); it != customAttributeReaders().end(); it++ ) { it->m_names( m_dagPath, attrs ); } // remove duplicates: std::sort( attrs.begin(), attrs.end() ); attrs.erase( std::unique( attrs.begin(), attrs.end() ), attrs.end() ); }
ConvertHandler() { #define ADD_OPTION(name) mNames.push_back("-" name); mOptions.insert(name) #define ADD_ALIAS(alias,original) ADD_OPTION(alias); mAliases.insert(pair<string,string>(alias,original)) // Long names mNames.push_back("--convert"); mNames.push_back("--input"); mNames.push_back("--output"); // Short names mNames.push_back("-c"); mNames.push_back("-i"); mNames.push_back("-o"); // Options ADD_OPTION("flips"); //flip s coordinate ADD_OPTION("flipt"); //flip t coordinate ADD_OPTION("flipr"); //flip r coordinate ADD_OPTION("flipx"); //flip x coordinate ADD_OPTION("flipy"); //flip y coordinate ADD_OPTION("flipz"); //flip z coordinate ADD_OPTION("flip"); //? ADD_OPTION("flop"); //? ADD_OPTION("flipn"); //flip normals ADD_OPTION("dims"); //show dimensions ADD_OPTION("basepath"); //specify model base path for building material scripts ADD_OPTION("autolod"); //create automatic lods (TODO: may specify distance list) ADD_OPTION("autoedge"); //create edge list (prepare for stencil shadows) ADD_OPTION("autotangent"); //create tangent texcoord unit ADD_OPTION("forceflatshade"); //force flat shading ADD_OPTION("no-optimize"); //forcefully disable mesh optimization ADD_ALIAS ("x","addx"); //translate x (alias) ADD_ALIAS ("y","addy"); //translate y (alias) ADD_ALIAS ("z","addz"); //translate z (alias) ADD_OPTION("addx"); //translate x ADD_OPTION("addy"); //translate y ADD_OPTION("addz"); //translate z ADD_OPTION("adds"); //translate s ADD_OPTION("addt"); //translate t ADD_OPTION("addr"); //translate r ADD_OPTION("mpyx"); //multiply x ADD_OPTION("mpyy"); //multiply y ADD_OPTION("mpyz"); //multiply z ADD_OPTION("mpys"); //multiply s ADD_OPTION("mpyt"); //multiply t ADD_OPTION("mpyr"); //multiply r ADD_OPTION("inputPath"); //override input path ADD_OPTION("outputPath"); //override output path ADD_OPTION("rootPath"); //override executable path #undef ADD_OPTION }
const clbr::RuleNameMap* clbr::DrcLibrary::rules() { RuleNameMap* ruleMap = DEBUG_NEW clbr::RuleNameMap(); for (CellMap::const_iterator wc = _cells.begin(); wc != _cells.end(); wc++) { std::string cellName = wc->first; const RuleMap* cRules = wc->second->rules(); for (RuleMap::const_iterator wr = cRules->begin(); wr != cRules->end(); wr++) { std::string ruleName = wr->first; NameList* cellNames; if (ruleMap->end() == ruleMap->find(ruleName)) { cellNames = DEBUG_NEW NameList(); (*ruleMap)[ruleName] = cellNames; } else cellNames = (*ruleMap)[ruleName]; cellNames->push_back(cellName); } } for (RuleNameMap::iterator wr = ruleMap->begin(); wr != ruleMap->end(); wr++) { wr->second->unique(); } return ruleMap; }
NameList SplattingManager::getMapTextureNames() const { NameList names; for (size_t i = 0; i < mImpl->maps.size(); ++i) names.push_back(mImpl->maps[i]->getName()); return names; }
void user_pass(char *username) { NameList name; IdMap users; ServerPrx server; server = meta->getServer(serverId, ctx); name.push_back(username); users = server->getUserIds(name, ctx); if (users[username] < 0) throw "Invalid User"; else { UserInfoMap uinfo = server->getRegistration(users[username], ctx); cout << "Enter new password for " << uinfo[UserName] << ": "; string pass; getline(cin, pass); uinfo[UserPassword] = pass; server->updateRegistration(users[username], uinfo, ctx); cout << "Password Updated!" << endl; } }
RecordPtr Common::assembleRecord(const Json::Value& rVal) { auto contact = rVal["contact"].asString(); auto nonce = rVal["nonce"].asString(); auto pow = rVal["pow"].asString(); auto pubHSKey = rVal["pubHSKey"].asString(); auto sig = rVal["recordSig"].asString(); auto type = rVal["type"].asString(); auto name = rVal["name"].asString(); if (type != "Create") Log::get().error("Record parsing: not a Create Record!"); NameList subdomains; if (rVal.isMember("subd")) { Json::Value list = rVal["subd"]; auto sources = list.getMemberNames(); for (auto source : sources) subdomains.push_back(std::make_pair(source, list[source].asString())); } auto key = Utils::base64ToRSA(pubHSKey); return std::make_shared<CreateR>(contact, name, subdomains, nonce, pow, sig, key); }
/** * Create a new field declaration with exactly one variable in it. * If the field is uninitialized, the initializer may be * <code>null</code>. * * @param context Context indicating what line and file this * field is created at * @param type Type of the field * @param name Name of the field * @param init Expression initializing the field, or * <code>null</code> if the field is uninitialized */ FieldDecl(FEContext *context, Type *type, string name, Expression *init) : FENode(context) { types = new TypeList; names = new NameList; inits = new ExpressionList; types->push_back(type); names->push_back(name); inits->push_back(init); }
void HoudiniScene::attributeNames( NameList &attrs ) const { attrs.clear(); for ( std::map<Name, CustomReader>::const_iterator it = customAttributeReaders().begin(); it != customAttributeReaders().end(); ++it ) { if ( it->second.m_has( retrieveNode() ) ) { attrs.push_back( it->first ); } } }
void MayaScene::attributeNames( NameList &attrs ) const { if( !m_isRoot && m_dagPath.length() == 0 ) { throw Exception( "MayaScene::attributeNames: Dag path no longer exists!" ); } tbb::mutex::scoped_lock l( s_mutex ); attrs.clear(); attrs.push_back( SceneInterface::visibilityName ); for ( std::vector< CustomAttributeReader >::const_iterator it = customAttributeReaders().begin(); it != customAttributeReaders().end(); it++ ) { it->m_names( m_dagPath, attrs ); } }
void user_delete(char *username) { NameList name; IdMap users; ServerPrx server; server = meta->getServer(serverId, ctx); name.push_back(username); users = server->getUserIds(name, ctx); if (users[username] < 0) throw "Invalid User"; else { server->unregisterUser(users[username], ctx); cout << username << " deleted." << endl; } }
void LiveScene::attributeNames( NameList &attrs ) const { attrs.clear(); OP_Node *node = retrieveNode(); const std::vector<CustomAttributeReader> &attributeReaders = customAttributeReaders(); for ( std::vector<CustomAttributeReader>::const_iterator it = attributeReaders.begin(); it != attributeReaders.end(); ++it ) { NameList names; it->m_names( node, names ); /// \todo: investigate using a set here if performance becomes an issue for ( NameList::const_iterator nIt = names.begin(); nIt != names.end(); ++nIt ) { if ( std::find( attrs.begin(), attrs.end(), *nIt ) == attrs.end() ) { attrs.push_back( *nIt ); } } } }
void LiveScene::childNames( NameList &childNames ) const { tbb::mutex::scoped_lock l( s_mutex ); if( m_dagPath.length() == 0 && !m_isRoot ) { throw Exception( "IECoreMaya::LiveScene::childNames: Dag path no longer exists!" ); } unsigned currentPathLength = m_dagPath.fullPathName().length(); MDagPathArray paths; getChildDags( m_dagPath, paths ); for( unsigned i=0; i < paths.length(); ++i ) { if( paths[i].hasFn( MFn::kTransform ) ) { std::string childName( paths[i].fullPathName().asChar() + currentPathLength + 1 ); childNames.push_back( Name( childName ) ); } } }
void EditQueueBinCommand::Execute() { SNZBEditQueueRequest EditQueueRequest; if (!ReceiveRequest(&EditQueueRequest, sizeof(EditQueueRequest))) { return; } int iNrIDEntries = ntohl(EditQueueRequest.m_iNrTrailingIDEntries); int iNrNameEntries = ntohl(EditQueueRequest.m_iNrTrailingNameEntries); int iNameEntriesLen = ntohl(EditQueueRequest.m_iTrailingNameEntriesLen); int iAction = ntohl(EditQueueRequest.m_iAction); int iMatchMode = ntohl(EditQueueRequest.m_iMatchMode); int iOffset = ntohl(EditQueueRequest.m_iOffset); int iTextLen = ntohl(EditQueueRequest.m_iTextLen); bool bSmartOrder = ntohl(EditQueueRequest.m_bSmartOrder); unsigned int iBufLength = ntohl(EditQueueRequest.m_iTrailingDataLength); if (iNrIDEntries * sizeof(int32_t) + iTextLen + iNameEntriesLen != iBufLength) { error("Invalid struct size"); return; } char* pBuf = (char*)malloc(iBufLength); // Read from the socket until nothing remains char* pBufPtr = pBuf; int NeedBytes = iBufLength; int iResult = 0; while (NeedBytes > 0) { iResult = recv(m_iSocket, pBufPtr, NeedBytes, 0); // Did the recv succeed? if (iResult <= 0) { error("invalid request"); break; } pBufPtr += iResult; NeedBytes -= iResult; } bool bOK = NeedBytes == 0; if (iNrIDEntries <= 0 && iNrNameEntries <= 0) { SendBoolResponse(false, "Edit-Command failed: no IDs/Names specified"); return; } if (bOK) { char* szText = iTextLen > 0 ? pBuf : NULL; int32_t* pIDs = (int32_t*)(pBuf + iTextLen); char* pNames = (pBuf + iTextLen + iNrIDEntries * sizeof(int32_t)); IDList cIDList; NameList cNameList; if (iNrIDEntries > 0) { cIDList.reserve(iNrIDEntries); for (int i = 0; i < iNrIDEntries; i++) { cIDList.push_back(ntohl(pIDs[i])); } } if (iNrNameEntries > 0) { cNameList.reserve(iNrNameEntries); for (int i = 0; i < iNrNameEntries; i++) { cNameList.push_back(pNames); pNames += strlen(pNames) + 1; } } if (iAction < eRemoteEditActionPostMoveOffset) { bOK = g_pQueueCoordinator->GetQueueEditor()->EditList( iNrIDEntries > 0 ? &cIDList : NULL, iNrNameEntries > 0 ? &cNameList : NULL, (QueueEditor::EMatchMode)iMatchMode, bSmartOrder, (QueueEditor::EEditAction)iAction, iOffset, szText); } else { bOK = g_pPrePostProcessor->QueueEditList(&cIDList, (PrePostProcessor::EEditAction)iAction, iOffset); } } free(pBuf); if (bOK) { SendBoolResponse(true, "Edit-Command completed successfully"); } else { #ifndef HAVE_REGEX_H if ((QueueEditor::EMatchMode)iMatchMode == QueueEditor::mmRegEx) { SendBoolResponse(false, "Edit-Command failed: the program was compiled without RegEx-support"); return; } #endif SendBoolResponse(false, "Edit-Command failed"); } }
void HoudiniScene::childNames( NameList &childNames ) const { OP_Node *node = retrieveNode(); OBJ_Node *objNode = node->castToOBJNode(); OBJ_Node *contentNode = retrieveNode( true )->castToOBJNode(); // add subnet children if ( node->isManager() || ( objNode && objNode->getObjectType() == OBJ_SUBNET ) ) { for ( int i=0; i < node->getNchildren(); ++i ) { OP_Node *child = node->getChild( i ); // ignore children that have incoming connections, as those are actually grandchildren // also ignore the contentNode, which is actually an extension of ourself if ( child != contentNode && !hasInput( child ) ) { childNames.push_back( Name( child->getName() ) ); } } } if ( !contentNode ) { return; } // add connected outputs for ( unsigned i=0; i < contentNode->nOutputs(); ++i ) { childNames.push_back( Name( contentNode->getOutput( i )->getName() ) ); } // add child shapes within the geometry if ( contentNode->getObjectType() == OBJ_GEOMETRY ) { OP_Context context( getDefaultTime() ); const GU_Detail *geo = contentNode->getRenderGeometry( context, false ); GA_ROAttributeRef nameAttrRef = geo->findStringTuple( GA_ATTRIB_PRIMITIVE, "name" ); if ( !nameAttrRef.isValid() ) { return; } const GA_Attribute *nameAttr = nameAttrRef.getAttribute(); const GA_AIFSharedStringTuple *tuple = nameAttr->getAIFSharedStringTuple(); GA_Size numShapes = tuple->getTableEntries( nameAttr ); for ( GA_Size i=0; i < numShapes; ++i ) { const char *currentName = tuple->getTableString( nameAttr, tuple->validateTableHandle( nameAttr, i ) ); const char *match = matchPath( currentName ); if ( match && *match != *emptyString ) { std::pair<const char *, size_t> childMarker = nextWord( match ); std::string child( childMarker.first, childMarker.second ); if ( std::find( childNames.begin(), childNames.end(), child ) == childNames.end() ) { childNames.push_back( child ); } } } } }
void HoudiniScene::readTags( NameList &tags, bool includeChildren ) const { tags.clear(); const OP_Node *node = retrieveNode(); if ( !node ) { return; } // add user supplied tags if we're not inside a SOP if ( !m_contentIndex && node->hasParm( pTags.getToken() ) ) { UT_String parmTagStr; node->evalString( parmTagStr, pTags.getToken(), 0, 0 ); if ( !parmTagStr.equal( UT_String::getEmptyString() ) ) { UT_WorkArgs tokens; parmTagStr.tokenize( tokens, " " ); for ( int i = 0; i < tokens.getArgc(); ++i ) { tags.push_back( tokens[i] ); } } } // add tags from the registered tag readers std::vector<CustomTagReader> &tagReaders = customTagReaders(); for ( std::vector<CustomTagReader>::const_iterator it = tagReaders.begin(); it != tagReaders.end(); ++it ) { NameList values; it->m_read( node, values, includeChildren ); tags.insert( tags.end(), values.begin(), values.end() ); } // add tags based on primitive groups OBJ_Node *contentNode = retrieveNode( true )->castToOBJNode(); if ( contentNode && contentNode->getObjectType() == OBJ_GEOMETRY && m_splitter ) { GU_DetailHandle newHandle = m_splitter->split( contentPathValue() ); if ( !newHandle.isNull() ) { GU_DetailHandleAutoReadLock readHandle( newHandle ); if ( const GU_Detail *geo = readHandle.getGdp() ) { GA_Range prims = geo->getPrimitiveRange(); for ( GA_GroupTable::iterator<GA_ElementGroup> it=geo->primitiveGroups().beginTraverse(); !it.atEnd(); ++it ) { GA_PrimitiveGroup *group = static_cast<GA_PrimitiveGroup*>( it.group() ); if ( group->getInternal() || group->isEmpty() ) { continue; } const UT_String &groupName = group->getName(); if ( groupName.startsWith( tagGroupPrefix ) && group->containsAny( prims ) ) { UT_String tag; groupName.substr( tag, tagGroupPrefix.length() ); tag.substitute( "_", ":" ); tags.push_back( tag.buffer() ); } } } } } }