Updating InExclude List
-
On 24/02/2013 at 12:31, xxxxxxxx wrote:
User Information:
Cinema 4D Version: r13
Platform: Windows ;
Language(s) : C++ ;---------
Hi there,i am facing a strange problem. I have an InExclude List where the user can put different objects. Now when one removes an object it seems the InExclude List is not recognizing it.
myList->GetObjectCount() still returns the count as if the deleted object is still in the list. Removing it within the List does work. How can i fix this behaviour?thanks in advance,
Ello -
On 24/02/2013 at 12:36, xxxxxxxx wrote:
That's kinda funny,
Someone just asked this same question a couple of days ago in the python forum:
https://developers.maxon.net/forum/topic/6955/7831_removing-objects-from-om-and-update-inexcludeWhat are the odds of that happening?
Pretty sure it's a known bug/limitation with the In/Exclude list.
-ScottA
-
On 24/02/2013 at 12:58, xxxxxxxx wrote:
Originally posted by xxxxxxxx
i am facing a strange problem. I have an InExclude List where the user can put different objects. Now when one removes an object it seems the InExclude List is not recognizing it.
myList->GetObjectCount() still returns the count as if the deleted object is still in the list. Removing it within the List does work. How can i fix this behaviour?A bit of a silly question, but are you initialising the list before you use it? If you don't it won't work correctly, this may be a symptom of that. In your Init() function you could do something like:
BaseContainer *data = op->GetDataInstance(); if (!SUPER::Init(node)) return FALSE; data->SetData(MY_LIST_ID), GeData(CUSTOMDATATYPE_INEXCLUDE_LIST, DEFAULTVALUE));
Apologies in advance if you knew this already.
-
On 24/02/2013 at 23:34, xxxxxxxx wrote:
thank you. i'll have to check this when i am back home. but this sounds like a possible solution as i am quite sure i missed the initialisation.
-
On 25/02/2013 at 01:11, xxxxxxxx wrote:
No, it's nothing to do with that if I remember correctly. I noticed this years ago (there must be a thread here somewhere) and it still persists. You have to check for it and remove the object from the list yourself!
-
On 25/02/2013 at 01:18, xxxxxxxx wrote:
thanks for the input.. i found that thread, too. would you mind showing a snippet on how to do this as i have no idea about it?
-
On 25/02/2013 at 01:37, xxxxxxxx wrote:
Here is some code:
InExcludeData* t_objlist = (InExcludeData* )data->GetCustomDataType(FLUID_CONTAINER_OBSTACLES,CUSTOMDATATYPE_INEXCLUDE_LIST); if(t_objlist && t_objlist->GetObjectCount()>0) { for(int i=0; i<t_obj->GetObjectCount(); ++i) { BaseList2D* t_baseobject = t_obj->ObjectFromIndex(doc,i); if(!t_baseobject){/* An object has been deleted but C4D still returns the old count (C4D bug) */ if(!t_objlist->DeleteObject(i)) break; op->SetDirty(DIRTYFLAGS_DATA); } } }
-
On 25/02/2013 at 02:12, xxxxxxxx wrote:
thank you very much
edit: just tried it out and now it works ... another issue appeared now. when i delete an object which is in the list and than undo the delete, the object isnt back in the list. how can i make this happen?
cheers,
Ello