On 10/06/2015 at 16:28, xxxxxxxx wrote:
Try using LoadDocument() instead of LoadFile() :
_<_dt id="c4d.s.load" style="line-height: 16.5px; : rgb251, 234, 174;"_>_c4d.documents.LoadDocument
(name, loadflags[, thread])[](file:///C:/Users/Tangerine/Desktop/Python%20Docs%20R14/help/modules/c4d.documents/index.html?highlight=documents#c4d.documents.LoadDocument)
Similar to [LoadFile()
](file:///C:/Users/Tangerine/Desktop/Python%20Docs%20R14/help/modules/c4d.documents/index.html?highlight=documents#c4d.documents.LoadFile) but this time the document isn't put into the editors list of documents and you have control over the document.
Parameters:|
- name (str or [
MemoryFileStruct
](file:///C:/Users/Tangerine/Desktop/Python%20Docs%20R14/help/modules/c4d.storage/MemoryFileStruct/index.html#c4d.storage.MemoryFileStruct)) – The file to load.
- loadflags (int) –
Flags for the loader:
SCENEFILTER_0 |
No flags. |
SCENEFILTER_OBJECTS |
Load/save only the objects and associated items, such as materials used. |
SCENEFILTER_MATERIALS |
Load/save only the materials. |
SCENEFILTER_DIALOGSALLOWED |
Flag to inform your plugin that a dialog can be displayed if you wish, if this flag not set then no dialogs must be opened. |
SCENEFILTER_PROGRESSALLOWED |
Flag to inform your plugin that a progress bar can be displayed if you wish. The progress bar can be set by calling [StatusSetBar() ](file:///C:/Users/Tangerine/Desktop/Python%20Docs%20R14/help/modules/c4d/index.html#c4d.StatusSetBar). |
SCENEFILTER_MERGESCENE |
Flag to inform your plugin that this is a merge operation, i.e. that the document you are inserting to is an existing scene. |
SCENEFILTER_NONEWMARKERS |
Objects loaded from disk will keep their markers |
SCENEFILTER_SAVECACHES |
Caches of objects will also be written (only supported by C4D file format). This equals the global option "Save Polygon Objects for Melange Exchange"<_<_t_>_ |
- thread ([
BaseThread
](file:///C:/Users/Tangerine/Desktop/Python%20Docs%20R14/help/modules/c4d.threading/BaseThread/index.html#c4d.threading.BaseThread)) – The current thread, or None for the main CINEMA 4D thread.
Return type:|
[BaseDocument
](file:///C:/Users/Tangerine/Desktop/Python%20Docs%20R14/help/modules/c4d.documents/BaseDocument/index.html#c4d.documents.BaseDocument)
Returns:|
Document that was loaded, or None if it failed.
_tr>
Here's roughly how i've used it:
file = documents.LoadDocument(filePath, c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS | c4d.SCENEFILTER_MERGESCENE)
documents.InsertBaseDocument(file)
doc = documents.GetActiveDocument()