ToolData.InitTool



  • On 23/12/2015 at 05:39, xxxxxxxx wrote:

    Hello,

    I am new to python and plugin making since this month, so I might have overlooked something.
    While working on a tooldata plugin I got confused about the InitTool function, a I always get an error in the console when reloading the python plugin, telling me the c4d.BaseContainer does not have attribute GetMode, while I was doing a doc.GetMode()

    While investigating the issue I found that with following code:

    def InitTool(self, doc, data, bt) :
     print doc
     print data

    I do get two different results.
    When I reload the python plugin, the console shows:
    <c4d.BaseContainer object at 0x000...>
    <c4d.documents.BaseDocument object called '' ....>

    However, when I select the plugin I get the same but with the lines swapped
    <c4d.documents.BaseDocument object called '' ....>
    <c4d.BaseContainer object at 0x000...>

    Since the description of InitTool mentions that basedocument is the second argument and basecontainer the third one, I can agree with the result I get when selecting the plugin.
    What I don't understand is why the two arguments seem to be swapped when performing the "reload python plugins" from the menu.

    So, except for the error in the console when reloading the plugin, the plugin is working correctly once selected.

    Is there something I am missing ?
    Thanks



  • On 23/12/2015 at 06:01, xxxxxxxx wrote:

    Hi,

    This is a known issue that has already been discussed in the Plugin Cafe here.
    But it hasn't been fixed yet. I'll report it and hope it will be fixed for the next SP.



  • On 23/12/2015 at 06:12, xxxxxxxx wrote:

    OK, thanks.
    I did a search on InitTool in the forums but didn't see that topic listed.

    As a side note, the documentation of FreeTool indicates it returns a bool, but it actually returns none


Log in to reply