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

    save document in background

    Scheduled Pinned Locked Moved SDK Help
    8 Posts 0 Posters 576 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 03/03/2009 at 13:53, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   11 
      Platform:   Windows  ;   
      Language(s) :   C.O.F.F.E.E  ;  C++  ;

      ---------
      Hi Everyone,

      What I'm trying to do is to load a scene, then save it to the different file format (obj) in background, i.e. without GUI. That's the major task. What I've got is this:
      1. I've tried to write simple script for loading/saving file using COFFEE

      > \> //loading part \> var filename = new(Filename); \> filename->SetFullString("mypath/mymodelname.c4d"); \> var res = LoadDocument(filename); \> println(res); \> \> //saving part \> var filename2 = GeGetStartupWritePath(); \> filename2->AddLast("template.c4d"); \> \> res = doc->Save(filename2); \> println(filename2->GetFullString(), res); \>

      It works great if I run the Cinema4D and then run a script. However there's no option in the COFFEE SDK to save the file in the different format doc->Save always saves to the cinema file format.

      Anyway, that was good, but I need to run this in background with no ui visible. After some research I've found that if I start cinema 4D with -nogui command line option and then pass *.csc script as a parameter cinema will execute it and quit. Here comes the first problem:
      It doesn't want to save the file from COFFEE script if the script passed as a command line parameter
      doc- >Save just returns false. Any ideas why this could happen?

      Ok, then I tried another approach using C++ plugins
      2. I've decided to write a plugin, that will call save scene function, and which will be executed by the script via CallCommand func.

      I've ended up with:

      > \> Filename file("mypath/mymodel.c4d"); \> LoadFile(file); \> //so far so good \> \> Filename file2("mypath/othermodel.obj"); \> SaveDocument(GetActiveDocument(), file2, 0, FORMAT_OBJEXPORT); \>

      It works great with one major problem:
      Cinema 4D always brings me up Save As dialog even if I don't specify SAVEAS flag. Any ideas how not to bring this dialog? Especially with "show SAVEAS dialog" flag available in the SDK, I'm thinking I'm missing something.

      Any ideas? Big thanks for help!

      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 25/03/2010 at 05:00, xxxxxxxx wrote:

        I've a similar issue here. Any input on this? Key point i that I'd like to suppress the file dialog in BaseDocument->SaveDocument.

        Eventually I actually would like to overwrite the file if it already exists, but that's a secondary concern.

        Thanks

        Kabe

        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 25/03/2010 at 07:33, xxxxxxxx wrote:

          There is a good base for obj script exporting done by Gord T. at DVXuser.com.
          Both for geometry and .mtl.

          http://www.dvxuser.com/V6/showthread.php?t=162209&page;=2

          Cheers
          Lennart

          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 25/03/2010 at 07:51, xxxxxxxx wrote:

            Yep its a decent script with lots of good info in it for study.
            With a little modification you can export out only single obj files, or even export only .uvs files for use in uvmapper pro.

            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 25/03/2010 at 08:37, xxxxxxxx wrote:

              Well, thanks for your efforts, but this is not what I'm looking for... I've written quite a number of parsers and exporters in my life, but this is exactly what I would like to avoid here.

              The issue is quite simple: I just would like to use the existing exporters in a scenario w/o user interaction at this time in the process, and I would like to use the SaveDocument() method of BaseDocument for it. I have a valid filename, I can take care that the file doesn't exist, I just don't want to ask the user.

              Cheers

              Klaus

              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 05/04/2010 at 07:25, xxxxxxxx wrote:

                Matthias, is it possible to save a document in the background (under a new name) w/o user interaction - and w/o writing you own exporter?

                Or is the file dialog an integral part of the SaveDocument() method, which can't be suppressed? However, if it can't be suppressed, what's the SAVEFLAG_SAVEAS for?

                Thanks

                Kabe

                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 06/04/2010 at 00:53, xxxxxxxx wrote:

                  Following line should work:

                  SaveDocument(doc, GeGetStartupPath()+Filename("test.c4d"), 0, FORMAT_C4DEXPORT)
                  

                  cheers,
                  Matthias

                  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 06/04/2010 at 02:08, xxxxxxxx wrote:

                    Ah, ok... thanks! Wasn't clear to me from the docs that the path is supposed to be delivered in the filename, not in the document's path.

                    Kabe

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