Exemplo n.º 1
0
        public void Init()
        {
            foreach (Layer l in layers)
            {
                l.Init();
            }

            // gather control params
            List <string> lst  = new List <string>();
            List <float>  vals = new List <float>();

            foreach (Layer l in layers)
            {
                foreach (State s in l.states)
                {
                    if (s.SpeedControlName != null)
                    {
                        if (lst.Contains(s.SpeedControlName))
                        {
                            Debug.LogError("Multiple control params with the same name exist: " + s.SpeedControlName);
                        }
                        lst.Add(s.SpeedControlName);
                        vals.Add(1f);
                    }
                    foreach (TreeNode t in s.GetAllNodes())
                    {
                        t.graph = this;
                        if (t.Controls != null)
                        {
                            foreach (string c in t.Controls)
                            {
                                if (lst.Contains(c))
                                {
                                    Debug.LogError("Multiple control params with the same name exist: " + c);
                                }
                                lst.Add(c);
                                vals.Add(0f);
                            }
                        }
                    }
                    s.SetInitialWrapMode(s.IsLooping ? MixamoWrapMode.Loop : MixamoWrapMode.ClampForever);
                }
            }
            control_params = new ControlParameters(lst.ToArray(), vals.ToArray());
        }
Exemplo n.º 2
0
        public void Init()
        {
            foreach( Layer l in layers ) {
                l.Init();
            }

            // gather control params
            List<string> lst = new List<string>();
            List<float> vals = new List<float>();
            foreach( Layer l in layers ) {
                foreach( State s in l.states ) {
                    if( s.SpeedControlName != null ) {
                        if( lst.Contains( s.SpeedControlName ) ) {
                            Debug.LogError( "Multiple control params with the same name exist: " + s.SpeedControlName );
                        }
                        lst.Add( s.SpeedControlName );
                        vals.Add( 1f );
                    }
                    foreach( TreeNode t in s.GetAllNodes() ) {
                        t.graph = this;
                        if( t.Controls != null ) {
                            foreach( string c in t.Controls ) {
                                if( lst.Contains( c ) ) {
                                    Debug.LogError( "Multiple control params with the same name exist: " + c );
                                }
                                lst.Add( c );
                                vals.Add( 0f );
                            }
                        }
                    }
                    s.SetInitialWrapMode( s.IsLooping ? MixamoWrapMode.Loop : MixamoWrapMode.ClampForever  );
                }
            }
            control_params = new ControlParameters( lst.ToArray() , vals.ToArray() );
        }