Object Plugin not Rendering, ok in Viewport



  • On 02/07/2015 at 04:09, xxxxxxxx wrote:

    Hi c4d Community

    i'm trying to learn the Basics of python Plugin development, and i'm stuck with a little Problem.

    I wrote a script, which sets Keys on a Plugin-Object and then changes the Active Camera in the Object Manager acordingly to the Keyvalues. This works fine in the Viewport, but when I render nothing changes.

    The "key to camera comparison" functions are called in the Draw function like this:

    def Draw(self, op, drawpass, bd, bh) :
        if drawpass == c4d.DRAWPASS_OBJECT:
            self.activate_scene(op)
            self.activate_light(op)
            self.activate_camera(op)
        return c4d.DRAWRESULT_OK

    Do I have to "set" something in General or in my functions to say that the Render is the Same than the Viewport? c4d.EventAdd() and c4d.CallCommand(12147) seem to make no difference as well...

    Sorry for this "noobish" question ;)
    Thanks!!



  • On 03/07/2015 at 02:19, xxxxxxxx wrote:

    Hello,

    Draw() functions are just used to draw something in the (OpenGL) viewport. So this function has nothing to do with the rendering process and therefore is not called during rendering.

    In fact, the viewport drawing (an the call of Draw()) is executed from a separate thread. So it is forbidden to manipulate the scene from Draw(). Please read "Threading Information". Modifying the scene from the drawing-thread could lead to any kind of problems including crashes.

    Best wishes,
    Sebastian



  • On 04/07/2015 at 01:40, xxxxxxxx wrote:

    Ah I get it, thanks for your reply :) But now the next question is, which functions are responsible for the rendering output. Which functions are called for the actual Rendering process? 
    I would be very happy to get some tipps, because I somehow can't figure it out.
    Thanks a lot!



  • On 13/07/2015 at 05:24, xxxxxxxx wrote:

    Hello,

    the functions responsible for the rendering output are the functions responsible for the state of the scene. In case of a generator this is ObjectData.GetVirtualObjects, in case of a tag it is TagData.Execute, etc.

    best wishes,
    Sebastian


Log in to reply