plugin for importing a file
On 10/09/2016 at 00:00, xxxxxxxx wrote:
I'm new to plugin programming in Cinema 4D, so I have a lot to learn. I've got some files with character information (mesh, rig, weighting, materials) that I want to import to Cinema 4D and convert it to a native character.
I successfully imported the character via FBX, but only partially, as Cinema 4D seems to ignore some information in this FBX (which Maya reads by the way). Anyway, there are additional parameters located in other files in a different format, which I would like to read as well and merge with the FBX data.
As this is a long term project, I would like to start in the right way and avoid dead ends as good as possible. I thought about taking the C++ or Python route.
The first task would be to search a file (Windows platform), parse it and use the parameters set values in joints and add xPresso content to the joints.
Any recommendations for plugin types, examples, tutorials for starters besides the obvious stuff here in the forum?
Thanks in advance
On 10/09/2016 at 09:01, xxxxxxxx wrote:
Most SDK's are written in C++.
So if you're planning on reading the data from file formats like .fbx, .max, etc... then you'll probably need to use C++.
Some file formats like .ma are text based. And you can easily read them directly with any coding language you like. And then easily write C4D versions of the data with Python or C++.
But it's likely the other files you want to read data from will not be text based.
If you're going to only read text based files. Then Python should be good enough.
The Python SDK is fairly deep in R17. And it should be able to create everything in your rig.
It sounds like a user based plugin. Where the user executes the operation.
The type of plugin for this is typically a GeDialog type. Using a small CommandData class in it at the bottom to launch the dialog from the C4D plugins menu.
Hard to give more advice without knowing more about what you're trying to do.
It also depends on how much you like, or need, to use Python vs. C++.
I personally mostly play (prototype) in Python. Then release using C++. But not everyone likes C++ as much as I do.
On 11/09/2016 at 12:36, xxxxxxxx wrote:
Thanks for your reply. I started programming in C++ in 1991 (MFC 1.0). I never programmed in Python up to now, but willing to learn as well. Unfortunately I never programmed anything in Cinema 4D.
I'd like to read in joint, mesh and weighting data. The files are in zlib compressed text format. I can convert it to a textfile with 7zip upfront, but it would be nice to directly read it. As all information is distributed over several file, the user would load one file after the other and get the data in one by one. I may need xPresso tags later on to get joint controlled point morphs to the figure.
I'll start with GeDialog and C++. A little practice will certainly help
On 11/09/2016 at 15:18, xxxxxxxx wrote:
You are lucky in that you are already comfortable with C++.
Most people use Python with C4D because they can't handle C++.
So you only need to learn "the C4D way" of doing things. Which has been not so easy up until recently. But Maxon have recently put lots of helpful little code snippets in the new on line docs to help people coming from other SDKs.
The hardest part of learning a new SDK is learning the specific workflow, rules, and philosophies.
The C++ examples that come with the SDK can be a bit confusing at first. So I have posted a bunch of examples on my website that are smaller. And tend to spell things out a little bit plainer for new developers. They are for an older version of C4D, and there have been some naming changes since then. But they might help you get to grips with the C4D way of doing things:
GeDialog is the class that makes dialog based plugins.
CommandData is a class that either executes something(like a script) from the plugins menu. Or is used to launch your GeDialog plugin.
There are other types of plugins. But I think those are the ones you'll want to use for your task.
If you have a specific question. Use the forum search, which can often lead to an answer.
Or feel free to ask questions in the forums.
On 11/09/2016 at 22:29, xxxxxxxx wrote:
Thanks a lot. Hopefully I can contribute here with some useful information as well some day .
On 12/09/2016 at 07:11, xxxxxxxx wrote:
welcome to the Plugin Café forums
As I'm not completely sure you are aware of our resources, I thought I add some links:
Online docs: C++ and Python
Sticky thread with some links to 3rd party resources.
SDK examples on GitHub
Development blog: Downloads page (e.g. SDK docs for offline use, in case of Python including examples)
Then I'd like to slightly adjust one of Scott's statements (Scott, I hope you don't mind) :
Actually GeDialog is no plugin type nor the base of dialog based plugins. It's just the class for dialogs (heavily simplified: dockable windows). Several plugin types can have such dialogs, so the CommandData plugin type mentioned by Scott.
Finally I'd like to point you to SceneLoadData (and maybe also SceneSaverData) plugin type, which is the standard plugin type for developing importers for any kind of scene data (e.g. the FBX import in Cinema 4D is based on this type). There's also an example.
On 12/09/2016 at 12:21, xxxxxxxx wrote:
Hallo aus Wien,
and thank you for the links.
I really try to understand the concept of plugins in Cinema 4D. I plan some complex plugins in the distant future, but for now I try to start with some simple things.
Good to know that GeDialog is a class. I assume, you can have several classes in a plugin. Good to know as well about SceneLoadData. I try to do something similar like the FBX importer. I have a collection of files containing parts of a character and I have to load one after the other to get the complete figure. The FBX is just the base for it.
I also have to change the rotation system from XYZ to HPB or simulate the XYZ rotation including joint controlled point morphs.
So there's a lot to do and to learn for that. You're help is highly appreciated.