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

    Debugger for the plugins created in Cinema4D

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 626 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 09/12/2013 at 08:05, xxxxxxxx wrote:

      We have  created a XML3DExporter plugin for Cinema4D and we are planning to add few more functionalities in it. So we need to debug the code.
      Does Cinema4D has a debugger for the python plugin code or how can we debug the code with an external debugger?
      Suggest me some ways to debug my python plugin code

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

        On 09/12/2013 at 10:14, xxxxxxxx wrote:

        Debugging is a rather vague term an people do understand multiple things under it. You can 
        debug in c4d itself with the c4d console, which is most likely the way most people are doing it. 
        Using the reload python plugins feature does make it a quite straight forward process. That 
        does assume that you are not trying to reload modules, as reloading modules in a python 
        instance before 2.7 is impossible due to the fact that you cannot overload import / establish a 
        hook to it (you can still use multiple files, just not in the __init__.py fashion or if you do, you have
        to restart c4d each time you made a change to a module).

        There is also the theoretical possibility to remote debug, but it is practically very difficult IMHO.
        Here is an article about it :

        http://www.smart-page.net/blog/2011/05/29/debugging-cinema-4d-python-plugins-with-pydev/

        If you mean by debugging also having an inspector / live insight into the memory used by python,
        that is not possible for c4d.

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

          On 10/12/2013 at 01:48, xxxxxxxx wrote:

          If you are working with modules that are distributed with your plugin, it is easily possible to
          automatically reload them when you reload the Python plugins in Cinema (and actually required!).
          Check out the following link:

          https://github.com/NiklasRosenstein/py4d-tips/blob/master/README.md#the-correct-way-to-load-libraries-that-are-distributed-with-your-plugin

          The Advantages

          1. [...]
          2. If you reload your plugin from Cinema 4D, the locally loaded libraries will automatically be reloaded

          For debugging, you can use the Python pdb module which is part of the standard library.

          Best,
          -Niklas

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

            On 10/12/2013 at 03:00, xxxxxxxx wrote:

            unless i am mistaken that isn't the module workflow you are showing there nikklas. that
            is the usual 'I do throw everything into the sys.path' approach. which is fine, but not the same
            as true python modules.

            the problem for python modules is, that python does create copies of them per instance and
            you are not able to track those unless you are at least on python 2.7 and do establish a hook
            on the import function (or use python 3.2 which covers module reloading out of the box  - 
            imp.reload()).

            here is a github for python 2.7 on the topic https://github.com/jparise/python-reloader.

            of course there is a lot of black magic like deleting reference strings in sys and the environment 
            variable. but those will fail in 99% of the cases in my experience.

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

              On 10/12/2013 at 09:19, xxxxxxxx wrote:

              Here importing the c4d is the main error in the code because it is not available in Eclipse editor. How could I proceed?

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

                On 10/12/2013 at 10:19, xxxxxxxx wrote:

                read the link on remote debugging i have posted.

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