On 27/04/2017 at 09:27, xxxxxxxx wrote:
Hi,
I have a problem in R18 (works fine in R17), when trying to export/save documents to alembic file. (SaveDocument). When using command documents.SaveDocument(), c4d returns True, but it doesn't export/save anything to disk...
I usually execute my command...
documents.SaveDocument(documents.GetActiveDocument(), DEST_FILE, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, ABC_EXPORTER_ID)
... from an external application, communicating with C4D using OSC mudules.
Following that post, which is similar to my problem, I'm trying to export from within another thread (as suggested).
https://plugincafe.maxon.net/topic/9881/13306_cannot-export-to-fbx-from-command-line&KW=saveDocument&PID=52663#52663
So... to test it out, running in C4D Script Manager, here's what I am trying...
import c4d
from c4d import documents, threading
import sys
ABC_EXPORTER_ID = 1028082
DEST_FILE = "C:/temp/C4dExport_v001.abc"
DEST_FILE2 = "C:/temp/C4dExport_v002.abc"
class ExportThread(threading.C4DThread) :
def __init__(self, doc) :
self.status = False
def Main(self) :
# Export document to ABC
self.status = documents.SaveDocument(documents.GetActiveDocument(), DEST_FILE, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, ABC_EXPORTER_ID)
c4d.EventAdd()
def GetStatus(self) :
return self.status
def ExportABC() :
# thread = ExportThread(clone)
thread = ExportThread(doc)
thread.Start() # Start thread
thread.End() # Then end it but wait until it finishes
# Retrieve export status and return it
status = thread.GetStatus()
return status
print 'EXPORT ABC THREADED: ' , ExportABC()
print 'EXPORT ABC NOT THREADED: ', documents.SaveDocument(documents.GetActiveDocument(), DEST_FILE2, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, ABC_EXPORTER_ID)
Testing to export both from another thread, and from current, c4d returns 'True', from both.
But, only one file is created to disk (the not threaded one), while the other one is not created.
Any idea about what went wrong?