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
    • Register
    • Login

    Object Creation with COFFEE

    Scheduled Pinned Locked Moved SDK Help
    9 Posts 0 Posters 715 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 18/08/2005 at 14:56, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   9.012 
      Platform:      Mac OSX  ; 
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      Hey out there.

      I am trying to find out how to create new objects with COFFEE. Should be simple, but I can't seem to find any examples in the SDK or online forums.

      I am trying to use AllocObject(), but can't figure out the syntax. I'm a newbie to COFFEE and I just need some help getting started. Any assistance would be much appreciated.

      -Cheers

      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 18/08/2005 at 15:48, xxxxxxxx wrote:

        Go grab yourself the COFFEE documentation!

        Plugin Cafe Downloads[URL-REMOVED]

        Since you are MacOS, get the HTML version, not the CHM Windows help file.


        [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

        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 18/08/2005 at 16:00, xxxxxxxx wrote:

          I have the documentation. I'm finding it a bit cryptic, and there are no examples of how to do what I want to do. AllocObject is not a member of BaseObject, understandably, but when I try the following:

          var cam = new(BaseObject);

          or:

          var cam = new(AllocObject(Ocamera));

          I get errors. I know that there is something basic about the object method that I'm just not grasping. I need help. Thank you.

          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 18/08/2005 at 19:03, xxxxxxxx wrote:

            Try this:

            var cam = AllocObject(Ocamera);

            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 19/08/2005 at 10:31, xxxxxxxx wrote:

              I've tried this as well. I get an error, "Variable or function expected" at the type call to AllocObject.

              Thanks.

              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 19/08/2005 at 13:05, xxxxxxxx wrote:

                Okay. What you may need here is this then:

                  
                var type = Ocamera;  
                var cam = AllocObject(type);  
                

                I haven't used the 9.1 version of COFFEE yet, but the doc says ([int] type), so I expect that one cannot use the type directly. Examples of the changes in 9.1 would be warranted.

                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 19/08/2005 at 17:32, xxxxxxxx wrote:

                  Robert, thanks for your help. I'm still geting an error though. At the end of the first line I still get, "Variable or function expected."

                  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 19/08/2005 at 21:56, xxxxxxxx wrote:

                    Something must be incorrect somewhere else then. My second message had the correct methodology. Here's a simple test source (MenuPlugin) - it loads an icon, so you may want to dump some tif or jpg image as the one mentioned in main() to avoid complaints. Also, use your own Plugin_ID for PLUGIN_MENU_ID.

                    This worked perfectly. Calling the plugin from the Plugins menu created a Camera object.

                      
                    ////////////////////////////////////////////////////////////////  
                    // allocobject.cof  
                    ////////////////////////////////////////////////////////////////  
                      
                    // Included symbols  
                    //include "c4d_symbols.h"  
                      
                    enum  
                    {  
                         // Unique ids from http://www.plugincafe.com  
                         PLUGIN_MENU_ID = xxxxxxx,  
                      
                         _DUMMY02_  
                    };  
                      
                    var resource;  
                    var plugin_path;  
                    var plugin_icon;  
                      
                    // CLASS: Drop To Floor Menu - Register plugin in menu  
                    class AllocObject_MenuPlugin : MenuPlugin  
                    {  
                         private:  
                         public:  
                              AllocObject_MenuPlugin();  
                              GetID();  
                              GetIcon();  
                              GetName();  
                              GetHelp();  
                              Execute(doc);  
                    }  
                    AllocObject_MenuPlugin::AllocObject_MenuPlugin()     { super(); }  
                    AllocObject_MenuPlugin::GetID()                                   { return PLUGIN_MENU_ID; }  
                    AllocObject_MenuPlugin::GetName()                              { return "AllocObject"; }  
                    AllocObject_MenuPlugin::GetHelp()                              { return "Help"; }  
                    AllocObject_MenuPlugin::GetIcon()                              { return plugin_icon; }  
                    AllocObject_MenuPlugin::Execute(doc)  
                    {  
                         StatusSetText("AllocObject");  
                         var camera;  
                         var document;  
                         if (!(camera = AllocObject(Ocamera))) return FALSE;  
                         document = GetActiveDocument();  
                         StatusSetText("");  
                         if (!document->InsertObject(camera, NULL, NULL)) return FALSE;  
                         EventAdd();  
                         return TRUE;  
                    }  
                      
                    // Start of plugin  
                    main()  
                    {  
                         // Load Resource  
                         if (!(plugin_path = GeGetRootFilename())) println("Unable to find plugin!");  
                         plugin_path->RemoveLast();  
                      
                         // Load Icons  
                         var icon_file = plugin_path->GetClone();  
                         icon_file->AddLast("pluginicon.tif");  
                         plugin_icon = new(BaseBitmap,1,1);  
                         plugin_icon->Load(icon_file);  
                      
                         // Register Plugins  
                         Register(AllocObject_MenuPlugin);  
                    }  
                    
                    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 22/08/2005 at 15:40, xxxxxxxx wrote:

                      Robert,

                      Thank you so much for all your help. Your example was very useful as an addition to those that come with the SDK, so thanks.

                      I was still getting an error, and found that the real problem all along was that I hadn't installed the 9.102 updater from 9.012. So I had really been using the right syntax from early on, but the AllocObject() command was giving an error regardless. Now that I've installed the updater, everything is fine.

                      Sorry that I overlooked this, and thank you for taking time out to help me.

                      -Aaron

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