BaseDraw problems

On 25/01/2013 at 14:07, xxxxxxxx wrote:


first of all i want to report some problems regarding the BaseDraw class.

1 .BaseDraw.DrawPoints() is still broken

2. BaseDraw.SetPointSize() is being ignored by most of the methods. at least i couldn't get it to
work with DrawLine2D(), DrawLine(), DrawPoint2D() or DrawCircle2D() only DrawHandle() in
custom mode seems to work.

3. the BaseDraw.DrawHandle() method description is at least misleading. the handle is drawn
in your previously set pointsize when you set the flag to  _DRAWHANDLE_CUSTOM  _and 
4. performing 2D drawing operations prior to 3d drawing operations causes the 3d drawing
operations not to be drawn correctly. i am not sure if this is an intended limitation, but this
should be stated then more clearly in the documents.


but i have also a question. every drawing operation ( i tried drawpoint2d, drawhandle2d, 
drawhandle, drawline2d, drawline) is affected by the new highlight outline. i want to suppress 
this behaviour, is this possible ? some 3d drawing opeartions allow me to define a drawing 
pass (highlight pass) which i have not tried yet, because this only applies to complex
shapes like spheres or whole objects.

i want this :

but i get this, when my object is selected :



On 26/01/2013 at 10:03, xxxxxxxx wrote:

SetPointSize() is only supported with DrawPoints(). Even in C++.

Any time I need to use SetPointSize() on a single point, or maybe the two end points in a line segment. I have to build an array of just one or two points. And then use DrawPoints() on it.
It's not broken. Just really silly. Tongue


On 27/01/2013 at 11:35, xxxxxxxx wrote:

hey scott,

i did not knew that and i am also to lazzy to constantly crossread the cpp sdk when i am
looking something up. this should be stated more clearly in the documents, because at 
least for me this was not obvious.

but the other 'problems' still remain i guess, plus the fact, that every drawing operation,
no matter if it is a 2d ord 3d one, is being highlighted. for handles this might be the 
expected/desired behaviour, but i cannot see the reason for the other drawing

do open gl drawing operations done from cpp also come with this 'feature' ?

On 27/01/2013 at 14:26, xxxxxxxx wrote:

When performing 2D draw actions, you have to make sure to (re-)set the draw matrix correctly after you're done.
Some more information on that topic can be found in an article I wrote on the C4Dprogramming blog:
2D drawing using a Scenehook

Also, you have to take care of which DRAWPASS you want to draw in. Make sure to skip DRAWPASS_HIGHLIGHTS to prevent the unwanted highlighting from happening.

On 27/01/2013 at 17:24, xxxxxxxx wrote:

first of all thanks for your help/answer 🙂

The problem is, i do not have access to the drawpass. The python BaseDraw class does not have a GetDrawPass constant like the 
cpp class does. So i cannot check the BaseDraw itself. Some of the more fancy drawing operations provide a drawpass parameter, 
but the Draw() method it self not. tagdata.draw() is defined in the py sdk as followed :

TagData.Draw(self, tag, op, bd, bh)

Which seems to be correct . Tag is the BaseTag, op a BaseObject, bd a BaseDraw and bh a BaseDrawHelp. However there is also a 
small example snippet in the BaseDraw help for basedraw.AddToPostPass() :

def Draw(self, op, drawpass, bd, bh) :
    if drawpass==c4d.DRAWPASS_OBJECT:
        bd.AddToPostPass(op, bh)
    elif drawpass==c4d.DRAWPASS_XRAY:
    if ok==False: return c4d.DRAWRESULT_OK

As python does not provide/require types for input parameters and the naming does not mean anything, but how can the second 
parameter transform into a drawpass ? Drawpass would be in my case a polygonobject. Comparing  a BaseObject with an int/long 
does not make much sense for me. I have just checked the cpp docs on this, which do make it more clear, that Draw() from the 
example code is actually meant to be an overridden ObjectData/TagData.Draw() method.

Bool MyObject::Draw(BaseObject* op, LONG drawpass, BaseDraw* bd, BaseDrawHelp* bh)
    if (drawpass==DRAWPASS_OBJECT) 
    else if (drawpass==DRAWPASS_XRAY)
    if (!ok) return;

I am totally confused right now, how is this magic transformation of the 2nd input parameter meant ? Is the Draw() method 
(undocumented) overloaded ? One version with a LONG as second parameter and one with a BaseObject and c4d calls them both ? 
If it is so, how is then the example in python to be understood, as python has no type overloading and the parameter count 
is the same ?

edit :
just changed out of curiosity i have changed the parameter naming of my draw method to Draw(self, op, drawpass, bd, bh). as 
expected, this does not change anything for the given parameter types.

On 28/01/2013 at 01:13, xxxxxxxx wrote:


It's currently not possible to check the drawpass from a TagData plugin because as you've said it before, BaseDraw.GetDrawPass() doesn't exist in the Python SDK.
Don't try to hack: TagData.Draw(self, tag, op, bd, bh) is the only hook to override TagData.Draw().

And the Draw() method example for BaseDraw.AddToPostPass() in the documentation is only relevant to ObjectData plugins. I'll add a note.

On 28/01/2013 at 02:27, xxxxxxxx wrote:


thanks for the clarification, it would be cool, if the devs could add this to their todo list. at least
some sort of highlight pass filtering. in the current state the value of draw is quite limited due
to the described problem.

On 28/01/2013 at 02:39, xxxxxxxx wrote:


i currently writing a second tag plugin, which draws some point normals with draw, there the 
highlighting problem does not occur. i could have sworn that the problem in my first tag plugin
also occurred for other drawing operations than drawhandle. i am slightly confused right now,
i guess i'll have to go back and check if can build up some handles out of 3d lines.

edit : ah ok, when i select my tag and the polygon object, while hovering the polygonobject it 
happens also, while for handles selecting the tag and the polygonobject is enough, i guess
this sort of intended / a feature.

edit2: nope, it was the drawing color, same mess as for my first plugin, drawing with black 
seems to suppress somehow the highlighting.