Adding a new object to InExclude List



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

    On 25/10/2008 at 02:14, xxxxxxxx wrote:

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

    ---------
    Hi,

    first of all: yes, I have read this thread:
    Topic: Insertobjects in InExludeData

    But it doesn't help me.

    In my plugin, I have a button. Clicking it creates an object (one of my plugin objects) and inserts it into the scene. The new object should then be added to an InExclude List automatically.

    Creating and inserting into scene works fine:

    > BaseObject\* NewObj = BaseObject::Alloc(1023185); if (!NewObj) return FALSE; \> doc->InsertObject(NewObj, NULL, NULL, TRUE); \> doc->SetActiveObject(NewObj);

    Now I want to link this object in an InExclude List in my plugin (the object that also contains the button). I tried it this way, but nothing happens:

    > GeData     \*ObjList; \> bc->GetParameter(DescID(MY_FUNKY_OBJLIST), ObjList); \> InExcludeData \*AttObjList = static_cast<InExcludeData\*>(ObjList.GetCustomDataType(CUSTOMDATATYPE_INEXCLUDE_LIST)); \> AttObjList->InsertObject(NewObj, C_ZERO);

    As I said, nothing happens. No crash, no error message, and also no object link in the list. What am I doing wrong?

    Thanks for any help!

    Greetings,
    Jack



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

    On 25/10/2008 at 03:20, xxxxxxxx wrote:

    OK, it seems my static_cast was the problem, not sure about this.

    The following code works:

    > InExcludeData \*list = NULL; \> list = (InExcludeData\* )bc->GetCustomDataType(MY_FUNKY_OBJLIST,CUSTOMDATATYPE_INEXCLUDE_LIST); \> list->InsertObject(NewObj, DEFAULTVALUE);

    Cheers,
    Jack



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

    On 05/11/2008 at 06:01, xxxxxxxx wrote:

    OK, it works *almost* always.

    Sometimes it crashes here:

    > list = (inexcludeData\* )bc->GetCustomDataType(MY_FUNKY_OBJLIST,CUSTOMDATATYPE_inexclude_LIST);

    It seems (but I am not sure) this happens if the list is empty, and if nothing has been in the list since the plugin object has been created. In these cases, 'list' is still NULL after the shown code was executed.

    Do I have to initialize the list somehow?

    Thanks for any help.

    Greetings,
    Jack



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

    On 05/11/2008 at 06:23, xxxxxxxx wrote:

    Addition:

    For debugging, I added the following line before the crashing line:

    > bc->GetType(MY_FUNKY_OBJLIST)

    When the code is executed BEFORE any object has ever been in the InExclude list, it returns 0.

    If an object has been in the list before (doesn't matter if it's still there or if it has been removed again), it returns 1009290.

    Now I am sure I have to initialize the InExclude list somehow in the Init() function of my plugin object. But how does that work?

    Greetings,
    Jack



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

    On 05/11/2008 at 06:36, xxxxxxxx wrote:

    This should do the trick:

    > \> bc->SetData(SPLINESPREAD_EFFECTS_ATTRACT_OBJLIST,GeData(CUSTOMDATATYPE_INEXCLUDE_LIST)) \>

    cheers,
    Matthias



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

    On 05/11/2008 at 06:38, xxxxxxxx wrote:

    OK, I'm just talking to myself here.
    But the crash problem can in fact be solved using the tip from the thread I linked in my initial posting... ;-)

    Nevermind...

    Greetings,
    Jack



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

    On 05/11/2008 at 06:43, xxxxxxxx wrote:

    Oops, didn't see your posting before sending mine ;-)
    Yes, that's the trick, exactly. Thanks Matthias!

    Greetings,
    Jack



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

    On 05/11/2008 at 12:00, xxxxxxxx wrote:

    *hust* forum search?! ;o)



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

    On 06/11/2008 at 04:04, xxxxxxxx wrote:

    I did, as you see in the initial posting.
    And it helped, as you see in my posting from 6:38am ;-)

    Cheers,
    Jack



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

    On 06/11/2008 at 08:41, xxxxxxxx wrote:

    argh, ok ok, shame on my head. Haven´t seen that post! :)


Log in to reply