Exemplo n.º 1
0
            public EyelidPositionBlendshapeForExport GetExport(Transform startXform)
            {
                EyelidPositionBlendshapeForExport export = new EyelidPositionBlendshapeForExport
                            {
                                skinnedMeshRendererPath = Utils.GetPathForTransform(startXform, skinnedMeshRenderer.transform),
                                defaultWeight = defaultWeight,
                                positionWeight = positionWeight,
                                index = index,
                                name = name,
                                isUsedInEalierConfig = isUsedInEalierConfig
                            };

                            return export;
            }
Exemplo n.º 2
0
            public void Import(EyelidPositionBlendshapeForExport export, Transform startXform)
            {
                skinnedMeshRenderer = Utils.GetTransformFromPath(startXform, export.skinnedMeshRendererPath).GetComponent<SkinnedMeshRenderer>();
                            defaultWeight = export.defaultWeight;
                            positionWeight = export.positionWeight;
                            index = export.index;
                            name = export.name;
                            isUsedInEalierConfig = export.isUsedInEalierConfig;

                            //*** If we imported a name for the blendshape, find the correct index, because during runtime we use the index to manipulate blendshapes
                            {
                                if ( false == string.IsNullOrEmpty(name) )
                                    for ( int i=0;  i<skinnedMeshRenderer.sharedMesh.blendShapeCount;  i++ )
                                        if ( skinnedMeshRenderer.sharedMesh.GetBlendShapeName(i).Equals( name ) )
                                        {
                                            index = i;
                                            break;
                                        }
                            }
            }
Exemplo n.º 3
0
            public static bool CanImport(EyelidPositionBlendshapeForExport import, Transform startXform)
            {
                Transform t = Utils.GetTransformFromPath(startXform, import.skinnedMeshRendererPath);

                            if ( t == null )
                                return false;

                            SkinnedMeshRenderer meshRenderer = t.GetComponent<SkinnedMeshRenderer>();

                            if ( meshRenderer == null )
                                return false;

                            if ( import.index >= meshRenderer.sharedMesh.blendShapeCount )
                                return false;

                            if ( false == string.IsNullOrEmpty(import.name) )
                            {
                                bool containsName = false;
                                for ( int i=0;  i<meshRenderer.sharedMesh.blendShapeCount;  i++ )
                                    if ( meshRenderer.sharedMesh.GetBlendShapeName(i).Equals( import.name ) )
                                    {
                                        containsName = true;
                                        break;
                                    }

                                if ( false == containsName )
                                    return false;
                            }

                            return true;
            }