On 22/01/2018 at 11:23, xxxxxxxx wrote:
Hi Riccardo,
Thanks for this. My question really is how do I let C4D know that the active document has just been saved so that a user hitting "Ctrl+S" to save over the existing document that was just saved with the API will not be presented with a dialog box?
Currently although the SaveDocument function will save the file appropriately, C4D seems to be completely unaware that the document was saved or where it was saved.
Additionally, if I goto close the document, C4D asks me if I want to save changes to my project. There have been no changes made and this dialog actually has the correct location for the project.
Using your advice I set the saved the filepath to the world container instance returned by GetWorldContainerInstance()....
c4d.documents.GetActiveDocument()
doc.SetDocumentName( filePath )
c4d.documents.SaveDocument( doc, str(filePath), c4d.SAVEDOCUMENTFLAGS_DIALOGSALLOWED, c4d.FORMAT_C4DEXPORT )
wci = c4d.GetWorldContainerInstance()
wci[90003] = str( filePath )
This fixes the issue with the File/Close option not asking if I want to save the project when it has just been saved, however the File/Save function still presents me with a dialog box, but instead of the path being the last place I manually opened a file, it is defaulting to the root of my documents folder.
My steps are:
Open C4D
Create a cube
Save the project using the API
goto File/Save -- dialog box appears defaulting to ~/Documents (on Windows 7)
The behavior I would expect here is that the project is saved to the location it was just saved to with no dialog, overwriting the file the API just created.
Thoughts?
Andrew