DrawPolygoneObject - Overlapping wrong direction

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

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.

Might you provide some additional information?

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

Best, Riccardo

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()  
      Bc = B.GetClone()  
      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",  
                              description="DrawTest", icon=icon,  



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

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.