Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    InitBakeTexture compile error

    SDK Help
    0
    16
    1.4k
    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
      Helper
      last edited by

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

      On 22/09/2010 at 09:10, xxxxxxxx wrote:

      anyone please??

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

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

        On 23/09/2010 at 03:00, xxxxxxxx wrote:

        I don't know why, but the err parameter in InitBakeTexture(...) is BAKE_TEX_ERR_WRONG_BITMAP, after call the function.

        I'm really confused, because InitBakeTexture() does not handle a bitmap as parameter... so why it says wrong bitmap??

        And BakeTexture(...) returns BAKE_TEX_ERR_NO_DOC. I have two BaseDocuments, one is doc, is the main document in the plugin:

        virtual Bool SequentialBaking::Execute(BaseDocument *doc)

        And the other is created only for the baking process, bakeDoc:

        BaseDocument* bakeDoc = BaseDocument::Alloc();

        My calls to bake texture:

        ---------------------------------------------------------

        bakeDoc = InitBakeTexture((BaseDocument* )doc, (TextureTag* )textag, (UVWTag* )uvwtag, NULL, bakeSettings, &error3, NULL);

        // error3 = BAKE_TEX_ERR_WRONG_BITMAP

        // BaseBitmap:
                          BaseBitmap* resultbitmap = BaseBitmap::Alloc();

        error = BakeTexture((BaseDocument* )bakeDoc, NULL, resultbitmap, NULL,NULL,NULL);

        //error = BAKE_TEX_ERR_NO_DOC

        // and of course resultbitmap->Save returns NULL...

        -------------------------------------------------------

        I'm really confused... Anyone knows how to make it work?? I only want to save the baked textures in a folder, with the name of the baked object...

        Thanks for the help.

        Cheers

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

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

          On 29/09/2010 at 06:09, xxxxxxxx wrote:

          It seems that the BAKE_TEX_AUTO_xxx IDs are causing the errors. It's not quite clear to me how to use them either. I will ask the developers.

          Using a fixed texture size seems to work fine though (BAKE_TEX_WIDTH, BAKE_TEX_HEIGHT).

          cheers,
          Matthias

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

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

            On 30/09/2010 at 04:30, xxxxxxxx wrote:

            Ok thanks Matthias, I will try using a fixed size, would be great to view autosize working... 🙂

            I will post the results.

            Cheers

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

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

              On 01/10/2010 at 01:17, xxxxxxxx wrote:

              Same errors using a fixed 1024x1024 size...

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

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

                On 04/10/2010 at 06:57, xxxxxxxx wrote:

                It seems to work fione here.

                Here my test code:

                  
                Bool MenuTest::Execute(BaseDocument *doc)  
                {  
                  BaseObject *obj = doc->GetFirstObject();  
                  if (!obj) return FALSE;  
                  
                  BaseContainer bakeSettings;  
                  
                  bakeSettings.SetBool(BAKE_TEX_USE_CAMERA_VECTOR, FALSE);  
                  bakeSettings.SetBool(BAKE_TEX_USE_POLYSELECTION, FALSE);  
                  bakeSettings.SetBool(BAKE_TEX_AMBIENT_OCCLUSION, FALSE);  
                  bakeSettings.SetBool(BAKE_TEX_NORMAL, FALSE);  
                  bakeSettings.SetBool(BAKE_TEX_SURFACECOLOR, FALSE);  
                  bakeSettings.SetBool(BAKE_TEX_COLOR, FALSE);  
                  bakeSettings.SetBool(BAKE_TEX_DIFFUSION, FALSE);  
                  bakeSettings.SetBool(BAKE_TEX_LUMINANCE, FALSE);  
                  bakeSettings.SetBool(BAKE_TEX_ALPHA, FALSE);  
                  bakeSettings.SetBool(BAKE_TEX_ALPHA, FALSE);  
                  bakeSettings.SetBool(BAKE_TEX_ILLUMINATION, TRUE);  
                  bakeSettings.SetBool(BAKE_TEX_SHADOWS, TRUE);  
                  
                  bakeSettings.SetBool(BAKE_TEX_BUMP, FALSE);  
                  bakeSettings.SetBool(BAKE_TEX_TRANSPARENCY, FALSE);  
                  bakeSettings.SetBool(BAKE_TEX_UVMAP, FALSE);  
                  bakeSettings.SetBool(BAKE_TEX_REFLECTION, FALSE);  
                  
                  bakeSettings.SetBool(BAKE_TEX_USE_PHONG_TAG, TRUE);  
                  bakeSettings.SetBool(BAKE_TEX_COLOR_ILLUM, TRUE);  
                  bakeSettings.SetBool(BAKE_TEX_COLOR_SHADOWS, TRUE);  
                  
                  bakeSettings.SetLong(BAKE_TEX_WIDTH, 512);  
                  bakeSettings.SetLong(BAKE_TEX_HEIGHT, 512);  
                  bakeSettings.SetLong(BAKE_TEX_PIXELBORDER, 2);  
                  bakeSettings.SetVector(BAKE_TEX_FILL_COLOR, Vector(1.0));  
                  
                  BaseTag* textag = obj->GetTag(Ttexture);  
                  BaseTag* uvwtag = obj->GetTag(Tuvw);  
                  
                  if(textag)  
                  {  
                      LONG error;  
                  
                      BaseDocument *bakeDoc = InitBakeTexture(doc, (TextureTag* )textag, (UVWTag* )uvwtag, NULL, bakeSettings, &error, NULL);  
                  
                      AutoAlloc<BaseBitmap> bmp;  
                      if (!bmp) return FALSE;  
                        
                      if (bakeDoc) error = BakeTexture(bakeDoc, bakeSettings, bmp, NULL, NULL, NULL);  
                  
                      ShowBitmap(bmp);  
                  }  
                    
                  return TRUE;  
                }  
                

                cheers,
                Matthias

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

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

                  On 04/10/2010 at 15:30, xxxxxxxx wrote:

                  Modifing the code like your example works (YES, THANK YOU!😄), but only if I use a fixed bitmap size.

                  Can you give a working autosize example please??

                  Thank you again for your help, Matthias

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

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

                    On 02/01/2012 at 20:34, xxxxxxxx wrote:

                    Sorry for resurrecting this old thread. But I can't get the example Matthias posted to work.
                    The error I get is: no instance of overloaded function "InitBakeTexture" matches the argument list

                    I'm puzzled why it's asking me to overload a method. Because there is never one used in any of the above examples.
                    And when I try to make one inside of my class. I can't get it to compile.

                    Did something change between then and now that's making this not work anymore?

                    -ScottA

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

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

                      On 03/01/2012 at 00:22, xxxxxxxx wrote:

                      Hi,

                      The compiler doesn't tell you to overload  InitBakeTexture (). InitBakeTexture() has 2 overloads (2 versions of the function but with different arguments) and it just can't find which overload to call.

                      Instead of declaring error as LONG:

                      LONG error;
                      

                      Declare it as BAKE_TEX_ERR:

                      BAKE_TEX_ERR error; 
                      

                      And it compiles fine now - yes just that... poor compilers :).

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

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

                        On 03/01/2012 at 01:32, xxxxxxxx wrote:

                        I've just looked in the SDK docs up to R13 and the error parameter is given as a LONG. So this looks like a documentation error. Can't really blame the compiler for that 🙂

                        (Looking in c4d_tools.h shows that InitBakeTexture does use BAKE_TEX_ERR but this change hasn't made it into the docs.)

                        Steve

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

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

                          On 03/01/2012 at 02:36, xxxxxxxx wrote:

                          Originally posted by xxxxxxxx

                          I've just looked in the SDK docs up to R13 and the error parameter is given as a LONG. So this looks like a documentation error. Can't really blame the compiler for that 🙂

                          (Looking in c4d_tools.h shows that InitBakeTexture does use BAKE_TEX_ERR but this change hasn't made it into the docs.)

                          Right. The parameter type is wrong in the docs. So... blame the docs 🙂.
                          Thanks for pointing that out Steve.

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

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

                            On 03/01/2012 at 07:38, xxxxxxxx wrote:

                            Thanks.
                            Works fine now with the correct type.

                            -ScottA

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