BaseDraw in TagDataPlugin



  • 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)
    


  • 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.



  • 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.



  • @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!


Log in to reply