Import Plugin?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/12/2010 at 22:10, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   11.5 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hello,

    I am trying to write an import plugin. The problem is that I can find absolutely no information about how to do it. In the documentation I found a class "SceneLoaderData". Besides that I don't know how to use it (because it is nowhere explained) I also even don't know how I could add objects to Cinema. For example, I want to add a triangle. How can I do this with the SDK?
    I've read somewhere something about something that's called "Melange". I've found out that it could have something to do with it. But I have no idea what it is though. I can't find explanations or descriptions about it anywhere. I think google doesn't even know that it exists...
    Please help me.
    Thank you.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/12/2010 at 06:11, xxxxxxxx wrote:

    Please have a look at the SDK examples. You can find them in the plugins folder in the CINEMA 4D installation. The SDK examples include code example to almost every area of the SDK. In your case please have a closer look at the stl.cpp file. This is a complete importer/exporter plugin.

    Btw. is this to be your first CINEMA 4D plugin?

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/12/2010 at 10:44, xxxxxxxx wrote:

    Yes, it is the first time for me.
    Thank you very much for your help.
    However, I have a problem. This is a part of my code:
         ZPolygon *polygons = (ZPolygon* )GeAlloc(sizeof(ZPolygon) * 1);
         polygons[0].a.x = 0;
         polygons[0].a.y = 0;
         polygons[0].a.z = 0;
         polygons[0].b.x = 100;
         polygons[0].b.y = 0;
         polygons[0].b.z = 0;
         polygons[0].c.x = 100;
         polygons[0].c.y = 100;
         polygons[0].c.z = 0;
         PolygonObject *op = PolygonObject::Alloc(3 * 1, 1);
         op->SetName("Name"); // Access Violation
         CPolygon *pol = op->GetPolygonW();
         Vector *vertices = op->GetPointW();

    pol[0] = CPolygon(0, 1, 2);
         vertices[0] = polygons[0].a;
         vertices[1] = polygons[0].b;
         vertices[2] = polygons[0].c;

    doc->InsertObject(op, NULL, NULL);
    EventAdd();
    Everything works without op->SetName(), but until I scale the Polygonobject in Cinema 4D, it is not visible. op->Message(MSG_UPDATE); also results in an access violation. What did I do wrong?

    Edit: I got it to work now :)
    I had to change ~50 project settings to match the sdk-example file.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/12/2010 at 22:48, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    I had to change ~50 project settings to match the sdk-example file.

    To start a new plugin, I usually find it more convenient to just copy the whole SDK project to a new folder and remove all the example plugins. This way, you get a "blank" project with allt the right settings.

    /Filip



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 21/12/2010 at 21:52, xxxxxxxx wrote:

    I had to change ~50 project settings to match the sdk-example file.

    Did you create a new MSVC++ project from scratch?  Because I've found if you don't include some commandline parameters
    from the original C4D project, your plugin will crash.
    One of the reasons why I created my own project, was because everytime I recompiled the C4D project, the "entire" project
    gets re-compiled for some odd reason.  And I didn't want to wait around forever just because I made a small change.
    Maybe it has something to do with the way the C4D projects are separated into different .vsprops files, which is
    kind of odd.  But, creating your own project speeds up compliation considerably.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/12/2010 at 02:48, xxxxxxxx wrote:

    There's a tutorial on my site at http://www.microbion.co.uk/graphics/c4d/create_plugins2.htm which will show you how to create a new C++ plugin from scratch. It will also show you how to link it to the compiled API library so you don't have to keep compiling it.

    Uses VS2008 but VS2010 is probably much the same.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/12/2010 at 14:33, xxxxxxxx wrote:

    Without these two commandline parameters, your C4D plugin may crash:
    /vmg /vms
    /vmg  "Uses full generality for pointers to members"
    /vms  "Declares single inheritance"
    The rest is pretty much straight forward.  Most of the compilation errors will most likely come from not including
    a specific resource directory.


Log in to reply