Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > General Discussion
  New Posts New Posts
  FAQ FAQ  Forum Search

Need to create an window for camera view

Author
Message
  Topic Search Topic Search
amlendra View Drop Down
Member
Member


Joined: 2018 Feb 01
Online Status: Offline
Posts: 46
Direct Link To This Post Topic: Need to create an window for camera view
    Posted: 2018 Aug 16 at 4:20am
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.
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1878
Direct Link To This Post Posted: 2018 Aug 17 at 8:51am
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(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.

Cheers,
Andreas
SDK Support Engineer
Back to Top
amlendra View Drop Down
Member
Member


Joined: 2018 Feb 01
Online Status: Offline
Posts: 46
Direct Link To This Post Posted: 2018 Aug 20 at 2:23am
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?
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1878
Direct Link To This Post Posted: 2018 Aug 24 at 5:33am
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.

Cheers,
Andreas
SDK Support Engineer
Back to Top

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.094 seconds.