Search Unity

Bug [Fixed: 5.5.0b1] Blender could not convert .blend to FBX (5.4.0b15)

Discussion in 'Linux' started by LukaKotar, Apr 20, 2016.

  1. LukaKotar

    LukaKotar

    Joined:
    Sep 25, 2011
    Posts:
    394
    When importing Blender (in this case 2.77a) models into Unity, an error is thrown in the console:
    Blender could not convert the .blend file to FBX file.
    You need to use Blender 2.45-2.49 or 2.58 and later versions for direct Blender import to work.


    This was not an issue with previous versions of Unity (5.4.0b13 and earlier).

    The 5.4.0b14 release notes claim "Asset Import: Support of Blender 2.77 and later", so I'm guessing that this change might have something to do with it.

    Update: I went back to beta 13, and Blender models import as they should again. Does anyone else have this issue with beta 15?
     
    Last edited: Apr 22, 2016
  2. Odd-Redesign

    Odd-Redesign

    Joined:
    Jul 26, 2013
    Posts:
    134
    Sadly, this is a bug caused by Visual C++ apparently introduced by microsoft. It has nothing to do with unity3d and blender specifically, but rather with the way the python executable is called to execute the .fbx export dynamically.

    http://forum.unity3d.com/threads/blender-2-71-blend-to-unity-broken.254632/
    https://connect.microsoft.com/VisualStudio/feedback/details/785119/

    I also experienced this bug on the weekend when using the windows version. Maybe an older version of blender may help? I don't know. Hope it leads you to a path were you can find a workaround for this issue.
     
    LukaKotar likes this.
  3. LukaKotar

    LukaKotar

    Joined:
    Sep 25, 2011
    Posts:
    394
    That's a bummer. Thanks for the explanation though.
     
  4. Adder

    Adder

    Joined:
    Mar 4, 2015
    Posts:
    1
    They use new python in blender 2.77 and there are problems.
     
    Last edited: Apr 22, 2016
  5. LukaKotar

    LukaKotar

    Joined:
    Sep 25, 2011
    Posts:
    394
    This issue is still present in 5.4.0b16.

    I currently have beta 13 installed in a different directory, and I use it whenever I'm working on a Blender model. I use the latest Unity version for everything else. Not exactly an ideal solution, but it gets the job done. I'm still looking for workarounds, I'll share them here if I find something out.
     
  6. Norgg

    Norgg

    Joined:
    Aug 24, 2014
    Posts:
    2
    Just tried out Linux Unity for the first time today and hit the same issue. I've got Blender 2.74 installed and can import blender models in b13, but not b16.
     
  7. Grosama

    Grosama

    Joined:
    Oct 5, 2015
    Posts:
    10
    The issue is still present in 5.4.0b18 :(
     
  8. Odd-Redesign

    Odd-Redesign

    Joined:
    Jul 26, 2013
    Posts:
    134
    I just successfully imported .blend files with 5.3.5f1 and Ubuntu 16.04.

    I think the issue is not Unity3d but blender itself. More importantly, the bug sits inside the python executable.

    Ubuntu 16.04 uses Blender 2.76b as default. More precisely, 2.76.b+dfsg0-3build1

    It may be worth taking a look into downgrading blender to an older version and checking if the problem can be solved that way. I'm pretty confident that this will make a difference.
     
  9. cernys

    cernys

    Joined:
    Jun 1, 2016
    Posts:
    18
    Hi,
    I have the same problem, blender 2.77 and Unity 5.4.0b10. I have to use a .blend on Unity and it say the same error as you LukaKotar. But, with a lot of patience, I found a semi-solution : In blender, you have to export the file in .fbx directly, and drag this file in the folder Asset of your unity project. If you're lucky, it will be OK. I've tried to export a mannequin with bones and one animation, it miss the hands of the mannequin. But I think you have to configure your export, and maybe it will be complete.
     
  10. Grosama

    Grosama

    Joined:
    Oct 5, 2015
    Posts:
    10
    Still present in 5.4.0f1 (RC1)
    Ubuntu 16.04 + Blender 2.77a

    Have to export directly in .fbx :(
     
  11. rootPL

    rootPL

    Joined:
    Sep 5, 2015
    Posts:
    14
    I'm exporting to fbx in blender itself and have no issues in linux edition
    5.3.6f1
     
  12. LukaKotar

    LukaKotar

    Joined:
    Sep 25, 2011
    Posts:
    394
    Any chance for the Blender importer to be reverted to the one in 5.4b13 (and older) for the Linux editor? The old one worked fine.
     
  13. LukaKotar

    LukaKotar

    Joined:
    Sep 25, 2011
    Posts:
    394
    So, I came up with a workaround. I created an editor script which automatically exports the Blender file to FBX (so a .fbx file will appear next to the .blend).

    Few things to note:
    • It has trouble exporting the file if there are spaces in either the last folder of the model path, or the .blend file.
    • The un-applied modifiers sometimes won't update in the FBX file.
    • When re-importing, re-import the Blender file rather than the FBX, if there are changes that don't show up.
    The editor script (I put mine in Assets/Editor/BlenderImporter.cs):
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. using System.IO;
    4. using System.Diagnostics;
    5. public class BlenderImporter : AssetPostprocessor{
    6.     public void OnPreprocessModel (){
    7.         if(assetPath.EndsWith(".blend")){
    8.             string path = Directory.GetParent(Application.dataPath).ToString();
    9.             string fbx = path + "/" + Path.GetDirectoryName(assetPath) + "/" + Path.GetFileNameWithoutExtension(assetPath) + ".fbx";
    10.  
    11.             ProcessStartInfo psi = new ProcessStartInfo();
    12.             psi.FileName = "blender";
    13.             psi.UseShellExecute = false;
    14.             psi.RedirectStandardOutput = true;
    15.             psi.Arguments = " --background " + assetPath + " --python-expr 'import bpy; bpy.ops.export_scene.fbx(filepath="+'"'+fbx+'"'+",use_selection=False,use_mesh_modifiers=True)'";
    16.             Process p = Process.Start(psi);
    17.             //string strOutput = p.StandardOutput.ReadToEnd();
    18.             p.WaitForExit();
    19.             //UnityEngine.Debug.Log(strOutput);
    20.             AssetDatabase.Refresh();
    21.         }
    22.     }
    23. }
    I will reply again if I can get it to import the actual .blend file. I found out that if you import an FBX file, rename the *.fbx to *.blend and *.fbx.meta to *.blend.meta and then replace the *.blend with the actual blend file, the blend file is then usable in Unity, however the object will loose reference anytime it is imported that way, which is why I didn't include that part of code. (I had a shell script which does this automatically when called from Unity).

    For now, the above script will at least provide a more seamless workflow than exporting manually each time. I am still hoping this issue gets fixed, though.
     
    tonialatalo and fumangy like this.
  14. LearningNot

    LearningNot

    Joined:
    Sep 30, 2015
    Posts:
    106
    i head problem too i wasted whole day trying to figure out whats the issue, anyway in my case i head 1 lose vert in blend file and it dident want to export, after deleting it it all worked normal
     
  15. fumangy

    fumangy

    Joined:
    Mar 28, 2013
    Posts:
    17
  16. LukaKotar

    LukaKotar

    Joined:
    Sep 25, 2011
    Posts:
    394
    This is becoming more and more of an issue for me, since switching to FBX (or a different format) means I'll have to update the model references in the scene(s) as well as configure all of the import settings again, which is quite a major inconvenience, especially when the models have animations.

    If possible, I'd like to see the Blender importer reverted to a working version (builds #2016040601 and earlier worked perfectly fine). What's the status of this issue?
     
  17. Grosama

    Grosama

    Joined:
    Oct 5, 2015
    Posts:
    10
    Seems to be fixed in 5.5.0b1.
    At least i don't get that error anymore.
     
  18. knighthawk

    knighthawk

    Joined:
    Nov 30, 2014
    Posts:
    34
  19. kmare

    kmare

    Joined:
    Jan 30, 2016
    Posts:
    34
    when you say running with 5.5b07 or 5.5b08, you mean on windows and not linux, right?
     
  20. knighthawk

    knighthawk

    Joined:
    Nov 30, 2014
    Posts:
    34
    Yes windows 7.
     
  21. knighthawk

    knighthawk

    Joined:
    Nov 30, 2014
    Posts:
    34
    Sorry didn't realize it was a Linux thread.