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

    Tag-plugin draw-function and transparency

    Scheduled Pinned Locked Moved PYTHON Development
    8 Posts 0 Posters 561 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 26/02/2013 at 06:07, xxxxxxxx wrote:

      Hey guys.
      I'm toying around with a tag-plugin which draws a simple polygon into the viewport. The polygon should be transparent which I set by using BaseDraw.SetTransparency(-235). It works, the polygon is transparent but has one major flaw: every polygon-object behind my polygon is not visible except for it's wireframe-lines (the world-grid is also visible).

      def Draw(self, tag, op, bd, bh) :  
      bd.SetMatrix_Matrix(None, c4d.Matrix())  
      bd.SetTransparency(-235)  
      p = ( c4d.Vector(0,0,0), c4d.Vector(100,0,0), c4d.Vector(50,100,0) )  
      f = ( c4d.Vector(1,0,0), c4d.Vector(0,0,1), c4d.Vector(0,1,0) )  
        bd.DrawPolygon(p, f)
      

      Is there some kind of workaround for this? The transparency works fine in my tool-plugins.
      Thanks
      Phil

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

        On 27/02/2013 at 00:31, xxxxxxxx wrote:

        Hi Phil,

        With a positive value for the transparency it works. But it's dotted.
        I asked the developers if it's possible to get a true transparency from within a TagData plugin.

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

          On 27/02/2013 at 02:39, xxxxxxxx wrote:

          Hi Yannick.
          Yeah I tried the dotted version, but I don't like the look (too dominant) and in my viewport other objects start flickering when I use positive values.
          I assume there won't be a workaround, but I just want to be sure.
          Thanks for your help.

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

            On 27/02/2013 at 07:55, xxxxxxxx wrote:

            Maybe I don't understand the problem. But it seems to work fine for me.
            I tried it using the Py-LiquidPainter plugin example in the python SDK.  The two triangle polygons are transparent. And the objects behind it are seen through them as expected.

                ...plugin code  
              
            def Draw(self, doc, data, bd, bh, bt, flags) :  
                  bd.SetMatrix_Matrix(None, c4d.Matrix())  
                  bd.SetTransparency(-235)  
              
            ...Rest of the plugin code
            

            -ScottA

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

              On 27/02/2013 at 08:45, xxxxxxxx wrote:

              i guess the point is that he is trying to do it from a tag plugin, c4d seems to throttle tag draw
              functions.

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

                On 28/02/2013 at 00:13, xxxxxxxx wrote:

                Yeah that's exactly the point. Tool-plugins like LiquidPainter work without problems, tags not so much 😕

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

                  On 26/03/2013 at 06:57, xxxxxxxx wrote:

                  The developers told me that true transparencies are only possible with shaders.
                  The result is more or less undefined when using BaseDraw::SetTransparency().

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

                    On 26/03/2013 at 07:34, xxxxxxxx wrote:

                    Thanks for the clarification Yannick.

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