soupday / cc_unity_tools_URP

Package for importing and auto setup of Character Creator (3 & 4) and iClone (7 & 8) character exports for Unity URP Pipeline.
GNU General Public License v3.0
101 stars 26 forks source link

[Feature] Run build wrinkle map for blend shape index #61

Open liudger opened 2 weeks ago

liudger commented 2 weeks ago

When combining meshes for better performance the index of the blendshapes changes as there are more blenshapes for some meshed. (eyebrows) It would be nice to have a button to set the index of the wrinkle manager again based on the current blend shapes. Using Unity Meshbaker https://digitalopus.ca/site/mesh-baker/

image image

liudger commented 2 weeks ago

Code is already there. Just need a button!


private void UpdateBlendShapeIndices()
        {
            if (skinnedMeshRenderer && headMaterial)
            {
                Mesh mesh = skinnedMeshRenderer.sharedMesh;

                foreach (WrinkleConfig wc in config)
                {
                    wc.blendShapeIndex = mesh.GetBlendShapeIndex(wc.blendShapeName);
                    wc.enabled = wc.blendShapeIndex >= 0;

                    foreach (WrinkleRuleSet wm in wc.ruleSets)
                    {
                        if (wrinkleRules.TryGetValue(wm.ruleName, out WrinkleRule rule))
                        {
                            wm.enabled = true;
                        }
                        else
                        {
                            wm.enabled = false;
                        }
                    }
                }
            }
        }
liudger commented 2 weeks ago

created pull request #62