Example #1
0
 void OnActiveToolChanging()
 {
     if (ToolManager.IsActiveTool(this))
     {
         polyUtility.StopEditing();
     }
 }
Example #2
0
        public static void DeactivateTool(bool selectNode = false)
        {
            if (!IsActive())
            {
                return;
            }
            // Unity has unreliable events
            ChiselGeneratorManager.GeneratorMode.OnDeactivate();
            ToolManager.RestorePreviousPersistentTool();
            if (!IsActive())
            {
                return;
            }

            if (selectNode && ChiselToolbarUtility.HaveNodesInSelection())
            {
                ChiselEditGeneratorTool.ActivateTool();
                if (!IsActive())
                {
                    return;
                }
            }

            ToolManager.RestorePreviousTool();
            if (!IsActive())
            {
                return;
            }

            Tools.current = Tool.Move;
        }
Example #3
0
            void OnActiveToolChanged()
            {
                var scenePolygon = target as ScenePolygon;

                if (ToolManager.IsActiveTool(this) && IsAvailable() && scenePolygon)
                {
                    polyUtility.StartEditing(scenePolygon);
                }
            }
Example #4
0
            void OnSelectionChanged()
            {
                if (ToolManager.IsActiveTool(this))
                {
                    polyUtility.StopEditing();
                }
                var scenePolygon = target as ScenePolygon;

                if (ToolManager.IsActiveTool(this) && IsAvailable() && scenePolygon != null)
                {
                    polyUtility.StartEditing(scenePolygon);
                }
            }
        static void EditModeButton(Rect position, bool enabled, ChiselEditToolBase editMode, GUIStyle style)
        {
            var editModeType = editMode.GetType();

            using (new EditorGUI.DisabledScope(!enabled))
            {
                EditorGUI.BeginChangeCheck();
                var value = Toggle(position, editMode, editModeType, style);
                if (EditorGUI.EndChangeCheck() && value)
                {
                    ToolManager.SetActiveTool(editModeType);
                    ChiselEditorSettings.Save();
                }
            }
        }
 public void ToolNotActivatingBugWorkAround()
 {
     if (lastSelectedTool == null)
     {
         if (Tools.current != Tool.Custom &&
             lastRememberedToolType != null)
         {
             ToolManager.SetActiveTool(lastRememberedToolType);
             lastRememberedToolType = null;
         }
         else
         if (ToolManager.activeToolType == this.GetType())
         {
             OnActivate();
         }
     }
 }
Example #7
0
 public static void ActivateTool()
 {
     ToolManager.SetActiveTool <ChiselUVRotateTool>();
 }
Example #8
0
 public static void ActivateTool()
 {
     ToolManager.SetActiveTool <ChiselMovePivotTool>();
 }
Example #9
0
 public static void ActivateTool()
 {
     ToolManager.SetActiveTool <ChiselPlacementTool>();
 }
 public static void ActivateTool()
 {
     ToolManager.SetActiveTool <ChiselEditGeneratorTool>();
 }
Example #11
0
        // Unity bug workaround
        void OnDelayedSelectionChanged()
        {
            UnityEditor.Selection.selectionChanged -= OnDelayedSelectionChanged;

            ToolManager.SetActiveTool(typeof(ChiselEditGeneratorTool));
        }