On 28/04/2016 at 03:44, xxxxxxxx wrote:
Hello people!
I have some problems with the BaseDraw, one with DrawTexture() and one with SetMatrix_Screen().
- Using SetMatrix_Screen() causes other object's visuals to be corrupted
- I get a strange "cut" on the right side of the image drawn with DrawTexture()
- I can't get the image to be drawn on top of the Cube
This image shows all problems:
You can download a full example to reproduce here: https://cloud.niklasrosenstein.com/index.php/s/wkAnX8zFfvlV7VV
The relevant code is:
def Draw(self, op, drawpass, bd, bh) :
if drawpass != c4d.DRAWPASS_OBJECT: return c4d.DRAWRESULT_SKIP
if not self.PluginIcon: return c4d.DRAWRESULT_SKIP
wpsize = 48
# Draw the object icon on the screen.
pos = bd.WS(op.GetMg().off)
bmp = self.PluginIcon
padr = get_draw_screen_padr(pos, wpsize, wpsize, ALIGN_CENTERH | ALIGN_BOTTOM)
uvadr = get_draw_screen_uvcoords(bmp, 0, 0, bmp.GetBw(), bmp.GetBh())
cadr = [c4d.Vector(1.0)] * 4
vnadr = [c4d.Vector(0.0, 0.0, 1.0)] * 4
mode = c4d.DRAW_ALPHA_NORMAL
flags = c4d.DRAW_TEXTUREFLAGS_0
bd.SetMatrix_Screen(4)
bd.DrawTexture(self.PluginIcon, padr, cadr, vnadr, uvadr, 4, mode, flags)
return c4d.DRAWRESULT_OK
I have no idea how to solve either of those issues. Looking forward to your input!
Thanks in advance,
Niklas