Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    ToolData.InitTool

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 308 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post