Need to create an window for camera view



  • On 16/08/2018 at 04:20, xxxxxxxx wrote:

    HI team, I need to create a small window to see the preview of the camera. I know that cinema4d has the option to see the view of the camera, but I need to create a small window that displays the view of the camera at 720x1280.



  • On 17/08/2018 at 08:51, xxxxxxxx wrote:

    Hi,

    is this a question how to achieve such in general or via code? If the question is for code than I'd recommend to rather post into SDK Help subforum for C++ or Python subforum for Python.

    As a user you can just create a "New View Panel..." from the Window menu. You can resize it to your needs, dock it where ever you like (or have it on a second screen) and select what ever camera you want within its "Cameras" menu.

    Via code you could do something like this (you didn't specify a language, I'll be using Python in Script Manager here) :

    import c4d
      
    def main() :
        cam = doc.GetFirstObject() # in test scene the wanted camera is the first object
        if cam is None or not cam.CheckType(c4d.Ocamera) :
            print "No camera"
            return
        c4d.CallCommand(12544) # New View Panel...
        bdNew = doc.GetActiveBaseDraw()
        bdNew.[SetSceneCamera](https://developers.maxon.net/docs/Cinema4DPythonSDK/html/modules/c4d/C4DAtom/GeListNode/BaseList2D/BaseView/BaseDraw/index.html?highlight=basedraw#BaseDraw.SetSceneCamera)(cam)
        bdNew.SetParameter(c4d.BASEDRAW_DISPLAYFILTER_GRID, False, c4d.DESCFLAGS_SET_0)
        c4d.EventAdd()
      
    if __name__=='__main__':
        main()
    

    The BaseDraw offers quite a few options via SetParameter(). The IDs are unfortunately only listed in the C++ docs: dbasedraw.h

    So far so good. But it is impossible to dock the new view panel into the layout nor to change the window size of the new view panel via code.



  • On 20/08/2018 at 02:23, xxxxxxxx wrote:

    Thanks for your valuable comment I am using C++ as the development language. So can you specify me any sample code or example project that clarifies the way to create camera preview window?



  • On 24/08/2018 at 05:33, xxxxxxxx wrote:

    Hi,

    my code snippet in the last post actually does it already. And the Python API is (with very few exceptions) exactly the same as the C++ API. So you should be able to use my example from above.


Log in to reply