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

    WARNING! R10 Joint is instance of Opoint

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 292 Views
    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 Offline
      Helper
      last edited by

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

      On 03/07/2007 at 16:08, xxxxxxxx wrote:

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

      ---------
      Howdy,

      Just a little warning that an R10 Joint returns true for

      op->IsInstanceOf(Opoint)
      

      BUT it doesn't have a points array. So, don't assume that when a user drops an object into a link, and the object passes the Opoint instance test, that you can retrieve a points array. It'll crash Cinema for sure if you don't double check that the array exists. I'm having to go through all my plugins' code to fix that.

      Adios,
      Cactus Dan

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

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

        On 04/07/2007 at 13:53, xxxxxxxx wrote:

        Well you should never assume that anyway! an object is still valid even with no polygons or points. Just add a Polygon Object (Objects > Polygon). Its empty, what is stop a user dropping this into a link?

        The joint object can have polygons/points if the user has it set to custom, the same can go for other objects too. Don't assume that have the data you want to use, always check.

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

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

          On 04/07/2007 at 14:25, xxxxxxxx wrote:

          Howdy,

          Yes, it was a hard lesson learned. ;o)

          But it was an easy fix. All I did was do a search for "IsInstanceOf" and change all lines that were like this:

          if(!op->IsInstanceOf(Opoint)) return FALSE;
          

          ...to this:

          if(!op->IsInstanceOf(Opoint) || !ToPoint(op)->GetPoint()) return FALSE;
          

          I reckon it was lucky, though, that it hadn't crashed sooner. I mean, since as you said a user could've created an empty polygon object and dropped that in the link and made it crash, too.

          Adios,
          Cactus Dan

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