Graphics.UsingTheDougPluginCommand - lordmundi/wikidoctest GitHub Wiki

Using the Plugin Tcl Commands

« Using the doug camera tcl command | EDGE User’s Guide | Using the doug display command »

EDGE provides an extensive tcl scripting ability to DSP.

The doug.plugin command can be used to call functions within specifc plugins that they expose. This is a great functionality for plugin developers since it means that a generic engine can be developed in the plugin source code allowing tcl scripts to set up specific usage. For example, the canvas command is generic and lets tcl scripts draw overlays on the viewport or in the screen. Another example is the joystick2 plugin, which generically connects to any USB joystick and lets the user define what tcl script to call when buttons or axes change value.

A plugin exposes Tcl commands by using the "InstallPluginCmd" function documented in the DOUG Plugin Function Reference. You can seen an example of this in the simdata plugin source code in the src.dist directory (playback.cpp).

Simple Directions

The doug.plugin usage will be dependent upon the specific plugin that is being called. Some examples help to illustrate the usage (with the lodloader and dsp_script plugins):

doug.plugin lodloader.node set 1
doug.plugin lodloader.node get
doug.plugin lodloader.scene set 0
doug.plugin script.get
doug.plugin script.exec $script_name

What's really going on

If the above examples are not enough info, or you need more information about a particular option, the source code implementing the doug.plugin command is below:

[Show DOUG_PLUGIN_cmd source code][5]

int
DOUG_PLUGIN_cmd( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] )
{
#if 0
doug.plugin lodloader.node set 1
doug.plugin lodloader.node get
doug.plugin lodloader.scene set 0
doug.plugin script.get
doug.plugin script.exec $script_name
#endif
    Tcl_HashEntry *entry;
    DOUG_PLUGIN_CMD_DATA *pcmddata;

    if( entry = Tcl_FindHashEntry( &plugin_cmds, Tcl_GetString( objv[1] ) ) )
    {
        pcmddata = (DOUG_PLUGIN_CMD_DATA*)Tcl_GetHashValue( entry );
        return pcmddata->pcmd( pcmddata->data, interp, objc-1, (Tcl_Obj **)(&objv[1]) );
    }
    else
    {
        /* IGNORE UNDEFINED PLUGIN CMDS FOR NOW */
        return TCL_OK;
    }
}

« Using the doug camera tcl command | EDGE User’s Guide | Using the doug display command »

[5]: javascript:toggleObj('togglecode_id0','hide','Show DOUG_PLUGIN_cmd source code','Show DOUG_PLUGIN_cmd source code','')