Object Creation with COFFEE
-
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
-
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.
-
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.
-
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);
-
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.
-
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.
-
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."
-
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); }
-
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