GetPointR() & GetPointW()



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

    On 08/02/2007 at 14:52, xxxxxxxx wrote:

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

    ---------
    Howdy,

    In the documentation it says that GetPointR() gets the start of the read-only points array, and GetPointW() gets the start of the writeable points array.

    What is the significance of having the two arrays? And when would you use the read only array? And does that read only array ever change internally?

    Adios,
    Cactus Dan



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

    On 08/02/2007 at 18:06, xxxxxxxx wrote:

    Don't know the significance other than it is similar to any reason to use 'const' - the value/memory cannot be written to (accidentally). There may be speed advantages to this as well - but would need to find correlating evidence for that.

    You are getting the same array in each instance, just one returns the array in a mutable-writable state (GetPointW) and the other in an immutable-read-only state (GetPointR). The 'const' required guarantees this - but there are ways to type-cast out of a const declaration. :)



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

    On 08/02/2007 at 18:40, xxxxxxxx wrote:

    Howdy,

    So it's returning the same array, but the GetPointR() won't let you alter the points?

    Adios,
    Cactus Dan



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

    On 08/02/2007 at 22:15, xxxxxxxx wrote:

    Yes, but you need to declare them this way:

    const Vector* pts = ptObj->GetPointR();
    Vector* pts = ptObj->GetPointW();

    If you try the first as:

    Vector* pts = ptObj->GetPointR();

    you'll get a compiler error. But you can type-cast that restriction away, probably using something like:

    const Vector* pts = ptObj->GetPointR();
    *((Vector* )pts) = Vector(0.0);

    Maybe this is some way to allow plugins to provide interfaces of their own wherein other developers (say a script interface) cannot make modifications. Would be interesting to know the reasons.



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

    On 09/02/2007 at 01:08, xxxxxxxx wrote:

    With R10 memory might be shared with clones (e.g. a variable tag, polygons, points) so CINEMA needs to know if you intend to start modifying this. If you do need to modify it (the points, polygons etc.) then it will no longer share the memory and using the W function will cause the memory to be duplicated before returning you the pointer. If you are not going to be changing anything then you should use the read only access otherwise you will be loosing the memory reduction advantages in R10.



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

    On 09/02/2007 at 08:02, xxxxxxxx wrote:

    Howdy,

    OK, thanks.

    Adios,
    Cactus Dan



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

    On 09/02/2007 at 11:24, xxxxxxxx wrote:

    Thanks, David.


Log in to reply