Hi @blastframe,
I know that your question has been answered, but just for completeness and future readers - here is a small example for how you can pipe drawing operations to different viewports.
Cheers,
Ferdinand
"""How to limit drawing operations to certain view ports and cameras.
"""
import c4d
def draw(bd):
"""
"""
# Get the camera attached to the view port that has been passed.
camera = bd.GetSceneCamera(doc)
# We only want to draw into a camera "MyCamera" attached to a view port.
# Using the name of the camera is of course a bad method of
# identification, better would be comparing it against a BaseLink.
if (isinstance(camera, c4d.CameraObject) and
camera.GetName() == "MyCamera"):
# Draw a red dot in top left corner of the viewport.
bd.SetMatrix_Screen()
bd.SetPen(c4d.Vector(1, 0, 0))
bd.DrawHandle(vp=c4d.Vector(50, 50, 0),
type=c4d.DRAWHANDLE_BIG,
flags=0)
# Draw into all view ports that have a camera with right projection.
elif (isinstance(camera, c4d.CameraObject) and
camera[c4d.CAMERA_PROJECTION] == c4d.Pright):
# Draw a green dot in top left corner of the viewport.
bd.SetMatrix_Screen()
bd.SetPen(c4d.Vector(0, 1, 0))
bd.DrawHandle(vp=c4d.Vector(50, 50, 0),
type=c4d.DRAWHANDLE_BIG,
flags=0)
# And finally draw into any view port that is labeled as "Top". This is
# probably a bit dicey, since we rely on a string here.
elif bd.GetName() == "Top":
# Draw a blue dot in top left corner of the viewport.
bd.SetMatrix_Screen()
bd.SetPen(c4d.Vector(0, 0, 1))
bd.DrawHandle(vp=c4d.Vector(50, 50, 0),
type=c4d.DRAWHANDLE_BIG,
flags=0)
return True
def main(): pass
Giving you something like this:
