Hi im converting Materials using the Corona To C4D Plugin,
and im running into a strange problem, were my the context for my doc seems to go missing. But first thing first:
My setup:
I convert using the Cinema 4D exe as commandline, as the plugin otherwise does not seem to convert and store the information.
"Cinema 4D.exe" -nogui etc. etc..
This gives me very little commandline error output, making it very hard to debug, but its the only workaround i got for now. Se la vie.
I call my converter module giving it a doc reference and storing the document reference upon return
cac = CoronaAuraConverter.Converter(clone)
cloneResult = cac.main(clone, self, dst)
clone = cloneResult
In the converter submodule i process using the following code. This is because i can not seem to acess the converted materials until i saved and reload the document. This has been profen to work in a minimal sandbox example.
def main(self, doc, vuframeAuraInstanceRef, dst):
#Conversion process copied from Sandbox
c4d.CallCommand(CORONA_MENU_CONVERT)
tempORaryFilePath = self.tools.path_replace_leaf( dst, "tempStorageForMaterialDrop.c4d")
LogWithTimestamp("TempoaryFilePath " + tempORaryFilePath)
documents.SaveDocument(doc, tempORaryFilePath, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, c4d.FORMAT_C4DEXPORT)
newDoc = Tools.loadActiveDocumentFrom(tempORaryFilePath)
allMats = newDoc.GetMaterials()
for mat in allMats:
LogWithTimestamp("Storing Material Standard Info:" + mat.GetName())
#Doing work with the loaded materials - this work
c4d.documents.KillDocument(newDoc)
return doc
The problem:
Upon return working with the returned old doc reference seems to fail.
I tried to refresh it with
doc = documents.GetActiveDocments()
assumption being its some context reference going stale and getting gcc or similar.
Anyone any idea were i did go wrong. Also a way to get the standard output beyond 25 kb by g_logfile="c4dconversion.log" would be greatly appreciated.
Regards FSS
PS: Is there a way to buy SDK-Team Support tickets?
PS: Just for completness, not relevant as it loads the document
def loadActiveDocumentFrom(src):
print "DEBUG: file exists :" + str(os.path.exists(src))
load = documents.LoadFile(src)
if not load:
LogWithTimestamp( "Source File could not be loaded: " + src)
raise FileNotFoundError("Source file at path " +src + " not found")
doc = documents.GetActiveDocument()
if doc is None:
LogWithTimestamp( "Could not get active document")
return False
return doc