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

    Troubles with user areas

    Scheduled Pinned Locked Moved SDK Help
    6 Posts 0 Posters 463 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 12/06/2006 at 01:49, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   9.603 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hi all, I'm developing a plugin that uses a modeless dialog, and I need to create and center a user area, complete with scollbars. This is my code:
      ScrollGroupBegin(10,BFH_SCALEFIT|BFV_SCALEFIT,SCROLLGROUP_VERT|SCROLLGROUP_HORIZ);
      {
       GroupBegin(2,BFH_SCALEFIT|BFV_SCALEFIT,1,0,"",BFV_GRIDGROUP_ALLOW_WEIGHTS);
       { 
        gadgetua = AddUserArea(1006,BFH_SCALEFIT|BFV_SCALEFIT,0,0); 
        if (gadgetua)
         AttachUserArea(ua,gadgetua);
       }
       GroupEnd();
      }
      GroupEnd();
      The user area is visible, but it's left-top aligned, not centered. Also, the scrollbars appears in grey and they are always disabled.
      Have some suggestions?...

      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 15/06/2006 at 06:04, xxxxxxxx wrote:

        - Ok, my code for the scroll group became this:_<_o:_<_o:p_>_o:p>

            
            
            ScrollGroupBegin(10, BFH_SCALEFIT|BFV_SCALEFIT, SCROLLGROUP_STATUSBAR | SCROLLGROUP_VERT | SCROLLGROUP_HORIZ);{
            
                   GroupBorder(BORDER_IN);
            
                   gadgetua = AddUserArea(1006,BFH_CENTER|BFV_CENTER,100,100);
            
                   if (gadgetua) 
            
                         AttachUserArea(ua,gadgetua);
            
            }_T-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
            
            GroupEnd();
        

        _SPAN> 
        Now the user area has a non-zero dimension, so when I resize the dialog, the scroll bars works well. The problem now is that the user area look_<_o:_<_o:p_>_rectangle, not as a 100x100 square, as specified in the AddUserArea().
        Also, I use DrawBitmap() to draw a picture in the user area. Is it possible to resize the user area according the bitmap size? In my pr_<_o:_<_o:p_>_implementation I used the flag BFH_SCALEFIT|BFV_SCALEFIT, but it didn't work.
        _nother question: I used this code to render a frame and get the image alpha channel:

            
            
            if((RenderDocume_<_o:_<_o:p_>_ rd, NULL, NULL, bitmap, RENDERFLAG_EXTERNAL, NULL, NOTOK, NOTOK, NOTOK, NOTOK)) == RAY_OK)
            
            
            
            
            _EN-GB style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-GB">.
            
            
            
            
            .
            
            
            
            
            .
            
            
            
            
            AlphaBitmap* channel = bitmap->GetChannelNum(0);
            
            
            
            
            UWORD alpha = 0;
            
            
            
            
             
            
            
            
            
            for(int i=0; i<x; i++)
            
            
            
            
            {
            
            
            
            
                     for(int j=0; j<y; j++)
            
            
            
            
                     {
            
            
            
            
               &n;_<_o:_<_o:p_>_sp;             bitmap->GetAlphaPixel(channel, i, j, &alpha);
            
            
            
            
                _<_o:_<_o:p_>_nbsp;            bitmap->SetPixel(i,j,(LONG)alpha, (LONG)alpha, (LONG)alpha);
            
            
            
            
                     _ style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 'Courier New'">}
            
            
            
            
            }
            
            
            
        

        The problem is that the function GetAlphaPixel() returns only zero values, no matter what is there in scene. Any suggestions?_<_o:_<_o:p_>_ss=Msonormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none">Thanks

        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 15/06/2006 at 09:59, xxxxxxxx wrote:

          I have no problems with:

          AddUserArea(1006,BFH_SCALEFIT|BFV_SCALEFIT);

          but then I've not succeeded in using a scrollgroup with it either. The problem is that a scrollgroup for a userarea will require a limited size userarea (virtual space). If you want an unlimited virtual space, you'll need to control the scrolling either some other way (I use my own drag and zoom controls) or find a way to get the userarea and scrollgroup to integrate and control the scrollgroup's details yourself (as I said, no success here).

          As for the render alphamap, the render will need to have an alpha channel render - otherwise, zero values is correct. No alpha channel, zeroes. Why are you getting the alpha pixel and setting the RGB pixels to the alpha value?

          Robert

          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 16/06/2006 at 01:26, xxxxxxxx wrote:

            Thanks for the help Robert
            I'm trying to get the alpha channel and visualize it as a gray scale image in my custom picture viewer. This code allocates a BaseBitmap, using the active render settings, and add it an alpha channel. This bitmap is then passed to the render, as showed in my previous post. Also, the option "Alpha Channel" in C4D Render Settings is checked correctly.

                
                
                  BaseDocument* doc;_<_o:_<_o:p_>_o:p>
                
                  BaseContai_<_o:_<_o:p_>_
                
                  doc = GetAct_<_o:_<_o:p_>_ment();
                
                  RenderData*  rd = doc->G_<_o:_<_o:p_>_eRenderData();
                
                  .
                
                  .
                
                  .
                
                  bmp = bmp->Alloc();
                
                  bmp->_<_o:_<_o:p_>_c.GetLong(RDATA_XRES),bc.GetLong(RDATA_YRES),32);
                
                  AlphaBitmap* channel = bmp->AddChannel(TRUE,TRUE);
                
                  .
                
                  .
                
                  .
                
                  if((RenderDocument(doc, bc, NULL, NULL, bitmap, RENDERFLAG_EXTERNAL, NULL, NOTOK, NOTOK, NOTOK, NOTOK)) == RAY_OK)
                
                  .
                
                _<_o:p_>_T-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-GB">  .
                
                _<_o:p_>_le="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-GB">  .
                
                _"FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-GB">
            

            The bitmap has a valid alpha channel, and I'm able to modify it in any way (using SetAlphaPixel() for example), but the render produces an RBGA image with all zero alpha values.
             
            Riccardo

            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 20/06/2006 at 01:49, xxxxxxxx wrote:

              Could someone paste here a full example to get the render alphamap?
              Thanks in advance...
              Riccardo

              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 27/06/2006 at 03:09, xxxxxxxx wrote:

                Unfortunately this is not directly possible through RenderDocument(). There's a workaround in this thread: https://developers.maxon.net/forum/topic/2058

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