protected virtual void Update() { if (m_editor.ActiveWindow == null || m_editor.ActiveWindow != this && m_editor.ActiveWindow.WindowType != RuntimeWindowType.Scene) { return; } IInput input = m_editor.Input; bool select = input.GetKey(KeyCode.S); bool unselect = input.GetKey(KeyCode.U); if (!select && !unselect) { if (!m_proBuilderTool.HasSelection) { return; } } if (!input.GetKey(KeyCode.LeftAlt) && !input.GetKey(KeyCode.RightAlt) && !input.GetKey(KeyCode.AltGr)) { return; } for (int keyCode = (int)KeyCode.Alpha0; keyCode <= (int)KeyCode.Alpha0 + 9; ++keyCode) { if (!input.GetKeyDown((KeyCode)keyCode)) { continue; } int index = keyCode - (int)KeyCode.Alpha1; if (index == -1) { index = 9; } if (0 <= index && index < Palette.Materials.Count) { Material material = Palette.Materials[index]; if (material == null) { break; } if (select) { m_proBuilderTool.SelectFaces(material); } else if (unselect) { m_proBuilderTool.UnselectFaces(material); } else { m_proBuilderTool.ApplyMaterial(material); } } } }
public void SelectFacesByMaterial(Material material) { if (m_proBuilderTool != null) { m_proBuilderTool.SelectFaces(material); } }