WARNING! R10 Joint is instance of Opoint
-
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 -
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.
-
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