Exemplo n.º 1
0
        protected override ActionResult PerformActionImplementation()
        {
            ProBuilderEditor.selectMode = SelectMode.Object;
            MeshSelection.SetSelection((GameObject)null);

            m_Tool = ScriptableObject.CreateInstance <DrawShapeTool>();
            ToolManager.SetActiveTool(m_Tool);

            MenuAction.onPerformAction         += ActionPerformed;
            ToolManager.activeToolChanging     += LeaveTool;
            ProBuilderEditor.selectModeChanged += OnSelectModeChanged;

            return(new ActionResult(ActionResult.Status.Success, "Draw Shape Tool Starts"));
        }
        static void SetTool <T>() where T : VertexManipulationTool, new()
        {
            //If the type is already active do nothing
            if (typeof(T) == ToolManager.activeToolType)
            {
                return;
            }

            VertexManipulationTool formerTool = null;

            if (EditorToolManager.activeTool is VertexManipulationTool)
            {
                formerTool = (VertexManipulationTool)EditorToolManager.activeTool;
            }
            ToolManager.SetActiveTool(CreateInstance <T>());
            if (formerTool != null)
            {
                DestroyImmediate(formerTool);
            }
        }
 public static void SetActiveTool(EditorTool tool)
 {
     ToolManager.SetActiveTool(tool);
 }
 public static void SetActiveTool(Type type)
 {
     ToolManager.SetActiveTool(type);
 }