If you have ever been wanting to write your own plugins for CINEMA 4D, or in fact for any application that exposes an API for other developers to use, you probably know that setting up your IDE such that you can actually start coding can be a bit cumbersome.
Depending on the needs of the API you are using, there are compiler settings to take care of, paths to check, things to include, etc. when all you want to do is get up and running quickly, and get the boilerplate stuff out of the way.
Solutions to make this process less painful do exist, though.
In CINEMA 4D’s case, what you are supposed to do is take the
cinema4dsdk folder included with every CINEMA 4D installation (you can find it inside the plugins folder located under the root install directory), make a copy of it and then get rid of every superfluous SDK example that doesn’t resemble the type of plugin you want to write.
Of course this gets you going more quickly than starting from scratch but this is still cumbersome. Just copying the folder won’t be enough. You still need to open the project file for the IDE you are using (either Xcode on OS X or Visual Studio on Windows) and remove every reference to no longer existing source files. Then you need to check the project’s compiler settings regardless and make sure your targets are set up correctly.
Most developers in this situation will want to create their own bare-bones template once (for each plugin type) using the manual copy method as outlined above. Fortunately you only need to do this once for every new CINEMA 4D release.
A Better Way?
Wouldn’t it be better though, if we could generalize this process even more?
To satisfy this very need I created the CINEMA 4D Plugin Wizard.
And since its initial inception, it has actually outgrown this very specific task.
So what is it, and what can you do with it?
Well, the CINEMA 4D Plugin Wizard is a multi-purpose template system with a wizard GUI.
Often found in Microsoft products, a wizard is a user interface metaphor that guides the user towards a goal via pre-determined steps.
For example, in some Visual Studio versions, the New Class Wizard aids the user in creating source code files for a new class. The user provides some initial details and can then adjust optional settings along each of the remaining steps towards the end goal. An even more classical example of the wizard metaphor are programs that I am sure all of you have seen: installers.
In our case, the wizard metaphor is actually quite suitable. Especially so when combined with a multi-purpose template system.
What is a multi-purpose template system? Well, a template system is a framework for creating templates. And a multi-purpose template system is a system that doesn’t actually care what the template is trying to represent, what content it ought to have. It is more abstract than that.
In the case of the CINEMA 4D Plugin Wizard, on the lowest level, all the program does is, it makes copies of a template folder structure which it then processes by going through all items inside that structure looking for certain kinds of text that it replaces with text supplied by the user. These text replacements are supported not only inside the contents of any type of file, but also inside the names of any file or folder found inside that template structure.
I could go into more detail here, but seeing as I do include a short help entry reachable from within the GUI, I will leave those details for you to check out when you actually use the program.
More importantly, I want to stress that, even though the GUI and the wizard process tie the program very much to the creation of plugins for CINEMA 4D’s SDK, the underlying system is multi-purpose.
Nothing is stopping you from creating templates for any other usage case, since the program doesn’t care what kinds of files (and folders) it processes. You can provide text replacements that the current GUI doesn’t cover via the
rules system (see the Template help mentioned above, when you run the program). And, as always, I do provide you with access to the source code for the GUI and the actual program, so you can adapt the GUI to cover other needs.
In fact, I initially created the template system for a job where the client required rapid changes over a wide range of catalog pages.
I suggested an automated system like this when I noticed that there was a large pool of similar data shared between all of the master pages.
In the end, the client was quite happy to find out that we were actually able to finish earlier than expected.
Current version: 1.1
Note: on OS X 10.7 and above, due to Gatekeeper, please be sure to right click the app and choose Open instead of double clicking it.
You only need to do this for the first time. This is because I can’t sign the app so depending on your security settings Gatekeeper may block the app.
The source code is available below so you can be sure there is no foul play here.
You can find the source code for the GUI and the program over on github by following this link.
You can find the documentation for the template system as well as the UI online at this address.
UI (OS X)