Legacy Blend Shape Normals missing on Modelimporter?

Hi,

I wrote a model-import-editor-plugin for unity. Now I have the problem that I can’t find how to enable “Legacy Blend Shape Normals” in code.
As far as I understand it should be possible to enable this bool on the modelimporter (Unity - Scripting API: ModelImporter)

I can find every other property I need to adjust on the modelimporter (see picture below), but this one seems to be missing.

Does anyone know where it is located or where I can access and set the bool for Legacy Blend Shape Normals?

Best regards,
Dominik

I’ll push this one as well.
I want to set “Legacy Blendshape Normals” in the ModelImport Settings to “true” by default but wasn’t able to find anything

Please make this happen. We need this setting, and its not acceptable that artist have to manually press this for every asset. Very prone to error.

Please make this public :slight_smile:

    internal extern bool legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }
1 Like

Also pushing this egain

8498315--1131383--upload_2022-10-8_14-1-28.png
Had to “Cheat” a bit but was able to modify the UnityEditor.dll for my project.
Now I can access legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes in Script

Definitely a bit late on this, but you can do it this way too:

public class ModelImportManager : AssetPostprocessor
{
void OnPreprocessModel()
    {
        Debug.Log($"Handling import for model {assetPath}");
        ModelImporter modelImporter = assetImporter as ModelImporter;
        modelImporter.isReadable = true;

        //Force legacy blendshape normals
        string pName = "legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes";
        PropertyInfo prop = modelImporter.GetType().GetProperty(pName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
        prop.SetValue(modelImporter, true);

        EditorUtility.SetDirty(modelImporter);
        modelImporter.SaveAndReimport();
    }
}

This will force this on all imported models, but of course you could add more logic to only set it sometimes.

This was helpful, thank you!

1 Like