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
    • Register
    • Login
    1. Home
    2. sasha_janvier
    3. Posts
    • Profile
    • Following 0
    • Followers 0
    • Topics 6
    • Posts 23
    • Best 0
    • Controversial 0
    • Groups 0

    Posts made by sasha_janvier

    • RE: How to set the "Texture preview size" value on a new material?

      Once again, I am immensely grateful for your generous and incredibly helpful assistance, @ferdinand !

      I don’t know why I didn’t mention SetParameter() in my original message, as this was the first thing I attempted before experimenting with the other methods I mentioned.

      Thank you once again. I was able to throughly familiarize myself with GetParameter() and SetParameter() today.

      posted in Cinema 4D SDK
      sasha_janvierS
      sasha_janvier
    • How to set the "Texture preview size" value on a new material?

      Hey y'all,

      Apologies if this is a pretty basic question, but I can't for the life of me figure out how to set the "Texture preview size" value of a new material, as such:

      #include <customgui_matpreview.h>
      
      Material* const material = Material::Alloc();
      if (material == nullptr)
          return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
      
      // To-do: Set the CUSTOMDATATYPE_MATPREVIEW to "None" (which is ID = 1)
      
      material->Update(TRUE, TRUE);
      

      I've tried every iteration of GetData() / SetData() and GetCustomDataType() / SetCustomDataType() I could think of, and yet, I either get an error, or (if no error) the value of the "Texture Preview Size" value is not changed upon being applied onto my object.

      I was able to set Channel-related values, which is great, so I'm left wondering why I'm struggling with the Material's "Viewport" options.

      I've scoured the forum before asking, but to no avail.

      Thank you very much in advance! I very much appreciate it.

      posted in Cinema 4D SDK c++ windows 2024
      sasha_janvierS
      sasha_janvier
    • RE: Overlapping images with transparency with BaseBitmap

      Thank you very kindly, @ferdinand! I had already started exploring the maxon::ParallelImage class as I suspected it to be the ideal path forward for my case, so it's great to have my suspicions be validated!

      I will make sure to start a new thread if I have any questions related to this class.

      Thank you very much once again. Your assistance has been indispensable!

      Cheers πŸ™‚

      posted in Cinema 4D SDK
      sasha_janvierS
      sasha_janvier
    • RE: Overlapping images with transparency with BaseBitmap

      As always, thanks a million for your incredibly thorough answer, @ferdinand.

      How many files to blend?, size of the files?, done in one batch or spread over the runtime of a user session?, etc. pp.

      The exact number of drawn bitmap images depends on the settings set by the user through my plugin's UI, but on average, I would roughly estimate the number of drawn bitmap files to be between 200 and 500. The bitmap's dimensions are set to be 256px by 256px and the drawing process is all done in one batch upon the user triggering the plugin's primary action button.

      Thanks for the heads up about the possibility of flooding Cinema 4D's job-queue with too many jobs. This is something I will be very mindful of and aim to prevent in any way I can.

      I am extremely grateful for your generous support, but because you've presented multiple methods and concepts I was completely unfamiliar with, you'll have to bear with me as I carefully research and revise them over the week-end before opting for a solution that seems ideal for my specific case.

      Thanks again for everything, @ferdinand. I will get back to you with my findings!

      Cheers πŸ™‚

      posted in Cinema 4D SDK
      sasha_janvierS
      sasha_janvier
    • RE: Overlapping images with transparency with BaseBitmap

      Hey @ferdinand,

      Just out of curiosity, I was wondering if there was any hopes for the Image API to handle transparency one day? As you've stated yourself (and as I'm experiencing myself while testing my plugin everyday), iterating pixel by pixel in the goal of splicing channels is very slow when dealing with a lot of semi-transparent images.

      Of course, I am gonna stick with the approach you generously proposed as it works, but a faster alternative would eventually be very welcome.

      Thank you!

      posted in Cinema 4D SDK
      sasha_janvierS
      sasha_janvier
    • RE: Can't build my plugin's Solution in Visual Studio 2019 after updating to C4D 2024.3.1

      @ferdinand Yay! Amazing. I can confirm that my solution builds without any problems in 2024.3.2.

      Big thanks to you and the dev team at Maxon! πŸ™‚

      posted in Bugs
      sasha_janvierS
      sasha_janvier
    • RE: Can't build my plugin's Solution in Visual Studio 2019 after updating to C4D 2024.3.1

      Wow, thank you very much, @ferdinand! This was extremely insightful and informative. I didn't know what application_opt.pdb was until I read your message. Thank you.

      I manually excluded/unchecked example.assets from my solution and rebuilt my solution and while this got rid of the "Forcing folder to be mounted as database (...assets/sdkdatabase.db) instead of nullptr" error, the objectbase1.hxx(537) error (which triggers a breakpoint), as well as the Symbol error are still there (the latter being expected I guess).

      Do you see the SDK asset database in 2024.2?

      In the SDK > Assets folder, I am seeing 11 presets divided in multiple categories, .e.g "Model" (1 item), "Material" (4 items), "Scene" (1 item), "Node" (1 item), "Node Operator" (1 item) and "Image Media" (3 items).

      ⚠ That said, I can confirm that the folder SDK > C++ > Asset API Examples is completely empty.

      Are you using any firewalls or VPNs that might restrict access to that URL?

      My firewall has remained untouched and no VPNs or anti-virus/spyware software are blocking requests to maxon.net.

      For the time being, although inconvenient and dare I say a bit annoying, I can hit "Continue" in Visual Studio after the breakpoint is triggered.

      I wish I could revert back to 2024.2, but I guess I need to message Maxon's team support to do so?

      I guess I could also test with 2023, but that would be less than ideal.

      Thank you once again for everything, @ferdinand. I really appreciate your assistance.

      posted in Bugs
      sasha_janvierS
      sasha_janvier
    • Can't build my plugin's Solution in Visual Studio 2019 after updating to C4D 2024.3.1

      Hey guys,

      I'm not sure exactly if this is a Visual Studio 2019 issue or a Cinema 4D issue...

      I've been working on my plugin for months now and throughout the plugin's development, I've updated from 2024.1.0 to 2024.3.1. None of the Cinema 4D updates have ever caused any problems in regards to my plugin development, until now.

      As of this morning, when building my solution in Visual Studio 2019, I get the error message: "Cinema 4D.exe has triggered a breakpoint."

      Visual Studio 2019 then opens a new tab named "No Symbols Loaded", which contains the message "application_opt.pdb not loaded".

      Additionally, right before the breakpoint is triggered, I noticed the following message being logged in Visual Studio 2019's "Output" window when building the solution:

      Forcing folder to be mounted as database (https://assets.maxon.net/assets/sdkdatabase.db) instead of nullptr
      
      objectbase1.hxx(537): CRITICAL: Method net.maxon.interface.nimbusbase.GetGraphNodeFromBaseList@72780fd07b2bfeae not implemented by NimbusBaseStaticImpl (requested by file:///C:/Code/sdk/plugins/example.assets/example.assets.xdl64). [object_impl.cpp(913)]
      
      Cinema 4D.exe has triggered a breakpoint.
      

      I have spent the last 1 hour and a half on Google reading StackOverflow threads and I have tried multiple things, none of which have resolved my problem.

      I have not made any changes to my code after updating Cinema 4D to 2024.3.0 and 2024.3.1. All I did was open Visual Studio 2019 and click "Local Windows Debugger" to launch Cinema 4D.

      Any insight or guidance would be immensely helpful. I wonder if I am the only one running into this issue since the latest update?

      Thank you!

      posted in Bugs windows 2024
      sasha_janvierS
      sasha_janvier
    • RE: Overlapping images with transparency with BaseBitmap

      Absolutely wonderful, @ferdinand. I can't thank you and the team at Maxon enough. No worries whatsoever about the delay, you guys make up for it by 10 folds when you come back with a response.

      Thank you again. I did indeed notice some similarities with the approach I pasted in my first message. I will try out your proposed implementation later today. I'm very eager to get the alpha channel working.

      πŸ‘

      posted in Cinema 4D SDK
      sasha_janvierS
      sasha_janvier
    • RE: Session timeout

      Thank you @ferdinand!

      I'm using Google Chrome V.121 on Windows 11 Pro. I haven't changed anything in my browser (i.e. extensions, scripts, etc) since the forum was updated.

      I'll report back on my findings next time this happens πŸ™‚

      Thanks!

      posted in General Talk
      sasha_janvierS
      sasha_janvier
    • RE: 'CreateNewTexture': identifier not found

      Edit: Nevermind. Once again, a silly oversight. I hadn't provided enough TEXTURE-type settings to the BaseContainer, such as TEXTURE_FILEFORMAT.

      Apologies!

      posted in Cinema 4D SDK
      sasha_janvierS
      sasha_janvier
    • Session timeout

      Hey,

      Just curiously, am I the only one on here who keeps getting logged out every 4-5 hours since the forum was last updated?

      I've checked my cookie settings in Chrome and nothing has changed. This seems to only be happening on this website.

      It's not the end of the world, just slightly inconvenient.

      Thanks!

      posted in General Talk chit-chat
      sasha_janvierS
      sasha_janvier
    • RE: 'CreateNewTexture': identifier not found

      It seems like executing the code I provided in my first message (along with your revision) in Cinema 4D triggers a breakpoint error in Visual Studio 2019.

      @ferdinand Are you by any chance able to reproduce this?

      I've tried using SetParameter() instead of SetInt32() with the right nomenclature/format, and it only lead to more errors.

      I hope this isn't yet another oversight on my part. I've spent quite some time digging through the forum and looking at examples in the GitHub repo (not the CreateNewTexture() as there are no examples of that, but examples of setting parameters). So far, no success.

      Thank you once again.

      posted in Cinema 4D SDK
      sasha_janvierS
      sasha_janvier
    • RE: 'CreateNewTexture': identifier not found

      Ah! Thank you so very much once again, @ferdinand! I was right about it being a silly oversight on my part. Much appreciated!

      PS: I am still on the alpha/bitmap thing, we did not find a solution on Friday.

      Thank you for the update! I was considering messaging you about this.

      For now, I am trying to move forward as much as possible without the alpha channel. Here's hoping that you guys can solve this eventually 🀞

      Thanks again and please, if possible, keep me in the loop!

      posted in Cinema 4D SDK
      sasha_janvierS
      sasha_janvier
    • 'CreateNewTexture': identifier not found

      Hey guys,

      I have the following code:

      #include "c4d.h"
      
      ...
      
      Filename path = "C:\\path\\uv-islands-matte-01.png";
      BaseContainer settings;
      settings.SetInt32(TEXTURE_WIDTH, 1024);
      settings.SetInt32(TEXTURE_HEIGHT, 1024);
      
      PaintTexture* paintTexture = CreateNewTexture(path, settings);
      if (!paintTexture) {
          ApplicationOutput("Failed to create a new paint texture.");
          return TRUE;
      }
      

      Upon building my solution in Visual Studio 2019, I get the following error:

      Error C3861 'CreateNewTexture': identifier not found
      

      Shouldn't CreateNewTexture() be already available, given that I am including c4d.h? I've tried brute-forcing the import by adding #include <c4d_painter.h> at the top of my script, but this obviously didn't help.

      Additional context:

      I am trying to create a "matte" bitmap image of my currently selected Object, where the UV islands of my Object are pure white, while the background (i.e. non-UV islands) is pure black.

      This should be doable by programmatically by creating a new texture with a black background, then selecting all polygons in Polygon Mode by using CallCommand / SendModelingCommand, then executing the command "Fill Polygons" with the white foreground color and then finally saving the results. I'm not sure if this is all entirely possible with the current SDK, but I can compromise on some parts.

      Either way, I can't go too far with the plan outlined above, given how CreateNewTexture() is not working to begin with.

      Any insight / guidance would be very much appreciated. Here's hoping that this is just some silly oversight on my part.

      Thank you!

      posted in Cinema 4D SDK windows c++ 2024
      sasha_janvierS
      sasha_janvier
    • RE: Overlapping images with transparency with BaseBitmap

      Thank you very very much once again, @ferdinand. I really appreciate the thorough explanation, as well as you sending an email to the team at Maxon.

      In the meantime, I'll keep using the BaseBitmap interface and use an image with no alpha. Not an ideal situation, but at least I can progress with my plugin in the meantime.

      Thanks a million once again. Very much looking forward to see what Maxon says and how we can resolve this issue.

      posted in Cinema 4D SDK
      sasha_janvierS
      sasha_janvier
    • RE: Overlapping images with transparency with BaseBitmap

      Thank you very much @ferdinand. It's both relieving and admittedly a bit annoying to have confirmation that something fishy is going on with alphas in 2024.2 given the time I've put into this so far, but ultimately, I'm just glad I brought this issue to you and the team's attention.

      And yes, I am using 2024.2.

      Regarding your answers, while I knew of the "BaseBitmap::ScaleIt", I guess what I was really asking was whether the Image API still would allow me to do pixel-per-pixel transformations such as scaling/rotating (like I am currently doing with the BaseBitmap class), but upon closer inspection, I feel like the answer to this question would lean towards "Yes".

      Thanks again @ferdinand and very much looking forward to your testing and update. I really appreciate it your time and assistance.

      posted in Cinema 4D SDK
      sasha_janvierS
      sasha_janvier
    • RE: Overlapping images with transparency with BaseBitmap

      In case you are still stuck, drop me a note here

      @ferdinand Just a little update to inform you that, after spending half of my week-end trying to simply draw 1 semi-transparent image (as illustrated in my original message) onto the gray background using the Image API, that I am very much stuck πŸ˜†

      I'm not sure what you will say in regards to my last message, because if, in the end, the Image API does not allow me to rotate/scale/smooth out the image, then attempting to implement it (i.e. what I've been doing this week-end) might end up being a fruitless endeavor.

      Thanks again!

      posted in Cinema 4D SDK
      sasha_janvierS
      sasha_janvier
    • RE: Overlapping images with transparency with BaseBitmap

      Thank you very kindly @ferdinand . I truly appreciate your thorough and insightful response.

      I have just spent some time reading the Image API Manual and I can while I can attest to it being more complex than the BaseBitmap Class, it does seem to have some great advantages.

      I guess, before I dive completely into it, my first question is whether or not the Image API would allow me to do what I am currently achieving with the BaseBitmap Class, which is:

      • Scale up the image by a factor of 2X
      • Rotate the image (any degree value between 0 and 360)
      • Apply a bilinear interpolation onto the rotational transformation of the image as a way to smooth out the interior pixels of said image
      • Scale down the image by a factor of 2X. The point of the scaling up and then scaling down is to apply anti-aliasing to the edges of the image (i.e. supersampling)

      As of now, aside from the alpha channel not being correctly applied, all of the 4 listed steps above work and are achieved with standard C++ (i.e. no external library).

      Upon reading the Image API Manual, it appears that I can still draw each pixel individually, leading me to believe that I could still preserve some of the current logic in my code to some extent, but I am still not completely certain. I am also not completely certain of how I will be able to handle alpha values and if "maxon::GetFirstAlphaOf()" will be of any use.

      Regardless, I am going to dive in this evening, but any clarification on the points listed above would be very(!) appreciated as always.

      Thank you very much once again @ferdinand!

      posted in Cinema 4D SDK
      sasha_janvierS
      sasha_janvier
    • Overlapping images with transparency with BaseBitmap

      Hey guys,

      I want to overlay multiple images that contain alpha values onto a plain gray background. Important note: said images may overlap.

      I seem to be completely unable to have the images' alpha values be correctly drawn onto the gray background, despite the alpha values being correctly read (as evidenced by my printed logs not included here).

      Here is the image (this is just a placeholder, the actual image is a lot more intricate):
      alt text

      The goal is to, once drawn onto the gray background, the final saved texture can look like this (note: I rotated one image to better illustrate the overlapping effect):

      alt text

      Currently, this is what I end up with:

      alt text

      My code was greatly inspired by a lot of (supposedly functional) code I found on here, so I don't fully understand what is not working. Here is a code snippet:

      BaseBitmap* targetTexture = BaseBitmap::Alloc();
      targetTexture->Init(512, 512, 24);
      targetTexture->AddChannel(TRUE, FALSE); // Not sure if necessary
      targetTexture->Clear(128, 128, 128); // Gray background
      
      Filename srcImageFile = Filename("C:\\...pathToImage..\\image.png");
      
      BaseBitmap* srcImageBitmap = BaseBitmap::Alloc();
      srcImageBitmap->Init(srcImageFile);
      srcImageBitmap->AddChannel(TRUE, FALSE);
      
      BaseBitmap* targetTextureAlpha = targetTexture->GetInternalChannel();
      UInt16 r, g, b, a;
      
      // Code in the drawing function:
      
      Int32 offsetX = (targetTexture->GetBw() / 2) - (srcImageBitmap->GetBw() / 2);
      Int32 offsetY = (targetTexture->GetBh() / 2) - (srcImageBitmap->GetBh() / 2);
      
      for (Int32 y = 0; y < srcImageBitmap->GetBh(); ++y) {
          for (Int32 x = 0; x < srcImageBitmap->GetBw(); ++x) {
              srcImageBitmap->GetPixel(x, y, &r, &g, &b);
              // As mentioned above, "a" returns the correct alpha value
              srcImageBitmap->GetAlphaPixel(srcImageBitmap->GetInternalChannel(), x, y, &a);
              if(a != 0)
              {
                  targetTexture->SetPixel(x + offsetX, y + offsetY, r, g, b);
                  targetTexture->SetAlphaPixel(targetTextureAlpha, x + offsetX, y + offsetY, a);
              }
      
          }
      }
      

      Any thoughts? Do I have to resort to some type of "Blend()" function?

      Thank you very very much for any insight or guidance. I really appreciate it! β™₯

      posted in Cinema 4D SDK 2024 windows c++
      sasha_janvierS
      sasha_janvier