DrawLine2D on top of everything else

On 09/02/2014 at 14:27, xxxxxxxx wrote:

Hi
Im struggeling with how i can get DrawLine2D to be draw on top of the other scene objects. I have a tooldata plugin and im drawing a simple rectangle inside the MouseInput function:

  
(omitted code)   
# Draw a rectangular region in the picture viewer   
        while result==c4d.MOUSEDRAGRESULT_CONTINUE:   
            mx += dx   
            my += dy   
  
            p2 = c4d.Vector(mx,firstMy,0)   
            p3 = c4d.Vector(mx,my,0)   
            p4 = c4d.Vector(firstMx,my,0)   
  
            # bd.SetDepth()   
            bd.LineZOffset(100)   
            bd.SetMatrix_Screen()   
            # bd.SetMatrix_Camera()   
  
            bd.SetPen(c4d.Vector(0.9,0.9,0.9),c4d.SET_PEN_USE_PROFILE_COLOR)   
            bd.SetDepth(True)   
  
            bd.DrawLine2D(p1, p2)   
            bd.DrawLine2D(p2, p3)   
            bd.DrawLine2D(p3, p4)   
            bd.DrawLine2D(p4, p1)   
  
            c4d.DrawViews(c4d.DA_ONLY_ACTIVE_VIEW|c4d.DA_NO_THREAD|c4d.DA_NO_ANIMATION)   
            result, dx, dy, channel = win.MouseDrag()   
  
(omitted code)   

The rectangle is drawn on top of the grid but behind shaded objects. How can i draw it on top of everything else in the scene? Setting the LineZOffset doesn't seem to have an effect.

Any help appreciated

Cheers
Bonsak

On 10/02/2014 at 14:02, xxxxxxxx wrote:

Ok. Moving the drawing of the lines to the Draw function solves the problem :)

Cheers
Bonsak

On 11/02/2014 at 06:31, xxxxxxxx wrote:

Yep, drawing only in the Draw procedures. ;-) Anything else could even crash the program!

On 11/02/2014 at 07:33, xxxxxxxx wrote:

I had a couple of crashes with the old version so i rewrote the whole thing :) Thanks.

Cheers
Bonsak