1.Unity与windows交互 调用文件浏览器

1.用C#调用comdlg32.dll  ,  利用GetOpenFileName实现打开文件对话框

<1> 整体参考https://www.cnblogs.com/chinarbolg/p/9601432.html

<2>文件过滤属性设置参考https://zhidao.baidu.com/question/221417585.html

pth.filter = "jpg files\0*.jpg\0png files\0*.png\0jpeg files\0*.jpeg";

jpg files是显示的内容,\0是转义字符,*.jpg是过滤格式,然后是下一个过滤器

完整形式openFileName.filter = "图片文件(*.jpg,*.png,*.bmp)\0*.jpg;*.png;*.bmp";

 

2.面部表情制作,BlendShapes

1.参考https://www.jianshu.com/p/4ae6662a40df

 

3.将一个Mesh的BlendShape复制到另一个Mesh上

// Copy blend shape data from myMesh to tmpMesh
 
 Vector3[] dVertices = new Vector3[myMesh.vertexCount];
 Vector3[] dNormals = new Vector3[myMesh.vertexCount];
 Vector3[] dTangents= new Vector3[myMesh.vertexCount];
 for (int shape = 0; shape < myMesh.blendShapeCount; shape++) {
     for (int frame = 0; frame < myMesh.GetBlendShapeFrameCount(shape); frame++) {
         string shapeName = myMesh.GetBlendShapeName(shape);
         float frameWeight = myMesh.GetBlendShapeFrameWeight(shape, frame);
 
         myMesh.GetBlendShapeFrameVertices(shape, frame, dVertices, dNormals, dTangents);
         tmpMesh.AddBlendShapeFrame(shapeName, frameWeight, dVertices, dNormals, dTangents);
     }
 }