FBX Export parameters



  • On 23/04/2014 at 07:49, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R15.057 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hello guys. It's my first time posting :)

    I'm playing around with C++ scripting for c4d and now I'm trying to export an FBX in this way

    \> String fbx_filepath = "HARDCODED_PATH.fbx";
    \> 
    \> Bool saved = SaveDocument(doc, fbx_filepath, SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, fbx_plugin_id);
    

    It exported the file and saved it correctly, but take the parameters from last manual export on the export option in c4d.

    Can I set these options from my script? can I get all the options available for this exporter?

    EDIT:
    It seems not to be take in consideration the parameters passed through SetWorldPluginData. Any ideas?

    Thanks

    PS: Sorry for my caveman english.



  • On 28/04/2014 at 06:10, xxxxxxxx wrote:

    I'm Getting the plugin settings with:  GetWorldPluginData and trying to save those with  SetWorldPluginData but is not working.

    Any ideas?



  • On 28/04/2014 at 07:28, xxxxxxxx wrote:

    I'm not sure if I understand your question.
    But this is an example of using .fbx export that works fine for me in R13:

    //To get/set an exporter settings we have to send a MSG_RETRIEVEPRIVATEDATA message to the exporter  
    //We can then access and change the exporter settings retrieving its container instance  
    //Here's an example of how to setup an FBX export in C++:  
      
      
    #include "..\..\..\..\resource\modules\fbx\res\description\Ffbxexport.h"  
      
      
    BaseList2D *exporter;  
    BasePlugin *plug = FindPlugin(1026370, PLUGINTYPE_SCENESAVER);  
    if (plug && plug->Message(MSG_RETRIEVEPRIVATEDATA, &exporter))  
    {  
      BaseContainer *data = exporter->GetDataInstance();  
      
      data->SetLong(FBXEXPORT_ASCII, FALSE);  
      data->SetLong(FBXEXPORT_BAKE_ALL_FRAMES, FALSE);  
      
      data->SetLong(FBXEXPORT_SAVE_NORMALS, TRUE);  
      data->SetLong(FBXEXPORT_ANIMATION, TRUE);  
      data->SetLong(FBXEXPORT_TEXTURES, TRUE);  
      data->SetLong(FBXEXPORT_EMBED_TEXTURES, TRUE);  
      
      SaveDocument(doc, "C:\\model.fbx", SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, 1026370);  
    }
    

    -ScottA



  • On 28/04/2014 at 08:08, xxxxxxxx wrote:

    Instead of SetLong for R15 I must call SetInt32 but It work.

    I was trying to do the same using GetWorldPluginData and SetWorldPluginData. I can retrieve the parameters but I can't set them.

    Thank you very much.



  • On 28/04/2014 at 09:46, xxxxxxxx wrote:

    I can't tell from your answer.
    Is it working OK for you now. Or are you still having problems?

    -ScottA



  • On 28/04/2014 at 10:18, xxxxxxxx wrote:

    Now it's working! Thanks to you.

    My previous attempt:

    	BaseContainer* bc = GetWorldPluginData(FBX_PLUGIN_ID);
    	Bool saved = false;
    	if (bc != NULL)
    	{
    		bc->SetInt32(FBXEXPORT_SAVE_NORMALS, 1);
    		saved = SetWorldPluginData(FBX_PLUGIN_ID, *bc, false);	
    	}
    	if (saved)
    	{
    		GePrint("PARAMETERS SET CORRECTLY");
    	}
    	else
    	{
    		GePrint("PARAMETERS NOT SET");
    	}
    	saved = SaveDocument(doc, fbx_filepath, SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, FBX_PLUGIN_ID);
    


  • On 07/05/2014 at 12:59, xxxxxxxx wrote:

    Now I'm exporting an FBX from my plugin.

    When I'm trying to export Textures using the exporter I noticed that textures are exported only if "Embed textures" is checked. This behavior happen using the plugin from file->export->fbx and using the SaveDocument invocation from my plugin.

    Any ideas to fix it?


Log in to reply