InExclude list



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

    On 15/04/2012 at 21:54, xxxxxxxx wrote:

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

    ---------
    Hi folks,
     
    I have the following code sitting in a dialog, and is run when a button is pressed:

    BaseContainer *bc_Cube = obj->GetDataInstance();
    InExcludeData *List = (InExcludeData* )bc_Cube->GetCustomDataType(7005, CUSTOMDATATYPE_INEXCLUDE_LIST);
    BaseObject *cube = BaseObject::Alloc( Ocube );  
    if(!cube) GePrint("Cube failure");  
    cube->SetName("Cube");  
    cube->SetAbsPos(Vector(0,0,0));  
    doc->InsertObject( cube, NULL, NULL );  
    List->InsertObject(cube, DESCFLAGS_SET_0);  
    EventAdd();
    

    I'm wanting to put the cube into a custom InExclude list that's on object "obj". The container ID is 7005. It all compiles, but crashes when run inside Cinema.
     
    Here's the description code in my "obj" object for the customgui element (does this look right also?) :

    cid_list = DescLevel(ID_TAB_LIST, CUSTOMGUI_INEXCLUDE_LIST, 0);  
    if (!id_List || cid_list.IsPartOf(*id_List,NULL))  
    {  
    BaseContainer locked = GetCustomDataTypeDefault(CUSTOMGUI_INEXCLUDE_LIST);  
    locked = GetCustomDataTypeDefault(CUSTOMGUI_INEXCLUDE_LIST);  
    locked.SetString(DESC_NAME, "");  
    locked.SetString(DESC_SHORT_NAME, "");  
    if (!description->SetParameter(cid_list, locked, DescLevel(ID_TAB_LIST_GROUP))) return TRUE;  
    }
    

    Where might I be going wrong here?
     
    WP.



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

    On 16/04/2012 at 14:39, xxxxxxxx wrote:

    Not sure if this will be of any help.
    But here's your code used on a light object. And it seems to work fine.

    //Required includes:  
    #include "customgui_inexclude.h"  
    #include "..\..\..\..\resource\res\description\olight.h"  
      
      
    //.cpp Code:  
      
      BaseObject *obj = doc->SearchObject("Light");    //A pointer to the light object which has an In/Exclude attribute   
      BaseContainer *bc_Cube = obj->GetDataInstance();  
      InExcludeData *List = (InExcludeData* )bc_Cube->GetCustomDataType(LIGHT_EXCLUSION_LIST, CUSTOMDATATYPE_INEXCLUDE_LIST);  
      
      BaseObject *cube = BaseObject::Alloc( Ocube );  
      if(!cube) GePrint("Cube failure");  
      cube->SetName("Cube");  
      cube->SetAbsPos(Vector(0,0,0));  
      doc->InsertObject( cube, NULL, NULL );  
      List->InsertObject(cube, DESCFLAGS_SET_0);
    

    The Olight.res & Olight.h files found in the maxon folder might be helpful example to look at to check against your files for errors.

    -ScottA



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

    On 16/04/2012 at 20:26, xxxxxxxx wrote:

    Hmmm, it does too. Must be the way I've coded my Description element? Unfortunately I'm not using a .res file so I don't know if that has anything to do with it or not.
     
    Seems a bit strange that I can manually drop an object into my own plugin and it doesn't crash, but going through the dialog's command does. Yet inserting the object into a light's list using the same dialog and code works...


Log in to reply