'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 includingc4d.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!
-
Hello @sasha_janvier,
thank you for reaching out to us. PaintTexture::CreateNewTexture is a static method of
PaintTexture
, so your statement should look like this:PaintTexture* const paintTexture = PaintTexture::CreateNewTexture(path, settings);
You should avoid umbrella includes such as
#include "c4d.h"
. For once they can significantly increase your compile times (not that much of a problem in the SDK context), but they also obfuscate your dependencies and what you are doing in a file.Cheers,
FerdinandPS: I am still on the alpha/bitmap thing, we did not find a solution on Friday.
-
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!
-
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 ofSetInt32()
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.
-
Edit: Nevermind. Once again, a silly oversight. I hadn't provided enough
TEXTURE
-type settings to the BaseContainer, such asTEXTURE_FILEFORMAT
.Apologies!