void MaterialUIHandler::GetMtlIDList (Mtl *mtl, NumList& mtlIDList) { if (mtl != NULL && mtl->ClassID() == Class_ID(MULTI_CLASS_ID, 0)) { int subs = mtl->NumSubMtls(); if (subs <= 0) subs = 1; for (int i=0; i<subs;i++){ if(mtl->GetSubMtl(i)) mtlIDList.Add(i, TRUE); } } }
void MaterialUIHandler::GetMtlIDList (EPolyMod *pMod, INode *node, NumList& mtlIDList) { if (!pMod) return; if (!node) return; MNMesh *pMesh = pMod->EpModGetMesh (node); if (!pMesh) return; for (int i=0; i<pMesh->numf; i++) { int mid = pMesh->f[i].material; if (mid != -1) mtlIDList.Add (mid, true); } }
bool MaterialUIHandler::SetupMtlSubNameCombo (HWND hWnd, EPolyMod *pMod) { INode *singleNode = GetNode(pMod); Mtl *nodeMtl = (singleNode) ? singleNode->GetMtl() : NULL; // check for scripted material if(nodeMtl){ MSPlugin* plugin = (MSPlugin*)((ReferenceTarget*)nodeMtl)->GetInterface(I_MAXSCRIPTPLUGIN); if(plugin) nodeMtl = dynamic_cast<Mtl*>( plugin->get_delegate() ); } if (nodeMtl == NULL || nodeMtl->ClassID() != Class_ID(MULTI_CLASS_ID, 0)) { //no UI for cloned nodes, and not MultiMtl SendMessage(GetDlgItem(hWnd, IDC_MTLID_NAMES_COMBO), CB_RESETCONTENT, 0, 0); EnableWindow(GetDlgItem(hWnd, IDC_MTLID_NAMES_COMBO), false); return false; } NumList mtlIDList; NumList mtlIDMeshList; GetMtlIDList (nodeMtl, mtlIDList); GetMtlIDList (pMod, singleNode, mtlIDMeshList); MultiMtl *nodeMulti = (MultiMtl*) nodeMtl; EnableWindow(GetDlgItem(hWnd, IDC_MTLID_NAMES_COMBO), true); SendMessage(GetDlgItem(hWnd, IDC_MTLID_NAMES_COMBO), CB_RESETCONTENT, 0, 0); for (int i=0; i<mtlIDList.Count(); i++){ TSTR idname, buf; if(mtlIDMeshList.Find(mtlIDList[i]) != -1) { nodeMulti->GetSubMtlName(mtlIDList[i], idname); if (idname.isNull()) idname = GetString(IDS_MTL_NONAME); //az: 042503 - FIGS buf.printf(_T("%s - ( %d )"), idname.data(), mtlIDList[i]+1); int ith = SendMessage(GetDlgItem(hWnd, IDC_MTLID_NAMES_COMBO), CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)buf.data()); SendMessage(GetDlgItem(hWnd, IDC_MTLID_NAMES_COMBO), CB_SETITEMDATA, ith, (LPARAM)mtlIDList[i]); } } return true; }
NumList openCLMath(NumList vec1, NumList vec2, const std::string& operation) { // Discover OpenCl platforms available on host std::vector<cl::Platform> platformList; cl::Platform::get(&platformList); // Pick the first platform and query its GPU devices std::vector<cl::Device> deviceList; platformList[1].getDevices(CL_DEVICE_TYPE_GPU, &deviceList); // Create a context for the devices and use the first device to create // a command-queue. cl::Context context = cl::Context(deviceList); cl::CommandQueue queue = cl::CommandQueue(context, deviceList[0]); // Build and get kernel for the devices cl::Kernel kernel = getKernel(deviceList, context, kernelStart + operation + kernelEnd, "vadd"); // Build a kernel functor cl::KernelFunctor vadd(kernel, queue, cl::NullRange, cl::NDRange(vec1.size()), cl::NullRange); // Run the kernel and obtain results return mathViaOpenCL(context, queue, kernel, vadd, vec1, vec2); }
TransactionStatement::TransactionStatement(const String& serialized) { auto raw = irr::io::createIrrXMLReader(StringXML::Factory(serialized).get()); std::unique_ptr<irr::io::IrrXMLReader> xml(raw); if (!xml) { return; } while (xml && xml->read()) { const auto nodeName = String::Factory(xml->getNodeName()); switch (xml->getNodeType()) { case irr::io::EXN_NONE: case irr::io::EXN_TEXT: case irr::io::EXN_COMMENT: case irr::io::EXN_ELEMENT_END: case irr::io::EXN_CDATA: { } break; case irr::io::EXN_ELEMENT: { if (nodeName->Compare("nymData")) { version_ = xml->getAttributeValue("version"); nym_id_ = xml->getAttributeValue("nymID"); } else if (nodeName->Compare("transactionNums")) { notary_ = xml->getAttributeValue("notaryID"); auto list = String::Factory(); const bool loaded = Contract::LoadEncodedTextField(raw, list); if (notary_.empty() || !loaded) { otErr << __FUNCTION__ << ": Error: transactionNums field without value." << std::endl; break; } NumList numlist; if (!list->empty()) { numlist.Add(list); } TransactionNumber number = 0; while (numlist.Peek(number)) { numlist.Pop(); LogDebug(OT_METHOD)(__FUNCTION__)( ": Transaction Number ")(number)( " ready-to-use for NotaryID: ")(notary_) .Flush(); available_.insert(number); } } else if (nodeName->Compare("issuedNums")) { notary_ = xml->getAttributeValue("notaryID"); auto list = String::Factory(); const bool loaded = Contract::LoadEncodedTextField(raw, list); if (notary_.empty() || !loaded) { otErr << __FUNCTION__ << ": Error: issuedNums field without value." << std::endl; break; } NumList numlist; if (!list->empty()) { numlist.Add(list); } TransactionNumber number = 0; while (numlist.Peek(number)) { numlist.Pop(); LogDebug(OT_METHOD)(__FUNCTION__)( ": Currently liable for issued trans# ")(number)( " at NotaryID: ")(notary_) .Flush(); issued_.insert(number); } } else { otErr << "Unknown element type in " << __FUNCTION__ << ": " << nodeName << std::endl; } } break; default: { LogInsane(OT_METHOD)(__FUNCTION__)(": Unknown XML type in ")( nodeName) .Flush(); break; } } } }
void OTTransactionType::GetNumList(NumList& theOutput) { theOutput.Release(); theOutput.Add(m_Numlist); }