Could not initialize global resource

  • On 18/06/2018 at 08:35, xxxxxxxx wrote:

    Hi folks,
    Recently, I tried to create my first Python plug-in, and I was troubled by a problem for a long time.

    Console:  RuntimeError: Could not initialize global resource for the plugin.

    I search a lot in the SDK document and forum, but I still don't know how to solve it. I hope can get your help. Here's my test code:

    import c4d
    import sys
    import os
    from c4d import plugins,bitmaps
    PLUGIN_ID = 1000001
    OBJECTGROUP = 1001
    OBJECT = 1002
    MAP = 1003
    class test(plugins.ObjectData) :
    def __init__(self) :
    def ModifyObject(self, mod, doc, op, op_mg, mod_mg, lod, flags, thread) :
    return True
    if __name__ == "__main__":
    bmp = bitmaps.BaseBitmap()
        dir, file = os.path.split(__file__) 
    bitmapfile = os.path.join(dir, "res", "Icon.tif")
    result = bmp.InitWith(bitmapfile)
    plugins.RegisterObjectPlugin(id=PLUGIN_ID, str="test",g=test,description="test",icon=bmp,info=c4d.OBJECT_MODIFIER)
    #ifndef _Oatom_H_
    #define _Oatom_H_
        OBJECTGROUP = 1001,
        OBJECT = 1002,
        MAP = 1003,
    CONTAINER test
    NAME test;
    INCLUDE Obase;
        LINK OBJECT {}
        LINK MAP {}
    OBJECT "obj"
    MAP "map";

  • On 19/06/2018 at 02:21, xxxxxxxx wrote:


    The resource for the plugin can't be initialized because there's an error in test.str : a semicolon ';' is missing at the end of the line OBJECT "obj".

    It looks like you've copied the resource for C++ SDK Oatom example.
    It's better to copy the resource for a Python SDK example, for instance object plugin Py-RoundedTube.
    Use this as a base to define resources: macro #def in .h, naming for parameters, resource tree structure etc.

    Note Python plugins resource need c4d_symbols.h present in res folder.

  • On 20/06/2018 at 08:05, xxxxxxxx wrote:

    Thank you for your help, Yannick Puech!

    My first test plugin  run  successfully!

    I made a stupid mistake a lot, such as forgetting to add a semicolon ";" and I forgot to add "s" folder of strings. It is these wrong to let me crazy for a long time. Next time I encounter a problem, I will check these low-level mistakes first.

    I also want to ask a question again, why is the c4d_symbols.h file necessary? There seems to be nothing in it. What role does he have? I don't seem to find his introduction in the document. This also confuses me.

  • On 21/06/2018 at 01:21, xxxxxxxx wrote:

    The c4d_symbols.h has to be there even if it's empty. It's mandatory for plugins that use description resources.

  • On 21/06/2018 at 07:40, xxxxxxxx wrote:

    Yeah, I get it! Thank you for your patient answer, Yannick Puech!

Log in to reply