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
    • Recent
    • Tags
    • Users
    • Login

    Copy Datatype

    Scheduled Pinned Locked Moved SDK Help
    13 Posts 0 Posters 1.1k 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 20/05/2009 at 02:53, xxxxxxxx wrote:

      Did you try to pass the reference as a = *b; ?

      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 20/05/2009 at 03:46, xxxxxxxx wrote:

        Ok this is funny.
        I have found a line in my code where i wrote something like this.

        AixGeometry cubeCache = *defaultCube; //defaultCube is a pointer on an    
                                                                                  //AixGeometry

        In this case it seems to work correct. But why it doesn't work if i have two "concrete" AixGeometries.

        AixGeometry a;
        AixGeometry b;

        b = a;

        Is it not the same as b = *a if a is a pointer (AixGeometry* a)?

        Thanks,

        Oli

        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 20/05/2009 at 07:48, xxxxxxxx wrote:

          Ok, i found another line where a = *b doesn't work :-(.
          I have written a copy-constructor with the same success. It can't be mere chance, that the function one time does it's work and one time not.

          I' m glad about every idea i get.

          cheers,

          Oli

          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 20/05/2009 at 11:56, xxxxxxxx wrote:

            Do you have a copy constructer defined in your AixGeometry class?

            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 25/05/2009 at 01:56, xxxxxxxx wrote:

              Hi,

              yes, i have tried this too. But no chance; same garbage.

              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 25/05/2009 at 02:46, xxxxxxxx wrote:

                Actually the assignment operator must be called as a.operator=(b) is called in the case of a = b.

                But if you have both defined (you should have both defined), an explicit copy constructor and an assignment operator, the only chance (cause I don´t know the structure of the full class you have there) you should in the end try a copy assignment operator, to avoid shallow copying.

                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 26/05/2009 at 02:26, xxxxxxxx wrote:

                  So, i have tried this too; without success. I have also compared the memory-adresses - all correct. So i have to search anywhere else in my code.

                  Thanks for your help,

                  Oli

                  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 26/05/2009 at 02:30, xxxxxxxx wrote:

                    hmm, then I really have no other idea either. 😕 I am curious in knowing the solution to your problem if you find out.

                    Good luck

                    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 26/05/2009 at 06:16, xxxxxxxx wrote:

                      I got it :-).
                      AixGeometry works like a container for the other datatypes (points, lines etc). In one of them i have commented out the operator= not so long ago to debug something.

                      So I summarise.
                      To make deep copies of your datatype(s), you need the CopyData-function of each datatype, the operator= and the copyconstructor.
                      If one of the last two functions doesn't exist, Cinema only makes a shallow copy.

                      So thanks for your help,

                      cheers Oli

                      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 26/05/2009 at 06:19, xxxxxxxx wrote:

                        ah there you go. Glad you finally worked it out. The good ol power of three. 🙂

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