Example #1
0
bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, CFileItemList &items)
{
  items.Clear();

  VECADDONS addons;
  if (!GetScriptsAndPlugins(content, addons))
    return false;

  for (unsigned i=0; i<addons.size(); i++)
  {
    CFileItemPtr item(FileItemFromAddon(addons[i], 
                      addons[i]->Type()==ADDON_PLUGIN?"plugin://":"script://",
                      addons[i]->Type() == ADDON_PLUGIN));
    PluginPtr plugin = boost::dynamic_pointer_cast<CPluginSource>(addons[i]);
    if (plugin->ProvidesSeveral())
    {
      CURL url = item->GetAsUrl();
      CStdString opt;
      opt.Format("?content_type=%s",content.c_str());
      url.SetOptions(opt);
      item->SetPath(url.Get());
    }
    items.Add(item);
  }

  items.Add(GetMoreItem(content));

  items.SetContent("addons");
  items.SetLabel(g_localizeStrings.Get(24001)); // Add-ons

  return items.Size() > 0;
}
Example #2
0
PluginPtr
RotoShapeRenderNode::createPlugin()
{
    std::vector<std::string> grouping;
    grouping.push_back(PLUGIN_GROUP_PAINT);
    PluginPtr ret = Plugin::create(RotoShapeRenderNode::create, RotoShapeRenderNode::createRenderClone, PLUGINID_NATRON_ROTOSHAPE, "RotoShape", 1, 0, grouping);
    ret->setProperty<bool>(kNatronPluginPropIsInternalOnly, true);
    EffectDescriptionPtr effectDesc = ret->getEffectDescriptor();
    effectDesc->setProperty<RenderSafetyEnum>(kEffectPropRenderThreadSafety, eRenderSafetyFullySafe);
#ifdef ROTO_SHAPE_RENDER_CPU_USES_CAIRO
    effectDesc->setProperty<PluginOpenGLRenderSupport>(kEffectPropSupportsOpenGLRendering, ePluginOpenGLRenderSupportYes);
#else
    effectDesc->setProperty<PluginOpenGLRenderSupport>(kEffectPropSupportsOpenGLRendering, ePluginOpenGLRenderSupportNeeded);
#endif
    effectDesc->setProperty<bool>(kEffectPropSupportsTiles, false);
    effectDesc->setProperty<bool>(kEffectPropSupportsMultiResolution, true);
    effectDesc->setProperty<bool>(kEffectPropTemporalImageAccess, true);
    ret->setProperty<bool>(kNatronPluginPropMultiPlanar, true);

    ret->setProperty<ImageBitDepthEnum>(kNatronPluginPropOutputSupportedBitDepths, eImageBitDepthFloat, 0);
    ret->setProperty<std::bitset<4> >(kNatronPluginPropOutputSupportedComponents, std::bitset<4>(std::string("1111")));
    {
        InputDescriptionPtr input = InputDescription::create("Source", "Source", "", true, false, std::bitset<4>(std::string("1111")));
        ret->addInputDescription(input);
    }

    return ret;
}
Example #3
0
CGUIViewStateFromItems::CGUIViewStateFromItems(const CFileItemList &items) : CGUIViewState(items)
{
  const std::vector<GUIViewSortDetails> &details = items.GetSortDetails();
  for (unsigned int i = 0; i < details.size(); i++)
  {
    const GUIViewSortDetails sort = details[i];
    AddSortMethod(sort.m_sortDescription, sort.m_buttonLabel, sort.m_labelMasks);
  }
  //! @todo Should default sort/view mode be specified?
  m_currentSortMethod = 0;

  SetViewAsControl(DEFAULT_VIEW_LIST);

  if (items.IsPlugin())
  {
    CURL url(items.GetPath());
    AddonPtr addon;
    if (CServiceBroker::GetAddonMgr().GetAddon(url.GetHostName(), addon, ADDON_PLUGIN))
    {
      PluginPtr plugin = std::static_pointer_cast<CPluginSource>(addon);
      if (plugin->Provides(CPluginSource::AUDIO))
        m_playlist = PLAYLIST_MUSIC;
      if (plugin->Provides(CPluginSource::VIDEO))
        m_playlist = PLAYLIST_VIDEO;
    }
  }

  LoadViewState(items.GetPath(), g_windowManager.GetActiveWindow());
}
Example #4
0
NATRON_NAMESPACE_ENTER



PluginPtr
JoinViewsNode::createPlugin()
{
    std::vector<std::string> grouping;
    grouping.push_back(PLUGIN_GROUP_MULTIVIEW);
    PluginPtr ret = Plugin::create(JoinViewsNode::create, JoinViewsNode::createRenderClone, PLUGINID_NATRON_JOINVIEWS, "JoinViews", 1, 0, grouping);

    QString desc =  tr("Take in input separate views to make a multiple view stream output. "
                       "The first view from each input is copied to one of the view of the output.");
    ret->setProperty<std::string>(kNatronPluginPropDescription, desc.toStdString());
    EffectDescriptionPtr effectDesc = ret->getEffectDescriptor();
    effectDesc->setProperty<RenderSafetyEnum>(kEffectPropRenderThreadSafety, eRenderSafetyFullySafe);
    effectDesc->setProperty<bool>(kEffectPropSupportsTiles, true);
    ret->setProperty<bool>(kNatronPluginPropViewAware, true);
    ret->setProperty<std::string>(kNatronPluginPropIconFilePath,  "Images/joinViewsNode.png");
    ret->setProperty<ImageBitDepthEnum>(kNatronPluginPropOutputSupportedBitDepths, eImageBitDepthFloat, 0);
    ret->setProperty<ImageBitDepthEnum>(kNatronPluginPropOutputSupportedBitDepths, eImageBitDepthByte, 1);
    ret->setProperty<ImageBitDepthEnum>(kNatronPluginPropOutputSupportedBitDepths, eImageBitDepthShort, 2);
    ret->setProperty<std::bitset<4> >(kNatronPluginPropOutputSupportedComponents, std::bitset<4>(std::string("1111")));
    return ret;
}
        void Application::Initialize()
        {
            BOOST_ASSERT( m_IsInitialized == false );
            
            Super::Initialize();

            // Initialize loaded plug-ins
            PluginList::iterator pluginIter = m_Plugins.begin();
            while ( pluginIter != m_Plugins.end() )
            {
                PluginPtr plugin = (*pluginIter);
                plugin->Initialize();

                ++pluginIter;
            }

            // Initialize registered subsystems
            SubsystemList::iterator subsystemIter = m_Subsystems.begin();
            while ( subsystemIter != m_Subsystems.end() )
            {
                SubsystemPtr subsystem = (*subsystemIter);
                subsystem->Initialize();

                ++subsystemIter;
            }

            m_IsInitialized = true;

            OnInitialized( EventArgs( *this ) );
        }
Example #6
0
CGUIViewStateFromItems::CGUIViewStateFromItems(const CFileItemList &items) : CGUIViewState(items)
{
  const vector<SORT_METHOD_DETAILS> &details = items.GetSortDetails();
  for (unsigned int i = 0; i < details.size(); i++)
  {
    const SORT_METHOD_DETAILS sort = details[i];
    AddSortMethod(sort.m_sortMethod, sort.m_buttonLabel, sort.m_labelMasks);
  }
  // TODO: Should default sort/view mode be specified?
  m_currentSortMethod = 0;

  SetViewAsControl(DEFAULT_VIEW_LIST);

  SetSortOrder(SORT_ORDER_ASC);
  if (items.IsPlugin())
  {
    CURL url(items.m_strPath);
    AddonPtr addon;
    if (CAddonMgr::Get().GetAddon(url.GetHostName(),addon) && addon)
    {
      PluginPtr plugin = boost::static_pointer_cast<CPluginSource>(addon);
      if (plugin->Provides(CPluginSource::AUDIO))
        m_playlist = PLAYLIST_MUSIC;
      if (plugin->Provides(CPluginSource::VIDEO))
        m_playlist = PLAYLIST_VIDEO;
    }
  }
  LoadViewState(items.m_strPath, g_windowManager.GetActiveWindow());
}
Example #7
0
PluginPtr
DiskCacheNode::createPlugin()
{
    std::vector<std::string> grouping;
    grouping.push_back(PLUGIN_GROUP_OTHER);
    PluginPtr ret = Plugin::create(DiskCacheNode::create, DiskCacheNode::createRenderClone, PLUGINID_NATRON_DISKCACHE, "DiskCache", 1, 0, grouping);

    QString desc =  tr("This node caches all images of the connected input node onto the disk with full 32bit floating point raw data. "
                       "When an image is found in the cache, %1 will then not request the input branch to render out that image. "
                       "The DiskCache node only caches full images and does not split up the images in chunks.  "
                       "The DiskCache node is useful if working with a large and complex node tree: this allows to break the tree into smaller "
                       "branches and cache any branch that one is no longer working on. The cached images are saved by default in the same directory that is used "
                       "for the viewer cache but you can set its location and size in the preferences. A solid state drive disk is recommended for efficiency of this node. "
                       "By default all images that pass into the node are cached but they depend on the zoom-level of the viewer. For convenience you can cache "
                       "a specific frame range at scale 100% much like a writer node would do.\n"
                       "WARNING: The DiskCache node must be part of the tree when you want to read cached data from it.").arg( QString::fromUtf8(NATRON_APPLICATION_NAME) );
    ret->setProperty<std::string>(kNatronPluginPropDescription, desc.toStdString());
    EffectDescriptionPtr effectDesc = ret->getEffectDescriptor();
    effectDesc->setProperty<RenderSafetyEnum>(kEffectPropRenderThreadSafety, eRenderSafetyFullySafe);
    effectDesc->setProperty<bool>(kEffectPropSupportsTiles, false);
    effectDesc->setProperty<bool>(kEffectPropSupportsMultiResolution, true);
    ret->setProperty<std::string>(kNatronPluginPropIconFilePath,  "Images/diskcache_icon.png");
    ret->setProperty<ImageBitDepthEnum>(kNatronPluginPropOutputSupportedBitDepths, eImageBitDepthFloat);
    ret->setProperty<std::bitset<4> >(kNatronPluginPropOutputSupportedComponents, std::bitset<4>(std::string("1111")));

    ret->setProperty<ImageBitDepthEnum>(kNatronPluginPropOutputSupportedBitDepths, eImageBitDepthFloat, 0);
    ret->setProperty<std::bitset<4> >(kNatronPluginPropOutputSupportedComponents, std::bitset<4>(std::string("1111")));
    {
        InputDescriptionPtr input = InputDescription::create("Source", "", "", false, false, std::bitset<4>(std::string("1111")));
        ret->addInputDescription(input);
    }

    return ret;
}
Example #8
0
ClientPtr LoginDialog::loadClient(const QString &name, Buffer *cfg)
{
	if (name.isEmpty())
		return ClientPtr();
	QString clientName = name;
	QString pluginName = getToken(clientName, '/');
    if (pluginName.isEmpty() || clientName.length() == 0)
		return ClientPtr();
	if(!getPluginManager()->isPluginProtocol(pluginName))
    {
        log(L_DEBUG, "Plugin %s is not a protocol plugin", qPrintable(pluginName));
		return ClientPtr();
	}
	PluginPtr plugin = getPluginManager()->plugin(pluginName);
	if(plugin.isNull())
    {
        log(L_WARN, "Plugin %s not found", qPrintable(pluginName));
		return ClientPtr();
	}
	m_protocolPlugins.append(plugin);
	ProfileManager::instance()->currentProfile()->enablePlugin(pluginName);
	ProtocolPtr protocol;
	ProtocolIterator it;
    while ((protocol = ++it) != NULL)
        if (protocol->description()->text == clientName)
            return protocol->createClient(cfg);
    log(L_DEBUG, "Protocol %s not found", qPrintable(clientName));
	return ClientPtr();
}
Example #9
0
QString
PluginGroupNode::getTreeNodeID() const
{
    PluginPtr plugin = getPlugin();
    if (plugin) {
        return QString::fromUtf8(plugin->getPluginID().c_str());
    } else {
        return _name;
    }
}
Example #10
0
PluginDatabase::func_t ModulesPluginDatabase::getSymbol (PluginSpec const & spec, std::string const & which) const
{
	try
	{
		PluginPtr plugin = impl->modules.load (spec.getName (), spec.getConfig ());
		return plugin->getSymbol (which);
	}
	catch (...)
	{
		return NULL;
	}
}
Example #11
0
    void PluginContainer::load(PluginPtr plugin, system::Library library) throw(PluginLoadException) {
      if (plugin->getCompilerInfo() != BFT_COMPILER_INFO) {
        // TODO more information in the exception.
        throw PluginLoadException("Compiler mis-match.");
      }

      if (!common::isCompatible(application.getVersion(), plugin->getEngineVersion())) {
        // TODO more information in the exception.
        throw PluginLoadException("Version mis-match.");
      }

      plugins.emplace_back(std::move(library), std::move(plugin));
    }
Example #12
0
std::string ModulesPluginDatabase::lookupInfo (PluginSpec const & spec, std::string const & which) const
{
	PluginPtr plugin;
	try
	{
		plugin = impl->modules.load (spec.getName (), spec.getConfig ());
	}
	catch (...)
	{
		throw;
	}

	return plugin->lookupInfo (which);
}
Example #13
0
SoundUserConfig::SoundUserConfig(QWidget *parent, SIM::PropertyHubPtr data, SoundPlugin *plugin)
  : QWidget(parent)
  , m_plugin(plugin)
{
    setupUi(this);

    setProperty("override", data->value("sound/override").toBool());

    int row = 0;
    addRow(lstSound, row, Icon("SIM"), i18n("Online alert"), ONLINE_ALERT, data->value("sound/Alert").toString());

    // Well, basically, this mess means that core plugin shouldn't keep messageTypes
    PluginPtr coreplugin = getPluginManager()->plugin("_core");
    CorePlugin* core = static_cast<CorePlugin*>(coreplugin.data());
    CommandDef *cmd;
    CommandsMapIterator it(core->messageTypes);
    while((cmd = ++it) != NULL)
    {
        MessageDef *def = (MessageDef*)(cmd->param);
        if ((def == NULL) || (cmd->icon.isEmpty()) ||
                (def->flags & (MESSAGE_HIDDEN | MESSAGE_SENDONLY | MESSAGE_CHILD)))
		{
            continue;
		}
        if ((def->singular == NULL) || (def->plural == NULL) ||
                (*def->singular == 0) || (*def->plural == 0))
		{
            continue;
		}
        QString type = i18n(def->singular, def->plural, 1);
        int pos = type.indexOf("1 ");
        if (pos == 0){
            type = type.mid(2);
        }else if (pos > 0){
            type = type.left(pos);
        }
        type = type.left(1).toUpper() + type.mid(1);

        row++;
        addRow(lstSound, row, Icon(cmd->icon), type, cmd->id, m_plugin->messageSound(cmd->id, data->value("id").toUInt()));
    }
    chkActive->setChecked(data->value("sound/NoSoundIfActive").toBool());
    chkDisable->setChecked(data->value("sound/Disable").toBool());
    connect(chkDisable, SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
    toggled(data->value("sound/Disable").toBool());
    lstSound->resizeColumnsToContents();
    lstSound->setItemDelegate(new EditSoundDelegate(1, lstSound));
    lstSound->sortByColumn(0, Qt::AscendingOrder);
}
Example #14
0
void Backend::tryPlugin (PluginSpec const & spec)
{
	PluginPtr plugin = modules.load (spec);

	errorplugins.tryPlugin (*plugin.get ());
	getplugins.tryPlugin (*plugin.get ());
	setplugins.tryPlugin (*plugin.get ());


	for (auto & elem : plugins)
	{
		if (plugin->getFullName () == elem->getFullName ()) throw PluginAlreadyInserted (plugin->getFullName ());
	}


	plugins.push_back (std::move (plugin));
}
        PluginPtr Application::LoadPlugin( const std::wstring& filename )
        {            
            fs::wpath filePath( filename );
            fs::wpath pluginName = filePath.stem();
            PluginPtr pluginPtr = GetPluginByName( pluginName.wstring() );

            if ( !pluginPtr )
            {
                // Try to load the dynamic lib from the provided filename.
                DynamicLibPtr pluginLib = m_DynamicLibSubsystem->Load( filename );
                if ( pluginLib )
                {
                    CreatePluginFP createPluginFunc = (CreatePluginFP)pluginLib->GetSymbol( "CreatePlugin" );
                    if ( createPluginFunc != NULL )
                    {
                        pluginPtr = createPluginFunc();
                        if ( pluginPtr != NULL )
                        {
                            pluginPtr->FileName = filePath.wstring();
                            pluginPtr->PluginName = filePath.stem().wstring();
                            if ( m_IsInitialized )
                            {
                                pluginPtr->Initialize();
                            }

                            AddPlugin( pluginPtr );
                        }
                        else
                        {
                            std::cerr << "Application::LoadPlugin: Plug-in creation failed in library \"";
                            std::wcerr << filename;
                            std::wcerr << "\"" << std::endl;
                        }
                    }
                    else
                    {

                        std::cerr << "Application::LoadPlugin: Could not find symbol \"CreatePlugin\" in library \"";
                        std::wcerr << filename;
                        std::cerr << "\"" << std::endl;
                    }
                }
            }

            return pluginPtr;
        }
Example #16
0
void TreeViewModel::importConfiguration(const QString& name, const QString& format, QString& file, const QVariantList &mergeStrategies)
{
	Key		root(name.toStdString(), KEY_END);
	KeySet	originalKeys = collectCurrentKeySet();
	KeySet	base = originalKeys.cut(root);
	printWarnings (cerr, root);

	KeySet importedKeys;

	string formatString = format.toStdString();
	string fileString = file.remove("file://").toStdString();

	Modules modules;
	PluginPtr plugin = modules.load(formatString);

	Key errorKey (root);
	errorKey.setString (fileString);

	plugin->get(importedKeys, errorKey);

	stringstream ws;
	stringstream es;
	QString warnings;
	QString errors;

	printWarnings(ws, errorKey);
	warnings = QString::fromStdString(ws.str());
	printError(es, errorKey);
	errors  = QString::fromStdString(es.str());

	if(!errors.isEmpty())
	{
		emit showMessage(tr("Error"), tr("Failed to import configuration from %1 to %2.").arg(file, QString::fromStdString(root.getName())), errors);
		return;
	}

	ThreeWayMerge merger;

	foreach(QVariant s, mergeStrategies)
	{
		MergeConflictStrategy* strategy = getMergeStrategy(s.toString());

		if(strategy)
			merger.addConflictStrategy(strategy);
	}
Example #17
0
PluginCfg::PluginCfg(QWidget *parent, const QString& pluginname) : QWidget(parent)
{
	setupUi(this);
    m_pluginName = pluginname;
	if(ProfileManager::instance()->currentProfile()->enabledPlugins().contains(m_pluginName) ||
			getPluginManager()->isPluginAlwaysEnabled(m_pluginName))
	{
		PluginPtr plugin = getPluginManager()->plugin(pluginname);
        QWidget *w = plugin->createConfigWindow(addWnd);
        if (w){
            QVBoxLayout *lay = new QVBoxLayout(addWnd);
            lay->addWidget(w);
            QObject::connect(parent->topLevelWidget(), SIGNAL(applyChanges()), w, SLOT(apply()));
            // adjust plugin widget
            w->setMinimumSize(w->sizeHint());
            w->adjustSize();
            // adjust addWnd widget
            addWnd->setMinimumSize(addWnd->sizeHint());
            addWnd->adjustSize();
        }
    }
    // adjust description
    if(!getPluginManager()->pluginDescription(pluginname).isNull())
	{
        lblDescription->setText(i18n(getPluginManager()->pluginDescription(pluginname)));
    }
	else
	{
        lblDescription->setText("");
    }
    // adjust tab
    tabWnd->setCurrentIndex(0);
    tabWnd->setTabText(0, i18n(getPluginManager()->pluginTitle(pluginname)));
    tabWnd->setMinimumSize(tabWnd->sizeHint());
    tabWnd->adjustSize();
    // adjust complete widget
    setMinimumSize(sizeHint());
    adjustSize();
    if (getPluginManager()->isPluginAlwaysEnabled(pluginname)) {
        chkEnable->hide();
	} else {
		chkEnable->setEnabled(true);
		chkEnable->setChecked(ProfileManager::instance()->currentProfile()->enabledPlugins().contains(pluginname));
	}
}
Example #18
0
int ExportCommand::execute (Cmdline const & cl)
{
	size_t argc = cl.arguments.size ();
	if (argc != 1 && argc != 2 && argc != 3)
	{
		throw invalid_argument ("need 1 to 3 arguments");
	}

	Key root = cl.createKey (0);

	kdb.get (ks, root);
	printWarnings (cerr, root);

	KeySet part (ks.cut (root));

	if (cl.withoutElektra)
	{
		Key systemElektra ("system/elektra", KEY_END);
		part.cut (systemElektra);
	}

	string format = cl.format;
	if (argc > 1) format = cl.arguments[1];

#ifdef _WIN32
	string file = "CON";
#else
	string file = "/dev/stdout";
#endif
	if (argc > 2 && cl.arguments[2] != "-") file = cl.arguments[2];

	Modules modules;
	PluginPtr plugin = modules.load (format, cl.getPluginsConfig ());

	Key errorKey (root);
	errorKey.setString (file);

	plugin->set (part, errorKey);

	printWarnings (cerr, errorKey);
	printError (cerr, errorKey);

	return 0;
}
        void Application::Terminate()
        {
            BOOST_ASSERT( m_IsInitialized == true );

            // Terminate the subsystems in the opposite order as they were registered.
            SubsystemList::reverse_iterator iter = m_Subsystems.rbegin();
            while ( iter != m_Subsystems.rend() )
            {
                SubsystemPtr subsystem = (*iter);
                subsystem->Terminate();

                ++iter;
            }

            m_Subsystems.clear();

            // Unload any previously loaded plug-ins
            PluginList plugins = m_Plugins;
            PluginList::iterator pluginIter = plugins.begin();
            while ( pluginIter != plugins.end() )
            {
                PluginPtr plugin = (*pluginIter);
                plugin->Terminate();

                UnloadPlugin( plugin );
                ++pluginIter;
            }

            plugins.clear();
            m_PluginsByName.clear();
            m_PluginsByFileName.clear();
            m_Plugins.clear();

            // Flush all the libraries.  At this point
            // there should be no residual pointers to objects
            // created in the library.
            m_DynamicLibSubsystem->Flush();

            m_IsInitialized = false;

            OnTerminated( EventArgs( *this ) );
        }
Example #20
0
bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, CFileItemList &items)
{
  items.Clear();

  CPluginSource::Content type = CPluginSource::Translate(content);
  if (type == CPluginSource::UNKNOWN)
    return false;

  VECADDONS addons;
  CAddonMgr::Get().GetAddons(ADDON_PLUGIN, addons);
  for (unsigned i=0; i<addons.size(); i++)
  {
    PluginPtr plugin = boost::dynamic_pointer_cast<CPluginSource>(addons[i]);
    if (!plugin || !plugin->Provides(type))
      continue;
    items.Add(FileItemFromAddon(addons[i], "plugin://", true));
  }

  addons.clear();
  CAddonMgr::Get().GetAddons(ADDON_SCRIPT, addons);
  for (unsigned i=0; i<addons.size(); i++)
  {
    PluginPtr plugin = boost::dynamic_pointer_cast<CPluginSource>(addons[i]);
    if (!plugin || !plugin->Provides(type))
      continue;
    items.Add(FileItemFromAddon(addons[i], "script://", false));
  }

  CFileItemPtr item(new CFileItem("addons://more/"+content,false));
  item->SetLabelPreformated(true);
  item->SetLabel(g_localizeStrings.Get(21452));
  item->SetIconImage("DefaultAddon.png");
  item->SetSpecialSort(SORT_ON_BOTTOM);
  items.Add(item);

  items.SetContent("addons");

  return items.Size() > 0;
}
Example #21
0
std::vector<PluginSpec> PluginVariantDatabase::getPluginVariants (PluginSpec const & whichplugin) const
{
	PluginPtr plugin = this->impl->modules.load (whichplugin);
	KeySet ksSysconf (this->variantImpl->pluginconf);
	KeySet ksGenconf;

	// read plugin variants via genconf
	try
	{
		auto funcGenconf = reinterpret_cast<void (*) (ckdb::KeySet *, ckdb::Key *)> (plugin->getSymbol ("genconf"));
		funcGenconf (ksGenconf.getKeySet (), 0);
	}
	catch (kdb::tools::MissingSymbol & e)
	{
		// no genconf, but maybe sysconf variants
		KeySet placeholder;
		return this->getPluginVariantsFromSysconf (whichplugin, ksSysconf, placeholder);
	}

	// get plugin variants from genconf, but also consider sysconf for disable/override
	return this->getPluginVariantsFromGenconf (whichplugin, ksGenconf, ksSysconf);
}
Example #22
0
PluginPtr
NodeCreationDialog::getPlugin(QString* presetName) const
{
    QString lineEditText = _imp->textEdit->text();

    const CompleterLineEdit::PluginsNamesMap& names = _imp->textEdit->getPluginNamesMap();
    for (CompleterLineEdit::PluginsNamesMap::const_iterator it = names.begin(); it!=names.end(); ++it) {
        if (it->second.comboLabel == lineEditText) {
            if (presetName) {
                *presetName = it->second.presetName;
            }
            PluginPtr ret = it->second.plugin.lock();
            if (ret) {
                incrementPluginWeight(QString::fromUtf8(ret->getPluginID().c_str()),
                                      it->second.presetName,
                                      ret->getMajorVersion());
            }
            return ret;
        }
    }

    return PluginPtr();
}
Example #23
0
bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, VECADDONS &addons)
{
  CPluginSource::Content type = CPluginSource::Translate(content);
  if (type == CPluginSource::UNKNOWN)
    return false;

  VECADDONS tempAddons;
  CAddonMgr::Get().GetAddons(ADDON_PLUGIN, tempAddons);
  for (unsigned i=0; i<tempAddons.size(); i++)
  {
    PluginPtr plugin = boost::dynamic_pointer_cast<CPluginSource>(tempAddons[i]);
    if (plugin && plugin->Provides(type))
      addons.push_back(tempAddons[i]);
  }
  tempAddons.clear();
  CAddonMgr::Get().GetAddons(ADDON_SCRIPT, tempAddons);
  for (unsigned i=0; i<tempAddons.size(); i++)
  {
    PluginPtr plugin = boost::dynamic_pointer_cast<CPluginSource>(tempAddons[i]);
    if (plugin && plugin->Provides(type))
      addons.push_back(tempAddons[i]);
  }
  return true;
}
        void Application::UnloadPlugin( PluginPtr plugin )
        {
            if ( plugin )
            {
                RemovePlugin( plugin );

                plugin->Terminate();

                // Unload the DLL the plugin was loaded from.
                DynamicLibPtr ptrLib = m_DynamicLibSubsystem->GetLibrary( plugin->FileName );
                if ( ptrLib )
                {
                    DestroyPluginFP destroyPluginFunc = (DestroyPluginFP)ptrLib->GetSymbol( "DestroyPlugin" );
                    if ( destroyPluginFunc != NULL )
                    {
                        // Unload the plugin and all of the types that are associated with the plugin.
                        destroyPluginFunc();
                    }
                    else
                    {
                        std::cerr << "Application::UnloadPlugin: Could not find \"DestroyPlugin\" method in library \"";
                        std::wcerr << ptrLib->FileName.get();
                        std::cerr << "\"" << std::endl;
                    }
                    // Don't forget to call DynamicLibSubsystem::Flush to actually 
                    // release the libraries from memory.
                    m_DynamicLibSubsystem->Unload( ptrLib );
                }
                else
                {
                    std::cerr << "Application::UnloadPlugin: Could not find library with filename: \"";
                    std::wcerr << plugin->FileName.get();
                    std::cerr << "\"" << std::endl;
                }
            }
        }
Example #25
0
// \brief With this function you can react on a users click in the list/thumb panel.
// It returns true, if the click is handled.
// This function calls OnPlayMedia()
bool CGUIMediaWindow::OnClick(int iItem)
{
  if ( iItem < 0 || iItem >= (int)m_vecItems->Size() ) return true;
  CFileItemPtr pItem = m_vecItems->Get(iItem);

  if (pItem->IsParentFolder())
  {
    GoParentFolder();
    return true;
  }
  if (pItem->GetPath() == "add" || pItem->GetPath() == "sources://add/") // 'add source button' in empty root
  {
    OnContextButton(iItem, CONTEXT_BUTTON_ADD_SOURCE);
    return true;
  }

  if (!pItem->m_bIsFolder && pItem->IsFileFolder())
  {
    XFILE::IFileDirectory *pFileDirectory = NULL;
    pFileDirectory = XFILE::CFactoryFileDirectory::Create(pItem->GetPath(), pItem.get(), "");
    if(pFileDirectory)
      pItem->m_bIsFolder = true;
    else if(pItem->m_bIsFolder)
      pItem->m_bIsFolder = false;
    delete pFileDirectory;
  }

  if (pItem->IsScript())
  {
    // execute the script
    CURL url(pItem->GetPath());
    AddonPtr addon;
    if (CAddonMgr::Get().GetAddon(url.GetHostName(), addon))
    {
#ifdef HAS_PYTHON
      if (!g_pythonParser.StopScript(addon->LibPath()))
        g_pythonParser.evalFile(addon->LibPath(),addon);
#endif
      return true;
    }
  }

  if (pItem->m_bIsFolder)
  {
    if ( pItem->m_bIsShareOrDrive )
    {
      const CStdString& strLockType=m_guiState->GetLockType();
      if (g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE)
        if (!strLockType.IsEmpty() && !g_passwordManager.IsItemUnlocked(pItem.get(), strLockType))
            return true;

      if (!HaveDiscOrConnection(pItem->GetPath(), pItem->m_iDriveType))
        return true;
    }

    // check for the partymode playlist items - they may not exist yet
    if ((pItem->GetPath() == g_settings.GetUserDataItem("PartyMode.xsp")) ||
        (pItem->GetPath() == g_settings.GetUserDataItem("PartyMode-Video.xsp")))
    {
      // party mode playlist item - if it doesn't exist, prompt for user to define it
      if (!XFILE::CFile::Exists(pItem->GetPath()))
      {
        m_vecItems->RemoveDiscCache(GetID());
        if (CGUIDialogSmartPlaylistEditor::EditPlaylist(pItem->GetPath()))
          Update(m_vecItems->GetPath());
        return true;
      }
    }

    // remove the directory cache if the folder is not normally cached
    CFileItemList items(pItem->GetPath());
    if (!items.AlwaysCache())
      items.RemoveDiscCache(GetID());

    CFileItem directory(*pItem);
    if (!Update(directory.GetPath()))
      ShowShareErrorMessage(&directory);

    return true;
  }
  else if (pItem->IsPlugin() && !pItem->GetProperty("isplayable").asBoolean())
  {
    return XFILE::CPluginDirectory::RunScriptWithParams(pItem->GetPath());
  }
  else
  {
    m_iSelectedItem = m_viewControl.GetSelectedItem();

    if (pItem->GetPath() == "newplaylist://")
    {
      m_vecItems->RemoveDiscCache(GetID());
      g_windowManager.ActivateWindow(WINDOW_MUSIC_PLAYLIST_EDITOR,"newplaylist://");
      return true;
    }
    else if (pItem->GetPath().Left(19).Equals("newsmartplaylist://"))
    {
      m_vecItems->RemoveDiscCache(GetID());
      if (CGUIDialogSmartPlaylistEditor::NewPlaylist(pItem->GetPath().Mid(19)))
        Update(m_vecItems->GetPath());
      return true;
    }
    else if (pItem->GetPath().Left(14).Equals("addons://more/"))
    {
      CBuiltins::Execute("ActivateWindow(AddonBrowser,addons://all/xbmc.addon." + pItem->GetPath().Mid(14) + ",return)");
      return true;
    }

    // If karaoke song is being played AND popup autoselector is enabled, the playlist should not be added
    bool do_not_add_karaoke = g_guiSettings.GetBool("karaoke.enabled") &&
      g_guiSettings.GetBool("karaoke.autopopupselector") && pItem->IsKaraoke();
    bool autoplay = m_guiState.get() && m_guiState->AutoPlayNextItem();

    if (pItem->IsPlugin())
    {
      CURL url(pItem->GetPath());
      AddonPtr addon;
      if (CAddonMgr::Get().GetAddon(url.GetHostName(),addon))
      {
        PluginPtr plugin = boost::dynamic_pointer_cast<CPluginSource>(addon);
        if (plugin && plugin->Provides(CPluginSource::AUDIO) && pItem->IsAudio())
        {
          autoplay = g_guiSettings.GetBool("musicplayer.autoplaynextitem");
        }
      }
    }

    if (autoplay && !g_partyModeManager.IsEnabled() && 
        !pItem->IsPlayList() && !do_not_add_karaoke)
    {
      return OnPlayAndQueueMedia(pItem);
    }
    else
    {
      return OnPlayMedia(iItem);
    }
  }

  return false;
}
Example #26
0
int ImportCommand::execute (Cmdline const & cl)
{
	size_t argc = cl.arguments.size ();
	if (argc != 1 && argc != 2 && argc != 3)
	{
		throw invalid_argument ("need 1 to 3 arguments");
	}

	Key root = cl.createKey (0);
	if (!root.isValid ())
	{
		throw invalid_argument ("root key \"" + cl.arguments[0] + "\" is not a valid key name");
	}

	KeySet originalKeys;
	kdb.get (originalKeys, root);
	KeySet base = originalKeys.cut (root);
	printWarnings (cerr, root);

	string format = cl.format;
	if (argc > 1) format = cl.arguments[1];

	string file = "/dev/stdin";
	if (argc > 2 && cl.arguments[2] != "-") file = cl.arguments[2];

	Modules modules;
	PluginPtr plugin = modules.load (format, cl.getPluginsConfig ());

	Key errorKey (root);
	errorKey.setString (file);

	KeySet importedKeys;
	plugin->get (importedKeys, errorKey);
	importedKeys = importedKeys.cut (root);

	printWarnings (cerr, errorKey);
	printError (cerr, errorKey);

	ThreeWayMerge merger;
	MergeHelper helper;

	helper.configureMerger (cl, merger);
	MergeResult result = merger.mergeKeySet (
		MergeTask (BaseMergeKeys (base, root), OurMergeKeys (base, root), TheirMergeKeys (importedKeys, root), root));

	helper.reportResult (cl, result, cout, cerr);

	int ret = -1;
	if (!result.hasConflicts ())
	{
		if (cl.verbose)
		{
			cout << "The merged keyset with strategy " << cl.strategy << " is:" << endl;
			cout << result.getMergedKeys ();
		}

		KeySet resultKeys = result.getMergedKeys ();
		originalKeys.append (resultKeys);
		kdb.set (originalKeys, root);
		ret = 0;
	}

	return ret;
}
Example #27
0
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 << "&nbsp;\n\n"; // &nbsp; 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";
        }
Example #28
0
/*! \brief Run a script or plugin add-on.
 *  \param params The parameters.
 *  \details params[0] = add-on id.
 *           params[1] is blank for no add-on parameters
 *           or
 *           params[1] = add-on parameters in url format
 *           or
 *           params[1,...] = additional parameters in format param=value.
 */
static int RunAddon(const std::vector<std::string>& params)
{
  if (params.size())
  {
    const std::string& addonid = params[0];

    AddonPtr addon;
    if (CAddonMgr::GetInstance().GetAddon(addonid, addon, ADDON_PLUGIN))
    {
      PluginPtr plugin = std::dynamic_pointer_cast<CPluginSource>(addon);
      std::string urlParameters;
      std::vector<std::string> parameters;
      if (params.size() == 2 &&
          (StringUtils::StartsWith(params[1], "/") || StringUtils::StartsWith(params[1], "?")))
        urlParameters = params[1];
      else if (params.size() > 1)
      {
        parameters.insert(parameters.begin(), params.begin() + 1, params.end());
        urlParameters = "?" + StringUtils::Join(parameters, "&");
      }
      else
      {
        // Add '/' if addon is run without params (will be removed later so it's safe)
        // Otherwise there are 2 entries for the same plugin in ViewModesX.db
        urlParameters = "/";
      }

      std::string cmd;
      if (plugin->Provides(CPluginSource::VIDEO))
        cmd = StringUtils::Format("ActivateWindow(Videos,plugin://%s%s,return)", addonid.c_str(), urlParameters.c_str());
      else if (plugin->Provides(CPluginSource::AUDIO))
        cmd = StringUtils::Format("ActivateWindow(Music,plugin://%s%s,return)", addonid.c_str(), urlParameters.c_str());
      else if (plugin->Provides(CPluginSource::EXECUTABLE))
        cmd = StringUtils::Format("ActivateWindow(Programs,plugin://%s%s,return)", addonid.c_str(), urlParameters.c_str());
      else if (plugin->Provides(CPluginSource::IMAGE))
        cmd = StringUtils::Format("ActivateWindow(Pictures,plugin://%s%s,return)", addonid.c_str(), urlParameters.c_str());
      else
        // Pass the script name (addonid) and all the parameters
        // (params[1] ... params[x]) separated by a comma to RunPlugin
        cmd = StringUtils::Format("RunPlugin(%s)", StringUtils::Join(params, ",").c_str());
      CBuiltins::GetInstance().Execute(cmd);
    }
    else if (CAddonMgr::GetInstance().GetAddon(addonid, addon, ADDON_SCRIPT) ||
        CAddonMgr::GetInstance().GetAddon(addonid, addon, ADDON_SCRIPT_WEATHER) ||
        CAddonMgr::GetInstance().GetAddon(addonid, addon, ADDON_SCRIPT_LYRICS) ||
        CAddonMgr::GetInstance().GetAddon(addonid, addon, ADDON_SCRIPT_LIBRARY))
    {
      // Pass the script name (addonid) and all the parameters
      // (params[1] ... params[x]) separated by a comma to RunScript
      CBuiltins::GetInstance().Execute(StringUtils::Format("RunScript(%s)", StringUtils::Join(params, ",").c_str()));
    }
    else
      CLog::Log(LOGERROR, "RunAddon: unknown add-on id '%s', or unexpected add-on type (not a script or plugin).", addonid.c_str());
  }
  else
  {
    CLog::Log(LOGERROR, "RunAddon called with no arguments.");
  }

  return 0;
}
Example #29
0
JSONRPC_STATUS CAddonsOperations::GetAddons(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
{
  std::vector<TYPE> addonTypes;
  TYPE addonType = CAddonInfo::TranslateType(parameterObject["type"].asString());
  CPluginSource::Content content = CPluginSource::Translate(parameterObject["content"].asString());
  CVariant enabled = parameterObject["enabled"];
  CVariant installed = parameterObject["installed"];

  // ignore the "content" parameter if the type is specified but not a plugin or script
  if (addonType != ADDON_UNKNOWN && addonType != ADDON_PLUGIN && addonType != ADDON_SCRIPT)
    content = CPluginSource::UNKNOWN;

  if (addonType >= ADDON_VIDEO && addonType <= ADDON_EXECUTABLE)
  {
    addonTypes.push_back(ADDON_PLUGIN);
    addonTypes.push_back(ADDON_SCRIPT);

    switch (addonType)
    {
    case ADDON_VIDEO:
      content = CPluginSource::VIDEO;
      break;
    case ADDON_AUDIO:
      content = CPluginSource::AUDIO;
      break;
    case ADDON_IMAGE:
      content = CPluginSource::IMAGE;
      break;
    case ADDON_GAME:
      content = CPluginSource::GAME;
      break;
    case ADDON_EXECUTABLE:
      content = CPluginSource::EXECUTABLE;
      break;

    default:
      break;
    }
  }
  else
    addonTypes.push_back(addonType);

  VECADDONS addons;
  for (std::vector<TYPE>::const_iterator typeIt = addonTypes.begin(); typeIt != addonTypes.end(); ++typeIt)
  {
    VECADDONS typeAddons;
    if (*typeIt == ADDON_UNKNOWN)
    {
      if (!enabled.isBoolean()) //All
      {
        if (!installed.isBoolean() || installed.asBoolean())
          CServiceBroker::GetAddonMgr().GetInstalledAddons(typeAddons);
        if (!installed.isBoolean() || (installed.isBoolean() && !installed.asBoolean()))
          CServiceBroker::GetAddonMgr().GetInstallableAddons(typeAddons);
      }
      else if (enabled.asBoolean() && (!installed.isBoolean() || installed.asBoolean())) //Enabled
        CServiceBroker::GetAddonMgr().GetAddons(typeAddons);
      else if (!installed.isBoolean() || installed.asBoolean())
        CServiceBroker::GetAddonMgr().GetDisabledAddons(typeAddons);
    }
    else
    {
      if (!enabled.isBoolean()) //All
      {
        if (!installed.isBoolean() || installed.asBoolean())
          CServiceBroker::GetAddonMgr().GetInstalledAddons(typeAddons, *typeIt);
        if (!installed.isBoolean() || (installed.isBoolean() && !installed.asBoolean()))
          CServiceBroker::GetAddonMgr().GetInstallableAddons(typeAddons, *typeIt);
      }
      else if (enabled.asBoolean() && (!installed.isBoolean() || installed.asBoolean())) //Enabled
        CServiceBroker::GetAddonMgr().GetAddons(typeAddons, *typeIt);
      else if (!installed.isBoolean() || installed.asBoolean())
        CServiceBroker::GetAddonMgr().GetDisabledAddons(typeAddons, *typeIt);
    }

    addons.insert(addons.end(), typeAddons.begin(), typeAddons.end());
  }

  // remove library addons
  for (int index = 0; index < (int)addons.size(); index++)
  {
    PluginPtr plugin;
    if (content != CPluginSource::UNKNOWN)
      plugin = std::dynamic_pointer_cast<CPluginSource>(addons.at(index));

    if ((addons.at(index)->Type() <= ADDON_UNKNOWN || addons.at(index)->Type() >= ADDON_MAX) ||
       ((content != CPluginSource::UNKNOWN && plugin == NULL) || (plugin != NULL && !plugin->Provides(content))))
    {
      addons.erase(addons.begin() + index);
      index--;
    }
  }

  int start, end;
  HandleLimits(parameterObject, result, addons.size(), start, end);

  CAddonDatabase addondb;
  for (int index = start; index < end; index++)
    FillDetails(addons.at(index), parameterObject["properties"], result["addons"], addondb, true);

  return OK;
}
Example #30
0
NATRON_NAMESPACE_ENTER


PluginPtr
ViewerNode::createPlugin()
{
    std::vector<std::string> grouping;
    grouping.push_back(PLUGIN_GROUP_IMAGE);
    PluginPtr ret = Plugin::create(ViewerNode::create, ViewerNode::createRenderClone, PLUGINID_NATRON_VIEWER_GROUP, "Viewer", 1, 0, grouping);

    ret->setProperty<std::string>(kNatronPluginPropIconFilePath, "Images/viewer_icon.png");
    QString desc = tr("The Viewer node can display the output of a node graph. Shift + double click on the viewer node to customize the viewer display process with a custom node tree");

    ret->setProperty<ImageBitDepthEnum>(kNatronPluginPropOutputSupportedBitDepths, eImageBitDepthFloat, 0);
    ret->setProperty<ImageBitDepthEnum>(kNatronPluginPropOutputSupportedBitDepths, eImageBitDepthShort, 1);
    ret->setProperty<ImageBitDepthEnum>(kNatronPluginPropOutputSupportedBitDepths, eImageBitDepthByte, 2);
    ret->setProperty<std::bitset<4> >(kNatronPluginPropOutputSupportedComponents, std::bitset<4>(std::string("1111")));


    EffectDescriptionPtr effectDesc = ret->getEffectDescriptor();
    effectDesc->setProperty<RenderSafetyEnum>(kEffectPropRenderThreadSafety, eRenderSafetyFullySafe);
    effectDesc->setProperty<bool>(kEffectPropSupportsTiles, true);
    ret->setProperty<std::string>(kNatronPluginPropDescription, desc.toStdString());
    ret->setProperty<int>(kNatronPluginPropShortcut, (int)Key_I, 0);
    ret->setProperty<int>(kNatronPluginPropShortcut, (int)eKeyboardModifierControl, 1
                          );
    ret->addActionShortcut( PluginActionShortcut(kViewerInstanceParamClipToFormat, kViewerInstanceParamClipToFormatLabel, kViewerInstanceParamClipToFormatHint, Key_C, eKeyboardModifierShift) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamFullFrame, kViewerNodeParamFullFrameLabel, kViewerNodeParamFullFrameHint) );
    ret->addActionShortcut( PluginActionShortcut(kViewerInstanceParamEnableUserRoI, kViewerInstanceParamEnableUserRoILabel, kViewerInstanceParamEnableUserRoIHint, Key_W, eKeyboardModifierShift) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamPauseRender, kViewerNodeParamPauseRenderLabel, kViewerNodeParamPauseRenderHint, Key_P) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamEnableGain, kViewerNodeParamEnableGainLabel, kViewerNodeParamEnableGainHint) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamEnableAutoContrast, kViewerNodeParamEnableAutoContrastLabel, kViewerNodeParamEnableAutoContrastHint) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamEnableGamma, kViewerNodeParamEnableGammaLabel, kViewerNodeParamEnableGammaHint) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamRefreshViewport, kViewerNodeParamRefreshViewportLabel, kViewerNodeParamRefreshViewportHint, Key_U) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamFitViewport, kViewerNodeParamFitViewportLabel, kViewerNodeParamFitViewportHint, Key_F) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamSyncViewports, kViewerNodeParamSyncViewportsLabel, kViewerNodeParamSyncViewportsHint) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamCheckerBoard, kViewerNodeParamCheckerBoardLabel, kViewerNodeParamCheckerBoardHint) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamEnableColorPicker, kViewerNodeParamEnableColorPickerLabel, kViewerNodeParamEnableColorPickerHint) );

    // Right-click actions
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamRightClickMenuToggleWipe, kViewerNodeParamRightClickMenuToggleWipeLabel, "", Key_W) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamRightClickMenuCenterWipe, kViewerNodeParamRightClickMenuCenterWipeLabel, "", Key_F, eKeyboardModifierShift) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamRightClickMenuPreviousLayer, kViewerNodeParamRightClickMenuPreviousLayerLabel, "", Key_Page_Up) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamRightClickMenuNextLayer, kViewerNodeParamRightClickMenuNextLayerLabel, "", Key_Page_Down) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamRightClickMenuSwitchAB, kViewerNodeParamRightClickMenuSwitchABLabel, "", Key_Return) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamRightClickMenuPreviousView, kViewerNodeParamRightClickMenuPreviousViewLabel, "", Key_Page_Up, eKeyboardModifierShift) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamRightClickMenuNextView, kViewerNodeParamRightClickMenuNextViewLabel, "", Key_Page_Down, eKeyboardModifierShift) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamRightClickMenuShowHideOverlays, kViewerNodeParamRightClickMenuShowHideOverlaysLabel, "", Key_O) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamRightClickMenuHideAll, kViewerNodeParamRightClickMenuHideAllLabel, "", Key_space, KeyboardModifiers(eKeyboardModifierShift | eKeyboardModifierAlt) ));
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamRightClickMenuHideAllTop, kViewerNodeParamRightClickMenuHideAllTopLabel, "", Key_space, eKeyboardModifierShift ));
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamRightClickMenuHideAllBottom, kViewerNodeParamRightClickMenuHideAllBottomLabel, "", Key_space, eKeyboardModifierAlt ));
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamRightClickMenuShowHidePlayer, kViewerNodeParamRightClickMenuShowHidePlayerLabel, "") );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamRightClickMenuShowHideTimeline, kViewerNodeParamRightClickMenuShowHideTimelineLabel, "") );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamRightClickMenuShowHideLeftToolbar, kViewerNodeParamRightClickMenuShowHideLeftToolbarLabel, "") );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamRightClickMenuShowHideTopToolbar, kViewerNodeParamRightClickMenuShowHideTopToolbarLabel, "") );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamRightClickMenuShowHideTabHeader, kViewerNodeParamRightClickMenuShowHideTabHeaderLabel, "") );

    // Viewer actions
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionLuminance, kViewerNodeParamActionLuminanceLabel, "", Key_Y) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionRed, kViewerNodeParamActionRedLabel, "", Key_R) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionRedA, kViewerNodeParamActionRedALabel, "", Key_R, eKeyboardModifierShift) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionGreen, kViewerNodeParamActionGreenLabel, "", Key_G) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionGreenA, kViewerNodeParamActionGreenALabel, "", Key_G, eKeyboardModifierShift) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionBlue, kViewerNodeParamActionBlueLabel, "", Key_B) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionBlueA, kViewerNodeParamActionBlueALabel, "", Key_B, eKeyboardModifierShift) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionAlpha, kViewerNodeParamActionAlphaLabel, "", Key_A) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionAlphaA, kViewerNodeParamActionAlphaALabel, "", Key_A, eKeyboardModifierShift) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionMatte, kViewerNodeParamActionMatteLabel, "", Key_M) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionMatteA, kViewerNodeParamActionMatteALabel, "", Key_M, eKeyboardModifierShift) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionZoomIn, kViewerNodeParamActionZoomInLabel,"",  Key_plus) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionZoomOut, kViewerNodeParamActionZoomOutLabel, "", Key_minus) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionScaleOne, kViewerNodeParamActionScaleOneLabel, "", Key_1, eKeyboardModifierControl) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionProxy2, kViewerNodeParamActionProxy2Label, "", Key_1, eKeyboardModifierAlt) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionProxy4, kViewerNodeParamActionProxy4Label, "", Key_2, eKeyboardModifierAlt) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionProxy8, kViewerNodeParamActionProxy8Label, "", Key_3, eKeyboardModifierAlt) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionProxy16, kViewerNodeParamActionProxy16Label, "", Key_4, eKeyboardModifierAlt) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionProxy32, kViewerNodeParamActionProxy32Label, "", Key_5, eKeyboardModifierAlt) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionLeftView, kViewerNodeParamActionLeftViewLabel, "", Key_Left, eKeyboardModifierAlt) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionRightView, kViewerNodeParamActionRightViewLabel, "", Key_Right, eKeyboardModifierAlt) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionCreateNewRoI, kViewerNodeParamActionCreateNewRoILabel, "", Key_W, eKeyboardModifierAlt) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionPauseAB, kViewerNodeParamActionPauseABLabel, "", Key_P, eKeyboardModifierShift) );
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionRefreshWithStats, kViewerNodeParamActionRefreshWithStatsLabel, "", Key_U, KeyboardModifiers(eKeyboardModifierShift | eKeyboardModifierControl)) );


    // Player
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamPreviousFrame, kViewerNodeParamPreviousFrameLabel, kViewerNodeParamPreviousFrameHint, Key_Left, eKeyboardModifierNone));
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamNextFrame, kViewerNodeParamNextFrameLabel, kViewerNodeParamNextFrameHint, Key_Right, eKeyboardModifierNone));
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamPlayBackward, kViewerNodeParamPlayBackwardLabel, kViewerNodeParamPlayBackwardHint, Key_J, eKeyboardModifierNone));
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamPlayForward, kViewerNodeParamPlayForwardLabel, kViewerNodeParamPlayForwardHint, Key_L, eKeyboardModifierNone));
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamActionAbortRender, kViewerNodeParamActionAbortRenderLabel, kViewerNodeParamActionAbortRenderHint, Key_K, eKeyboardModifierNone));
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamPreviousIncr, kViewerNodeParamPreviousIncrLabel, kViewerNodeParamPreviousIncrHint, Key_Left, eKeyboardModifierShift));
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamNextIncr, kViewerNodeParamNextIncrLabel, kViewerNodeParamNextIncrHint, Key_Right, eKeyboardModifierShift));
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamPreviousKeyFrame, kViewerNodeParamPreviousKeyFrameLabel, kViewerNodeParamPreviousKeyFrameHint, Key_Left, KeyboardModifiers(eKeyboardModifierShift | eKeyboardModifierControl)));
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamNextKeyFrame, kViewerNodeParamNextKeyFrameLabel, kViewerNodeParamNextKeyFrameHint, Key_Right, KeyboardModifiers(eKeyboardModifierShift | eKeyboardModifierControl)));
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamFirstFrame, kViewerNodeParamFirstFrameLabel, kViewerNodeParamFirstFrameHint, Key_Left, eKeyboardModifierControl));
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamLastFrame, kViewerNodeParamLastFrameLabel, kViewerNodeParamLastFrameHint, Key_Right, eKeyboardModifierControl));
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamSetInPoint, kViewerNodeParamSetInPointLabel, kViewerNodeParamSetInPointHint, Key_I, eKeyboardModifierAlt));
    ret->addActionShortcut( PluginActionShortcut(kViewerNodeParamSetOutPoint, kViewerNodeParamSetOutPointLabel, kViewerNodeParamSetOutPointHint, Key_O, eKeyboardModifierAlt));


    return ret;
}