Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Vector

    SDK Help
    0
    4
    401
    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 17/02/2004 at 18:40, xxxxxxxx wrote:

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

      ---------
      Hi all,
      I am trying to get the rotation of the particular object. The code is like this:
      **  BaseDocument *doc = GetActiveDocument();
       BaseObject *obj = BaseObject::Alloc(Ocube);
       obj = doc->GetActiveObject();** **
        Vector rotation = obj->GetRot();**
      But I am getting the error in C4D that the memory could not be read. Can anyone tell me what's wrong with this code.
      Thanks for the reply in advance
      Regards

      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 17/02/2004 at 19:27, xxxxxxxx wrote:

        When you get that error it means that a pointer has been accessed that isn't properly initialized, or is NULL. To find out where the issue is you have to start a debug session, then step through the lines to find out where it fails.
        By programming defensively, e.g. checking or asserting all pointers before you access them, you can avoid much of the hassle. For example, always put in stuff like "if (!obj) return FALSE;".
        Finding the above error (which is glaringly obvious, and might be a typo) would be a good way to learn your development environment. But in case you just want to know what it is, I've included a spoiler below.
        Spoiler: In the third line you get the active object in the scene, but I suspect that no object is active. Thus obj gets assigned the NULL value. Then on the fourth line there's an error when you try to get the rotation of "no object". How you would change the code depends on what you were trying to do in the first place. (Select the paragraph to see it.)

        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 17/02/2004 at 19:35, xxxxxxxx wrote:

          Ok, thanks Mikael for the reply

          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 17/02/2004 at 19:48, xxxxxxxx wrote:

            Nice trick btw. Mikael ;o)

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