Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Un-commenting Message function of python tag results in RuntimeError

    Cinema 4D SDK
    s26 python windows
    2
    3
    379
    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
      HerrMay
      last edited by

      Hi guys,

      I don't know if this any news but I think I found a bug in def message(id: int, data: object) -> bool: of the python tag. Un-commenting this method results in the following error.

      Traceback (most recent call last):
        File "Python", line 20, in message
      RuntimeError: super(): __class__ cell not found
      

      I observed this in S26 if that helps.

      Cheers,
      Sebastian

      from typing import Optional
      import c4d
      
      doc: c4d.documents.BaseDocument # The document evaluating this tag
      op: c4d.BaseTag # The Python scripting tag
      flags: int # c4d.EXECUTIONFLAGS
      priority: int # c4d.EXECUTIONPRIORITY
      tp: Optional[c4d.modules.thinkingparticles.TP_MasterSystem] # Particle system
      thread: Optional[c4d.threading.BaseThread] # The thread executing this tag
      
      def main() -> None:
          # Called when the tag is executed. It can be called multiple time per frame. Similar to TagData.Execute.
          # Write your code here
          pass
      
      
      def message(id: int, data: object) -> bool:
          # Called when the tag receives messages. Similar to TagData.Message.
          # Write your code here
          return super().Message(id, data)
      
      """
      def draw(bd: c4d.BaseDraw) -> bool:
          # Called to display some visual element in the viewport. Similar to TagData.Draw.
          # Write your code here
          return True
      """
      
      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by

        Hi the issue is that normally when you implement a tag you are within a class and more especially a TagData which inherit from a NodeData therefor you can call the method "super" without issue because there is indeed a class. But in this case there is no TagData instance, so for the moment there is no good way to propagate the message and you should return True.

        And I know this is the default code, this will be looked at and fixed within a future version.
        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • H
          HerrMay
          last edited by

          Hi @m_adam,

          alrighty, good to know that this will be looked into and eventually get fixed.

          Yes, I remember I returned True in the past. In the python tag as well as in the TagData equivalent. As returning super didn't work.

          Thanks for the information anyway. 🙂

          Cheers,
          Sebastian

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