Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Create & save image of the Editor viewport?

    Scheduled Pinned Locked Moved SDK Help
    13 Posts 0 Posters 1.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 22/11/2009 at 13:37, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   10-11.5 
      Platform:   Windows  ;   Mac OSX  ; 
      Language(s) :     C++  ;

      ---------
      Hi,

      is it possible to create an image of the current editor view from within a CommandData plugin or a GeDialog? Editor display would be enough.

      Thanks for any hints!

      Cheers,
      Jack

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 22/11/2009 at 14:27, xxxxxxxx wrote:

        Hi, check out RenderDocument with the PREVIEW flag. Hope this helps. Bye.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 22/11/2009 at 16:33, xxxxxxxx wrote:

          It helps about 50% 😛

          I get a nice rendering of the scene, but I want to get a view of the editor. In my case most users will not want to wait for a long time, so I want to give them the chance to use a simple view from the OpenGL or Software shaded editor view, if their scene is very complex.

          RenderDocument always creates a rendering, except the user creates a render setting for an editor rendering.

          Cheers,
          Jack

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 22/11/2009 at 16:43, xxxxxxxx wrote:

            RenderDocument always creates a rendering, except the user creates a render setting for an editor rendering.

            Its strange that the preview flag does not work. Try this: This will work definitley:

              
            RenderData *rdata = /*recieve the renderdata*/;   
            [...]   
            BaseContainer bc = rdata->GetData();   
            bc.SetLong(RDATA_RENDERENGINE, RDATA_RENDERENGINE_PREVIEWSOFTWARE);   
            /* pass bc to RenderDocument */   
            

            Hope this helps. Bye 🙂

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 22/11/2009 at 17:09, xxxxxxxx wrote:

              OK, that helps in R11.5 (didn't try in R11.0). Better than nothing, thanks!
              But how can I make it work in R10?

              RDATA_RENDERENGINE and RDATA_RENDERENGINE_PREVIEWSOFTWARE are not defined in the R10 SDK.

              And another question: How do I use the Parameter "ProgressHook* pr" of the RenderDocument() function to show the rendering progress?

              Cheers,
              Jack

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 23/11/2009 at 01:14, xxxxxxxx wrote:

                RDATA_RENDERENGINE and RDATA_RENDERENGINE_PREVIEWSOFTWARE are not defined in the R10 SDK.

                Ah, you compile for R10, right. In this case, you have to split the code because in R10 the constants are different. Open the RenderData page in the R10 SDK documentation. Otherwise drag the attribute from the RenderSettings to the Console to get the ID Name.

                And another question: How do I use the Parameter "ProgressHook* pr" of the RenderDocument() function to show the rendering progress?

                Just pass a function as callback. When you open the index page of the documentation, look for "ProgressHook" so you get this information:

                typedef ProgressHook(Real p, void* private_data)
                

                In this case just create a function with these arguments like:

                void YourFunction(Real p, void* private_data)
                

                Now you can pass "YourFunction" to RenderDocument. Bye

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 23/11/2009 at 03:03, xxxxxxxx wrote:

                  Hm OK, it seems that setting the render engine (in R11/R11.5) or setting the RENDERASEDITOR property to 1 (in R10) does not help. Because all Cinema versions just output a black image if I do that 😞 There is obviously more one has to do to make it work,but it's not documented.

                  I guess I'll kick the image support out for now, and maybe add it later. Still, it would be interesting if somebody (Matthias? Come on 🙂 ) could find out about that.

                  Cheers,
                  Jack

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 23/11/2009 at 03:49, xxxxxxxx wrote:

                    Could you post a piece of your code?

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Helper
                      last edited by

                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                      On 23/11/2009 at 03:56, xxxxxxxx wrote:

                      Of course, here it is (for R11) :

                        
                      // Create Filename   
                      Filename ifn = Filename(settings->GetString(IDC_CDOC_FILENAME));   
                      ifn.SetFile("image");   
                      ifn.SetSuffix("jpg");   
                        
                      LONG x = 320;   
                      LONG y = 240;   
                        
                      // Allocate & init bitmap   
                      BaseBitmap *bmp = BaseBitmap::Alloc();   
                      if (!bmp) goto ErrorHandling;   
                      bmp->Init(x, y);   
                        
                      // Get Render Data   
                      rd = doc->GetActiveRenderData();   
                      if (!rd) goto ErrorHandling;   
                        
                      // Get Copy from & modify Render Data   
                      BaseContainer rdc = rd->GetData();   
                      rdc.SetLong(RDATA_XRES, x);   
                      rdc.SetLong(RDATA_YRES, y);   
                      rdc.SetLong(RDATA_RENDERENGINE, RDATA_RENDERENGINE_PREVIEWSOFTWARE);   
                        
                      // Render image   
                      if (RenderDocument(doc, rdc, NULL, NULL, bmp, 0/*RENDERFLAG_PREVIEWRENDER*/, NULL) == RAY_OK) {   
                           BaseContainer imgdata;   
                           imgdata.SetLong(JPGSAVER_QUALITY, 90);   
                           imgdata.SetLong(IMAGESAVER_DPI, 96);   
                           LONG Result = bmp->Save(ifn, FILTER_JPG, &imgdata;, 0);   
                           if (Result != IMAGE_OK)   
                                GeOutString(GeLoadString(IDS_RENDERIMAGE_ERRORMSG), GEMB_OK);   
                      }   
                      

                      If I don't set the RDATA_RENDERENGINE parameter, it renders out fine. But if I set it, only a black image is output.

                      Cheers,
                      Jack

                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        Helper
                        last edited by

                        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                        On 23/11/2009 at 06:02, xxxxxxxx wrote:

                        Hmm.. thats strange, Your code seems to be fine. Maybe Matthias has a suggestion?

                        1 Reply Last reply Reply Quote 0
                        • H Offline
                          Helper
                          last edited by

                          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                          On 23/11/2009 at 06:04, xxxxxxxx wrote:

                          I hope he does 🙂

                          1 Reply Last reply Reply Quote 0
                          • H Offline
                            Helper
                            last edited by

                            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                            On 23/11/2009 at 08:45, xxxxxxxx wrote:

                            You have to set the  RENDERFLAG_EXTERNAL flag in RenderDocument.

                            cheers,
                            Matthias

                            1 Reply Last reply Reply Quote 0
                            • H Offline
                              Helper
                              last edited by

                              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                              On 23/11/2009 at 08:52, xxxxxxxx wrote:

                              YES! That's it.
                              Didn't think of that.
                              Thanks a lot!

                              Cheers,
                              Jack

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post