Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Fine-tuning Alembic Export

    PYTHON Development
    0
    20
    1.5k
    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
      Helper
      last edited by

      On 08/02/2013 at 19:14, xxxxxxxx wrote:

      R14's support for Alembic has done wonders for our ability to make it a real pipeline citizen for us (at Mirada). We're now able to share cameras, models and animation seamlessly between Maya, Houdini, Cinema4D and (shortly) Max - but want to refine how C4D shares its data.

      To that end, I'm trying to identify how to control the export options. I was able to reverse-engineer the format ID and have it successfully writing Alembic files - but without much control, and the API documentation is completely silent on Alembic.

      I'm generally interested in being able to preserve the heirarchy (it currently shares a single mesh, compacted from the entire element being written), but other typical controls like frame relative sampling, frame interval and such are fairly essential to maintain parity with our other applications. I see a number of ABCEXPORT_ constants but am unsure where I should make use of them and how to provide the additional data that Alembic will make use of.

      Anyone have some unreleased documentation or sample code for passing additional parameters to the Alembic exporter?

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

        On 11/02/2013 at 14:03, xxxxxxxx wrote:

        I wonder if the discussion here is still accurate: https://developers.maxon.net/forum/topic/6715/7338_modify-exporter-settings&KW=FBXEXPORT_ASCII&PID=30592#30592

        ... in which case it looks like configuring the export via Python isn't currently supported. As the OP of that thread suggests, this seems like a strange omission.

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

          On 11/02/2013 at 19:32, xxxxxxxx wrote:

          A related significant problem: The Alembic export options include the *frame range* to export - it does not default to the frame range of the current project.

          This is pretty critical if it doesn't support adjusting the frame range of the export in the python API - and it's going to freeze Cinema's inclusion in our formal pipeline if there's not a way to manage this programmatically.

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

            On 12/02/2013 at 03:32, xxxxxxxx wrote:

            Hi Eddie,

            Originally posted by xxxxxxxx

            I wonder if the discussion here is still accurate: https://developers.maxon.net/forum/topic/6715/7338_modify-exporter-settings&KW=FBXEXPORT_ASCII&PID=30592#30592

            ... in which case it looks like configuring the export via Python isn't currently supported. As the OP of that thread suggests, this seems like a strange omission.

            This isn't an omission but just an issue with the Python API. This will be fixed in the near future.

            Originally posted by xxxxxxxx

            A related significant problem: The Alembic export options include the *frame range* to export - it does not default to the frame range of the current project.

            This is pretty critical if it doesn't support adjusting the frame range of the export in the python API - and it's going to freeze Cinema's inclusion in our formal pipeline if there's not a way to manage this programmatically.

            When the fix shall be released you'll be able to adjust programmatically the frame range of the export with ABCEXPORT_FRAME_START and ABCEXPORT_FRAME_END.

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

              On 12/02/2013 at 09:50, xxxxxxxx wrote:

              Originally posted by xxxxxxxx

              This isn't an omission but just an issue with the Python API. This will be fixed in the near future.

              Thanks. Is there a timeline for this? (ie., is this something to reasonably expect in the next service update?)

              Originally posted by xxxxxxxx

              When the fix shall be released you'll be able to adjust programmatically the frame range of the export with ABCEXPORT_FRAME_START and ABCEXPORT_FRAME_END.

              As I was hoping.

              I'll go ahead and share my temporary workaround for those who might run into the same problem:

              > During any asset publish action, the first .abc export operation will pop up the settings dialog using saveflags=c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST | c4d.SAVEDOCUMENTFLAGS_DIALOGSALLOWED | c4d.SAVEDOCUMENTFLAGS_EXPORTDIALOG - Subsequent ones during that export (such as if we have both standalone camera and a camera+survey geometry in the asset container) will not present the dialog, taking the previous settings.

              It's not ideal since it introduces a user step where errors may occur - but it addresses the problem in the short term in a way that's otherwise very automated.

              Besides my above complaint, we're having excellent results and I've been exceptionally pleased with the surprisingly well-designed API. I had expected issues with MoGraph or Simulations but Alembic support behind the scenes is obviously solid, so I look forward to making Cinema a full-fledged citizen.

              I know integrating c4d into a high end, multiplatform vfx pipeline isn't a common task and we're treading on new ground trying to make this happen. Thanks for your support.

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

                On 12/02/2013 at 10:34, xxxxxxxx wrote:

                Originally posted by xxxxxxxx

                Originally posted by xxxxxxxx

                This isn't an omission but just an issue with the Python API. This will be fixed in the near future.

                Thanks. Is there a timeline for this? (ie., is this something to reasonably expect in the next service update?)

                Yes, if there's no problem with the fix it'll be included in the next service update.

                Originally posted by xxxxxxxx

                I'll go ahead and share my temporary workaround for those who might run into the same problem:

                During any asset publish action, the first .abc export operation will pop up the settings dialog using saveflags=c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST | c4d.SAVEDOCUMENTFLAGS_DIALOGSALLOWED | c4d.SAVEDOCUMENTFLAGS_EXPORTDIALOG - Subsequent ones during that export (such as if we have both standalone camera and a camera+survey geometry in the asset container) will not present the dialog, taking the previous settings.

                It's not ideal since it introduces a user step where errors may occur - but it addresses the problem in the short term in a way that's otherwise very automated.

                Thanks for sharing your temporary workaround. I'm sure it'll be useful for other people.

                Originally posted by xxxxxxxx

                Besides my above complaint, we're having excellent results and I've been exceptionally pleased with the surprisingly well-designed API. I had expected issues with MoGraph or Simulations but Alembic support behind the scenes is obviously solid, so I look forward to making Cinema a full-fledged citizen.

                I know integrating c4d into a high end, multiplatform vfx pipeline isn't a common task and we're treading on new ground trying to make this happen. Thanks for your support.

                I'm glad to see CINEMA used in a complex VFX pipeline.
                As you've said it, CINEMA has a powerful, well-designed and robust API so there's no reason it couldn't be integrated into high-hend pipelines 🙂.

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

                  On 26/02/2013 at 15:44, xxxxxxxx wrote:

                  We haven't moved to r14.034 yet - will probably put a dev machine on it in the next 24 hrs.

                  Curious if the configuring the alembic export from Python as discussed in this thread is now supported.

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

                    On 11/04/2013 at 15:40, xxxxxxxx wrote:

                    Revisiting this post just so we're on the same page:

                    As of the R14.034 update, this bug remains: Users must still manually specify the alembic export frame range.

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

                      On 12/04/2013 at 02:37, xxxxxxxx wrote:

                      Originally posted by xxxxxxxx

                      As of the R14.034 update, this bug remains: Users must still manually specify the alembic export frame range.

                      Hi Eddie,

                      The fix for changing importer/exporter settings hasn't been yet published.
                      It's expected for the next service update (3rd of R14).

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

                        On 27/06/2013 at 18:17, xxxxxxxx wrote:

                        It looks like there was some attention paid to this in the latest release (R14.041). It now is able to access and update the exporter private data. Or at least appears to:

                        Something like this Python function:

                        > def plugindata() :
                        >
                        >     exporter={} # Creates container for Message return object
                        >
                        >     plug=c4d.plugins.FindPlugin(1028082, c4d.PLUGINTYPE_SCENESAVER)
                        >
                        >     doc=c4d.documents.GetActiveDocument()
                        >
                        >     fps=doc.GetFps()
                        >
                        >     if plug:
                        >
                        >         if plug.Message(c4d.MSG_RETRIEVEPRIVATEDATA,exporter) :
                        >
                        >             data=exporter['imexporter'].GetDataInstance()
                        >
                        >             start=doc.GetMinTime()
                        >
                        >             end=doc.GetMaxTime()
                        >
                        >             data.SetTime(c4d.ABCEXPORT_FRAME_START,start)
                        >
                        >             data.SetTime(c4d.ABCEXPORT_FRAME_END,end)

                        It also updates the start/end export frame range. It sets them to 0. No matter what value is passed to either. I know it's "working" because I can control which parameter I want to set to zero by commenting out alternating data.SetTime instructions.

                        Am I just missing something, or is this still not working?

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

                          On 28/06/2013 at 01:24, xxxxxxxx wrote:

                          Originally posted by xxxxxxxx

                          It also updates the start/end export frame range. It sets them to 0. No matter what value is passed to either. I know it's "working" because I can control which parameter I want to set to zero by commenting out alternating data.SetTime instructions.

                          Am I just missing something, or is this still not working?

                          Hi Eddie,

                          ABCEXPORT_FRAME_START and ABCEXPORT_FRAME_END aren't BaseTime but LONG values in the Alembic export container. So you have to pass a frame number to set them successfully.

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

                            On 28/06/2013 at 10:32, xxxxxxxx wrote:

                            Interesting.
                            Alembic itself supports float frames - which can be critical for capturing motion blur, especially while exchanging data between packages - but see, if I pass a float to either of those parameters, I get "argument 2 must be c4d.BaseTime, not float" - so the error message I get explicitly suggests I have to pass a BaseTime argument, not a LONG int.
                            If I pass an INT or a LONG, I get the same error - that "argument 2 must be a c4d.BaseTime, not _____" fill in the blank of whatever type I pass.

                            Give it a try. I think this still isn't working.

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

                              On 29/06/2013 at 06:52, xxxxxxxx wrote:

                              Got it - it's a SetLong instead of a SetTime.

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

                                On 26/02/2014 at 11:31, xxxxxxxx wrote:

                                Hi,

                                I up this thread because the code above and the script ExportAlembic.py (help/examples/scripts) were working fine in R14.041 but don't seem to work anymore in R15.037 or R15.057.

                                Is there a trick or another way to modify export settings or is it a regression bug ?

                                Thanks,

                                xs_yann

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

                                  On 27/02/2014 at 01:25, xxxxxxxx wrote:

                                  Thanks for reporting this bug. I reported it to the developers.
                                  I'm afraid there's no other way to change exporters/importers settings.

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

                                    On 03/08/2017 at 06:28, xxxxxxxx wrote:

                                    Hello,

                                    Related question,

                                    I am trying to access some of the other common alembic export settings...

                                    eg.
                                    [c4d.ABCEXPORT_SPLINES]
                                    [c4d.ABCEXPORT_HAIR]
                                    [c4d.ABCEXPORT_SDS_WEIGHTS]
                                    etc.
                                    

                                    ...in much the same way as offered in the python alembic export example in the documentation.

                                    Sadly however, it appears as though these values (and others) are not supported on export as these values are not being changed? I'd like to be able to customize all of these values if possible please?

                                    Should I try SetWorldPluginData() right before export instead?

                                    Regards

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

                                      On 03/08/2017 at 07:17, xxxxxxxx wrote:

                                      Everything is in the code you provide above on github.
                                      As you may already know using [parameter_name] allow you to change any parameter.
                                      So in this exemple its a tool. The tool is grab by

                                      plug = plugins.FindPlugin(1028082, c4d.PLUGINTYPE_SCENESAVER)
                                      Then understand plug as a variable who hold the tool.
                                      So now you simply have to set plug[parameter_name] = your value
                                      And thats it ! 🙂

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

                                        On 03/08/2017 at 07:34, xxxxxxxx wrote:

                                        Thank you for the reply,

                                        However this is what I am having problems with. While I can override some things, there does appear to be a whole bunch of these variables which I can't seem to access.

                                        So for example:

                                        # Begin Alembic export phase
                                        # Get Alembic export plugin, 1028082 is its ID
                                        plug = plugins.FindPlugin(1028082, c4d.PLUGINTYPE_SCENESAVER)
                                        if plug is None:
                                        	return
                                        		
                                        op = {}
                                        # Send MSG_RETRIEVEPRIVATEDATA to Alembic export plugin
                                        if plug.Message(c4d.MSG_RETRIEVEPRIVATEDATA, op) :
                                        	print '{} Loading Alembic plugin: {}'.format(self.debug_string, op)
                                        	if "imexporter" not in op:
                                        		print '{} Export Failed: There was a problem with the Alembic plugin: {}'.format(self.debug_string, op)
                                        		return
                                          
                                        	# BaseList2D object stored in "imexporter" key hold the settings
                                        	abcExport = op["imexporter"]
                                        	if abcExport is None:
                                        		return
                                          
                                        	# Change Alembic export settings			
                                          
                                        	abcExport[c4d.ABCEXPORT_FORMAT] = abc_export_format
                                          
                                        	abcExport[c4d.ABCEXPORT_FRAME_START] = frame_from_export	  	#WORKS!
                                        	abcExport[c4d.ABCEXPORT_FRAME_END] = frame_to_export	       	#WORKS!
                                        	abcExport[c4d.ABCEXPORT_FRAME_STEP] = frame_step		    	#WORKS!
                                        	abcExport[c4d.ABCEXPORT_SUBFRAMES] = subframes			    	#UNCONFIRMED
                                        	
                                        	abcExport[c4d.ABCEXPORT_SELECTION_ONLY] = True		        		#WORKS!
                                        	abcExport[c4d.ABCEXPORT_SPLINES] = True			         		#FAILS
                                        	abcExport[c4d.ABCEXPORT_SDS_WEIGHTS] = True		       		#FAILS
                                          
                                        	abcExport[c4d.ABCEXPORT_PARTICLES] = True				    	#WORKS
                                        	abcExport[c4d.ABCEXPORT_PARTICLE_GEOMETRY] = False		   	#WORKS
                                          
                                        etc...
                                          
                                        
                                        

                                        Running 18.057

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

                                          On 04/08/2017 at 03:11, xxxxxxxx wrote:

                                          Hi Matt,

                                          The options you're referring to can be changed and does affect the Alembic export.
                                          You should try to print their value before and after changing these.

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

                                            On 04/08/2017 at 04:28, xxxxxxxx wrote:

                                            Hi Yannick,

                                            I just can't seem to change these settings. I'm on a mac. This just does not work for me:

                                              
                                            abcExport[c4d.ABCEXPORT_SPLINES] = True			
                                              
                                            
                                            

                                            Curiously, when i try to change it's value by dragging the Alembicabc[c4d.ABCEXPORT_SPLINES] globalplugin export prefs into the console, it also won't change while some other values do...

                                            Am I doing something wrong?

                                            regards.

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