Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 18/10/2010 at 04:29, xxxxxxxx wrote:
User Information: Cinema 4D Version: R12 Platform: Windows ; Mac ; Mac OSX ; Language(s) : PYTHON ;
--------- Hello,
I'm trying to write an Object Plugin in Python and I have a problem. Here a sample code :
Test.py :
import os import c4d from c4d import plugins, documents, utils # be sure to use a unique ID obtained from www.plugincafe.com PLUGIN_ID = 1000006 class Test(c4d.plugins.ObjectData) : def GetVirtualObjects(self, op, hh) : print c4d.BAR print op.GetDataInstance().GetBool(1000) return c4d.BaseObject(c4d.Ocube) if __name__ == "__main__": bmp = c4d.bitmaps.BaseBitmap() dir, file = os.path.split(__file__) fn = os.path.join(dir, "res", "icon.tif") bmp.InitWith(fn) c4d.plugins.RegisterObjectPlugin(id = PLUGIN_ID, str = "Test", g = Test, description = "foo", info = c4d.OBJECT_GENERATOR | c4d.OBJECT_INPUT, icon = bmp)
foo.h
#ifndef _FOO_H_ #define _FOO_H_ enum { BAR = 1000, // BOOL DUMMY_ }; #endif
foo.res
CONTAINER foo { NAME foo; INCLUDE Obase; GROUP ID_OBJECTPROPERTIES { BOOL BAR {}; } }
I'm trying to get the BAR boolean value. With the GetDataInstance().GetBool that works, but the line "print c4d.BAR" generate this error : AttributeError: 'module' object has no attribute 'BAR'
I don't understand why, in a plugin tag i access resource with the same way and it worked.
Here the project : http://www.xsyann.com/plugincafe/Test.zip
Some help is welcome...
Thank you, Greetings,
Yann.
On 18/10/2010 at 07:05, xxxxxxxx wrote:
Hi Yann,
C4D adds the resources of a registered plugin to the c4d main module and writes them to "userfolder/prefs/coffeesymbolcache". If you change your resource files, just remove this file and restart C4D. I hope this helps.
Cheers, Sebastian
On 18/10/2010 at 07:19, xxxxxxxx wrote:
Originally posted by xxxxxxxx I hope this helps.
Originally posted by xxxxxxxx
I hope this helps.
This solves the problem. Thank you very much Sebastian. Greetings, Yann