Hello, I'm having a bit of trouble figuring out how to convert my ABC file to an AEC file using c4dpy. I wrote a script that works to convert it to a C4D file:
import c4d
def import_alembic_and_export_c4d(alembic_path):
# Create a new document
doc = c4d.documents.BaseDocument()
# Load the Alembic file
print(alembic_path)
alembic_file = c4d.documents.LoadDocument(alembic_path, c4d.SCENEFILTER_MERGESCENE)
if alembic_file is None:
print("Failed to load Alembic file.")
return
c4d.documents.LoadFile(alembic_path)
# Iterate through the objects in the Alembic file and add them to the target document
for obj in alembic_file.GetObjects():
doc.InsertObject(obj.Clone(), None, None)
# Set the output path for the AEC file
c4d_path = alembic_path.replace(".abc", ".c4d")
c4d.documents.SaveDocument(doc, c4d_path, c4d.SAVEDOCUMENTFLAGS_NONE, c4d.FORMAT_C4DEXPORT)
print(f"Exported C4D file: {c4d_path}")
if __name__ == "__main__":
import sys
import os
if len(sys.argv) != 2:
print("Usage: python import_export.py /path/to/alembic.abc")
sys.exit(1)
alembic_path = sys.argv[1]
import_alembic_and_export_c4d(alembic_path)
Obviously, this creates a different type than I would like - is it possible to script something similar for creating an AEC file instead? I noticed there's no format option for AEC under saving the document, so I assume it would need to involve rendering instead?
This would be for Cinema4D 2023 for Windows.
Thank you!