Fine-tuning Alembic Export



  • On 04/02/2018 at 03:20, xxxxxxxx wrote:

    bump. still having issues on 19.024 with the alembic exporter script given in the SDK examples.

    Can someone confirm the [c4d.ABCEXPORT_SELECTION_ONLY] please?

    Very hard to make c4d work in a pipeline...



  • On 05/02/2018 at 01:53, xxxxxxxx wrote:

    Hi line6dude, thanks for writing us.

    With regard to your issue you reported, I confirm I cannot reproduce it. Both on mac and pc using the mentioned scripted i was able to export only the selected entities from a scene.

    Could you please better articulate the issue or share a test scene proving it not to work?

    Best, Riccardo



  • On 05/02/2018 at 16:34, xxxxxxxx wrote:

    Hey Riccardo,

    Thanks for your reply.

    I am running r19.024 on a mac.

    Here is my really simple test.

    1. boot c4d fresh
    2. look in Edit>Preferences>Alembic (*.abc) Export settings (notice selection only is unselected and greyed out)
    3. create a basic scene with several objects, select one of those objects.
    4. paste the following script into the script manager and execute from the script manager (with object still selected).
    """
    Export Settings Example
      
    This example shows how to change an exporter settings.
    This works also for importers/scene loaders.
    """
      
    import c4d
    from c4d import documents, plugins, storage
      
    def main() :
        # Get Alembic export plugin, 1028082 is its ID
        plug = plugins.FindPlugin(1028082, c4d.PLUGINTYPE_SCENESAVER)
        if plug is None:
            return
        
        # Get a path to save the exported file
        filePath = storage.LoadDialog(title="Save File for Alembic Export", flags=c4d.FILESELECT_SAVE, force_suffix="abc")
        if filePath is None:
            return
        
        op = {}
        # Send MSG_RETRIEVEPRIVATEDATA to Alembic export plugin
        if plug.Message(c4d.MSG_RETRIEVEPRIVATEDATA, op) :
            if "imexporter" not in op:
                return
            
            # BaseList2D object stored in "imexporter" key hold the settings
            abcExport = op["imexporter"]
            if abcExport is None:
                return
            print abcExport[c4d.ABCEXPORT_SELECTION_ONLY]
            # Change Alembic export settings
            abcExport[c4d.ABCEXPORT_SELECTION_ONLY] = True
            abcExport[c4d.ABCEXPORT_PARTICLES] = True
            abcExport[c4d.ABCEXPORT_PARTICLE_GEOMETRY] = True
            print abcExport[c4d.ABCEXPORT_SELECTION_ONLY]
            
            # Finally export the document
            if documents.SaveDocument(doc, filePath, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, 1028082) :
                print "Document successfully exported to:"
                print filePath
            else:
                print "Export failed!"
      
      
    if __name__=='__main__':
        main()
    

    http://github.com/PluginCafe/cinema4d_py_sdk/blob/56f255307f28356bf374ef0feaee50fe8184289b/scripts/ExportAlembic.py

    1. follow save prompt
    2. open new alembic file, and it (incorrectly) contains all of the scene objects, despite selection only.

    When I try to print abcExport[c4d.ABCEXPORT_SELECTION_ONLY] it reports True as expected in console.

    Any ideas?

    Thank you very much for helping.



  • On 06/02/2018 at 01:10, xxxxxxxx wrote:

    Hi line6dude,

    thanks for following up and providing the detailed steps to reproduce the issue. Unfortunately, as visible in my screen record session, I wasn't able to get Cinema behaving as you've described.

    Is your Cinema installation a clean installation? If not, could you consider to run with a clean one just to start excluding stuff causing the issue?

    Best, Riccardo



  • On 06/02/2018 at 02:41, xxxxxxxx wrote:

    Hi Riccardo,

    Thank you for your video - terrific support.

    After a long search, including a reinstall and lots of fiddling, I believe I have found the solution to the problem.

    After the clean install, it worked just like your video, which tipped me off that it was potentially a plugin clash. Turns out it was...

    I am writing my first res style plugin - an alembic exporter which just conforms filenames to our pipe etc... So res syntax was new to me, turns out I was accidently using the same variable name in my res file as what Cinema 4D must internally use for it's ABC exporter?

    The odd thing was, even when I cleared out the plugins folder, the 'selection only test script' would still fail, I actually needed to first delete my preferences folder and relaunch for it to fully reset. Confusing one, but for now it seems the problem was a fairly simple one on my behalf and I have now unique names to my res variables which should do the trick. Thank you for helping me, appreciate it.



  • On 07/02/2018 at 00:58, xxxxxxxx wrote:

    Hi line6dude, thanks for following up and sharing your findings.

    In order to get rid of any symbol reference to the defines used by accident, instead of deleting the whole Preference folder, it would have been enough to just delete the symbolcache file under the <CinemaPrefFolder>\prefs.

    Best, Riccardo.


Log in to reply