THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/01/2011 at 14:49, xxxxxxxx wrote:
The error i'm getting is: "Could not initialize global resource for the plugin"
I'm new to C4D using Python and am a little frustrated just trying to register a helloworld plugin.
using version R12.032 on Win7 box
code:
import os
import sys
import c4d
from c4d import plugins, documents, utils
PLUGIN_ID = 1000010
class myFirstPlugin(c4d.plugins.ObjectData) :
def Init(self, op) :
c4d.gui.MessageDialog("Hello World")
if __name__ == "__main__":
bmp = c4d.bitmaps.BaseBitmap()
dir, file = os.path.split(__file__)
fn = os.path.join(dir, "res", "test.tif")
bmp.InitWith(fn)
try:
result = c4d.plugins.RegisterObjectPlugin(
id = PLUGIN_ID,
str = "myFirstPlugin",
g = myFirstPlugin,
description = "foo",
info = c4d.OBJECT_GENERATOR | c4d.OBJECT_INPUT,
icon = bmp
)
c4d.gui.MessageDialog("result is: " + result)
except:
exctype, value = sys.exc_info()[:2]
c4d.gui.MessageDialog(value)