Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    C++ for Beginners: Create an Object

    SDK Help
    0
    7
    467
    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 11/01/2005 at 00:35, xxxxxxxx wrote:

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

      ---------
      Hm, as the things were not working in Coffee I switched over to C++. And now I'm stuck. I've cleared out the SDK Examples to fit my needs, I was able to reuse my GUI - well, at least it shows up when I start the plugin. But I have no clue how to start from here. Could someone just give me a start - lets say how is the code to create a simple object, a sphere or a camera or something?
      I always seem to get lost in the sdk example files 😞

      Thanks

      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 11/01/2005 at 02:57, xxxxxxxx wrote:

        You might get lost in the SDK examples but just keep going over it. About 90% of what you can do is covered in the examples somewhere. Eventually everything will click into place.

        Also, you might want to use the search. This subject has been mentioned before.

        I'm assuming you already have a basic plugintype and you just need to create an object. This is very easy to do with SDK

        Here a few examples

          
        AutoAlloc<BaseObject> MyObject1(Ocube);  
        AutoAlloc<BaseObject> MyObject2(Onull);  
        AutoAlloc<BaseObject> MyObject3(Osphere);  
          
        // Add the objects into the document  
        GetActiveDocument()->InsertObject(MyObject1,NULL,NULL);  
        GetActiveDocument()->InsertObject(MyObject2,NULL,NULL);  
        GetActiveDocument()->InsertObject(MyObject3,NULL,NULL);  
        
        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 11/01/2005 at 03:51, xxxxxxxx wrote:

          Hm, I've tryed the search but was not able to find (or identify) a topic that fits what I need.
          I thought I had some basic plugintype - the plugin is already registered in the menue and opens up a GUI, but I don't know where to go from there. Where do I put the code you gave me?
          I basically changed the SubMenue Example, so I have a main.cpp which just openes a test.cpp and this is the former sub menue example, just changed to load my test.res file.

          I've made a switch and hoped it would work there but sadly it doesn't

          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 11/01/2005 at 03:58, xxxxxxxx wrote:

            Where to put the code actually depends where you WANT to put it. The most easiest is to put it in the CommandData::Execute method

            which I am guessing is where you have your code to open the GUI you have created

            take from the SDK examples:

              
            Bool MenuTest::Execute(BaseDocument *doc)  
            {  
            AutoAlloc<BaseObject> MyObject1(Ocube);  
            AutoAlloc<BaseObject> MyObject2(Onull);  
            AutoAlloc<BaseObject> MyObject3(Osphere);  
              
            // Add the objects into the document  
            GetActiveDocument()->InsertObject(MyObject1,NULL,NULL);  
            GetActiveDocument()->InsertObject(MyObject2,NULL,NULL);  
            GetActiveDocument()->InsertObject(MyObject3,NULL,NULL);  
                 //ControlThread ct;  
                 //ct.Start(FALSE); // multiprocessing test  
              
                 return TRUE;  
            }  
            

            Then clicking on the plugin in the plugins menu will create 3 objects in the docuemnt

            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 11/01/2005 at 04:42, xxxxxxxx wrote:

              Hm, nothing happenes.
              Yes, have the code to open the gui in the "Execute" function, but when I put your code here (with or without disabeling the open gui code) nothing happens.
              I've already tryed to erase the whole function and replace with yours bot no success.
              But it compiles without error.

              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 14/01/2005 at 08:12, xxxxxxxx wrote:

                Try putting a breakpoint or a GePrint() to verify that the code is actually run. Also, you should probably have an EventAdd() to make the editor update afterwards.

                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 14/01/2005 at 08:35, xxxxxxxx wrote:

                  Hm, thanks guys, I've found a solution, it just needed some time and a programmer with some spare time on my side to get me started. 😉

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