FBX Export plugin option setting with python
-
Hi, I'm newbie in c4d scripts and I can't english well:(
I want to set FBX export options with python.#FBX_EXPORTER_ID = 1026370 container = c4d.plugins.GetWorldPluginData(1026370) container[c4d.FBXEXPORT_ASCII] = 1 c4d.plugins.SetWorldPluginData(1026370, container, True)
I changed value for c4d.FBXEXPORT_ASCII. 0, 1...
I changed boolean for SetWorldPluginData. True, False...Console is [OK] but C4d doesn't changed.
Help me please.
Thank you. -
https://developers.maxon.net/forum/topic/11623/fbx-export-plugin-option-setting-with-python
Hi @Jiiny, first of all welcome in the plugincafe community.
As written in the documentation of GetWorldPluginData, GetWorldPluginData is not the way to go for importer/exporter.
Here an example for the FBX, if you want to see the full list of options please take a look at the C++ documention for Ffbxexport.h.""" Copyright: MAXON Computer GmbH Description: - Exports FBX with custom settings. Class/method highlighted: - c4d.plugins.FindPlugin() - MSG_RETRIEVEPRIVATEDATA - c4d.documents.SaveDocument() Compatible: - Win / Mac - R16, R17, R18, R19, R20 """ import c4d def main(): # Retrieves a path to save the exported file filePath = c4d.storage.LoadDialog(title="Save File for FBX Export", flags=c4d.FILESELECT_SAVE, force_suffix="abc") if not filePath: return # Retrieves FBX exporter plugin, 1026370 fbxExportId = 1026370 plug = c4d.plugins.FindPlugin(fbxExportId, c4d.PLUGINTYPE_SCENESAVER) if plug is None: raise RuntimeError("Failed to retrieves the fbx exporter.") data = dict() # Sends MSG_RETRIEVEPRIVATEDATA to fbx export plugin if not plug.Message(c4d.MSG_RETRIEVEPRIVATEDATA, data): raise RuntimeError("Failed to retrieves private data.") # BaseList2D object stored in "imexporter" key hold the settings fbxExport = data.get("imexporter", None) if fbxExport is None: raise RuntimeError("Failed to retrieves BaseContainer private data.") # Defines FBX export settings fbxExport[c4d.FBXEXPORT_ASCII] = True # Finally export the document if not c4d.documents.SaveDocument(doc, filePath, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, fbxExportId): raise RuntimeError("Failed to save the document.") print "Document successfully exported to:", filePath if __name__ == '__main__': main()
Finally I would like to point you to few rules (I've setup your topic corectly but please do it for the next one).
- Q&A New Functionality.
- How to Post Questions Especially the tagging part.
If you have any questions, please let me know.
Cheers,
Maxime. -
Thank you @m_adam
I completed my exporter scripts to your help.
I read Links, I will tagging next time.I'm studing c4d scripts. it still hard.
Thank you again.