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

    DrawPolygoneObject - Overlapping wrong direction

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 652 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 02/09/2017 at 10:50, xxxxxxxx wrote:

      Hi there,

      I draw some polygon objects into viewport from ObjectData.Draw and have troubles with the overlapping of the objects. It seems that the objects are drawn from the foreground to the background of the scene, so the objects closer to the editorcam are overlapped by the objects with a larger distance. Ive tried to reverse the order of drawing, but it didnt fixed it. Flipping polygon normals didnt fixed it, too. Has anyone an idea?

      Here 2 screenshots to illustrate the problem better.

      https://www.dropbox.com/s/s6qd8edceh0hfph/Screenshot_2017-09-02 19_24_36.png?dl=0
      https://www.dropbox.com/s/4jm261xv2qx457c/Screenshot_2017-09-02 19_24_58.png?dl=0

      Thx and Greetings
      rownn

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

        On 05/09/2017 at 04:01, xxxxxxxx wrote:

        Hi Rownn, thanks for writing us.

        With reference to your question, i wasn't able to reproduce the issue you mentioned. It's also unclear if the ObjectData is only responsible for drawing the polygon or also for generating some geometry in the scene. In my tests the polygon drawn by the ObjectData::Draw function appears properly represented in terms of draw-depth.

        ![]([URL-REMOVED]

        Might you provide some additional information?

        I also suggest, although not 100% related, to have a look here[URL-REMOVED] where Frank (a former colleague of us) touched the draw topic concerning 2D primitives in TagData.

        Best, Riccardo


        [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

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

          On 05/09/2017 at 06:39, xxxxxxxx wrote:

          Hey Riccardo,

          alot of thx for your efforts!

          I´ve also wrote a special to test objectData and it produce the same issue.

          import os  
          import math  
          import sys  
          import c4d  
            
          from c4d import plugins, utils, bitmaps, gui  
            
          PLUGIN_ID = 1234589123 #TestID  
            
          print "DrawTest"  
            
          class DrawTest(plugins.ObjectData) :  
            
            
            def GetVirtualObjects(self, op, hierarchyhelp) :  
                return None  
            
            def Draw(self, op, drawpass, bd, bh) :  
                if drawpass!=c4d.DRAWPASS_HANDLES: return c4d.DRAWRESULT_SKIP  
            
                bd.SetMatrix_Matrix(op, bh.GetMg())  
            
                A = op.GetDown()  
                if not A: return c4d.DRAWRESULT_OK  
                B = A.GetNext()  
                if not B: return c4d.DRAWRESULT_OK  
            
                Ac = A.GetClone()  
                Ac[c4d.ID_BASEOBJECT_VISIBILITY_EDITOR] = 0  
                Bc = B.GetClone()  
                Bc[c4d.ID_BASEOBJECT_VISIBILITY_EDITOR] = 0  
            
                bd.DrawPolygonObject(bh, Ac, c4d.DRAWOBJECT_0)  
                bd.DrawPolygonObject(bh, Bc, c4d.DRAWOBJECT_0)  
                  
                return c4d.DRAWRESULT_OK  
            
            
            
          if __name__ == "__main__":  
            dir, file = os.path.split(__file__)  
            icon = bitmaps.BaseBitmap()  
            icon.InitWith(os.path.join(dir, "res", "Icon_Default.png"))  
            plugins.RegisterObjectPlugin(id=PLUGIN_ID, str="DrawTest",  
                                        g=DrawTest,  
                                        description="DrawTest", icon=icon,  
                                        info=c4d.OBJECT_GENERATOR)
          

          https://www.dropbox.com/s/ahvqxl020tblzub/drawtest.gif?dl=0

          greetings
          rownn

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

            On 05/09/2017 at 07:02, xxxxxxxx wrote:

            Make sure to reset the 3D matrix after you have draw everything in order to correctly set it back to 3D space as said in the article from Frank Willeke given by Riccardo

            bd.SetMatrix_Matrix(None, Matrix())
              
            return c4d.DRAWRESULT_OK
            
            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 05/09/2017 at 07:42, xxxxxxxx wrote:

              Unfortunately, it makes no difference. And in Py-RoundedTube.pyp this line is missed, too. But I´ll keep it in mind if I´ve to fix other issues.

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