private void OnDestroy()
        {
            if (m_editor != null && m_editor.Object != null)
            {
                m_editor.Object.Started -= OnObjectStarted;

                foreach (ExposeToEditor obj in m_editor.Object.Get(false))
                {
                    PBMesh pbMesh = obj.GetComponent <PBMesh>();
                    if (pbMesh != null)
                    {
                        WireframeMesh wireframeMesh = pbMesh.GetComponentInChildren <WireframeMesh>(true);
                        if (wireframeMesh != null)
                        {
                            Destroy(wireframeMesh.gameObject);
                        }
                    }
                }
            }

            if (m_window != null)
            {
                ResetCullingMask(m_window);
            }
        }
Пример #2
0
        private void OnDestroy()
        {
            if (m_editor != null && m_editor.Object != null)
            {
                m_editor.Object.Started             -= OnObjectStarted;
                m_editor.Selection.SelectionChanged -= OnSelectionChanged;

                foreach (ExposeToEditor obj in m_editor.Object.Get(false))
                {
                    PBMesh pbMesh = obj.GetComponent <PBMesh>();
                    if (pbMesh != null)
                    {
                        WireframeMesh[] wireframeMesh = pbMesh.GetComponentsInChildren <WireframeMesh>(true);
                        for (int i = 0; i < wireframeMesh.Length; ++i)
                        {
                            WireframeMesh wireframe = wireframeMesh[i];
                            if (!wireframe.IsIndividual)
                            {
                                Destroy(wireframe.gameObject);
                                break;
                            }
                        }
                    }
                }
            }

            if (m_window != null)
            {
                ResetCullingMask(m_window);
            }
        }
Пример #3
0
        private void CreateWireframeMesh(PBMesh pbMesh)
        {
            GameObject wireframe = new GameObject("IndividualWireframe");

            wireframe.transform.SetParent(pbMesh.transform, false);
            wireframe.hideFlags          = HideFlags.DontSave;
            m_wireframeMesh              = wireframe.AddComponent <WireframeMesh>();
            m_wireframeMesh.IsIndividual = true;
        }
Пример #4
0
        protected virtual void CreateWireframeMesh(PBMesh pbMesh)
        {
            GameObject wireframe = new GameObject("Wireframe");

            wireframe.transform.SetParent(pbMesh.transform, false);
            wireframe.gameObject.hideFlags = HideFlags.DontSave | HideFlags.HideInHierarchy;
            wireframe.layer = m_editor.CameraLayerSettings.ExtraLayer;
            WireframeMesh wireframeMesh = wireframe.AddComponent <WireframeMesh>();

            if (IsSelected(pbMesh.gameObject))
            {
                wireframeMesh.IsSelected = true;
            }
        }
Пример #5
0
        protected virtual void TryDestroyWireframe(ExposeToEditor obj)
        {
            PBMesh pbMesh = obj.GetComponent <PBMesh>();

            if (pbMesh != null)
            {
                WireframeMesh[] wireframeMesh = pbMesh.GetComponentsInChildren <WireframeMesh>(true);
                for (int i = 0; i < wireframeMesh.Length; ++i)
                {
                    WireframeMesh wireframe = wireframeMesh[i];
                    if (!wireframe.IsIndividual)
                    {
                        Destroy(wireframe.gameObject);
                        break;
                    }
                }
            }
        }
 private void OnObjectsDuplicated(GameObject[] arg)
 {
     GameObject[] gameObjects = m_rte.Selection.gameObjects;
     for (int i = 0; i < gameObjects.Length; ++i)
     {
         GameObject go = gameObjects[i];
         if (go != null)
         {
             WireframeMesh wireframe = go.GetComponentInChildren <WireframeMesh>(true);
             if (wireframe != null)
             {
                 DestroyImmediate(wireframe.gameObject);
             }
             PBMesh pbMesh = go.GetComponent <PBMesh>();
             if (pbMesh != null)
             {
                 pbMesh.Refresh();
             }
         }
     }
 }