error C2065: 'layerObject': nichtdeklarie



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

    On 29/04/2009 at 07:39, xxxxxxxx wrote:

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

    ---------
    Hi all,
    I'm trying to read out the Layer informations.
    Searching the forum I found an example :

    Just use GetlayerData() with the layer and check the states of the structure elements of the layerData structure. Here a little example that prints all states of all layers in a scene.
    You can of course also get the layerData directly from objects, tags etc.

    static void StepThrulayers(GeListNode *layer, BaseDocument *doc)
    {
         while (layer)
         {
              layerObject *lobj = (layerObject* )layer;
              const layerData *ldata = lobj->GetlayerData(doc, FALSE);
              GePrint(lobj->GetName());
              if(ldata->solo)
                   GePrint("Solo On");
              else
                   GePrint("Solo Off");
              if(ldata->view)
                   GePrint("View On");
              else
                   GePrint("View Off");
              if(ldata->render)
                   GePrint("Render On");
              else
                   GePrint("Render Off");
              if(ldata->manager)
                   GePrint("Manager On");
              else
                   GePrint("Manager Off");
              if(ldata->locked)
                   GePrint("Locked On");
              else
                   GePrint("Locked Off");
              if(ldata->animation)
                   GePrint("Animation On");
              else
                   GePrint("Animation Off");
              if(ldata->generators)
                   GePrint("Generators On");
              else
                   GePrint("Generators Off");
              if(ldata->deformers)
                   GePrint("Deformers On");
              else
                   GePrint("Deformers Off");
              if(ldata->expressions)
                   GePrint("Expressions On");
              else
                   GePrint("Expressions Off");
              StepThrulayers(layer->GetDown(), doc);
              layer = layer->GetNext();
         }
    }
    Bool MenuTest::Execute(BaseDocument *doc)
    {
         GeListHead *llist = doc->GetlayerObjectRoot();
         if(!llist)
         {
              GePrint("no list");
              return FALSE;
         }
         StepThrulayers(llist->GetFirst(), doc);
         return TRUE;
    }
    But when I try to compile it I allways get the error:
    1>c:\maxon\cinema 4d r11 development\plugins\plugin-container-layer lesen\source ool\v4d_1.cpp(20) : error C2065: 'layerObject': nichtdeklarierter Bezeichner

    Here is my complete Code:
    #include "c4d.h"
    #include "c4d_symbols.h"
    #include "OperatingSystem.h"
    #include "ge_vector.h"
     
    class HelloWorld : public CommandData
    {
    public:
    virtual Bool Execute(BaseDocument* doc);
    };
     
     
    static void StepThrulayers(GeListNode *layer, BaseDocument *doc)
    {
    while (layer)
    {
    layerObject *lobj = (layerObject* )layer;
    const layerData *ldata = lobj->GetlayerData(doc, FALSE);
    GePrint(lobj->GetName());
    if(ldata->solo)
    GePrint("Solo On");
    else
    GePrint("Solo Off");
    if(ldata->view)
    GePrint("View On");
    else
    GePrint("View Off");
    if(ldata->render)
    GePrint("Render On");
    else
    GePrint("Render Off");
    if(ldata->manager)
    GePrint("Manager On");
    else
    GePrint("Manager Off");
    if(ldata->locked)
    GePrint("Locked On");
    else
    GePrint("Locked Off");
    if(ldata->animation)
    GePrint("Animation On");
    else
    GePrint("Animation Off");
    if(ldata->generators)
    GePrint("Generators On");
    else
    GePrint("Generators Off");
    if(ldata->deformers)
    GePrint("Deformers On");
    else
    GePrint("Deformers Off");
    if(ldata->expressions)
    GePrint("Expressions On");
    else
    GePrint("Expressions Off");
    StepThrulayers(layer->GetDown(), doc);
    layer = layer->GetNext();
    }
    }
     
    Bool HelloWorld::Execute (BaseDocument* doc) //This function is called by Cinema4D when the plugin shall be executed.
    {
    BaseObject *op=NULL;
    op=doc->GetFirstObject();
    if (!op) return false; // Verlässt die Funktion
    ModelingCommandData cd;
    cd.doc = doc;
    cd.op = op;
    GePrint("Hello World!");
    //-------------
    GeListHead *llist = doc->GetlayerObjectRoot();
    if(!llist)
    {
    GePrint("no list");
    return FALSE;
    }
    StepThrulayers(llist->GetFirst(), doc);
    //-------------
     
    return true;
    }
    // ------------------------------------------------------------------------------------------
    Bool RegisterV4D_1(void)
    {
    HelloWorld *helloWorld = NULL;
    // initialize global resource object
    if (!resource.Init()) return FALSE;
    // create new instance of HelloWorld class
    helloWorld = gNew HelloWorld;
    return (RegisterCommandPlugin(PLUGIN_ID, GeLoadString (IDS_PLUGIN_NAME),0,"Icon.tif", GeLoadString (IDS_PLUGIN_DESCR), helloWorld));
    }
    Does anybody here know how to solve the Problem.
    Thanks a lot.



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

    On 29/04/2009 at 08:59, xxxxxxxx wrote:

    It looks like a typo/syntax error. It's LayerObject and LayerData not layerObject and layerData.

    cheers,
    Matthias



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

    On 30/04/2009 at 01:24, xxxxxxxx wrote:

    Hi Matthias,
    thanks so much!!!
    Great job.
    Could it be that the VS2008 is a little bit kiki here.
    We compiled it in a VS2005 2 weeks ago and everything was fine.
    Now in VS2008 we got the errrors.



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

    On 30/04/2009 at 03:30, xxxxxxxx wrote:

    No, C++ is just a case sensitve language.

    cheers,
    Matthias


Log in to reply