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

    When exporting FBX using c4dpy.exe, there is no texture or material information for the material

    Bugs
    python 2024
    3
    6
    1.4k
    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.
    • Q
      qq475519905
      last edited by

      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()
      
      ferdinandF i_mazlovI 2 Replies Last reply Reply Quote 0
      • ferdinandF
        ferdinand @qq475519905
        last edited by

        Hello @qq475519905,

        Welcome to the Maxon developers forum and its community, it is great to have you with us!

        Getting Started

        Before creating your next postings, we would recommend making yourself accustomed with our forum and support procedures. You did not do anything wrong, we point all new users to these rules.

        • Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment.
        • Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support.
        • Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads.

        It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: Asking Questions.

        About your First Question

        Please provide code and a setup which make your claims reproducible for us. Your code contains a non-defined attribute c4d_file. It is also unclear to me what constitutes 'texture or material information' for you. Do you mean that the exported materials do not have materials or textures?

        I do not have any issues when I try to reproduce your claims at face value.

        Cheers,
        Ferdinand

        Result

        For scene: test.zip
        344f50c8-bacb-4df7-807d-a2c6dd762d96-image.png

        Code

        import c4d
        import os
        
        def main():
            """
            """
            doc: c4d.documents.BaseDocument | None = c4d.documents.LoadDocument(
                r"E:\temp\test.c4d", c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS)
            if doc is None:
                raise RuntimeError(f"Could not load the document.")
        
            bc: c4d.BaseContainer = c4d.BaseContainer()
            bc.SetInt32(c4d.FBXEXPORT_FBX_VERSION, c4d.FBX_EXPORTVERSION_NATIVE)
            bc.SetBool(c4d.FBXEXPORT_ASCII, False)
            bc.SetBool(c4d.FBXEXPORT_CAMERAS, True)
            bc.SetBool(c4d.FBXEXPORT_LIGHTS, True)
            bc.SetBool(c4d.FBXEXPORT_SPLINES, True)
            bc.SetBool(c4d.FBXEXPORT_INSTANCES, True)
            bc.SetBool(c4d.FBXEXPORT_SELECTION_ONLY, False)
            bc.SetBool(c4d.FBXEXPORT_GLOBAL_MATRIX, True)
            bc.SetInt32(c4d.FBXEXPORT_SDS, c4d.FBXEXPORT_SDS_GENERATOR)
            bc.SetBool(c4d.FBXEXPORT_TRIANGULATE, True)
            bc.SetBool(c4d.FBXEXPORT_SAVE_NORMALS, True)
            bc.SetBool(c4d.FBXEXPORT_SAVE_VERTEX_COLORS, True)
            bc.SetBool(c4d.FBXEXPORT_SAVE_VERTEX_MAPS_AS_COLORS, False)
            bc.SetInt32(c4d.FBXEXPORT_UP_AXIS, c4d.FBXEXPORT_UP_AXIS_Y)
            bc.SetBool(c4d.FBXEXPORT_FLIP_Z_AXIS, False)
            bc.SetBool(c4d.FBXEXPORT_TRACKS, True)
            bc.SetBool(c4d.FBXEXPORT_BAKE_ALL_FRAMES, True)
            bc.SetBool(c4d.FBXEXPORT_PLA_TO_VERTEXCACHE, True)
            bc.SetBool(c4d.FBXEXPORT_BOUND_JOINTS_ONLY, True)
            bc.SetInt32(c4d.FBXEXPORT_TAKE_MODE, c4d.FBXEXPORT_TAKE_NONE)
            bc.SetBool(c4d.FBXEXPORT_MATERIALS, True)
            bc.SetBool(c4d.FBXEXPORT_EMBED_TEXTURES, True)
            bc.SetBool(c4d.FBXEXPORT_SUBSTANCES, True)
            bc.SetBool(c4d.FBXEXPORT_BAKE_MATERIALS, True)
            bc.SetInt32(c4d.FBXEXPORT_BAKEDTEXTURE_WIDTH, 1024)
            bc.SetInt32(c4d.FBXEXPORT_BAKEDTEXTURE_HEIGHT, 1024)
            bc.SetInt32(c4d.FBXEXPORT_BAKEDTEXTURE_DEPTH, c4d.FBXEXPORT_BAKEDTEXTURE_DEPTH_16)
            bc.SetBool(c4d.FBXEXPORT_LOD_SUFFIX, False)
        
            if not c4d.documents.SaveDocument(
                doc, r"E:\temp\exported_test.fbx", c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, 
                c4d.FORMAT_FBX_EXPORT):
                raise RuntimeError("Failed to save document.") 
        
        if __name__ == "__main__":
            main()
        

        MAXON SDK Specialist
        developers.maxon.net

        Q 1 Reply Last reply Reply Quote 0
        • Q
          qq475519905 @ferdinand
          last edited by

          I tried to use Python to call c4d.exe within the system. When exporting Redshift materials with FBX, there are no materials or textures. using standard materials, everything works fine.
          [rsTEST.fbx](Invalid file type. Allowed types are: .png, .jpg, .bmp, .c4d, .gif, .txt, .py, .pyp, .vdb, .zip, .mp4, .webm, .cpp, .h, .pdf, .jpeg) rs测试.c4d

          1 Reply Last reply Reply Quote 0
          • Q
            qq475519905
            last edited by

            When exporting FBX, is it necessary to use C4DAtom.GetParameter()/C4DAtom.SetParameter() to access parameters for a successful material export?

            1 Reply Last reply Reply Quote 0
            • ferdinandF
              ferdinand
              last edited by

              Please stop bumping your thread by asking the same question again and again, I have deleted your duplicate posting. We have seen your questions and we will answer soon.

              MAXON SDK Specialist
              developers.maxon.net

              1 Reply Last reply Reply Quote 0
              • i_mazlovI
                i_mazlov @qq475519905
                last edited by i_mazlov

                Hi @qq475519905,

                You issue is likely a bug in the material export code, I've created a ticket (ITEM#530704) in our internal bug tracking system. Thank you for reporting the issue!

                Cheers,
                Ilia

                MAXON SDK Specialist
                developers.maxon.net

                1 Reply Last reply Reply Quote 0
                • i_mazlovI i_mazlov moved this topic from Cinema 4D SDK on
                • First post
                  Last post