OpenGL Drawing Order



  • On 05/04/2016 at 10:39, xxxxxxxx wrote:

    Hi all!

    Is there a way to change the OGL drawing order for certain objects from inside a CommandPlugin?

    Thanks a lot & best regards!
    Paul



  • On 06/04/2016 at 02:04, xxxxxxxx wrote:

    Hello,

    the order in which elements are drawn in the editor viewport cannot be changed. But the "Draw()" function of elements is called several times during the viewport drawing for several render passes. So the behaviour of a specific element depends on what it does in a certain render pass and not when "it is drawn".

    Best wishes,
    Sebastian



  • On 06/04/2016 at 11:56, xxxxxxxx wrote:

    Hi Sebastian,

    thanks for your answer!

    In other languages i would create a subclass and override the Draw() method... how to do that in python from within a CommandData plugin?

    Thanks for your help & best regards :)
    Paul



  • On 06/04/2016 at 12:04, xxxxxxxx wrote:

    The idea is to create a substitute for the relatively slow ghosting with a spline (already got that) and draw it on top of everything else...

    Best regards,
    Paul



  • On 07/04/2016 at 00:20, xxxxxxxx wrote:

    Hello,

    the CommandData class does not offer a "Draw" function because it is not supposed to draw anything in the viewport (it should only execute some code).

    A CommandData plugin instance is not part of a BaseDocument. Only elements that are part of the BaseDocument (objects, tags or tools) can draw something in the viewport. For general drawing operations in the viewport one could use a SceneHookData plugin but this class is only available in the C++ SDK.

    Best wishes,
    Sebastian



  • On 07/04/2016 at 03:54, xxxxxxxx wrote:

    Hi Sebastian,

    yeah, I already had a look at the SceneHook. Really sad there is none for Python.
    But thinking over my question maybe it already contains a viable solution...

    If every object has its own Draw() method, I could write a subclass of c4d's spline class and override the Draw() method? Then I instantiate my custom spline and add it to the BaseDocument.

    The only question is: How do I create a custom subclass? So far I create objects with:

    newObj = c4d.BaseObject( [c4d.Osomething] )
    

    How would I do that with custom subclasses?

    Thanks & best :)
    Paul



  • On 07/04/2016 at 09:33, xxxxxxxx wrote:

    Hello,

    one cannot create subclasses of existing Cinema classes. It is only possible to create subclasses of dedicated plugin classes like ObjectData.

    Best wishes,
    Sebastian



  • On 07/04/2016 at 09:36, xxxxxxxx wrote:

    Hi Paul,

    I have a few free python drawing plugin examples posted on my website that might give you some help.
    The one called "PyDrawSmoothSpline" might be something worth looking at.
    https://sites.google.com/site/scottayersmedia/plugins

    Since SH is not supported in python. The alternative is hosting the drawn object in a tag, object, or in a tool plugin.
    Tags and objects can also be made invisible if desired.

    -ScottA



  • On 07/04/2016 at 09:37, xxxxxxxx wrote:

    Hi Scott!

    Thanks a lot, will have a look :)

    Best regards,
    Paul


Log in to reply