My object import



  • 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?



  • On 17/04/2014 at 15:07, xxxxxxxx wrote:

    I'm not certain about your question ... there is not a single line regarding the materials in
    your code, of course they will be lost.

    Btw, the extra lines seem to be a problem with Safari Browser. Do you use Safari?

    Best,
    -Niklas



  • On 18/04/2014 at 06:55, xxxxxxxx wrote:

    Thanks, I've not much experiences with the aliastrans and I was hoping, that it transfers attached tags.

    I'm using all browsers (I'm web developer, also) and all show these extra lines on Windows. The code lines get additional line break tags, which are needless, since the entire code is embedded in a pre (pre-formatted) tag.


Log in to reply