Im developing a simple script to export an .FBX just the "Joints" object of each .c4d file in a folder, it works without any errors on console but it doesn't create any .FBX file in the folder I define
import c4d
import os
def main() -> None:
plugin = c4d.plugins.FindPlugin(c4d.FORMAT_FBX_EXPORT, c4d.PLUGINTYPE_SCENESAVER)
#print (plugin)
data = {}
plugin.Message(c4d.MSG_RETRIEVEPRIVATEDATA, data)
settings = data.get("imexporter", None)
#print (settings)
settings[c4d.FBXEXPORT_FBX_VERSION] = False
settings[c4d.FBXEXPORT_ASCII] = False
settings[c4d.FBXEXPORT_CAMERAS] = False
settings[c4d.FBXEXPORT_LIGHTS] = False
settings[c4d.FBXEXPORT_SPLINES] = False
settings[c4d.FBXEXPORT_INSTANCES] = False
settings[c4d.FBXEXPORT_SELECTION_ONLY] = True
settings[c4d.FBXEXPORT_GLOBAL_MATRIX] = False
settings[c4d.FBXEXPORT_SDS] = c4d.FBXEXPORT_SDS_GENERATOR
settings[c4d.FBXEXPORT_TRIANGULATE] = False
settings[c4d.FBXEXPORT_SAVE_NORMALS] = True
settings[c4d.FBXEXPORT_SAVE_VERTEX_COLORS] = False
settings[c4d.FBXEXPORT_SAVE_VERTEX_MAPS_AS_COLORS] = False
settings[c4d.FBXEXPORT_UP_AXIS] = c4d.FBXEXPORT_UP_AXIS_Y
settings[c4d.FBXEXPORT_TRACKS] = True
settings[c4d.FBXEXPORT_BAKE_ALL_FRAMES] = False
settings[c4d.FBXEXPORT_PLA_TO_VERTEXCACHE] = False
settings[c4d.FBXEXPORT_BOUND_JOINTS_ONLY] = False
settings[c4d.FBXEXPORT_TAKE_MODE] = c4d.FBXEXPORT_TAKE_TAKES
settings[c4d.FBXEXPORT_MATERIALS] = True
settings[c4d.FBXEXPORT_EMBED_TEXTURES] = False
settings[c4d.FBXEXPORT_SUBSTANCES] = True
settings[c4d.FBXEXPORT_BAKE_MATERIALS] = True
settings[c4d.FBXEXPORT_BAKEDTEXTURE_WIDTH] = 1024
settings[c4d.FBXEXPORT_BAKEDTEXTURE_HEIGHT] = 1024
settings[c4d.FBXEXPORT_BAKEDTEXTURE_RESIZE] = c4d.FBXEXPORT_BAKEDTEXTURE_RESIZE_OFF
settings[c4d.FBXEXPORT_BAKEDTEXTURE_FORMAT] = int(8)
settings[c4d.FBXEXPORT_BAKEDTEXTURE_DEPTH] = c4d.FBXEXPORT_BAKEDTEXTURE_DEPTH_8
settings[c4d.FBXEXPORT_LOD_SUFFIX] = False
c4dfilesfolder = c4d.storage.LoadDialog(c4d.FILESELECTTYPE_ANYTHING, '.C4D Animations Folder', c4d.FILESELECT_DIRECTORY, '','', '')
c4dfileslist = os.listdir(c4dfilesfolder)
exportpath = c4d.storage.LoadDialog(c4d.FILESELECTTYPE_ANYTHING, 'Save .FBX Files', c4d.FILESELECT_DIRECTORY, '','', '')
c4dpath = ''
for file in c4dfileslist :
c4dpath = '{}\{}'.format(c4dfilesfolder, file)
doc = c4d.documents.LoadDocument(c4dpath, c4d.SCENEFILTER_OBJECTS)
if not doc:
print ('NONE DOC')
else:
doc.SetSelection(doc.SearchObject('Joints'), c4d.SELECTION_NEW)
c4d.documents.SaveDocument(doc, exportpath, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, c4d.FORMAT_FBX_EXPORT)
c4d.documents.KillDocument(doc)
if __name__ == '__main__':
main()