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

    Testing of DrawHUDText

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 432 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 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

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

        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

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

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

          Hello
          Thank you Sebastian. I will check out

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