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.
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.
If you use it for anything let me know. Also if you have any features requests then send them my way.
I have posted my source code for the integration of Peter Shirleys Ray Tracing In One Weekend series to github.
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
Try using the absolute path to where your sdk is: /Users/YourName/Documents/C4D/sdk
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.
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.
@zipit I also want to say that the amount of time you contribute here to help out developers is very generous of you. You are doing an amazing job. I would hope that Maxon would actually pay you some retainer fee for your time or at least provide you with a free subscription for all the help you have given everyone here.
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.
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.
I am not exactly sure how it works in Python but I will give you a run down of how Global Variables work in C++.
If you set a global variable in C++, and you are using it in a Generator Object, then that variable will be exactly the same in every object in every document that you have open. So if you change the value of it on any object (again in any document you have opened) it will be changed across everything. That is the definition of a global variable. It is global, it is the same everywhere.
Now it may not work exactly like this in python depending on how it is setup in C4D. But in general it is a bad idea to use this for ay variable in something like a generator object.
So even though it might be working for now in a basic test scene, it will come back to bite you once you use it for anything more complex, such as two or more objects.
It all comes down to what it is that you are trying to achieve and what this data is that you are using in a global variable.
In C++ you could use a SceneHook to hold scene wide data. But I don't think that is in Python yet, so the best option to use scene wide data is to use a PluginID as your way to access that data in the preferences for your scene.
For storing a matrix value to compare why don't you just use a local variable in the generator object itself?
Also I would avoid using the word "Save" when you discuss this data, since "saving" and "persistent" mean writing data to disk. And that is not what you are doing. But if you did want to save the value then just make the matrix a description in the resource files for your object generator and access it using the BaseContainer. Then it will be saved automatically.
I keep seeing comments from the sdk team telling people to please add tags to their posts.
Instead I would recommend you split the "Cinema 4D Development" category back into two like it was, C++ and Python.
Then if someone posts into C++ just add the C++ tag automatically. Likewise for Python.
I myself used to like coming in here and quickly see if there is any C++ questions I can help out on. This new combined approach makes that more difficult so I am no longer doing this. Yes I know I can click on a tag to see all posts, but thats just one more required hunt and click.
I used to really enjoy browsing through plugin cafe, just as much as I did cgtalk or c4dcafe. But this new look and the way it is organized it doesn't feel as nice. Super large fonts and text, images etc... means hardly any information on a single screen. So its hard to quickly see and browse through. But it looks like lots of sites are going this way, which is a shame. I am looking at all these forums less and less now because of this. Maybe I am just old, but I like my concise compact views with loads of info, rather than having to go through pages and pages (or worse this horrible endless scrolling mechanism sites have adopted) of oversized text and clunky cells. On top of that, actually creating this post is painful with this split view and only taking up a tiny part of my screen. But thats another issue.
This site used to feel like a community. But now it feels more like what I guess it was originally designed for... that being an SDK support site. So its almost like this site is a forum based version of a ticketing system like zendesk or freshdesk.
Anyway, this is my vote to move back to two categories. That at least would help.
Is it possible to programmatically create a palette with commands that I specify? I would like to be able to create palettes on demand with certain commands so that a user can dock them.
I would like to open up the Script Manager and make it display a specific script.
Is this possible in C++ for R20 to S26?
I saw the CodeEditor_Open function, but that seems built for a completely different purpose.
Sorry I couldn't be of more help there. It sounds like maybe the latest macOS update has removed python. Did you just update to macOS 12.3 by any chance? A bit of a pain that the entire team is away this week. I would like to know the solution to this myself in case I want to update my macOS.
Did you make sure to unzip the ProjectTool on that new mac from the source file. And before you unzipped it did you make sure to remove the quarantine attribute?
xattr -d "com.apple.quarantine" <ProjectTool ZIP file>.zip
Just wondering if maybe some of the xlibs have been quarantined by the mac, or if they are possibly just missing completely. Copying the files from one mac to another may not work. I always unzip from the source.
How can I add a database to the "Databases" list in the Asset Browser preferences?
I would like to programmatically (C++) add a database, enable it and force the Asset Browser to update to display that database content. Is this possible to do yet?
Works great, thanks again Manuel.
So sorry for the duplicate question. I did search yesterday for json and it didn’t pop up, but appears to show up now. Must have just missed it when searching.
My example above, as you pointed out, was supposed to be a consistent array of objects with the same parameters, so your answer using 'b' was what I was looking for. Again my bad on the confusing question.
But it is really great to see a full example, including all required headers, showing how to use this functionality.
I will give it a try next week. Again thanks for the going over this again.
Would someone be able to provide a working example of how to use the Maxon API to read in some simple json like the following?
There doesn't seem to be any documentation that shows how to iterate over and extract this type of data from a DataDictionary. A complete working example would be great to have.
I am trying to use the Maxon API to read in the following JSON but I can't figure out how to get all the data from the returned DataDictionary.
To detect the value changing you can override the SetDParameter(...) method. Not sure about an animated value though.