I used DrawLine2D() to draw the "line", but it was blocked by the other objects. I hope "line" not obscured by any objects. (it's Tool_Plugin)
this is code:
def MouseInput(self, doc, data, bd, win, msg):
mx = msg[c4d.BFM_INPUT_X]
my = msg[c4d.BFM_INPUT_Y]
device = 0
if msg[c4d.BFM_INPUT_CHANNEL]==c4d.BFM_INPUT_MOUSELEFT:
device = c4d.KEY_MLEFT
elif msg[c4d.BFM_INPUT_CHANNEL]==c4d.BFM_INPUT_MOUSERIGHT:
device = c4d.KEY_MRIGHT
else:
return True
dx = 0.0
dy = 0.0
win.MouseDragStart(button=device, mx=int(mx), my=int(my), flags=c4d.MOUSEDRAGFLAGS_DONTHIDEMOUSE|c4d.MOUSEDRAGFLAGS_NOMOVE)
result, dx, dy, channel = win.MouseDrag()
####Add code
front_v = [c4d.Vector(mx,my,0)]
current_v = [c4d.Vector(mx,my,0)]
num = 0
bd.SetPen(c4d.Vector(0,0,1.0))
####
while result==c4d.MOUSEDRAGRESULT_CONTINUE:
mx += dx
my += dy
####Add code
current_v[num] = c4d.Vector(mx,my,0)
num += 1
####
#continue if user doesnt move the mouse anymore
if dx==0.0 and dy==0.0:
result, dx, dy, channel = win.MouseDrag()
num -= 1
continue
c4d.DrawViews(c4d.DA_ONLY_ACTIVE_VIEW|c4d.DA_NO_THREAD|c4d.DA_NO_ANIMATION)
result, dx, dy, channel = win.MouseDrag()
####Add code
for index in xrange(num):
bd.DrawLine2D(front_v[index],current_v[index])
front_v.append(c4d.Vector(mx,my,0))
current_v.append(c4d.Vector(mx,my,0))
####
c4d.DrawViews(c4d.DA_ONLY_ACTIVE_VIEW|c4d.DA_NO_THREAD|c4d.DA_NO_ANIMATION)
return True
Thanks for any help!