bool BaseMapGen::Terrain2Cell::Parse (iDocumentNode* node) { { csRef<iDocumentNode> name = node->GetNode ("name"); if (name.IsValid()) this->name = name->GetContentsValue(); } { csRef<iDocumentNode> basematerial = node->GetNode ("basematerial"); if (basematerial.IsValid()) this->baseMaterial = basematerial->GetContentsValue(); } { csRef<iDocumentNode> feederProperties = node->GetNode ("feederproperties"); if (feederProperties.IsValid()) { csRef<iDocumentNodeIterator> paramsIt (feederProperties->GetNodes ("param")); while (paramsIt->HasNext()) { csRef<iDocumentNode> paramNode = paramsIt->Next(); const char* paramName = paramNode->GetAttributeValue ("name"); if (paramName == 0) continue; if (strcmp (paramName, "materialmap source") == 0) { const char* matMapSrc = paramNode->GetContentsValue(); materialMapLayers.AttachNew (new AlphaLayers); csRef<iImage> matMapImg = basemapgen->LoadImage (matMapSrc, CS_IMGFMT_PALETTED8); materialMapLayers->BuildAlphaMapsFromMatMap (matMapImg); } } csRef<iDocumentNodeIterator> alphaMapIt (feederProperties->GetNodes ("alphamap")); while (alphaMapIt->HasNext()) { csRef<iDocumentNode> alphaMapNode = alphaMapIt->Next(); const char* material = alphaMapNode->GetAttributeValue ("material"); if (material == 0) continue; const char* alphaMapSrc = alphaMapNode->GetContentsValue(); csRef<iImage> alphaMapImg = basemapgen->LoadImage (alphaMapSrc, CS_IMGFMT_ANY | CS_IMGFMT_ALPHA); if (!alphaLayers.IsValid()) alphaLayers.AttachNew (new AlphaLayers); alphaLayers->AddAlphaMap (alphaMapImg); alphaMaterials.Push (basemapgen->materials.Get (material, (MaterialLayer*)0)); } } } return true; }
void QImWrite::setParams(const QJSValue ¶ms){ m_convertedParams.clear(); if ( params.isObject() ){ QJSValueIterator paramsIt(params); while( paramsIt.hasNext() ){ paramsIt.next(); if ( paramsIt.name() == "jpegQuality" ){ m_convertedParams.push_back(CV_IMWRITE_JPEG_QUALITY); m_convertedParams.push_back(paramsIt.value().toInt()); } else if ( paramsIt.name() == "pngCompression" ){ m_convertedParams.push_back(CV_IMWRITE_PNG_COMPRESSION); m_convertedParams.push_back(paramsIt.value().toInt()); } else if ( paramsIt.name() == "pxmBinary" ){ m_convertedParams.push_back(CV_IMWRITE_PXM_BINARY); m_convertedParams.push_back(paramsIt.value().toInt()); } } } m_params = params; emit paramsChanged(); }