AtomArray to BaseObject

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

On 12/06/2009 at 12:53, xxxxxxxx wrote:

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

---------
Hi there,
i have managed to create an AtomArray which holds all objects in the scene, now i want filter away the the lights out, create a new Document and copy the Objects from the list to that new doc.

> `

  
\>  sceneObjects->FilterObject(Olight,NULL,FALSE);  
\>  BaseDocument *doc3 = BaseDocument::Alloc();  
\>  if (!doc3) goto Ende;  
\>  BaseObject *newParent = BaseObject::Alloc(Onull);  
\>  newParent->SetName(objName);  
\>  doc3->InsertObject(newParent,NULL,NULL,FALSE);  
\>  for(int i=0;i<sceneObjects->GetCount();i++)  
\>  {                               
\>  doc3->InsertObject(static_cast<BaseObject*>(sceneObjects->GetIndex(i)),newParent,NULL,TRUE);  
\>  }  
\>  

`

anyway, the line in the loop where i try to insert the objects simply switches cinema away, not even a crash message appears 🙂

what am i doing wrong there? i guess something very basic?

thanks,
Ello

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

On 12/06/2009 at 13:16, xxxxxxxx wrote:

ok, i managed it to work , at least somehow:

> <code>
>
>> <code>
>>
>>> <code>
>>>
>>>> `

  
\>  oc3->InsertObject(static_cast<BaseObject*>(sceneObjects->GetIndex(i)->GetClone(0L,NULL)),newParent,NULL,TRUE);  
\>  

`
>>>
>>> </code>
>>
>> </code>
>
> </code>

but now if the base document looks for example like this:
parent
-object1
-object2

the target looks like this:

newParent
-object1
-object2
-parent
--object1
--object2

something still wents wrong and now i really dont have a clue what it is??

anyone has a hint?

and to make it more strange the light objects are still there. seems the Filter doesnt work...
edit: i guess its better to filter manually by using GetType(), but why are those duplications happening? ok, i think because the parent gets copied with the childs?? gonna test 🙂

thanks,
ello