bool supportsGeometryShaders() { if(getMajorVersion() > 3) { return true; } if(getMajorVersion() == 3 && getMinorVersion() >= 2) { return true; } return false; }
std::string Plugin::getLabelVersionMajorEncoded() const { std::stringstream ss; ss << getLabelWithoutSuffix(); ss << ' '; ss << getMajorVersion(); return ss.str(); }
/** * Deserialize incoming data */ int ContextPacket::deserialize(char *buffer) { if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "]" << std::endl; unsigned int b = 0; /* * HEADER */ if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] HEADER: " << std::endl; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ------------" << std::endl; sg_request = buffer[b++]; sg_profile = buffer[b++]; if(hasClientService(sg_request)) { if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] : sg_request ClientService" << std::endl; } else { if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] : sg_request No ClientService" << std::endl; } if(hasClientService(sg_profile)) { if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] : sg_profile ClientService" << std::endl; } else { if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] : sg_profile No ClientService" << std::endl; } if(hasGatewayService(sg_request)) { if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] : sg_request GatewayService" << std::endl; } else { if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] : sg_request No GatewayService" << std::endl; } if(hasGatewayService(sg_profile)) { if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] : sg_profile GatewayService" << std::endl; } else { if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] : sg_profile No GatewayService" << std::endl; } version = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] version: " << (int) version << std::endl; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] major version: " << (int) getMajorVersion(version) << std::endl; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] minor version: " << (int) getMinorVersion(version) << std::endl; channel = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] channel: " << (int) channel << std::endl; memcpy(uuid, &buffer[b], sizeof(uuid)); b += sizeof(uuid); if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] uuid: " << getUuidString(uuid) << std::endl; // memcpy(&sockAddress.sin_addr.s_addr, &buffer[b], sizeof(sockAddress.sin_addr.s_addr)); b += sizeof(sockAddress.sin_addr.s_addr); // memcpy(&sockAddress.sin_port, &buffer[b], sizeof(sockAddress.sin_port)); b += sizeof(sockAddress.sin_port); memcpy(×tamp, &buffer[b], 8); b += 8; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] timestamp: " << (long int) timestamp << std::endl; additionalHeaderType = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] additionalHeaderType: " << (int) additionalHeaderType << std::endl; if(additionalHeaderType != 1) { perror("Unknown header type"); // exit(EXIT_FAILURE); } additionalHeaderSize = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] additionalHeaderSize: " << (int) additionalHeaderSize << std::endl; if(additionalHeaderSize == 0) { perror("No service defined"); // exit(EXIT_FAILURE); } memcpy(&additionalHeaderData, &buffer[b], additionalHeaderSize); b += additionalHeaderSize; for(size_t j = 0; j < additionalHeaderSize; j++) { if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] additionalHeaderData[" << j << "]: " << (int) additionalHeaderData[j] << std::endl; } service = additionalHeaderData[0]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] service: " << (int) service << std::endl; /* * BRICKS */ if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] BRICKS: " << std::endl; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ------------" << std::endl; contextType = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] contextType: " << (int) contextType << std::endl; firstBrick->context = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] firstBrick->context: " << (int) firstBrick->context << std::endl; firstBrick->mask = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] firstBrick->mask: " << (int) firstBrick->mask << std::endl; additionalBricksSize = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] additionalBricksSize: " << (int) additionalBricksSize << std::endl; for(int i = 0; i < additionalBricksSize; i++) { additionalBricks[i].context = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] additionalBricks[" << i << "].context: " << (int) additionalBricks[i].context << std::endl; additionalBricks[i].mask = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] additionalBricks[" << i << "].mask: " << (int) additionalBricks[i].mask << std::endl; } /* * DATA */ if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] DATA: " << std::endl; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ------------" << std::endl; additionalDataSize = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] additionalDataSize: " << (int) additionalDataSize << std::endl; dataType = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] dataType: " << (int) dataType << std::endl; memcpy(&data, &buffer[b], DATA_SIZE); b += DATA_SIZE-1; buffer[b++] = '\0'; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] data: " << data << std::endl; memcpy(&additionalData, &buffer[b], additionalDataSize); b += additionalDataSize; for(int i = 0; i < additionalDataSize; i++) { if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] additionalData[" << i << "]: " << (int) additionalData[i] << std::endl; } return 0; }
/** * Serialize outgoing data */ int ContextPacket::serialize(char *buffer) { if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "]" << std::endl; unsigned int b = 0; /* * HEADER */ if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] HEADER: " << std::endl; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ------------" << std::endl; buffer[b++] = sg_request; buffer[b++] = sg_profile; if(hasClientService(sg_request)) { if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] sg_request: ClientService" << std::endl; } else { if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] sg_request: No ClientService" << std::endl; } if(hasClientService(sg_profile)) { if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] sg_profile: ClientService" << std::endl; } else { if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] sg_profile: No ClientService" << std::endl; } if(hasGatewayService(sg_request)) { if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] sg_request: GatewayService" << std::endl; } else { if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] sg_request: No GatewayService" << std::endl; } if(hasGatewayService(sg_profile)) { if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] sg_profile: GatewayService" << std::endl; } else { if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] sg_profile: No GatewayService" << std::endl; } buffer[b++] = version; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] version: " << (int) version << std::endl; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] major version: " << (int) getMajorVersion(version) << std::endl; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] minor version: " << (int) getMinorVersion(version) << std::endl; buffer[b++] = channel; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] channel: " << (int) channel << std::endl; memcpy(&buffer[b], uuid, sizeof(uuid)); b += sizeof(uuid); if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] uuid: " << getUuidString(uuid) << std::endl; memcpy(&buffer[b], &sockAddress.sin_addr.s_addr, sizeof(sockAddress.sin_addr.s_addr)); b += sizeof(sockAddress.sin_addr.s_addr); if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] sockAddress.sin_addr: " << inet_ntoa(sockAddress.sin_addr) << std::endl; memcpy(&buffer[b], &sockAddress.sin_port, sizeof(sockAddress.sin_port)); b += sizeof(sockAddress.sin_port); if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] sockAddress.sin_port: " << ntohs(sockAddress.sin_port) << std::endl; memcpy(&buffer[b], ×tamp, 8); b += 8; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] timestamp: " << (long int) timestamp << std::endl; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] timestamp: " << asctime (localtime (×tamp)) << std::ends; buffer[b++] = additionalHeaderType; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] additionalHeaderType: " << (int) additionalHeaderType << std::endl; if(additionalHeaderType != 1) { perror("Unknown header type"); // exit(EXIT_FAILURE); } buffer[b++] = additionalHeaderSize; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] additionalHeaderSize: " << (int) additionalHeaderSize << std::endl; if(additionalHeaderSize == 0) { perror("No service defined"); // exit(EXIT_FAILURE); } memcpy(&buffer[b], &additionalHeaderData, additionalHeaderSize); b += additionalHeaderSize; for(size_t j = 0; j < additionalHeaderSize; j++) { if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] additionalHeaderData[" << j << "]: " << (int) additionalHeaderData[j] << std::endl; } if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] service: " << (int) service << std::endl; /* * BRICKS */ if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] BRICKS: " << std::endl; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ------------" << std::endl; buffer[b++] = contextType; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] contextType: " << (int) contextType << std::endl; buffer[b++] = firstBrick->context; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] firstBrick->context: " << (int) firstBrick->context << std::endl; buffer[b++] = firstBrick->mask; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] firstBrick->mask: " << (int) firstBrick->mask << std::endl; buffer[b++] = additionalBricksSize; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] additionalBricksSize: " << (int) additionalBricksSize << std::endl; for(int i = 0; i<additionalBricksSize; i++) { buffer[b++] = additionalBricks[i].context; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] additionalBricks[" << i << "].context: " << (int) additionalBricks[i].context << std::endl; buffer[b++] = additionalBricks[i].mask; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] additionalBricks[" << i << "].mask: " << (int) additionalBricks[i].mask << std::endl; } /* * DATA */ if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] DATA: " << std::endl; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ------------" << std::endl; buffer[b++] = additionalDataSize; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] additionalDataSize: " << (int) additionalDataSize << std::endl; buffer[b++] = dataType; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] dataType: " << (int) dataType << std::endl; memcpy(&buffer[b], &data, DATA_SIZE); b += DATA_SIZE-1; if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] data: " << data << std::endl; memcpy(&buffer[b], &additionalData, additionalDataSize); b += additionalDataSize; for(int i = 0; i < additionalDataSize; i++) { if (! DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] additionalData[" << i << "]: " << (int) additionalData[i] << std::endl; } return b; }
NATRON_NAMESPACE_ENTER // those parameters should be ignored (they are always secret in Natron) #define kOCIOParamInputSpace "ocioInputSpace" #define kOCIOParamOutputSpace "ocioOutputSpace" // those parameters should not have their options in the help file if generating markdown, // because the options are dinamlically constructed at run-time from the OCIO config. #define kOCIOParamInputSpaceChoice "ocioInputSpaceIndex" #define kOCIOParamOutputSpaceChoice "ocioOutputSpaceIndex" #define kOCIODisplayPluginIdentifier "fr.inria.openfx.OCIODisplay" #define kOCIODisplayParamDisplay "display" #define kOCIODisplayParamDisplayChoice "displayIndex" #define kOCIODisplayParamView "view" #define kOCIODisplayParamViewChoice "viewIndex" // not yet implemented (see OCIOCDLTransform.cpp) //#define kOCIOCDLTransformPluginIdentifier "fr.inria.openfx.OCIOCDLTransform" //#define kOCIOCDLTransformParamCCCID "cccId" //#define kOCIOCDLTransformParamCCCIDChoice "cccIdIndex" #define kOCIOFileTransformPluginIdentifier "fr.inria.openfx.OCIOFileTransform" #define kOCIOFileTransformParamCCCID "cccId" #define kOCIOFileTransformParamCCCIDChoice "cccIdIndex" // genHTML: true for live HTML output for the internal web-server, false for markdown output QString Node::makeDocumentation(bool genHTML) const { QString ret; QString markdown; QTextStream ts(&ret); QTextStream ms(&markdown); QString pluginID, pluginLabel, pluginDescription, pluginIcon; int majorVersion = getMajorVersion(); int minorVersion = getMinorVersion(); std::vector<std::string> pluginGroup; bool pluginDescriptionIsMarkdown = false; QVector<QStringList> inputs; QVector<QStringList> items; { PluginPtr plugin = getPlugin(); assert(plugin); pluginID = QString::fromUtf8(plugin->getPluginID().c_str()); pluginLabel = QString::fromUtf8( Plugin::makeLabelWithoutSuffix( plugin->getPluginLabel() ).c_str()); pluginDescription = QString::fromUtf8( plugin->getPropertyUnsafe<std::string>(kNatronPluginPropDescription).c_str() ); pluginIcon = QString::fromUtf8(plugin->getPropertyUnsafe<std::string>(kNatronPluginPropIconFilePath).c_str()); pluginGroup = plugin->getPropertyNUnsafe<std::string>(kNatronPluginPropGrouping); pluginDescriptionIsMarkdown = plugin->getPropertyUnsafe<bool>(kNatronPluginPropDescriptionIsMarkdown); for (int i = 0; i < _imp->effect->getNInputs(); ++i) { QStringList input; input << convertFromPlainTextToMarkdown( QString::fromStdString( getInputLabel(i) ), genHTML, true ); input << convertFromPlainTextToMarkdown( QString::fromStdString( getInputHint(i) ), genHTML, true ); input << ( isInputOptional(i) ? tr("Yes") : tr("No") ); inputs.push_back(input); // Don't show more than doc for 4 inputs otherwise it will just clutter the page if (i == 3) { break; } } } // check for plugin icon QString pluginIconUrl; if ( !pluginIcon.isEmpty() ) { QFile iconFile(pluginIcon); if ( iconFile.exists() ) { if (genHTML) { pluginIconUrl.append( QString::fromUtf8("/LOCAL_FILE/") ); pluginIconUrl.append(pluginIcon); pluginIconUrl.replace( QString::fromUtf8("\\"), QString::fromUtf8("/") ); } else { pluginIconUrl.append(pluginID); pluginIconUrl.append(QString::fromUtf8(".png")); } } } // check for extra markdown file QString extraMarkdown; QString pluginMD = pluginIcon; pluginMD.replace( QString::fromUtf8(".png"), QString::fromUtf8(".md") ); QFile pluginMarkdownFile(pluginMD); if ( pluginMarkdownFile.exists() ) { if ( pluginMarkdownFile.open(QIODevice::ReadOnly | QIODevice::Text) ) { extraMarkdown = QString::fromUtf8( pluginMarkdownFile.readAll() ); pluginMarkdownFile.close(); } } // generate knobs info KnobsVec knobs = getEffectInstance()->getKnobs_mt_safe(); for (KnobsVec::const_iterator it = knobs.begin(); it != knobs.end(); ++it) { #pragma message WARN("TODO: restore getDefaultIsSecret from RB-2.2") //if ( (*it)->getDefaultIsSecret() ) { if ( (*it)->getIsSecret() ) { continue; } if ((*it)->getKnobDeclarationType() != KnobI::eKnobDeclarationTypePlugin) { continue; } // do not escape characters in the scriptName, since it will be put between backquotes QString knobScriptName = /*NATRON_NAMESPACE::convertFromPlainTextToMarkdown(*/ QString::fromUtf8( (*it)->getName().c_str() )/*, genHTML, true)*/; QString knobLabel = NATRON_NAMESPACE::convertFromPlainTextToMarkdown( QString::fromUtf8( (*it)->getLabel().c_str() ), genHTML, true); QString knobHint = NATRON_NAMESPACE::convertFromPlainTextToMarkdown( QString::fromUtf8( (*it)->getHintToolTip().c_str() ), genHTML, true); // totally ignore the documentation for these parameters (which are always secret in Natron) if ( knobScriptName.startsWith( QString::fromUtf8("NatronOfxParam") ) || knobScriptName == QString::fromUtf8("exportAsPyPlug") || knobScriptName == QString::fromUtf8(kOCIOParamInputSpace) || knobScriptName == QString::fromUtf8(kOCIOParamOutputSpace) || ( ( pluginID == QString::fromUtf8(kOCIODisplayPluginIdentifier) ) && ( knobScriptName == QString::fromUtf8(kOCIODisplayParamDisplay) ) ) || ( ( pluginID == QString::fromUtf8(kOCIODisplayPluginIdentifier) ) && ( knobScriptName == QString::fromUtf8(kOCIODisplayParamView) ) ) || //( ( pluginID == QString::fromUtf8(kOCIOCDLTransformPluginIdentifier) ) && // ( knobScriptName == QString::fromUtf8(kOCIOCDLTransformParamCCCID) ) ) || ( ( pluginID == QString::fromUtf8(kOCIOFileTransformPluginIdentifier) ) && ( knobScriptName == QString::fromUtf8(kOCIOFileTransformParamCCCID) ) ) || false) { continue; } QString defValuesStr, knobType; std::vector<std::pair<QString, QString> > dimsDefaultValueStr; KnobIntPtr isInt = toKnobInt(*it); KnobChoicePtr isChoice = toKnobChoice(*it); KnobBoolPtr isBool = toKnobBool(*it); KnobDoublePtr isDbl = toKnobDouble(*it); KnobStringPtr isString = toKnobString(*it); bool isLabel = isString && isString->isLabel(); KnobSeparatorPtr isSep = toKnobSeparator(*it); KnobButtonPtr isBtn = toKnobButton(*it); KnobParametricPtr isParametric = toKnobParametric(*it); KnobGroupPtr isGroup = toKnobGroup(*it); KnobPagePtr isPage = toKnobPage(*it); KnobColorPtr isColor = toKnobColor(*it); if (isInt) { knobType = tr("Integer"); } else if (isChoice) { knobType = tr("Choice"); } else if (isBool) { knobType = tr("Boolean"); } else if (isDbl) { knobType = tr("Double"); } else if (isString) { if (isLabel) { knobType = tr("Label"); } else { knobType = tr("String"); } } else if (isSep) { knobType = tr("Separator"); } else if (isBtn) { knobType = tr("Button"); } else if (isParametric) { knobType = tr("Parametric"); } else if (isGroup) { knobType = tr("Group"); } else if (isPage) { knobType = tr("Page"); } else if (isColor) { knobType = tr("Color"); } else { knobType = tr("N/A"); } if (!isGroup && !isPage) { for (int i = 0; i < (*it)->getNDimensions(); ++i) { QString valueStr; if (!isBtn && !isSep && !isParametric) { // If this is a ChoiceParam and we are not generating live HTML doc, // only add the list of entries and their halp if this node should not be // ignored (eg. OCIO colorspace knobs). if ( isChoice && (genHTML || !( knobScriptName == QString::fromUtf8(kOCIOParamInputSpaceChoice) || knobScriptName == QString::fromUtf8(kOCIOParamOutputSpaceChoice) || ( ( pluginID == QString::fromUtf8(kOCIODisplayPluginIdentifier) ) && ( knobScriptName == QString::fromUtf8(kOCIODisplayParamDisplayChoice) ) ) || ( ( pluginID == QString::fromUtf8(kOCIODisplayPluginIdentifier) ) && ( knobScriptName == QString::fromUtf8(kOCIODisplayParamViewChoice) ) ) || //( ( pluginID == QString::fromUtf8(kOCIOCDLTransformPluginIdentifier) ) && // ( knobScriptName == QString::fromUtf8(kOCIOCDLTransformParamCCCIDChoice) ) ) || ( ( pluginID == QString::fromUtf8(kOCIOFileTransformPluginIdentifier) ) && ( knobScriptName == QString::fromUtf8(kOCIOFileTransformParamCCCIDChoice) ) ) || ( ( pluginID == QString::fromUtf8("net.fxarena.openfx.Text") ) && ( knobScriptName == QString::fromUtf8("name") ) ) || // font family from Text plugin ( ( pluginID == QString::fromUtf8("net.fxarena.openfx.Polaroid") ) && ( knobScriptName == QString::fromUtf8("font") ) ) || // font family from Polaroid plugin ( ( pluginID == QString::fromUtf8(PLUGINID_NATRON_PRECOMP) ) && ( knobScriptName == QString::fromUtf8("writeNode") ) ) || ( ( pluginID == QString::fromUtf8(PLUGINID_NATRON_ONEVIEW) ) && ( knobScriptName == QString::fromUtf8("view") ) ) ) ) ) { // see also KnobChoice::getHintToolTipFull() int index = isChoice->getDefaultValue(DimIdx(i)); std::vector<ChoiceOption> entries = isChoice->getEntries(); if ( (index >= 0) && ( index < (int)entries.size() ) ) { valueStr = QString::fromUtf8( entries[index].id.c_str() ); } bool first = true; for (size_t i = 0; i < entries.size(); i++) { QString entryHelp = QString::fromUtf8( entries[i].tooltip.c_str() ); QString entry; if (entries[i].id != entries[i].label) { entry = QString::fromUtf8( "%1 (%2)" ).arg(QString::fromUtf8( entries[i].label.c_str() )).arg(QString::fromUtf8( entries[i].id.c_str() )); } else { entry = QString::fromUtf8( entries[i].label.c_str() ); } if (!entry.isEmpty()) { if (first) { // empty line before the option descriptions if (genHTML) { if ( !knobHint.isEmpty() ) { knobHint.append( QString::fromUtf8("<br />") ); } knobHint.append( tr("Possible values:") + QString::fromUtf8("<br />") ); } else { // we do a hack for multiline elements, because the markdown->rst conversion by pandoc doesn't use the line block syntax. // what we do here is put a supplementary dot at the beginning of each line, which is then converted to a pipe '|' in the // genStaticDocs.sh script by a simple sed command after converting to RsT if ( !knobHint.isEmpty() ) { if (!knobHint.startsWith( QString::fromUtf8(". ") )) { knobHint.prepend( QString::fromUtf8(". ") ); } knobHint.append( QString::fromUtf8("\\\n") ); } knobHint.append( QString::fromUtf8(". ") + tr("Possible values:") + QString::fromUtf8("\\\n") ); } first = false; } if (genHTML) { knobHint.append( QString::fromUtf8("<br />") ); } else { knobHint.append( QString::fromUtf8("\\\n") ); // we do a hack for multiline elements, because the markdown->rst conversion by pandoc doesn't use the line block syntax. // what we do here is put a supplementary dot at the beginning of each line, which is then converted to a pipe '|' in the // genStaticDocs.sh script by a simple sed command after converting to RsT knobHint.append( QString::fromUtf8(". ") ); } if (entryHelp.isEmpty()) { knobHint.append( QString::fromUtf8("**%1**").arg( convertFromPlainTextToMarkdown(entry, genHTML, true) ) ); } else { knobHint.append( QString::fromUtf8("**%1**: %2").arg( convertFromPlainTextToMarkdown(entry, genHTML, true) ).arg( convertFromPlainTextToMarkdown(entryHelp, genHTML, true) ) ); } } } } else if (isInt) { valueStr = QString::number( isInt->getDefaultValue( DimIdx(i) ) ); } else if (isDbl) { valueStr = QString::number( isDbl->getDefaultValue( DimIdx(i) ) ); } else if (isBool) { valueStr = isBool->getDefaultValue( DimIdx(i) ) ? tr("On") : tr("Off"); } else if (isString) { valueStr = QString::fromUtf8( isString->getDefaultValue( DimIdx(i) ).c_str() ); } else if (isColor) { valueStr = QString::number( isColor->getDefaultValue( DimIdx(i) ) ); } } dimsDefaultValueStr.push_back( std::make_pair(convertFromPlainTextToMarkdown( QString::fromUtf8( (*it)->getDimensionName( DimIdx(i) ).c_str() ), genHTML, true ), convertFromPlainTextToMarkdown(valueStr, genHTML, true)) ); } for (std::size_t i = 0; i < dimsDefaultValueStr.size(); ++i) { if ( !dimsDefaultValueStr[i].second.isEmpty() ) { if (dimsDefaultValueStr.size() > 1) { defValuesStr.append(dimsDefaultValueStr[i].first); defValuesStr.append( QString::fromUtf8(": ") ); } defValuesStr.append(dimsDefaultValueStr[i].second); if (i < dimsDefaultValueStr.size() - 1) { defValuesStr.append( QString::fromUtf8(" ") ); } } } if ( defValuesStr.isEmpty() ) { defValuesStr = tr("N/A"); } } if (!isPage && !isSep && !isGroup && !isLabel) { QStringList row; row << knobLabel << knobScriptName << knobType << defValuesStr << knobHint; items.append(row); } } // for (KnobsVec::const_iterator it = knobs.begin(); it!=knobs.end(); ++it) { // generate plugin info ms << tr("%1 node").arg(pluginLabel) << "\n==========\n\n"; // a hack to avoid repeating the documentation for the various merge plugins if ( pluginID.startsWith( QString::fromUtf8("net.sf.openfx.Merge") ) ) { std::string id = pluginID.toStdString(); std::string op; if (id == PLUGINID_OFX_MERGE) { // do nothing } else if (id == "net.sf.openfx.MergeDifference") { op = "difference (a.k.a. absminus)"; } else if (id == "net.sf.openfx.MergeIn") { op = "in"; } else if (id == "net.sf.openfx.MergeMatte") { op = "matte"; } else if (id == "net.sf.openfx.MergeMax") { op = "max"; } else if (id == "net.sf.openfx.MergeMin") { op = "min"; } else if (id == "net.sf.openfx.MergeMultiply") { op = "multiply"; } else if (id == "net.sf.openfx.MergeOut") { op = "out"; } else if (id == "net.sf.openfx.MergePlus") { op = "plus"; } else if (id == "net.sf.openfx.MergeScreen") { op = "screen"; } if ( !op.empty() ) { // we should use the custom link "[Merge node](|http::/plugins/" PLUGINID_OFX_MERGE ".html||rst::net.sf.openfx.MergePlugin|)" // but pandoc borks it ms << tr("The *%1* node is a convenience node identical to the %2, except that the operator is set to *%3* by default.") .arg(pluginLabel) .arg(genHTML ? QString::fromUtf8("<a href=\"" PLUGINID_OFX_MERGE ".html\">Merge node</a>") : QString::fromUtf8(":ref:`" PLUGINID_OFX_MERGE "`") //QString::fromUtf8("[Merge node](http::/plugins/" PLUGINID_OFX_MERGE ".html)") ) .arg( QString::fromUtf8( op.c_str() ) ); goto OUTPUT; } } if (!pluginIconUrl.isEmpty()) { // add a nonbreaking space so that pandoc doesn't use the alt-text as a caption // http://pandoc.org/MANUAL.html#images ms << "![pluginIcon](" << pluginIconUrl << ")"; if (!genHTML) { // specify image width for pandoc-generated printed doc // (for hoedown-generated HTML, this handled by the CSS using the alt=pluginIcon attribute) // see http://pandoc.org/MANUAL.html#images // note that only % units are understood both by pandox and sphinx ms << "{ width=10% }"; } ms << " \n\n"; // required so that there is no legend when converted to rst by pandoc } ms << tr("*This documentation is for version %2.%3 of %1.*").arg(pluginLabel).arg(majorVersion).arg(minorVersion) << "\n\n"; ms << "\n" << tr("Description") << "\n--------------------------------------------------------------------------------\n\n"; if (!pluginDescriptionIsMarkdown) { if (genHTML) { pluginDescription = NATRON_NAMESPACE::convertFromPlainText(pluginDescription, NATRON_NAMESPACE::WhiteSpaceNormal); // replace URLs with links QRegExp re( QString::fromUtf8("((http|ftp|https)://([\\w_-]+(?:(?:\\.[\\w_-]+)+))([\\w.,@?^=%&:/~+#-]*[\\w@?^=%&/~+#-])?)") ); pluginDescription.replace( re, QString::fromUtf8("<a href=\"\\1\">\\1</a>") ); } else { pluginDescription = convertFromPlainTextToMarkdown(pluginDescription, genHTML, false); } } ms << pluginDescription << "\n"; // create markdown table ms << "\n" << tr("Inputs") << "\n--------------------------------------------------------------------------------\n\n"; ms << tr("Input") << " | " << tr("Description") << " | " << tr("Optional") << "\n"; ms << "--- | --- | ---\n"; if (inputs.size() > 0) { Q_FOREACH(const QStringList &input, inputs) { QString inputName = input.at(0); QString inputDesc = input.at(1); QString inputOpt = input.at(2); ms << inputName << " | " << inputDesc << " | " << inputOpt << "\n"; }
bool supportsTessellationShaders() { return getMajorVersion() >= 4; }
String Version::toString () const { return String(getMajorVersion()) + "." + String(getMinorVersion()) + "." + String(getPointVersion()); }
/** * Deserialize incoming data */ int ContextPacket::deserialize(char *buffer) { if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "]" << std::endl; unsigned int b = 0; /* * HEADER */ if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] HEADER: " << std::endl; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ------------" << std::endl; request = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] request: " << (int) request << std::endl; profile = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] profile: " << (int) profile << std::endl; version = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] version: " << (int) version << std::endl; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] major version: " << (int) getMajorVersion(version) << std::endl; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] minor version: " << (int) getMinorVersion(version) << std::endl; channel = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] channel: " << (int) channel << std::endl; memcpy(uuid, &buffer[b], sizeof(uuid)); b += sizeof(uuid); if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] uuid: " << getUuidString(uuid) << std::endl; memcpy(&sockAddress.sin_addr.s_addr, &buffer[b], sizeof(sockAddress.sin_addr.s_addr)); b += sizeof(sockAddress.sin_addr.s_addr); memcpy(&sockAddress.sin_port, &buffer[b], sizeof(sockAddress.sin_port)); b += sizeof(sockAddress.sin_port); setTime(); b += 8; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] time: " << (long int) time << std::endl; headerType = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] headerType: " << (int) headerType << std::endl; headerSize = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] headerSize: " << (int) headerSize << std::endl; memcpy(&headerData, &buffer[b], headerSize); b += headerSize; for(int j = 0; j < headerSize; j++) { if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] headerData[" << j << "]: " << (int) headerData[j] << std::endl; } /* * BRICKS */ if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] BRICKS: " << std::endl; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ------------" << std::endl; ciType = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ciType: " << (int) ciType << std::endl; rootCIC->context = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] rootCIC->context: " << (int) rootCIC->context << std::endl; rootCIC->mask = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] rootCIC->mask: " << (int) rootCIC->mask << std::endl; ciSize = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ciSize: " << (int) ciSize << std::endl; for(int i = 0; i < ciSize; i++) { ciCICBricks[i].context = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ciCICBricks[" << i << "].context: " << (int) ciCICBricks[i].context << std::endl; ciCICBricks[i].mask = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ciCICBricks[" << i << "].mask: " << (int) ciCICBricks[i].mask << std::endl; } /* * DATA */ if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] DATA: " << std::endl; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ------------" << std::endl; appDataType = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] appDataType: " << (int) appDataType << std::endl; appDataSize = buffer[b++]; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] appDataSize: " << (int) appDataSize << std::endl; memcpy(&appData, &buffer[b], appDataSize); b += appDataSize; for(int i = 0; i < appDataSize; i++) { if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] appData[" << i << "]: " << (int) appData[i] << std::endl; } return 0; }
/** * Serialize outgoing data */ int ContextPacket::serialize(char *buffer) { if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "]" << std::endl; unsigned int b = 0; /* * HEADER */ if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] HEADER: " << std::endl; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ------------" << std::endl; buffer[b++] = request; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] request: " << (int) request << std::endl; buffer[b++] = profile; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] profile: " << (int) profile << std::endl; buffer[b++] = version; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] version: " << (int) version << std::endl; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] major version: " << (int) getMajorVersion(version) << std::endl; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] minor version: " << (int) getMinorVersion(version) << std::endl; buffer[b++] = channel; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] channel: " << (int) channel << std::endl; memcpy(&buffer[b], uuid, sizeof(uuid)); b += sizeof(uuid); if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] uuid: " << getUuidString(uuid) << std::endl; memcpy(&buffer[b], &sockAddress.sin_addr.s_addr, sizeof(sockAddress.sin_addr.s_addr)); b += sizeof(sockAddress.sin_addr.s_addr); if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] sockAddress.sin_addr: " << inet_ntoa(sockAddress.sin_addr) << std::endl; memcpy(&buffer[b], &sockAddress.sin_port, sizeof(sockAddress.sin_port)); b += sizeof(sockAddress.sin_port); if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] sockAddress.sin_port: " << ntohs(sockAddress.sin_port) << std::endl; memcpy(&buffer[b], ×tamp, 8); b += 8; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] timestamp: " << (long int) timestamp << std::endl; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] timestamp: " << asctime (localtime (×tamp)) << std::ends; buffer[b++] = headerType; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] headerType: " << (int) headerType << std::endl; buffer[b++] = headerSize; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] headerSize: " << (int) headerSize << std::endl; memcpy(&buffer[b], &headerData, headerSize); b += headerSize; for(size_t j = 0; j < headerSize; j++) { if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] headerData[" << j << "]: " << (int) headerData[j] << std::endl; } /* * BRICKS */ if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] BRICKS: " << std::endl; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ------------" << std::endl; buffer[b++] = ciType; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ciType: " << (int) ciType << std::endl; buffer[b++] = rootCIC->context; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] rootCIC->context: " << (int) rootCIC->context << std::endl; buffer[b++] = rootCIC->mask; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] rootCIC->mask: " << (int) rootCIC->mask << std::endl; buffer[b++] = ciSize; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ciSize: " << (int) ciSize << std::endl; for(int i = 0; i<ciSize; i++) { buffer[b++] = ciCICBricks[i].context; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ciCICBricks[" << i << "].context: " << (int) ciCICBricks[i].context << std::endl; buffer[b++] = ciCICBricks[i].mask; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ciCICBricks[" << i << "].mask: " << (int) ciCICBricks[i].mask << std::endl; } /* * DATA */ if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] DATA: " << std::endl; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] ------------" << std::endl; buffer[b++] = appDataType; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] dataType: " << (int) appDataType << std::endl; buffer[b++] = appDataSize; if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] additionalDataSize: " << (int) appDataSize << std::endl; memcpy(&buffer[b], &appData, appDataSize); b += appDataSize; for(int i = 0; i < appDataSize; i++) { if (DEBUG) std::cout << __FILE__ << "(" << __LINE__ << ")" << "[" << __FUNCTION__<< "] additionalData[" << i << "]: " << (int) appData[i] << std::endl; } return b; }