WorldViz User Forum

WorldViz User Forum (
-   Plug-in development (
-   -   How do I add custom functions to a custom plugin? (

reedev 01-24-2009 08:13 AM

How do I add custom functions to a custom plugin?

I am working on CustomNode plugin. I have my custom node up and running fine.

Now I would like to add my own functions to the plugin. Can anyone show me how that's done? It's not in the CustomNode example.

Thanks a lot.

Best regards

farshizzo 01-26-2009 05:46 PM

Here is a small example that uses the skydome plugin to show how to customize a plugin object. Usually you create your own Python module that specifies your class. In this example, create a file called and add the following code to it:

import viz

class SkyDomeClass(viz.VizCustomChild):
        def myfunc(self):

def addSkyDome():
        return viz.add('skydome.dlc')

The following code shows how to use your new module:

import viz

dome = addSkyDome()

reedev 01-27-2009 05:27 AM


Aha, ok, it's starting to make sense...
This command is then calling the C++ class func
void CommandCustomNode(void *custom) ? (from the CustomNode example)

Is there not a direct way of calling the CommandCustomNode() func? Isn't it exposed via the python module?


reedev 01-27-2009 07:07 AM

Also, I would like to specify arguments when the plugin is loaded, so that I can specify these arguments to my constructor.


farshizzo 01-27-2009 05:37 PM

When you create the custom node object, you can optionally specify additional arguments:

mynode = viz.add('mynode.dlc',command,mesg,x,y,z,w)
You can also send additional commands to the node once it is created:

The command, mesg, x, y, z, w values are part of the VizCustomNodeObj structure that is passed to your C++ function.

reedev 01-28-2009 12:16 AM

So this way I don't need to create a python class, right?
I like the last way better.

Thanks a lot

farshizzo 01-28-2009 03:31 PM

You don't have to create a Python class for you custom nodes. Wrapping your custom commands with proper functions usually makes the code easier to read, and this is the main reason to do it. It's 100% optional though.

reedev 02-01-2009 03:39 AM

It's all clear to me right. And working :-)

Thanks a lot for your support.
Best regards

All times are GMT -7. The time now is 05:52 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC