On 31/03/2014 at 09:36, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 13
Platform: Windows ;
Language(s) : C++ ;
---------
Hi,
I want my plugin to load, resp. import objects from dxf files. I use LoadDocument() to load the file in a new document and CopyTo to copy the object into the current document. The problem is, that materials get lost. Do I also have to copy each single material? And when, before or after copying the object and how to use then the AliasTrans? Any help is appriciated.
if (fn.FileSelect(FILESELECTTYPE_SCENES, FILESELECT_LOAD, GeLoadString(IDS_L_IMPORT)))
{
tdoc = LoadDocument(fn, SCENEFILTER_OBJECTS|SCENEFILTER_MATERIALS, NULL);
if (!tdoc)
{
MessageDialog(IDS_FILEERROR, fn.GetString());
break;
}
cp = tdoc->GetFirstObject();
if (cp)
{
AutoAlloc<AliasTrans> aliastrans;
if (!aliastrans || !aliastrans->Init(doc)) break;
BaseObject *dp = (BaseObject * )cp->GetClone(COPYFLAGS_0, aliastrans);
aliastrans->Translate(TRUE);
if (dp)
{
doc->InsertObject(dp, op, NULL, TRUE);
}
}
KillDocument(tdoc);
}
Btw.: How do you get rid of these space lines?