TACTIC Open Source
Plugins related question - Printable Version

+- TACTIC Open Source (http://forum.southpawtech.com)
+-- Forum: TACTIC Open Source (http://forum.southpawtech.com/forumdisplay.php?fid=3)
+--- Forum: TACTIC Discussion (http://forum.southpawtech.com/forumdisplay.php?fid=4)
+--- Thread: Plugins related question (/showthread.php?tid=143)



Plugins related question - listy - 06-20-2020

Currently i am testing vfx template and want make my custom tools to work with it properly.
So my question is, can plugins be overlapped?
Like if i make plugin for plugin.
Example: VFX_plugin > TC_VFX_Plugin
VFX_plugin - main official vfx plugin
TC_VFX_Plugin - my addition to this vfx plugin.

I want some schema things to be changed, and change sidebar definition. Does it legal?  Rolleyes

I am asking because i don't want to make any changes specifically related to my tools in official plugin. Or make special vfx_plugin which i should support by myself and ship it separately.
But i want to make some changes that will benefit for my tools.


RE: Plugins related question - remkonoteboom - 06-20-2020

You mentioned the two main places where this is an issue. As of now, plugins own a "row" in the table of the database. Often we claim that row by using a prefix on the "code" column, ie: MY_PLUGIN0001. This makes exporting easy to define with an expression and also claims that row for be owned by a particular plugin.

However, there are two main areas where this is an issue, as Listy mentioned, the Schema and the Sidebar. This is because these are global documents and only one exists. Your plugin can completely override the row and as long as you make sure your plugin is loaded after the VFX plugin, then all is good. However, this means it is difficult a project to receive updates, ie: updating the TACTIC and reloading the VFX plugin. Reloading your plugin will override any new items in the schema or the sidebar.

I have been exploring the ability to add "additions" to the schema. This would be additional rows that are added by the plugin which would then be merged in memory to one big schema. This can be seen in src/pyasm/biz/schema.py, line: 1406.

https://github.com/Southpaw-TACTIC/TACTIC/blob/4.8/src/pyasm/biz/schema.py

This would solve the schema problem as you can add search_types and connections in your plugin without interfering the VFX plugin. We could do the same with the sidebar and append the plugin links to the bottom.

Note that the templates never had this ability as the template exported and owned all of the definitions and became the source "plugin".


RE: Plugins related question - listy - 06-20-2020

This is make all thing more clear.
As i know the spt's files are just python modules, then it means i can add some fancy logic to it, and as You said add or change tables content not just replace them.
But at the same time, server admin should follow next logic if one wants to update plugins:
Update and Reload Plugin > Reload addition plugins manually.
I understand this right?


RE: Plugins related question - remkonoteboom - 06-21-2020

In the plugin.py file:

https://github.com/Southpaw-TACTIC/TACTIC/blob/4.8/src/tactic/command/plugin.py

There are a bunch of classes that allow you to programmatically load, unload and reload plugins.  Here is some sample code to load a bunch of plugins sequentially.  You could also use PluginReloader to reload the plugin (which basically just does a PluginUninstaller and then PluginInstaller execution in a single transactions).


Code:
plugins = [
            "vfx/stypes",
            "vfx/config",
            "my_plugin/stypes"
        ]

        for plugin in plugins:
            print "Installing plugin: ", plugin
            installer = PluginInstaller(relative_dir=plugin, verbose=False, register=True)
            installer.execute()