I have a ToolData plugin where the user can draw Planes.
I use MouseInput() to get the inital point and then MouseDragStart() and MouseDrag() to get the other point of the Plane.
Is there a way to snap to the grid using MouseDragStart() and MouseDrag() or is that something I have to do myself?
Something like snapPoint = grid_size * round(point / grid_size)
mousex = msg[c4d.BFM_INPUT_X]
mousey = msg[c4d.BFM_INPUT_Y]
leftTop = c4d.Vector(mousex, mousey, 0)
win.MouseDragStart(c4d.KEY_MLEFT, mousex, mousey, c4d.MOUSEDRAGFLAGS_DONTHIDEMOUSE|c4d.MOUSEDRAGFLAGS_NOMOVE)
color = c4d.Vector(256,256,256)
bd.SetMatrix_Screen() #Use the screen's matrix to draw on
mx = mousex
my = mousey
while True:
result, dx, dy, channels = win.MouseDrag()
if result!=c4d.MOUSEDRAGRESULT_CONTINUE: break
mx += dx
my += dy
rightBottom = c4d.Vector(mx, my,0)
self.v1 = leftTop
self.v2 = rightBottom
bd.SetDepth(True)
c4d.DrawViews(c4d.DA_ONLY_ACTIVE_VIEW|c4d.DA_NO_THREAD|c4d.DA_NO_ANIMATION)