THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/06/2012 at 13:40, xxxxxxxx wrote:
Ok, I now see my tag in the object manager.
However, I cannot add it to an object.
Here the code (all it should do, is print "hello world" when frame =0) :
import c4d
import os
import sys
from c4d import gui, plugins, bitmaps
PLUGIN_ID = 1234567880 #test id
class SayHello(plugins.ToolData) :
pass #put in your code here
def Execute(self, tag, doc, op, bt, priority, flags) :
frame = doc.GetTime().GetFrame(doc.GetFps())
if (frame == 0) :
print "Hello World."
return c4d.EXECUTIONRESULT_OK
if __name__ == "__main__":
bmp = bitmaps.BaseBitmap()
dir, file = os.path.split("D:\Program Files\MAXON\CINEMA 4D R13\plugins\hello.pyp")
fn = os.path.join(dir, "res", "Icon.tif")
print dir, file
bmp.InitWith(fn)
#c4d.plugins.RegisterTagPlugin(id, str, info, g, description, icon[, disklevel=0][, res])
okyn = plugins.RegisterTagPlugin(id=PLUGIN_ID, str="Hello", info=c4d.TAG_VISIBLE, g=SayHello, description=None, icon=None)
print "SayHello initialized: ", okyn