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

    My own classes in separate file?

    SDK Help
    0
    12
    1.3k
    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
      Helper
      last edited by

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

      On 13/02/2003 at 00:04, xxxxxxxx wrote:

      First...

          
          
          class ErrorDialog : GeModalDialog
      

      should be

          
          
          class ErrorDialog : public GeModalDialog
      

      otherwise you can't access the members of GeModalDialog (error C2248: 'Open' : cannot access public).
      Second...

          
          
          
          
          }  
          
          
          
          
          
          #endif //_ERRORDIALOG_H_
          
          
          
      

      the end bracket of the class is missing the ';' it should be

          
          
          
          
          };  
          
          
          
          
          
          #endif //_ERRORDIALOG_H_
          
          
          
      

      Your PoserCR2Loader class is ok, just the dialog one is missing it.
      These are easy mistakes when you are out of practice 🙂
      HTH!

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

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

        On 13/02/2003 at 00:09, xxxxxxxx wrote:

        That's what I was talking about.  Yes, I'm outta practice.  Java is nothing like C++ and there is definitely a different approach and mindset between them.
        Now it's time to try a non-derived class.  Wish me luck! :0)
        Thanks,
        Robert

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

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

          On 13/02/2003 at 01:04, xxxxxxxx wrote:

          I see that my non-derived custom classes are still giving me hell.  Do I need to derive these from some C4D class, like GeData or BaseContainer?  Otherwise, the class code themselves compiles, but as soon as they referenced by C4D classes, errors.
          Thanks again,
          Robert

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

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

            On 13/02/2003 at 01:19, xxxxxxxx wrote:

            Ah. Nevermind.  Figured it out.  I split the PoserCR2Loader class from the PluginXXX()'s, making a header for it.  So, the referenced classes needed header includes in the PoserCR2Loader header (didn't work by putting them before that header in the .cpp).
            Some of it is starting to comeback to me.  Can you tell that it's been several years since programming C++? 🙂
            I'm liking the AutoAlloc<> feature.   A quick question about my own custom classes: Do they need to be Alloc()/Free()'d or will they get destructed on exit if 'new' is used?
            Back to the grind...
            Robert

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

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

              On 13/02/2003 at 02:07, xxxxxxxx wrote:

              If you use the new operator you must use delete, anything that you allocate and isn't linked to CINEMA in some way you generally have to free, the docs give you info about what CINEMA owns (that doesn't need to be free'd), if it is pure C++ then you are responsible for it (generally).

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

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

                On 13/02/2003 at 09:36, xxxxxxxx wrote:

                Okay.  This is the behavior expected.

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

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

                  On 15/02/2003 at 12:59, xxxxxxxx wrote:

                  The convenience offered by AutoAlloc<> is offered automatically for classes you create on your own. For example, just as you can write
                  > void func()
                  > {
                  >   AutoAlloc<BaseSelect> bs;
                  >   // ...
                  > }
                  you can do this with your own class, without AutoAlloc<>:
                  > void func()
                  > {
                  >   MyClass mc;
                  >   // ...
                  > }
                  This is called stack, automatic or scoped instatiation. Just note that in both of these cases the object is destructed as soon as it goes out of scoop. So you mustn't store any pointers to it.

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

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

                    On 15/02/2003 at 15:48, xxxxxxxx wrote:

                    Okay.  I just haven't settled on the scope of some of the classes being created in other class methods yet. :0)  They may be needed for the entire plugin's duration or just the duration of the method itself.  Still, thanks for the pointer (or lack thereof).  It's been awhile.  Once again, memory allocation is not an issue in Java at all (since everything is created automatically and eventually removed by the GC when it looses scope or references).
                    Thanks,
                    Robert

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

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

                      On 16/02/2003 at 01:00, xxxxxxxx wrote:

                      Actually it's just as in Java, as long as you don't store any pointers to the stack objects. (Since in Java, as soon as you lose the last pointer, you can just as well consider the object destructed.)
                      A good rule of thumb is: use stack objects when you can, and gNew when you have to (for example when the object will be needed outside of the function).

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

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

                        On 16/02/2003 at 10:00, xxxxxxxx wrote:

                        Well, not totally.  In Java, any storage remains until references are lost to it, no matter where it was initiated.  I can create a class that creates an array, pass a reference to the array off to another class, remove references to the first class (thereby deleting the class), and  the array is still valid (even though the class in which it was created is now caput).  In C++, if I do the same for an automatic method variable, I think that the variable will become invalid in the other class since its memory has now been released to NULL.
                        There is also no garbage collection in C++.  Automatic variables just die natural deaths at the end of scope.  In Java, a variable can be kept alive as long as the process is running (by keeping a reference to it).  You never have to free memory in Java to avoid memory leaks since the GC cleans up after you.
                        Robert

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