Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Modify FBX Exporter?

    Cinema 4D SDK
    r20 python
    2
    5
    1.2k
    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.
    • B
      bentraje
      last edited by bentraje

      Hi,

      I have a problem in Cinema4D where it converts periods into underscores upon FBX export.
      You can see an illustration of the problem here:
      https://www.dropbox.com/s/newsmvxv2fdhbsx/c4d085_cinema_fbx_export_convert_problem.jpg?dl=0

      Previously, I initially shrug it off but currently I'm working with a pipeline that requires proper naming convention. As such, I need to have it as periods and not as undercores?

      So far what I have is a modified code from the OBJ exporter sample file. See below.
      However, I am still no clue where to investigate the unusual conversion of "." to "_"
      I did check the FBXexport.res file in the installation directory but it mostly offers booleans parameter/arguments.

      Is there a way around this?

      Thanks

      import c4d
      from c4d import documents, plugins, storage
      
      #Author: Joey Gaspe
      #OBJ export settings example
      
      def main():
      
          # Get OBJ export plugin, 1030178 is its ID
          plug = plugins.FindPlugin(1030178, c4d.PLUGINTYPE_SCENESAVER)
          if plug is None:
              return
      
          # Get a path to save the exported file
          filePath = c4d.storage.LoadDialog(title="Save File for OBJ Export", flags=c4d.FILESELECT_SAVE, force_suffix="obj")
      
          if filePath is None:
              return
      
          op = {}
          # Send MSG_RETRIEVEPRIVATEDATA to OBJ export plugin
          if plug.Message(c4d.MSG_RETRIEVEPRIVATEDATA, op):
              print op
              if "imexporter" not in op:
                  return
      
              # BaseList2D object stored in "imexporter" key hold the settings
              objExport = op["imexporter"]
              if objExport is None:
                  return
      
              # Define the settings
              # Example of OBJ export settings from the UI:
              objExport[c4d.OBJEXPORTOPTIONS_TEXTURECOORDINATES] = True
              objExport[c4d.OBJEXPORTOPTIONS_MATERIAL] = c4d.OBJEXPORTOPTIONS_MATERIAL_MATERIAL
      
              # objExport[c4d.] =
      
              # export without dialogs
              if c4d.documents.SaveDocument(doc, filePath, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, 1030178):
                  print "Document successfully exported to:"
                  print filePath
              else:
                  print "Export failed!"
      
              c4d.EventAdd()
      
      if __name__=='__main__':
          main()
      
      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by

        Hello @bentraje ,

        I'm afraid this is hard coded and there's no option to avoid this. The rename have been added to fix a bug with Maya and XSI. ("same base name is causing issues in Maya and XSI")

        You can try to export the fbx in a text format (this is an option) and to rename back every object in the file. I know it's far to be ideal but for now, i have nothing else in mind.

        Cheers
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

        1 Reply Last reply Reply Quote 1
        • B
          bentraje
          last edited by

          @m_magalhaes
          Thanks for the clarification. Yes, I guess the text format will be an alternative for now.

          Have a great day ahead!

          1 Reply Last reply Reply Quote 0
          • ManuelM
            Manuel
            last edited by

            hello,
            can we consider your issue as "solved" ?

            Cheers
            Manuel

            MAXON SDK Specialist

            MAXON Registered Developer

            1 Reply Last reply Reply Quote 1
            • B
              bentraje
              last edited by

              Sure sure we can label at as solved at the moment.
              Thanks again for the help!

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