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).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/02/2009 at 08:13, xxxxxxxx wrote:
User Information: Cinema 4D Version: Platform: Language(s) :
--------- Hi,
i want to save a single object into a new document, using this code:
> <code> > fn.SetDirectory(Filename(path)); > fn.SetFile(object->GetName()); > fn.SetSuffix("c4d"); > //GePrint("saving "+object->GetName()+" to "+fn.GetFileString()); > AutoAlloc<BaseDocument> saveDoc; > BaseObject* clone = (BaseObject* )object->GetClone(COPY_NO_ANIMATION,NULL); > saveDoc->InsertObject(clone,NULL,NULL); > saveDoc->SetDocumentName(fn.GetFileString()); > fn.FileSelect(FSTYPE_SCENES, GE_SAVE); > if(SaveDocument(saveDoc,fn,SAVEFLAG_SHOWERROR, FORMAT_C4DEXPORT)) { > GePrint("TRUE - SUCCESS"); > } > else { > GePrint("FALSE - FAILED"); > } > </code>
i get the 'save as' dialog, but when i press 'save', it always returns false.. Does anybody know what is wrong with the code ?
thanks, Daniel
On 23/02/2009 at 08:40, xxxxxxxx wrote:
I'd drop the 'fn.FileSelect()' call altogether. This is accomodated in the SaveDocument() call:
SaveDocument(saveDoc, fn, SAVEFLAG_SHOWERROR|SAVEFLAG_SAVEAS, FORMAT_C4DEXPORT)
It may be that 'saveDoc' must be inserted into the document list before it can be saved. Have you tried InsertBaseDocument(saveDoc) before saving? Since you AutoAlloc the BaseDocument, I would remove it from the document list right after saving with saveDoc->Remove(); to avoid crashing.
On 23/02/2009 at 09:43, xxxxxxxx wrote:
lol, i got it now..
was using an older demo-version of c4d for backward-compatibility, thus saving was disabled ofc ..
thanks for trying to help me robert, now it works with the original code.
cheers, Daniel
On 23/02/2009 at 10:11, xxxxxxxx wrote:
Ah. Yeah, you can't save documents from a demo-version.
Glad you got around that.