PrimitiveBoundsHandle
Base class for a compound handle to edit a bounding volume in the Scene view.
Read time 2 minutesLast updated 11 days ago
Definition
- Type: Class
- Namespace: UnityEditor.IMGUI.Controls
- Assembly: UnityEditor.CoreModule
public abstract class PrimitiveBoundsHandle
Remarks
This class allows you to display a shape with up to six control handles for simultaneously editing the size and center of a bounding volume. Dragging on any one control handle will expand the volume along the control handle's axis. All classes that inherit from this class also gain the following modifier keys while a control handle is being dragged:
• Alt: Pin the PrimitiveBoundsHandle.center of the volume to its location at the time the control handle was clicked and grow the size in both directions along the control handle's axis of movement.
• Shift: Uniformly scale the volume along all enabled PrimitiveBoundsHandle.axes in proportion to its size at the time the control handle was clicked.
The handle rendered by this class's PrimitiveBoundsHandle.DrawHandle() method is affected by global state in the Handles class, such as Handles.matrix and Handles.color.
Additional Resources: Editor.OnSceneGUI(), Handles.SetCamera.
Constructors
Constructor | Description |
|---|---|
| PrimitiveBoundsHandle() | Create a new instance of the PrimitiveBoundsHandle class. |
Properties
Property | Description |
|---|---|
| axes | Flags specifying which axes should display control handles. |
| center | Returns or specifies the center of the bounding volume for the handle. |
| handleColor | Returns or specifies the color of the control handles. |
| midpointHandleDrawFunction | An optional Handles.CapFunction to use when displaying the control handles. Defaults to Handles.DotHandleCap if no value is specified. |
| midpointHandleSizeFunction | The Handles.SizeFunction to specify how large the midpoint control handles should be. |
| wireframeColor | Returns or specifies the color of the wireframe shape. |
Methods
Method | Description |
|---|---|
| DrawHandle | A function to display this instance in the current handle camera using its current configuration. |
| DrawWireframe | Draw a wireframe shape for this instance. Subclasses must implement this method. |
| GetSize | Gets the current size of the bounding volume for this instance. |
| IsAxisEnabled | Gets a value indicating whether the specified axis is enabled for the current instance. |
| OnHandleChanged | A callback for when a control handle was dragged in the Scene. |
| SetColor | Sets PrimitiveBoundsHandle.handleColor and PrimitiveBoundsHandle.wireframeColor to the same value. |
| SetSize | Sets the current size of the bounding volume for this instance. |
Static Methods
Method | Description |
|---|---|
| DefaultMidpointHandleSizeFunction | A Handles.SizeFunction that returns a fixed screen-space size. |
Enums
Enum | Description |
|---|---|
| PrimitiveBoundsHandle.Axes | A flag enumeration for specifying which axes on a PrimitiveBoundsHandle object should be enabled. |
| PrimitiveBoundsHandle.HandleDirection | An enumeration of directions the handle moves in. |