protected override void GenerateEdgePickingObjects(IList <ProBuilderMesh> selection, bool doDepthTest, out Dictionary <uint, SimpleTuple <ProBuilderMesh, Edge> > map, out GameObject[] depthObjects, out GameObject[] pickerObjects) { base.GenerateEdgePickingObjects(selection, doDepthTest, out map, out depthObjects, out pickerObjects); if (depthObjects != null) { m_cache.Add(depthObjects.SelectMany(go => go.GetComponentsInChildren <Renderer>()).ToArray()); } if (pickerObjects != null) { m_cache.Add(pickerObjects.SelectMany(go => go.GetComponentsInChildren <Renderer>()).ToArray()); } }
private void TryToAddRenderers(IRuntimeSelection selection) { if (selection.gameObjects != null) { Renderer[] renderers = selection.gameObjects.Where(go => go != null).Select(go => go.GetComponent <ExposeToEditor>()).Where(e => e != null && e.ShowSelectionGizmo && !e.gameObject.IsPrefab() && (e.gameObject.hideFlags & HideFlags.HideInHierarchy) == 0).SelectMany(e => e.GetComponentsInChildren <Renderer>().Where(r => (r.gameObject.hideFlags & HideFlags.HideInHierarchy) == 0)).ToArray(); for (int i = 0; i < renderers.Length; ++i) { Renderer renderer = renderers[i]; if ((renderer.hideFlags & HideFlags.HideInHierarchy) == 0) { m_cache.Add(renderer); } } } }
private void Update() { if (m_activeWindow == null || m_selectionComponent == null) { return; } Ray ray = new Ray(m_activeWindow.Camera.transform.position, m_activeWindow.Camera.transform.forward); if (m_prevRay.origin == ray.origin && m_prevRay.direction == ray.direction && !m_editor.Tools.IsViewing) { if (m_animatingCamera) { m_updateRenderers = true; } m_animatingCamera = false; } else { m_prevRay = ray; m_animatingCamera = true; return; } if (m_updateRenderers) { m_updateRenderers = false; m_renderers = m_editor.Object.Get(true).SelectMany(go => go.GetComponentsInChildren <Renderer>()).ToArray(); m_texPixels = m_selectionComponent.BoxSelection.BeginPick(out m_texSize, m_renderers); } m_cache.Clear(); BaseHandle handle = null; switch (m_editor.Tools.Current) { case RuntimeTool.Move: handle = m_selectionComponent.PositionHandle; break; case RuntimeTool.Rotate: handle = m_selectionComponent.RotationHandle; break; case RuntimeTool.Scale: handle = m_selectionComponent.ScaleHandle; break; case RuntimeTool.Rect: handle = m_selectionComponent.RectTool; break; case RuntimeTool.Custom: handle = m_selectionComponent.CustomHandle; break; } if (IsPointerOver(handle) || m_editor.Tools.ActiveTool == m_selectionComponent.BoxSelection && m_selectionComponent.BoxSelection != null) { return; } Renderer[] renderers = m_selectionComponent.BoxSelection.EndPick(m_texPixels, m_texSize, m_renderers); m_cache.Add(renderers, true, true); }