hello,
setting the matrix to screen seems to work.
"""
Draw multiple text From Tag
"""
import c4d
from c4d import plugins, utils, bitmaps, gui
# Be sure to use a unique ID obtained from www.plugincafe.com
PLUGIN_ID = 1052927
class TDRAW_EXAMPLE(c4d.plugins.TagData):
def Draw(self, tag, op, bd, bh):
# Returns if object is not a polygon object
if not op.IsInstanceOf(c4d.Opolygon):
return c4d.DRAWRESULT_OK
# Retrieves the Object Matrix
opMg = op.GetMg()
# Retrieves All Points
points = op.GetAllPoints()
# Retrieves Global Coordinates
points = [opMg * p for p in points]
# From world to screen Coordinates (in another array)
screenPoints = [ bd.WS(p) for p in points ]
# Prepares the dictionary for the draw multipleHUDText Draw Point Coordinates (world space) at screenPoint Position.
value = [ { "_txt" : "point " + str(i) + " " + str(pos[0]) , "_position" : pos[1] } for i, pos in enumerate(zip(points, screenPoints)) ]
# Sets the matrix to screen space
bd.SetMatrix_Screen()
# Enables depth buffer.
bd.SetDepth(True)
# Draws points indices at point coordinates
bd.DrawMultipleHUDText(value)
return c4d.DRAWRESULT_OK
def Execute(self, tag, doc, op, bt, priority, flags):
return c4d.EXECUTIONRESULT_OK
if __name__ == "__main__":
# Register the tag
c4d.plugins.RegisterTagPlugin(id=PLUGIN_ID,
str="Tag that draw on viewport",
info=c4d.TAG_EXPRESSION | c4d.TAG_VISIBLE,
g=TDRAW_EXAMPLE,
description="tdrawexample",
icon=None)

tdrawexample.h
#ifndef __TDRAWEXAMPLE_H__
#define __TDRAWEXAMPLE_H__
enum
{
};
#endif // __pc11519_H__
tdrawexample.res
CONTAINER tdrawexample
{
NAME tdrawexample;
INCLUDE Obase;
GROUP ID_OBJECTPROPERTIES
{
}
}
tdrawexample.str
STRINGTABLE tdrawexample
{
tdrawexample "Draw on viewport from tag";
}
c4d_symbol.h
enum
{
// End of symbol definition
_DUMMY_ELEMENT_
};
Cheers
Manuel