public static void Add(this glTF_VRM_BlendShapeMaster master,
                               BlendShapeClip clip, Transform transform, List <Mesh> meshes)
        {
            var list = new List <glTF_VRM_BlendShapeBind>();

            if (clip.Values != null)
            {
                list.AddRange(clip.Values.Select(y => Create(transform, meshes.ToList(), y)));
            }

            var materialList = new List <glTF_VRM_MaterialValueBind>();

            if (clip.MaterialValues != null)
            {
                materialList.AddRange(clip.MaterialValues.Select(y => new glTF_VRM_MaterialValueBind
                {
                    materialName = y.MaterialName,
                    propertyName = y.ValueName,
                    targetValue  = y.TargetValue.ToArray(),
                }));
            }

            var group = new glTF_VRM_BlendShapeGroup
            {
                name           = clip.BlendShapeName,
                presetName     = clip.Preset.ToString().ToLower(),
                isBinary       = clip.IsBinary,
                binds          = list,
                materialValues = materialList,
            };

            master.blendShapeGroups.Add(group);
        }
示例#2
0
        public static void Serialize_vrm_blendShapeMaster(JsonFormatter f, glTF_VRM_BlendShapeMaster value)
        {
            f.BeginMap();


            if (value.blendShapeGroups != null && value.blendShapeGroups.Count >= 0)
            {
                f.Key("blendShapeGroups");
                Serialize_vrm_blendShapeMaster_blendShapeGroups(f, value.blendShapeGroups);
            }

            f.EndMap();
        }
示例#3
0
        public static glTF_VRM_BlendShapeMaster Deserialize_vrm_blendShapeMaster(ListTreeNode <JsonValue> parsed)
        {
            var value = new glTF_VRM_BlendShapeMaster();

            foreach (var kv in parsed.ObjectItems())
            {
                var key = kv.Key.GetString();

                if (key == "blendShapeGroups")
                {
                    value.blendShapeGroups = Deserialize_vrm_blendShapeMaster_blendShapeGroups(kv.Value);
                    continue;
                }
            }
            return(value);
        }
示例#4
0
        public static void Add(this glTF_VRM_BlendShapeMaster master,
                               BlendShapeClip clip, Transform transform, List <Mesh> meshes)
        {
            var list = new List <glTF_VRM_BlendShapeBind>();

            if (clip.Values != null)
            {
                foreach (var value in clip.Values)
                {
                    var bind = Create(transform, meshes, value);
                    if (bind == null)
                    {
                        // Debug.LogFormat("{0}: skip blendshapebind", clip.name);
                        continue;
                    }
                    list.Add(bind);
                }
            }

            var materialList = new List <glTF_VRM_MaterialValueBind>();

            if (clip.MaterialValues != null)
            {
                materialList.AddRange(clip.MaterialValues.Select(y => new glTF_VRM_MaterialValueBind
                {
                    materialName = y.MaterialName,
                    propertyName = y.ValueName,
                    targetValue  = y.TargetValue.ToArray(),
                }));
            }

            var group = new glTF_VRM_BlendShapeGroup
            {
                name           = clip.BlendShapeName,
                presetName     = clip.Preset.ToString().ToLower(),
                isBinary       = clip.IsBinary,
                binds          = list,
                materialValues = materialList,
            };

            master.blendShapeGroups.Add(group);
        }
示例#5
0
 public static void Add(this glTF_VRM_BlendShapeMaster master,
                        BlendShapeClip clip, gltfExporter exporter)
 {
     master.blendShapeGroups.Add(clip.Serialize(exporter));
 }