Ejemplo n.º 1
0
        private void UpdateSlotData(SkinnedMeshRenderer skinnedMesh)
        {
            SlotDataAsset slot = target as SlotDataAsset;

            string existingRootBone = slot.meshData.RootBoneName;

            UMASlotProcessingUtil.UpdateSlotData(slot, skinnedMesh, slot.material, null, existingRootBone, true);
            AssetDatabase.SaveAssets();
            UMAUpdateProcessor.UpdateSlot(slot);
        }
Ejemplo n.º 2
0
        private SlotDataAsset CreateSlot()
        {
            if (slotName == null || slotName == "")
            {
                Debug.LogError("slotName must be specified.");
                return(null);
            }

            SlotDataAsset sd = CreateSlot_Internal();

            UMAUpdateProcessor.UpdateSlot(sd);
            return(sd);
        }
Ejemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.DelayedTextField(slotName);
            if ((target as SlotDataAsset).isWildCardSlot)
            {
                EditorGUILayout.HelpBox("This is a wildcard slot", MessageType.Info);
            }

            if (slot.isWildCardSlot)
            {
                Editor.DrawPropertiesExcluding(serializedObject, WildcardSlotFields);
            }
            else
            {
                Editor.DrawPropertiesExcluding(serializedObject, RegularSlotFields);
            }
            GUILayout.Space(10);
            slot.tagList.DoLayoutList();


            (target as SlotDataAsset).eventsFoldout = EditorGUILayout.Foldout((target as SlotDataAsset).eventsFoldout, "Slot Events");
            if ((target as SlotDataAsset).eventsFoldout)
            {
                EditorGUILayout.PropertyField(CharacterBegun);
                if (!slot.isWildCardSlot)
                {
                    EditorGUILayout.PropertyField(SlotAtlassed);
                    EditorGUILayout.PropertyField(DNAApplied);
                }
                EditorGUILayout.PropertyField(CharacterCompleted);
            }


            foreach (var t in targets)
            {
                var slotDataAsset = t as SlotDataAsset;
                if (slotDataAsset != null)
                {
                    if (slotDataAsset.animatedBoneHashes.Length != slotDataAsset.animatedBoneNames.Length)
                    {
                        slotDataAsset.animatedBoneHashes = new int[slotDataAsset.animatedBoneNames.Length];
                        for (int i = 0; i < slotDataAsset.animatedBoneNames.Length; i++)
                        {
                            slotDataAsset.animatedBoneHashes[i] = UMASkeleton.StringToHash(slotDataAsset.animatedBoneNames[i]);
                        }
                        GUI.changed = true;
                        EditorUtility.SetDirty(slotDataAsset);
                    }
                }
            }

            if (!(target as SlotDataAsset).isWildCardSlot)
            {
                GUILayout.Space(20);
                Rect updateDropArea = GUILayoutUtility.GetRect(0.0f, 50.0f, GUILayout.ExpandWidth(true));
                GUI.Box(updateDropArea, "Drag SkinnedMeshRenderers here to update the slot meshData.");
                GUILayout.Space(10);
                UpdateSlotDropAreaGUI(updateDropArea);

                GUILayout.Space(10);
                Rect boneDropArea = GUILayoutUtility.GetRect(0.0f, 50.0f, GUILayout.ExpandWidth(true));
                GUI.Box(boneDropArea, "Drag Bone Transforms here to add their names to the Animated Bone Names.\nSo the power tools will preserve them!");
                GUILayout.Space(10);
                AnimatedBoneDropAreaGUI(boneDropArea);
            }
            serializedObject.ApplyModifiedProperties();
            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(target);
                AssetDatabase.SaveAssets();
                UMAUpdateProcessor.UpdateSlot(target as SlotDataAsset);
            }
        }