THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/03/2004 at 04:32, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.500
Platform: Windows ;
Language(s) : C.O.F.F.E.E ;
---------
Hi,
I am starting out writing my first plugin for C4D and am frustrated over the differences between C4D Rel 8.5 and 6. I wote a small test plugin which works perfectly with C4D 6 but fails for C4D 8.5. I expected it work as I cut and pasted it from the reference manual!
The " cube->SetPrimitiveType(PRIMITIVE_CUBE);" statement fails under 8.5 generating the error message "(5) Incomptible values ... NIL / Object". I am guessing the "new" function on the previous line failed.
Can someone help me to get this to work under 8.5 please?
The full code is:
_
_
class MyMenuPlugin : MenuPlugin
{
public:
MyMenuPlugin();
GetID();
GetName();
GetHelp();
Execute(doc);
}
MyMenuPlugin::MyMenuPlugin() { super(); }
MyMenuPlugin::GetID() { return 1234123; } // Temp
MyMenuPlugin::GetName() { return "C.O.F.F.E.E. Test"; }
MyMenuPlugin::GetHelp() { return "C.O.F.F.E.E. Dummy Plugin"; }
MyMenuPlugin::Execute(doc)
{
var doc = GetActiveDocument(); //get the active document
// create a cube using code from on-line reference manual
// PrimitiveObject example
// Creates a cube that's 200x100x300
var cube = new(PrimitiveObject);
cube->SetPrimitiveType(PRIMITIVE_CUBE);
var bc = cube->GetContainer();
bc->SetData(PRIM_CUBE_LEN, vector(200, 100, 300));
cube->SetContainer(bc);
doc->InsertObject(cube,NULL,NULL); // now put cube into the document
}
main() { Register(MyMenuPlugin);}
_
_
many thanks
Richard <SCRIPT language=javascript>postamble();_<_Script_>_