When exporting FBX using c4dpy.exe, there is no texture or material information for the material
May I ask how to add material information like the FBX exporter in the menu?
import c4d
import os
def main():
# 获取当前文档
doc = c4d.documents.LoadDocument(r"{c4d_file}", c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS)
if doc is None:
raise RuntimeError("No document is currently open.")
# 定义 FBX 文件导出的路径
documents_path = os.path.expanduser("~/Documents")
fbx_file_path = os.path.join(documents_path, "exported_file.fbx")
# 设置 FBX 导出参数
export_settings = c4d.BaseContainer()
export_settings.SetInt32(c4d.FBXEXPORT_FBX_VERSION, c4d.FBX_EXPORTVERSION_NATIVE)
export_settings.SetBool(c4d.FBXEXPORT_ASCII, False)
export_settings.SetBool(c4d.FBXEXPORT_CAMERAS, True)
export_settings.SetBool(c4d.FBXEXPORT_LIGHTS, True)
export_settings.SetBool(c4d.FBXEXPORT_SPLINES, True)
export_settings.SetBool(c4d.FBXEXPORT_INSTANCES, True)
export_settings.SetBool(c4d.FBXEXPORT_SELECTION_ONLY, False)
export_settings.SetBool(c4d.FBXEXPORT_GLOBAL_MATRIX, True)
export_settings.SetInt32(c4d.FBXEXPORT_SDS, c4d.FBXEXPORT_SDS_GENERATOR)
export_settings.SetBool(c4d.FBXEXPORT_TRIANGULATE, True)
export_settings.SetBool(c4d.FBXEXPORT_SAVE_NORMALS, True)
export_settings.SetBool(c4d.FBXEXPORT_SAVE_VERTEX_COLORS, True)
export_settings.SetBool(c4d.FBXEXPORT_SAVE_VERTEX_MAPS_AS_COLORS, False)
export_settings.SetInt32(c4d.FBXEXPORT_UP_AXIS, c4d.FBXEXPORT_UP_AXIS_Y)
export_settings.SetBool(c4d.FBXEXPORT_FLIP_Z_AXIS, False)
export_settings.SetBool(c4d.FBXEXPORT_TRACKS, True)
export_settings.SetBool(c4d.FBXEXPORT_BAKE_ALL_FRAMES, True)
export_settings.SetBool(c4d.FBXEXPORT_PLA_TO_VERTEXCACHE, True)
export_settings.SetBool(c4d.FBXEXPORT_BOUND_JOINTS_ONLY, True)
export_settings.SetInt32(c4d.FBXEXPORT_TAKE_MODE, c4d.FBXEXPORT_TAKE_NONE)
export_settings.SetBool(c4d.FBXEXPORT_MATERIALS, True)
export_settings.SetBool(c4d.FBXEXPORT_EMBED_TEXTURES, True)
export_settings.SetBool(c4d.FBXEXPORT_SUBSTANCES, True)
export_settings.SetBool(c4d.FBXEXPORT_BAKE_MATERIALS, True)
export_settings.SetInt32(c4d.FBXEXPORT_BAKEDTEXTURE_WIDTH, 1024)
export_settings.SetInt32(c4d.FBXEXPORT_BAKEDTEXTURE_HEIGHT, 1024)
export_settings.SetInt32(c4d.FBXEXPORT_BAKEDTEXTURE_DEPTH, c4d.FBXEXPORT_BAKEDTEXTURE_DEPTH_16)
export_settings.SetBool(c4d.FBXEXPORT_LOD_SUFFIX, False)
# 导出 FBX 文件
if not c4d.documents.SaveDocument(doc, fbx_file_path, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, c4d.FORMAT_FBX_EXPORT):
raise RuntimeError("Failed to export the document to FBX.")
print("Export successful! File saved to:", fbx_file_path)
if __name__ == "__main__":
main()