本文整理汇总了C++中NodeGuiPtr::restoreInternal方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeGuiPtr::restoreInternal方法的具体用法?C++ NodeGuiPtr::restoreInternal怎么用?C++ NodeGuiPtr::restoreInternal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeGuiPtr
的用法示例。
在下文中一共展示了NodeGuiPtr::restoreInternal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getGui
void
NodeSettingsPanel::onImportPresetsActionTriggered()
{
std::vector<std::string> filters;
filters.push_back(NATRON_PRESETS_FILE_EXT);
std::string filename = getGui()->popOpenFileDialog(false, filters, getGui()->getLastLoadProjectDirectory().toStdString(), false);
if ( filename.empty() ) {
return;
}
FStreamsSupport::ifstream ifile;
FStreamsSupport::open(&ifile, filename);
if (!ifile) {
Dialogs::errorDialog( tr("Presets").toStdString(), tr("Failed to open file: ").toStdString() + filename, false );
return;
}
std::list<boost::shared_ptr<NodeSerialization> > nodeSerialization;
try {
int nNodes;
boost::archive::xml_iarchive iArchive(ifile);
iArchive >> boost::serialization::make_nvp("NodesCount", nNodes);
for (int i = 0; i < nNodes; ++i) {
boost::shared_ptr<NodeSerialization> node( new NodeSerialization() );
iArchive >> boost::serialization::make_nvp("Node", *node);
nodeSerialization.push_back(node);
}
} catch (const std::exception & e) {
Dialogs::errorDialog( "Presets", e.what() );
return;
}
NodeGuiPtr node = getNode();
if ( nodeSerialization.front()->getPluginID() != node->getNode()->getPluginID() ) {
QString err = QString( tr("You cannot load ") + QString::fromUtf8( filename.c_str() ) + tr(" which are presets for the plug-in ") +
QString::fromUtf8( nodeSerialization.front()->getPluginID().c_str() ) + tr(" on the plug-in ") +
QString::fromUtf8( node->getNode()->getPluginID().c_str() ) );
Dialogs::errorDialog( tr("Presets").toStdString(), err.toStdString() );
return;
}
node->restoreInternal(node, nodeSerialization);
}