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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Blit to MultipassBitmap GeClipMap not working

    Cinema 4D SDK
    r20 c++
    2
    15
    1.7k
    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.
    • C4DSC
      C4DS @r_gigante
      last edited by

      @r_gigante
      I can confirm no problems exist on macOS, the output contains the blitted bitmap, as expected.
      I thus assume the provided implementation is OK, and should work on Windows ... in theory.
      Looking forward to you conclusion.

      1 Reply Last reply Reply Quote 0
      • r_giganteR
        r_gigante
        last edited by

        Hi Daniel,

        I filed a bug report with regard to this unexpected behavior. I will keep you updated on resolution.

        Best, Riccardo

        1 Reply Last reply Reply Quote 1
        • C4DSC
          C4DS
          last edited by

          I was doing a search through the forum related to AutoBitmap and came along this topic.
          What's the current status regarding R20.059, was it fixed in the latest update?
          And what about R21?

          1 Reply Last reply Reply Quote 0
          • r_giganteR
            r_gigante
            last edited by

            Hi Daniel, thanks for following up.

            Honestly, and I would say with huge surprise, I can't reproduce anymore the issue at this time. I've tried rerunning your code on:

            • R20.011
            • R20.030
            • R20.059
            • R21.022
              and on none of these I was able to hit the break point on Windows 10.

            Can you kindly check again and see if it's still the case on your side? I would really like to dive more and understand what's happened in the meantime.

            Cheers, R

            C4DSC 1 Reply Last reply Reply Quote 0
            • C4DSC
              C4DS @r_gigante
              last edited by

              @r_gigante
              I will try to check again, later today.
              However, I noticed you mentioned -early in the thread- you could reproduce it with Visual Studio 2015.
              Might it be the case you are currently using 2017 instead, and therefore don't encounter the issue anymore?
              For R20 I am still developing with 2015 on my laptop (windows 8.1) and use another machine (windows 10) for R21 with Visual Studio 2017.
              I will try to check on both development environments.

              r_giganteR 1 Reply Last reply Reply Quote 0
              • r_giganteR
                r_gigante @C4DS
                last edited by

                @C4DS I've used VS2015 as well to run the tests.

                Cheers

                C4DSC 1 Reply Last reply Reply Quote 0
                • C4DSC
                  C4DS @r_gigante
                  last edited by

                  @r_gigante

                  Tested on R20.057 with VS2015 on Windows 8.1 -> still get the exception, and no output
                  Tested on R21.026 with VS2017 on Windows 10 -> same exception, and no output.

                  1 Reply Last reply Reply Quote 0
                  • r_giganteR
                    r_gigante
                    last edited by r_gigante

                    Hi Daniel, I should strongly apologize here because due to an overlook of mine I forget to copy the test bitmap in the resource folder resulting in the code not to be executed and the breakpoint not to be hit.

                    Sorry about that.

                    I've looked more in detail and in order to get it done you have to actually set the draw mode to GE_CM_DRAWMODE::BLEND by calling

                    		// use a clipmap for drawing/blitting the bitmap
                    		AutoAlloc<GeClipMap> bitmapClipmap;
                    		if (!bitmapClipmap)
                    			return;
                    		if (bitmapClipmap->Init(bitmap) != IMAGERESULT::OK)
                    			return;
                    		clipmap->SetDrawMode(GE_CM_DRAWMODE::BLEND, GE_CM_SRC_MAX_OPACITY);
                    		clipmap->Blit(0, 0, *bitmapClipmap, 0, 0, bitmapClipmap->GetBw() - 1, bitmapClipmap->GetBh() - 1, GE_CM_BLIT::COPY);
                    
                    

                    This will ensure that upon calling the GE_CM_BLIT::COPY the GeClipMap->Blit() function using GE_CM_BLIT::COPY works properly.

                    Unfortunately this doesn't completely solve the issue, because it seems that initing a GeClipMap with a MultipassBitmap created via AddLayer has some issue I still need to investigate.

                    I'll get back on Monday, hopefully, with more details.

                    Again sorry for the confusion and have a nice weekend!

                    C4DSC 1 Reply Last reply Reply Quote 1
                    • C4DSC
                      C4DS @r_gigante
                      last edited by

                      @r_gigante

                      Without the line

                      clipmap->SetDrawMode(GE_CM_DRAWMODE::BLEND, GE_CM_SRC_MAX_OPACITY);
                      

                      I could continue after the "Cinema 4D has triggered a breakpoint" messagebox, now with that extra line I get a plain access violation. (tried on R20 with VS2015)

                      1 Reply Last reply Reply Quote 0
                      • r_giganteR
                        r_gigante
                        last edited by

                        Exactly, that's what I meant by

                        initing a GeClipMap with a MultipassBitmap created via AddLayer has some issue"

                        Without clipmap->SetDrawMode(GE_CM_DRAWMODE::BLEND, GE_CM_SRC_MAX_OPACITY); you hit a default case in a switch statement which fires a critical stop whilst using it you actually try to blit to the GeClipMap but now you end up in a memory issue.

                        I'll get back to you later next week
                        Cheers, R

                        C4DSC 1 Reply Last reply Reply Quote 1
                        • C4DSC
                          C4DS @r_gigante
                          last edited by C4DS

                          @r_gigante
                          While doing some code cleanup to add new features to a plugin, I noticed some comments regarding this particular topic. The comment mentioned the need for a workaround since the Blit() functionality on Windows was faulty.

                          Problem with Blit() and MultipassBitmap still occurs after switching to Visual Studio 2017, Windows 10, running R20.059

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