problems inserting an object



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

    On 12/04/2004 at 16:15, xxxxxxxx wrote:

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

    ---------
    Hi,
    I am new to C4D Pluggin and found out the last days that this forum is the only way to really learn Plugin Coding for Cinema :-/ ...
    I am about to Insert an Object into an active document but cannot see nor select it... It took me about 2 days  to find the right commands but they do not seem to work, what went wrong? Is there any readable help except for the SDK api to learn such things?
    My Code:
    BaseObject *obbc;
    BaseContainer ObjDescr;
     Vector Seiten;
     Seiten.x = 10.0;
     Seiten.y = 10.0;
     Seiten.z = 10.0;
     ObjDescr.SetVector(PRIM_CUBE_LEN, Seiten);
    obbc = AllocPrimitiveObject(PRIMITIVE_CUBE);
      ClearMem(&obbc, sizeof(obbc));
      obbc = GeneratePrimitive(GetActiveDocument(), PRIMITIVE_CUBE, ObjDescr, 10, NULL, NULL);
      obbc->SetName("TestQuader");
      GetActiveDocument()->InsertObject(obbc, NULL, NULL, TRUE);
    I suppose this should work but nothing happens - help! (Actually the routine is startet as I checked with some debugging output cut off in this code excerpt, so this cannot be the problem



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

    On 13/04/2004 at 03:20, xxxxxxxx wrote:

    BaseObject *obbc;
    BaseContainer ObjDescr;
    ObjDescr.SetVector(PRIM_CUBE_LEN, Vector(10.0f,10.0f,10.0f)); //This is faster ;-)
    obbc = AllocPrimitiveObject(PRIMITIVE_CUBE);
      ClearMem(&obbc, sizeof(obbc));
    What  is this for? You don´t need this.


    obbc = GeneratePrimitive(GetActiveDocument(), PRIMITIVE_CUBE, ObjDescr, 10, NULL, NULL);
      obbc->SetName("TestQuader");
      GetActiveDocument()->InsertObject(obbc, NULL, NULL, TRUE);
    Now add EventAdd(); to it and it should work.



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

    On 13/04/2004 at 07:42, xxxxxxxx wrote:

    That's it and it worked!
    It was nowhere written that I have to add that order - where did you know it from?
    It is very sad that Maxon does not deliver any Help except for those API descriptions. It took me 7 Days to create a working Dialogue and to put an Object into the Scene. Trial and Error is a very ineffective Way to learn coding Plugins
    There is not a single Tutorial for Plugin C++ Development in the whole Net ()and I've searched a lot times...)



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

    On 13/04/2004 at 16:25, xxxxxxxx wrote:

    Hi,
    that´s just a matter of experience.
    Do you have the SDK? There are several very good example plugins included that show almost any form of plugin for Cinema 4D. Trial & Error is needed, but most of the time, its also the most effective way to learn.
    Btw. I consider the SDK Documentation to be very good.



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

    On 13/04/2004 at 17:07, xxxxxxxx wrote:

    Nice to see that at least someone likes the docs. I'd be the first to admit that they're a bit thin on tutorials. But as you say yourself, this forum is a good place to find additional help, especially if you start searching the two archives.
    By the way, writing a beginners' tutorial as you go can be a good way to learn an API, hint hint... :-)



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

    On 23/06/2004 at 15:27, xxxxxxxx wrote:

    Hello,
    I'm completely new to this form and about to learn using COFFEE. After experiencing some features I've also got the problem that I don't know how to simply insert a basic object via a COFFEE description.
    So I wondered if someone could give me a little explanation about this problem, because I can't find it out with the SDK help system.
    Nice day,



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

    On 23/06/2004 at 18:39, xxxxxxxx wrote:

    Just do doc->InsertObject(obj, NULL, NULL) to insert obj into doc.
    PS. Please create a new thread rather then reusing an old one, especially when the subject changes (C++ => C.O.F.F.E.E.).



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

    On 24/06/2004 at 00:58, xxxxxxxx wrote:

    Thanks for the info. I've tried to fix my plugin but I still can't insert objects using COFFEE. 
    I really don't know what I'm doing wrong, and what to do in order to make it work.
    Below I've shown you all my code. Please have comments about everything that is wrong in it.
    ------------------------------------------------------------------------------------
    var PLUGIN_ID = x;
    var MENU_NAME = "Pin";
    var HELP_STR = "This option allows you to create....";
    var PLUGIN_TITLE = "Pin";
    class Sky : SkyObject
    {
    public:
     Sky();
    }
    class PinMenu : MenuPlugin
    {
    public:
     PinMenu();
     GetHelp();
     GetID();
     GetName();
     Execute(doc);
    }
    PinMenu::PinMenu() { super(); }
    PinMenu::GetID() { return PLUGIN_ID; }
    PinMenu::GetName() { return MENU_NAME; }
    PinMenu::GetHelp() { return HELP_STR; }
    PinMenu::Execute(doc)
    {
     //var Teg = new(Filename);
     //Teg->SetFullString("Teg.exe");
     //GeExecuteFile(Teg);
     doc->InsertObject(Sky, NULL, NULL);
     return;
    }
    main()
    {
     Register(PinMenu);
    }
    ------------------------------------------------------------------
    In the code above you can see that the program its functions are to open an executable (this code works) and inserting a SkyObject (this doesn't work).
    With regards,
    Ralf Euser



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

    On 24/06/2004 at 04:16, xxxxxxxx wrote:

    Sorry, "obj" in my example should be something like "new(SkyObject)". (You cannot inherit, like you tried to do above, from the built-in objects.)



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

    On 25/06/2004 at 06:01, xxxxxxxx wrote:

    Thanks, but I got another question, pointed to the peace of code below. (It's coming out of the C4D SDK.)

    void InsertMaterial(_<_a title="class basematerial : public baselist2d" href= "mk:@msitstore:c:\documents%20and%20settings\ralf%20euser\bureaublad\c4d%20r8%20sdk.chm::/pages/c4d_basematerial/class_basematerial45.html"_>_ color=#800080 BaseMaterial* m_<_a title="class basematerial : public baselist2d" href= "mk:@msitstore:c:\documents%20and%20settings\ralf%20euser\bureaublad\c4d%20r8%20sdk.chm::/pages/c4d_basematerial/class_basematerial45.html"_>_ml"> color=#800080 BaseMaterial* pred = NULL, Bool checknames_<_h4_>_UE)

    I'm trying to insert a new material and want it to be placed onto the SkyObject. The code above shows how to insert a new material, but how do I have to intepret this code, in order to let it be active in my plugin?
    I can't just insert the code, because that won't work. So what do all tags mean in the code above and what has to be the right code for my plugin?
    Best
    Ralf Euser



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

    On 28/06/2004 at 01:13, xxxxxxxx wrote:

    Aside from the weird formatting errors shown above in the forum, a declaration such as

        
        
        void InsertMaterial(BaseMaterial* mat, BaseMaterial* pred = NULL, Bool checknames = TRUE)
    

    says that...

    • ...the function doesn't return anything (void).
    • ...the first parameter should be a pointer to a material.
    • ...the second parameter can also point to a material, but if you don't supply it it will be automatically NULL.
    • ...the third parameter can be TRUE or FALSE, but if you don't specify it it will be automatically TRUE.
      So you would simply do
        
        
        doc->InsertMaterial(mat);
    

    where mat is a BaseMaterial you have created.



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

    On 28/06/2004 at 01:15, xxxxxxxx wrote:

    To place the material on the sky object you have to create a TextureTag, insert it on the sky with sky->InsertTag(tag) and then link it to the material tag->SetMaterial(mat).


Log in to reply