Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
On 28/03/2013 at 02:12, xxxxxxxx wrote:
Hey guys,
I'm trying to save the ACTIVE scene, not a copy of it with the following code:
_<_t_>_ doc = c4d.documents.GetActiveDocument() if doc.GetDocumentPath() == "": filePath = doc.GetDocumentPath() if c4d.documents.SaveDocument(doc, doc.GetDocumentName(), saveflags = c4d.SAVEDOCUMENTFLAGS_SAVEAS, format = c4d.FORMAT_C4DEXPORT) == False: print "File not saved" Message = c4d.BaseContainer() Message.SetString(0, "blabla") result = gui.ShowPopupDialog(cd = None, bc = Message, x=700, y=700) print result return True ... ... ... <_<_t_>_
It saves the document allright, but it saves a copy of it, not the actual file i'm working on. For example, If i save it in the "Save As..." Popup as PluginTest.c4d, it's being saved as that, but the file i'm working on is still called untitled 1.c4d, and if I execute the plugin again, doc.GetDocumentPath() == "" still returns true, hence it was not really saved.
Does anyone know what to do about it?
Thanks in advance
Aurel
On 28/03/2013 at 07:23, xxxxxxxx wrote:
I'm not a big fan of using CallCommands because the built-in undos are such a hassle to deal with. But in this case. I think it's something you can probably get away with using.
c4d.CallCommand(12098) #Saves the active document
-ScottA
On 28/03/2013 at 07:48, xxxxxxxx wrote:
BaseDocument.GetName() will always be an empty string for unsaved documents. most os do not like empty strings as file names.
On 29/03/2013 at 03:25, xxxxxxxx wrote:
Thanks guys!
Will try that