Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Fundamental Knowledge

    SDK Help
    0
    3
    231
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

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

      On 10/10/2007 at 06:34, xxxxxxxx wrote:

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

      ---------
      Hallo,

      I am trying to write a plugin that is capable of setting several orthographic cameras into the scene, yet I think I don't really understand the basics!? I've been looking at the plugins in the c4dsdk and couldn't find clues of how to do this. My guess is that I don't understand the basic architecture of C4D to do this properly. Are there any resources that would speed up my efforts? I'm looking for any fundamental knowledge about writing plugins. Espacially the control and changing the model of the camera, setting and rendering multiple views (which might include animations).

      Thanks,
      Bogumil

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

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

        On 23/10/2007 at 11:54, xxxxxxxx wrote:

        I recently started working on my first plugin only a few months ago with no coding experience whatsoever. What worked for me was to play around with scripts in the COFFEE editor, where you can get immediate feedback rather than constantly compiling and checking the results. The COFFEE SDK also has a tutorial in it, so that should give you a place to start if you're trying to create a full-fledged plugin.

        You'll have to relearn a few things when you switch to C++, but you'll at least have a fundamental understanding of what's going on under the hood of C4D at that point.

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

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

          On 25/10/2007 at 00:53, xxxxxxxx wrote:

          Hi,

          thank you bandini for the reply. At some point I will certainly use COFFEE to get a better grip on C4D. My problem (was) is that I had to do some things quickly (like creating and setting KeyFrames), which - as far as I understood - are not possible with COFFEE ...

          Anyway I think I made some progress in copeing with some aspects of plugin-programming using the C++ SDK. All I know is piecework from the things I read in the forum or in the SDK's reference, so its far from rock solid, but I think here are some points worth telling:

          Plugin Types and Behaviour
          A reply by kuroyume0161 in a thread started by mfranke named "Object creation" helped me a lot:
          some noteson plugin types

          Adding C4D Objects
          One can add primitives (e.g. Cube, Sphere,...) by calling the GeneratePrimitive() method. Here is an example creating a plane:

          > _
          > BaseDocument* actdoc = GetActiveDocument();
          > Plane_ = (PolygonObject* ) GeneratePrimitive(actdoc, Oplane, NULL, 0, FALSE);
          > actdoc- >InsertObject(Plane_, NULL, NULL, TRUE);
          > EventAdd();
          > _

          Other objects can be added the same way using the BaseObject::Alloc() method. Here is an example adding a camera:

          > _
          > Camera_ =
          >     (CameraObject* )BaseObject::Alloc(Ocamera);
          > Camera_->SetName("MyCamera");
          > BaseDocument* actdoc = GetActiveDocument();
          > actdoc->InsertObject(Camera_, NULL, NULL, TRUE);
          > EventAdd();
          > _

          Setting Parameters
          Some objects have C++-Methods that can be used conveniently to control their attributes, like the SetName() routine used in the code example above. More oftenly I had to use the SetParameter() method to change parameters or object states. Here is an example how the camera's viewing volume can be changed:

          > _
          > Real focus = ...;
          > Real aparture = ...;
          > Camera_- >SetParameter(DescID(CAMERA_FOCUS), GeData(focus), 0);
          > Camera_->SetParameter(DescID(CAMERAOBJECT_APERTURE), GeData(aparture),0);
          > _

          In order to use this method one has to identify the 'ID defines' (e.g. CAMERA_FOCUS ) for the parameter. These are located in the headers (*.h files) or the resource files (*.res files) belonging to the object under consideration. I found these files belonging to the C4D api in the resource\res\description subdirectory of the C4D installation. (I see there is even more information in the *.res files, which I can't read yet). The datum to be accessed can be the (sub)component of another object (for instance the x-component of a Vector ). This is handeled using the DescLevel class. The following DescID for instance allows to access the rotation of an object around the y-axis:

          > _
          > DescID(DescLevel(ID_BASEOBJECT_ROTATION,0,0),DescLevel(VECTOR_X,0,0))
          > _

          Building Dialogs
          One should read the SDK reference to GeDialog and use the ResourceEditor plugin provided by Maxon - the saved time when building dialogs makes it priceless!

          Setting Keyframes
          At this point a different thread in the forum, started by mozg with the topic "add keyframe" gave me all I needed. Last time I looked it could be found here:
          mozg/kuroyume0161 add keyframe

          I know this post does not go directly to the heart of my primary question but at least helped me to achive something. It also provides some implicit clues on how plugin-programming works , and I hope that if others also post their experiences we'll get a pretty collection of "fundamental knowledge" here.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post