Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    create new doc with SaveDocument

    Scheduled Pinned Locked Moved SDK Help
    4 Posts 0 Posters 341 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        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.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          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

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            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. 🙂

            1 Reply Last reply Reply Quote 0
            • First post
              Last post