Like this post if you are a Python Developer.

Best posts made by kbar
-
RE: How many C++ and Python devs do we have here?
-
C++ Plugin Development Tutorials
I created a short series of getting started videos for anyone just starting out developing C++ plugins for Cinema 4D. I hope you find them useful.
https://www.youtube.com/playlist?list=PLEPTxkpDVvX0r292yn8xL39Cm3Wi3E69i
-
How many C++ and Python devs do we have here?
I am just curious to know how many C++ developers we have here.
Since we don't have polls on this forum can you do the following...
Like this post if you are a C++ Developer.
-
Documentation Plugin
Hi everyone,
I have released a plugin I use to create documentation for my plugins.
The plugin is free. Currently available for R20 for Windows. I will add an OSX version if people ask for it.
https://www.plugins4d.com/docs
If you use it for anything let me know. Also if you have any features requests then send them my way.
Cheers,
Kent -
RE: How many C++ and Python devs do we have here?
Like this post if you are using the new Node System to create features.
-
Ray Tracing In One Weekend
I have posted my source code for the integration of Peter Shirleys Ray Tracing In One Weekend series to github.
https://github.com/kentbarber/rtow4d
This might be of interest to anyone wanting to play around with writing their own ray tracer.
You can also download a compiled version from here: https://plugins4d.com/Product/FunRay
Cheers,
Kent -
RE: Project Tool failing when installing on Mac
Try using the absolute path to where your sdk is: /Users/YourName/Documents/C4D/sdk
https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_projecttool.html
g_updateproject: Defines the folder the tool should work on. Currently the tool only accepts absolute paths. This is typically the location of the SDK including frameworks and plugins. See SDK Overview.
-
RE: Using "config" plugins to modify the loading queue in R19
You can use SetPluginPriority to tell your plugins to load in a specific order. IE tell some plugins to load after others have been loaded. Useful in cases where one of your plugins may register a library that your other plugins need to access as they start up.
-
Do not delete your posts once you get an answer
Yesterday I helped someone out with a question. Now they have marked it as deleted. The only reason I would help out on this forum is to help everyone and add to the knowledge pool here in this forum.
So please... do NOT delete your post if you received the answer you were looking for.
-
Something to watch out for with GetAllAssets
I just found that in S22 they have inverted the behaviour of a flag for GetAllAssets.
In R21 there existed a flag ASSETDATA_FLAG::MISSING.
From S22 onwards the functionality of this flag has been inverted and it is now called ASSETDATA_FLAG::NOMISSING.
The problem is that it sets the exact same bit.
So if you have a plugin that is compiled against R21 and your users use it in S22 then your code will not be getting the missing assets anymore, since this bit is set (if you use the MISSING flag) and it will now mean DO NOT get missing assets.
Compiling against the S22 SDK and removing the MISSING flag will fix your bugs if you have any.
Just something to watch out for if anyone is hearing of problems from your users relating to gather up assets. Mainly applies to people writing renderers and dealing with textures and materials.
Cheers,
Kent
Latest posts made by kbar
-
RE: How to handle AddDependence hh deprecation in 2024 onwards
@m_adam that is unfortunate.
-
RE: Continuously refresh the render result to the view port
@freeze I wrote this a few years back which might give you a good starting point.
https://plugins4d.com/Product/FunRay
https://github.com/kentbarber/rtow4dCheers,
Kent -
How to handle AddDependence hh deprecation in 2024 onwards
I have an ObjectPlugin written in Python.
It implements def GetVirtualObjects(self, op, hierarchyhelp)
Inside I am calling AddDependence
The following code produces an warning in 2024 and 2025: PendingDeprecationWarning: The 'hh' argument is not used since 2024.0 and will be removed in 2025.0. Since it is happening in GetVirtualObjects this error gets printed out 100's of thousands of times currently, leading to an eventual lockup.
for obj in ObjList: op.AddDependence(hierarchyhelp, obj)
It seems that I can't simply remove hierarchyhelp since that causes another error.
I can't seem to find any documentation on this other than to say that hh is deprecated, but no additional info saying what we should do to fix it. Since the help docs still contain hierarchyhelp as the first input to the method.
Thanks,
Kent -
How to correctly get maxon::NimbusInterface?
I noticed a new function in 2025 called FindOrCreateCorrespondingBaseList.
I went looking to see if I can find the corresponding function that works in 2023/2024 and it seems to be NbmFindOrCreateCorrespondingBaseList.
The code below seems to work, but I just want to make sure that casting from maxon::NimbusBaseRef to maxon::NimbusInterface* is actually correct.
(maxon::NimbusInterface*)nbmBase
I can't seem to find any documentation about this anywhere.
Thanks,
Kentmaxon::NimbusForwardRef nimbusRef = material->GetNimbusRef(maxon::Id("com.autodesk.arnold.nodespace")); maxon::NimbusBaseRef &nimbusBaseRef = nimbusRef.GetBase(); // This is in 2025 an up // BaseList2D* imageNodeBaseObject = nimbusBaseRef.FindOrCreateCorrespondingBaseList(imageNode.GetPath()) iferr_ignore(""_s); // This is for 2023 and 2024 maxon::NimbusBaseInterface* nbmBase = nimbusBaseRef.GetPointer(); const maxon::CString& nodePath = imageNode.GetPath().ToCString() iferr_ignore(""_s); BaseList2D* imageNodeBaseObject = NbmFindOrCreateCorrespondingBaseList((maxon::NimbusInterface*)nbmBase, nodePath) iferr_ignore(""_s); DescID texturePathID; // This is in 2025 and up //nimbusBaseRef.GetDescID(filenamePort.GetPath(), texturePathID); // This is for 2023 and 2024 NbmPortToDescID((maxon::NimbusInterface*)nbmBase, imageNode, filenamePort, texturePathID);
-
RE: BaseBitmap Save TIF with LZW and save EXR using ZIP
Great! That makes it so much easier. I will give this a try today.
With the classic BaseBitmap API I also had to pass in that I wanted it to be INITBITMAPFLAGS::GRAYSCALE when saving a greyscale image. And I also passed in the SAVEBIT settings such as SAVEBIT::USE16BITCHANNELS. Does this still need to be done when using the Maxon API? I had a quick look at the docs page but couldn't find anything that relates directly to this, will have a closer look later today.
Thanks @ferdinand !
-
BaseBitmap Save TIF with LZW and save EXR using ZIP
Hi team!
Is it possible to using any of the compression algorithms with the classic BaseBitmap->Save, where we pass in a BaseContainer with settings? I would like to save out TIF files with LZW and also EXR with ZIP.
I do see that these compression algorithms are available in the new Maxon API. So perhaps an alternative question would be how can I use the Maxon API ImageSaverClasses to save a file with compression if I have a BaseBitmap as the source?
I will also outline what I want to actually achieve, and that is to downsize images from 8k to 4k, which is working fine, but I would just like to keep the original compression that we are using when saving the 4k versions. So a third alternative to solve my problem may actually be to use the Maxon API for everything, loading, resizing and then saving (with a specified compression).
I am open to using whatever is the easiest solution out of the above. If I can somehow tell the BaseBitmap saver to do what is needed then that is all I really need.
Thanks,
Kent -
RE: How to use GetAllNimbusRefs in 2023
Thanks @ferdinand! Appreciate everything you do. Also what the rest of the sdk support and docs team are doing! Not an easy job keeping on top of all these changes.
-
RE: How to use GetAllNimbusRefs in 2023
Thanks @ferdinand,
I thought it must have been a missing framework, my eyes just didn't see nodespace.framework in the frameworks folder otherwise I would have tried that.
Adding the nodespace.framework and including "maxon/nimbusbase.h" is what did the trick.
Sharing my full code wouldn't have helped, since the issue was that I didn't have the framework, otherwise I would have found the header file during my searches.
It would be great if the documentation samples could somehow also mention what frameworks they require to get them to run.
Unfortunately I won't be able to use it due to the use of the nodespace.framework, since I am still providing supporting back to R20 and it gets messy altering/swapping out projectdefinition.txt files to support additional frameworks.
Also thanks for the tip on the MaterialNodeSpaces registry, although I have no idea how to use that at all. But will keep it in mind for future.
My intention was not to write a diary. I was just trying to provide as much information as I could. Since it seemed simple, and it was... ie missing framework.
I sometimes forget that this site is no longer a community and is really just a support system. I am still used to the old days of being able to provide info and have discussions with other developers. I will refrain from doing this from now on.
Thanks again!
Kent -
How to use GetAllNimbusRefs in 2023
Hi,
I am trying to call the following code in 2023. From this page.// Print all the NodeSpace ID from the selected material. In practice we should // test if mat is a nullptr before proceeding. BaseMaterial* mat = doc->GetActiveMaterial(); // The error handling needs to have an error context defined with either iferr_scope or iffer_handler. const maxon::HashMap<maxon::Id, maxon::NimbusForwardRef> hashNimbusRefs = mat->GetAllNimbusRefs() iferr_return; for (const auto& e : hashNimbusRefs) { const maxon::Id& key = e.GetKey(); const maxon::NimbusBaseRef nimbusRef = e.GetValue().GetBase(); ApplicationOutput("NodeSpace ID: @"_s, key); }
I get the following errors in my code.
Error C2079 'nimbusRef' uses undefined class 'maxon::NimbusBaseRef' Error C2027 use of undefined type 'maxon::NimbusBaseRef'
I have the nodes.framework and the graph framework installed (and actually use it in places as well). But looking through the maxon code I can't find where NimbusBaseRef is supposed to be defined.
I see the following in operatingsystem.hclass NimbusBaseRef; using NimbusForwardRef = ForwardRefWithExtraBase<NimbusRef, NimbusBaseRef>;
Is there some other framework that I am supposed to use so that this code will compile?
I tend to find this a lot with the documentation, where it will have the code I need, but not tell me the header file to include, or the required framework to use it.Thanks.
edited by @ferdinand:
@kbar wrote:
Actually looks like I don't have the graph.framework for this project. I will add that and see if it fixes the issue.
Unfortunately adding graph.framework did not fix the issue.
I case anyone is reading this I went back to using the following alternative, checking for an exact node space to see if it is what I am looking for, in this case redshift.
BaseMaterial *pMat = //the passed in material Int32 matID = pMat->GetType(); Bool isRSNode = false; // Documentation states this is always safe to cast NodeMaterial* pNodeMat = static_cast<NodeMaterial*>(pMat); if (matID == Mmaterial) { if (pNodeMat->HasSpace(maxon::Id("com.redshift3d.redshift4c4d.class.nodespace"))) isRSNode = true; }
-
Plugin Developer Job opening at Greyscalegorilla
Hey everyone,
We have a job opening at Greyscalegorilla for a plugin developer. Come and work with me on some fun projects.
https://greyscalegorilla.com/jobs/jobs-3d-plugin-developer/
Cheers,
Kent