Testing of DrawHUDText



  • On 01/03/2017 at 05:24, xxxxxxxx wrote:

    Hello
    I test new DrawHUDText with strange results - something wrong with clipping.
    I add null object, add script-tag and write this into tag(Niklas tip or somebody at forum) :

    import c4d  
    from c4d import plugins  
    class ObjectData(plugins.ObjectData) :  
      def Draw(self) :  
          bd = doc.GetActiveBaseDraw()  
          bd.DrawHUDText(100, 100, "Test")  
          bd.SetMatrix_Matrix(op.GetObject(), c4d.Matrix())  
          return True  
    def main() :  
      td = ObjectData()  
      td.Draw()
    

    Maybe did i miss something in code?

    I  test in active environment of c4d, not plugin body, for decoration of scripts, assets



  • On 02/03/2017 at 01:33, xxxxxxxx wrote:

    Hello,

    honestly, pretty much everything in your script is wrong.

    You cannot perform viewport draw operations whenever you want. One can only draw in the viewport when Cinema is drawing the viewport, you can add to that drawing process. This is done by implementing special "Draw" functions of various plugin classes like ObjectData.Draw() or TagData.Draw(). But you have to implement these functions with the exact signature, you cannot invent some new "Draw" function. You cannot call this "Draw" function yourself, it has to be called by Cinema. See the Draw Manual and BaseDraw Manual.

    So if you want to test DrawHUDText() you can create a ObjectData or TagData plugin, implement the "Draw" function of these classes and create and instance of this object or tag to test it.

    An example for an ObjectData plugin that draws something is the Py-DoubleCircle.pyp.

    If you want to create an instance of an object plugin you must not create an instance of the plugin class. You must call BaseObject() with the ID of you plugin class to create the corresponding BaseObject as seen in e.g. Py-LiquidPainter.pyp.

    best wishes,
    Sebastian



  • On 02/03/2017 at 03:20, xxxxxxxx wrote:

    Hello
    Thank you Sebastian. I will check out


Log in to reply