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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    BaseDraw in TagDataPlugin

    Cinema 4D SDK
    s22 python sdk
    2
    3
    371
    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.
    • ?
      A Former User
      last edited by

      Hello,
      I'd like to draw a 2D line over the Viewport from a TagDataPlugin while the tag is Enabled. This is my Drawing function below. It worked as an ObjectData plugin when I called it with DRAWPASS_OBJECT, but I'm not sure how to get this working as a Tag. Can anyone advise me on this? Thank you!

      class BaseDrawTest(c4d.plugins.TagData):
      
          def __init__(self, *args):
              super(BaseDrawTest, self).__init__(*args)
      
          def Draw(self, tag, op, bd, bh):
              bd.SetPen(c4d.Vector(1, 0.7, 0))
              v1 = c4d.Vector(0.0,0.0,0.0)
              v2 = c4d.Vector(1000.0,1000.0,1000.0)
              bd.SetMatrix_Screen()
              bd.DrawLine2D(v1, v2)
      
      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by

        Hi @blastframe, I'm not sure what is your issue, does the draw method is called? Because since S22 to get the Draw method called you needed to register your TagData with the c4d.TAG_IMPLEMENTS_DRAW_FUNCTION flags.

        Or does the Draw method is called but the result is not what you expected? If yes can you provide a screenshot of what you are aiming, or describe a bit more your issue?

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        ? 1 Reply Last reply Reply Quote 0
        • ?
          A Former User @m_adam
          last edited by

          @m_adam My apologies for not being clearer. I thought there was something wrong with how I was doing the Draw function. The issue was the TAG_IMPLEMENTS_DRAW_FUNCTION flag was missing.

          Thank you very much!

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