Disappearing cube in ToolData.Draw method
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/11/2012 at 07:21, xxxxxxxx wrote:
Hi.
Again a little problem I ran into, so here's a small and simplified piece of code:def Draw(self, doc, data, bd, bh, bt, flags) : bd.SetMatrix_Matrix(op, bh.GetMg()) gplist = [c4d.Vector(-100, -100, 300), c4d.Vector(100, -100, 300), c4d.Vector(100, -100, 500), c4d.Vector(-100, -100, 500), c4d.Vector(-100, 100, 300), c4d.Vector(100, 100, 300), c4d.Vector(100, 100, 500), c4d.Vector(-100, 100, 500)] polys = [] polys.extend([c4d.CPolygon(0, 1, 2, 3), c4d.CPolygon(4, 7, 6, 5), c4d.CPolygon(0, 3, 7, 4), c4d.CPolygon(1, 5, 6, 2), c4d.CPolygon(0, 4, 5, 1), c4d.CPolygon(2, 6, 7, 3)]) poly = c4d.PolygonObject(8,6) for i in range (0, 8) : poly.SetPoint(i, gplist[i]) for i in range (0, 6) : poly.SetPolygon(i, polys[i]) poly[c4d.ID_BASEOBJECT_COLOR] = c4d.Vector(0,1,0) bd.DrawPolygonObject(bh, poly, c4d.DRAWOBJECT_USE_OBJECT_COLOR) return c4d.DRAWRESULT_OK
This code draws a cube into the scene, so far so good. But depending on the position of the camera it disappears. I experienced this with nearly all methods to draw stuff (DrawLine, DrawPolygon, DrawPolygonObject), but not all the time. Sometimes the DrawPolygon method works flawless, I can zoom into the scene without disappearing of the object, sometimes I can't. I think it may have something to do with clipping, or the z-buffer but couldn't find anything helpful in the SDK or via the forum search (I found this method "ZSensitiveFarClipping" but this just returns the value, and there's no corresponding method for setting a value. If it is even the cause of the behaviour). So maybe someone could help me out here.
Thanks
Phil -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/11/2012 at 09:07, xxxxxxxx wrote:
Have you tried this dummy 2D object trick?
https://developers.maxon.net/forum/topic/6691/7296_couple-of-python-dev-qs-for-the-masters-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/11/2012 at 09:23, xxxxxxxx wrote:
Hi Scott.
Just tried it, sadly it doesn't work. Maybe it really just works with the 2D methods, but I need to use the real 3D methods.
I just noticed that the cube disappears when I move the camera and the world origin leaves the viewport and is not seen anymore. Maybe that helps in any way to find out what this is all about.
Phil