Exemple #1
0
        //============================================================================================
        /**
        *  @brief 
        *         
        *********************************************************************************************/
        public void CopyPreProcessData(MxMPreProcessData a_preProcessData)
        {
            m_overrideTagModule = a_preProcessData.OverrideTagModule;
            m_overrideEventModule = a_preProcessData.OverrideEventModule;
            m_overrideConfigModule = a_preProcessData.OverrideConfigModule;

            List<CompositeCategory> sourceCategories = a_preProcessData.CompositeCategories;
            m_compositeCategories = new List<CompositeCategory>(sourceCategories.Count + 1);

            foreach (CompositeCategory sourceCategory in sourceCategories)
            {
                CompositeCategory newCategory = new CompositeCategory(sourceCategory, this);
                m_compositeCategories.Add(newCategory);
            }

            List<MxMAnimationIdleSet> sourceIdleSets = a_preProcessData.AnimationIdleSets;
            m_animIdleSets = new List<MxMAnimationIdleSet>(sourceIdleSets.Count + 1);

            foreach(MxMAnimationIdleSet sourceIdleSet in sourceIdleSets)
            {
                MxMAnimationIdleSet newIdleSet = ScriptableObject.CreateInstance<MxMAnimationIdleSet>();
                newIdleSet.CopyData(sourceIdleSet);
                newIdleSet.name = sourceIdleSet.name;
                newIdleSet.hideFlags = HideFlags.HideInHierarchy;
                newIdleSet.TargetAnimModule = this;
                newIdleSet.TargetPreProcess = null;

                EditorUtility.SetDirty(newIdleSet);

                AssetDatabase.AddObjectToAsset(newIdleSet, this);

                m_animIdleSets.Add(newIdleSet);
            }

            List<MxMBlendSpace> sourceBlendSpaces = a_preProcessData.BlendSpaces;
            m_blendSpaces = new List<MxMBlendSpace>(sourceBlendSpaces.Count + 1);

            foreach(MxMBlendSpace sourceBlendSpace in sourceBlendSpaces)
            {
                MxMBlendSpace newBlendSpace = ScriptableObject.CreateInstance<MxMBlendSpace>();
                newBlendSpace.CopyData(sourceBlendSpace);
                newBlendSpace.name = sourceBlendSpace.name;
                newBlendSpace.hideFlags = HideFlags.HideInHierarchy;
                newBlendSpace.TargetAnimModule = this;
                newBlendSpace.TargetPreProcess = null;

                EditorUtility.SetDirty(newBlendSpace);

                AssetDatabase.AddObjectToAsset(newBlendSpace, this);

                m_blendSpaces.Add(newBlendSpace);
            }

            EditorUtility.SetDirty(this);
        }
        public CompositeCategory(CompositeCategory a_copy, ScriptableObject a_parentObj)
        {
            CatagoryName = a_copy.CatagoryName;
            Composites   = new List <MxMAnimationClipComposite>(a_copy.Composites.Count + 1);

            IgnoreEdges_default       = a_copy.IgnoreEdges_default;
            Extrapolate_default       = a_copy.Extrapolate_default;
            FlattenTrajectory_default = a_copy.FlattenTrajectory_default;
            RuntimeSplicing_default   = a_copy.RuntimeSplicing_default;
            RequireTags_default       = a_copy.RequireTags_default;
            FavourTags_default        = a_copy.FavourTags_default;

            foreach (MxMAnimationClipComposite sourceComposite in a_copy.Composites)
            {
                MxMAnimationClipComposite newComposite = ScriptableObject.CreateInstance <MxMAnimationClipComposite>();
                newComposite.CopyData(sourceComposite);
                newComposite.name      = sourceComposite.name;
                newComposite.hideFlags = HideFlags.HideInHierarchy;

                MxMPreProcessData targetPreProcess = a_parentObj as MxMPreProcessData;
                AnimationModule   targetAnimModule = a_parentObj as AnimationModule;

                if (targetPreProcess != null)
                {
                    newComposite.TargetPreProcess = targetPreProcess;
                    newComposite.TargetAnimModule = null;
                }
                else if (targetAnimModule != null)
                {
                    newComposite.TargetPreProcess = null;
                    newComposite.TargetAnimModule = targetAnimModule;
                }

                EditorUtility.SetDirty(newComposite);

                if (a_parentObj != null)
                {
                    AssetDatabase.AddObjectToAsset(newComposite, a_parentObj);
                }

                Composites.Add(newComposite);
            }
        }