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

    DrawHUDText returns a white box instead of a text?

    Cinema 4D SDK
    r20 python
    5
    19
    3.1k
    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.
    • ManuelM
      Manuel
      last edited by

      hello @bentraje

      Sorry i should have linked you to the c++ Draw manual.

      About the directory structure you should have a look at this documentation

      something like so
      tree.JPG

      Cheers,
      Manuel

      MAXON SDK Specialist

      MAXON Registered Developer

      1 Reply Last reply Reply Quote 1
      • B
        bentraje
        last edited by

        @m_magalhaes

        Thanks for the tree example. It loads successfully.
        But it gives an error of tdrawexample.str
        https://www.dropbox.com/s/rcr1xid9cqml92o/c4d132_HUD_draw_text_c.jpg?dl=0

        My concern is there is really nothing on .str file. Should I put something in there?

        1 Reply Last reply Reply Quote 0
        • ManuelM
          Manuel
          last edited by

          hey @bentraje,

          I've update the other thread with all information and files.
          In fact you always need a "minimum" in those files.

          Sorry for not being clear.

          Cheers
          Manuel

          MAXON SDK Specialist

          MAXON Registered Developer

          1 Reply Last reply Reply Quote 1
          • B
            bentraje
            last edited by bentraje

            @m_magalhaes

            Thank you so much for the patience. It loads with no errors. Just one thing, how does it draw in the viewport?
            I guess the name of the tag will appear on the viewport?

            You can see the current state here:
            https://www.dropbox.com/s/pekm2msrut6f2ia/c4d132_HUD_draw_text_d.jpg?dl=0

            Sorry again for the trouble.

            1 Reply Last reply Reply Quote 0
            • ManuelM
              Manuel
              last edited by Manuel

              Don't worry 🙂

              the code prevent to work with non polygon object because we need to acces point position information with GetAllPoints

              if not op.IsInstanceOf(c4d.Opolygon):
                          return c4d.DRAWRESULT_OK
              

              just edit your primitive. (by the way be carefull with the point number, it can be messy xD)

              Cheers
              Manuel

              MAXON SDK Specialist

              MAXON Registered Developer

              1 Reply Last reply Reply Quote 1
              • B
                bentraje
                last edited by

                @m_magalhaes

                Thanks for the response! It works as expected. You can see the result here:
                https://www.dropbox.com/s/c4iivf56vaqzztk/c4d132_HUD_draw_text_e.jpg?dl=0

                Using the plug-in code you provided, I just replaced the DrawMultiple command to
                bd.DrawHUDText(50, 50, 'HUD Test')

                I see now what you mean by "the viewport is redraw so you have to redraw your text again."
                I tried adding print "Hello World" within the code and it prints every redraw.

                Will consider the thread as solved.

                Thanks again. Have a great day ahead!

                1 Reply Last reply Reply Quote 0
                • M
                  mdr74
                  last edited by

                  Hi Manuel,
                  I've tried to follow your example from the thread you linked but it gives me "Could not initialize global resource for the plugin"

                  I thought it was solved, maybe something is changed in R21 or S22?

                  thanks

                  1 Reply Last reply Reply Quote 0
                  • M
                    mdr74
                    last edited by

                    I started again from scratch and now it works but only in R21.
                    In S22 here's no error in the console but nothing shows in the viewport (the object is a polygon).

                    1 Reply Last reply Reply Quote 0
                    • ManuelM
                      Manuel
                      last edited by

                      hi,

                      in s22 you have to register the tag with this tag : TAG_IMPLEMENTS_DRAW_FUNCTION

                      info=c4d.TAG_EXPRESSION | c4d.TAG_VISIBLE | c4d.TAG_IMPLEMENTS_DRAW_FUNCTION ,
                      

                      Cheers,
                      Manuel

                      MAXON SDK Specialist

                      MAXON Registered Developer

                      1 Reply Last reply Reply Quote 0
                      • M
                        mdr74
                        last edited by

                        it works.
                        thanks

                        1 Reply Last reply Reply Quote 0
                        • M
                          mdr74
                          last edited by

                          I discovered another problem in S22, maybe.
                          The Hud text is correct but when I deselect the polygon object I cannot select anything in the viewport anymore.
                          I don't know if it's a bug or an error in the plugin

                          thanks again

                          1 Reply Last reply Reply Quote 0
                          • ManuelM
                            Manuel
                            last edited by

                            hi,

                            thanks a lot for that, i didn't tested it.
                            I've opened a bug entry for that one. We changed the viewport and lot of stuff.

                            I'll update this thread when the bug will be fixed.

                            Cheers,
                            Manuel

                            MAXON SDK Specialist

                            MAXON Registered Developer

                            1 Reply Last reply Reply Quote 1
                            • Paul EverettP
                              Paul Everett
                              last edited by

                              @m_magalhaes said in DrawHUDText returns a white box instead of a text?:

                              TAG_IMPLEMENTS_DRAW_FUNCTION

                              I came across this problem today.

                              #define TAG_IMPLEMENTS_DRAW_FUNCTION (1 << 😎

                              note : you can add this flag to R21 builds, and your tags then display as expected in 22.

                              RE: DrawHUDText

                              z settings have no effect on text.
                              in 21, text is drawn behind poly objects.
                              in 22 text is drawn in front of obejcts.

                              IMO, this is a bit of a mess. the new draw flag should be the exact opposite to what it is, to keep compatibility.
                              small differences, make a big difference when your already bending over backwards trying not to have to rebuild everything yet again, for 22.

                              1 Reply Last reply Reply Quote 0
                              • M
                                m_adam
                                last edited by

                                Regarding the Z setting of DrawHUDText (I'm not sure about which one to be honest since there is no Z param for this method) previously the fact that HUD was behind poly object was a limitation regarding how our draw call was done by the viewport, but this is addressed in S22 and its the expected result that a HUD text is not overridden by any other objects but act as a HUD and to be draw in front of everything.

                                Cheers,
                                Maxime.

                                MAXON SDK Specialist

                                Development Blog, MAXON Registered Developer

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