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

    GetPointR() & GetPointW()

    Scheduled Pinned Locked Moved SDK Help
    7 Posts 0 Posters 561 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 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

      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 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. 🙂

        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 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

          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 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.

            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 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.

              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 09/02/2007 at 08:02, xxxxxxxx wrote:

                Howdy,

                OK, thanks.

                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 09/02/2007 at 11:24, xxxxxxxx wrote:

                  Thanks, David.

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