Scene GUI Drawer
Extend HutongGames.Editor.SceneGUIDrawer to implement custom scene tools for actions.
Use SceneGUIAttribute to set the action type the scene GUI is for:
[SceneGUI(typeof(TransformClampRotation))]
public class TransformClampRotationSceneGUI : SceneGUIDrawer
{
...
}
Implement the scene UI in OnSceneGUI:
Override IsValid to return when the scene GUI can be drawn. This defaults to return the result of the target action's CanExecute method. In other words, if CanExecute returns false, the scene GUI is not drawn.
Helper Methods
SceneGUIDrawer provides some helper methods:
Call this to draw handles at half their normal size. This can be useful to distinguish action scene handles from normal scene handles.
Call this to restore the matrix after calling HalfSizeHandles().
Call this to set the current Handles.color.
Call this to restore the current Handles.color.
Call this to check if objects are in a good state to be drawn in the scene GUI.
For example: