static void HierarchyChanged()
        {
            s_Bones    = EditorExtra.FindComponentsOfType <Bone2D>().ToList();
            s_Controls = EditorExtra.FindComponentsOfType <Control>().ToList();

            SceneView.RepaintAll();
        }
        void DestroyPreview()
        {
            m_OnionLayerManager.source = null;

            if (m_InstanceRoot)
            {
                EditorExtra.DestroyAnimatorPreviewInstance(m_InstanceRoot);
            }
        }
Пример #3
0
 public TickStyle()
 {
     if (EditorExtra.IsProSkin())
     {
         this.color      = new Color(0.45f, 0.45f, 0.45f, 0.2f);
         this.labelColor = new Color(0.8f, 0.8f, 0.8f, 0.32f);
     }
     else
     {
         this.color      = new Color(0f, 0f, 0f, 0.2f);
         this.labelColor = new Color(0f, 0f, 0f, 0.32f);
     }
 }
Пример #4
0
        public override GameObject Create()
        {
            bool active = original.activeSelf;

            original.SetActive(true);

            GameObject l_instance = base.Create();

            original.SetActive(active);

            if (l_instance)
            {
                EditorExtra.InitInstantiatedPreviewRecursive(l_instance);
            }

            return(l_instance);
        }
Пример #5
0
        void CreatePreview()
        {
            DestroyPreview();

            if (!AnimationMode.InAnimationMode())
            {
                return;
            }

            if (m_SelectedRenderer)
            {
                List <Renderer> l_renderers = new List <Renderer>();

                AnimationWindowExtra.rootGameObject.GetComponentsInChildren <Renderer>(l_renderers);

                foreach (Renderer renderer in l_renderers)
                {
                    renderer.enabled = renderer == m_SelectedRenderer;
                }

                m_InstanceRoot = EditorExtra.InstantiateForAnimatorPreview(AnimationWindowExtra.rootGameObject) as GameObject;

                foreach (Renderer renderer in l_renderers)
                {
                    renderer.enabled = true;
                }
            }
            else
            {
                m_InstanceRoot = EditorExtra.InstantiateForAnimatorPreview(AnimationWindowExtra.rootGameObject) as GameObject;
            }

            EditorExtra.InitInstantiatedPreviewRecursive(m_InstanceRoot);

            List <Ik2D> ik2Ds = new List <Ik2D>();

            m_InstanceRoot.GetComponentsInChildren <Ik2D>(ik2Ds);

            IkUtils.UpdateAttachedIKs(ik2Ds);

            m_OnionLayerManager.source = m_InstanceRoot;

            m_InstanceRoot.SetActive(false);
        }
        void CreatePreview()
        {
            DestroyPreview();

            if (!AnimationMode.InAnimationMode())
            {
                return;
            }

            m_InstanceRoot = EditorExtra.InstantiateForAnimatorPreview(AnimationWindowExtra.rootGameObject) as GameObject;

            EditorExtra.InitInstantiatedPreviewRecursive(m_InstanceRoot);

            List <Ik2D> ik2Ds = new List <Ik2D>();

            m_InstanceRoot.GetComponentsInChildren <Ik2D>(ik2Ds);

            IkUtils.UpdateAttachedIKs(ik2Ds);

            m_OnionLayerManager.source = m_InstanceRoot;

            m_InstanceRoot.SetActive(false);
        }
Пример #7
0
        void InitializeRenderers()
        {
            renderers = m_PreviewInstance.GetComponentsInChildren <Renderer>(true);

            if (!m_SourceSortingGroup)
            {
                List <string> editorSortingLayers = EditorExtra.GetSortingLayerNames();

                //Sort renderers front to back taking sorting layer and sorting order into account
                List <KeyValuePair <Renderer, double> > l_renderersOrder = new List <KeyValuePair <Renderer, double> >();

                for (int i = 0; i < renderers.Length; ++i)
                {
                    Renderer l_renderer     = renderers[i];
                    int      l_sortingOrder = l_renderer.sortingOrder;
                    int      l_layerIndex   = editorSortingLayers.IndexOf(l_renderer.sortingLayerName);

                    l_renderersOrder.Add(new KeyValuePair <Renderer, double>(l_renderer,
                                                                             (l_layerIndex * 2.0) + (l_sortingOrder / (double)32767)));
                }

                l_renderersOrder = l_renderersOrder.OrderByDescending((s) => s.Value).ToList();

                //Store renderers in order
                renderers = l_renderersOrder.ConvertAll(s => s.Key).ToArray();
            }

            //Create temp materials for non sprite renderers
            List <MaterialCache> l_materialCacheList = new List <MaterialCache>();

            foreach (Renderer renderer in renderers)
            {
                l_materialCacheList.Add(new MaterialCache(renderer));
            }

            materialCache = l_materialCacheList.ToArray();
        }
        void InitializeRenderers()
        {
            Renderer[] l_renderers = m_PreviewInstance.GetComponentsInChildren <Renderer>();

            List <string> l_sortingLayerNames = new List <string>(l_renderers.Length);

            foreach (Renderer l_renderer in l_renderers)
            {
                l_sortingLayerNames.Add(l_renderer.sortingLayerName);
            }

            //Find the deepest used layer
            List <string> editorSortingLayers = EditorExtra.GetSortingLayerNames();

            int deepestLayerIndex = int.MaxValue;

            foreach (string layerName in l_sortingLayerNames)
            {
                int index = editorSortingLayers.IndexOf(layerName);

                if (index < deepestLayerIndex)
                {
                    deepestLayerIndex = index;
                }
            }

            string deepestLayer = "Default";

            if (deepestLayerIndex >= 0 && deepestLayerIndex < editorSortingLayers.Count)
            {
                deepestLayer = editorSortingLayers[deepestLayerIndex];
            }

            //Sort renderers front to back taking sorting layer and sorting order into account
            //Set deepest layer to all renderers and calculate the sorting order
            List <KeyValuePair <Renderer, double> > l_renderersOrder = new List <KeyValuePair <Renderer, double> >();

            for (int i = 0; i < l_renderers.Length; ++i)
            {
                Renderer l_renderer     = l_renderers[i];
                int      l_sortingOrder = l_renderer.sortingOrder;
                int      l_layerIndex   = editorSortingLayers.IndexOf(l_renderer.sortingLayerName);

                l_renderer.sortingLayerName = deepestLayer;
                l_renderersOrder.Add(new KeyValuePair <Renderer, double>(l_renderer, (l_layerIndex * 2.0) + (l_sortingOrder / (double)32767)));
            }

            l_renderersOrder = l_renderersOrder.OrderByDescending((s) => s.Value).ToList();

            //Store renderers in order
            renderers = l_renderersOrder.ConvertAll(s => s.Key).ToArray();

            //Create temp materials for non sprite renderers
            List <MaterialCache> l_materialCacheList = new List <MaterialCache>();

            foreach (Renderer renderer in renderers)
            {
                l_materialCacheList.Add(new MaterialCache(renderer));
            }

            materialCache = l_materialCacheList.ToArray();
        }
 static void HierarchyChanged()
 {
     s_Ik2Ds    = EditorExtra.FindComponentsOfType <Ik2D>().ToList();
     s_Bones    = EditorExtra.FindComponentsOfType <Bone2D>().ToList();
     s_Controls = EditorExtra.FindComponentsOfType <Control>().ToList();
 }
Пример #10
0
 static void HierarchyChanged()
 {
     s_SpriteMeshInstances = EditorExtra.FindComponentsOfType <SpriteMeshInstance>().ToList();
 }