C# Class UnityEditor.HandleUtility

Helper functions for Scene View style 3D GUI.

显示文件 Open project: CarlosHBC/UnityDecompiled Class Usage Examples

Private Properties

Property Type Description
ApplyDottedWireMaterial void
ApplyWireMaterial void
BeginHandles void
CalcRayPlaceOffset float
CameraNeedsToRenderIntoRT bool
DistanceToDiamond float
DistanceToDiamondInternal float
DistanceToRectangleInternal float
EndHandles void
FindNearestVertex bool
FindSelectionBase UnityEngine.GameObject
GetParametrization float
INTERNAL_CALL_CalcRayPlaceOffset float
INTERNAL_CALL_DistancePointBezier float
INTERNAL_CALL_Internal_FindNearestVertex bool
INTERNAL_CALL_Internal_PickClosestGO UnityEngine.GameObject
INTERNAL_CALL_Internal_PickRectObjects UnityEngine.GameObject[]
INTERNAL_CALL_IntersectRayMesh bool
InitHandleMaterials void
Internal_FindNearestVertex bool
Internal_PickClosestGO UnityEngine.GameObject
Internal_PickRectObjects UnityEngine.GameObject[]
Internal_Repaint void
Internal_SetHandleWireTextureIndex void
IntersectRayMesh bool
PickGameObject UnityEngine.GameObject
PickGameObject UnityEngine.GameObject
SetViewInfo void

Public Methods

Method Description
AddControl ( int controlId, float distance ) : void

Record a distance measurement from a handle.

AddDefaultControl ( int controlId ) : void

Add the ID for a default control. This will be picked if nothing else is.

CalcLineTranslation ( Vector2 src, Vector2 dest, Vector3 srcPosition, Vector3 constraintDir ) : float

Map a mouse drag onto a movement along a line in 3D space.

ClosestPointToArc ( Vector3 center, Vector3 normal, Vector3 from, float angle, float radius ) : Vector3

Get the point on an arc (in 3D space) which is closest to the current mouse position.

ClosestPointToDisc ( Vector3 center, Vector3 normal, float radius ) : Vector3

Get the point on an disc (in 3D space) which is closest to the current mouse position.

ClosestPointToPolyLine ( ) : Vector3

Get the point on a polyline (in 3D space) which is closest to the current mouse position.

DistancePointBezier ( Vector3 point, Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent ) : float

Calculate distance between a point and a Bezier curve.

DistancePointLine ( Vector3 point, Vector3 lineStart, Vector3 lineEnd ) : float

Calculate distance between a point and a line.

DistancePointToLine ( Vector2 p, Vector2 a, Vector2 b ) : float

Distance from a point p in 2d to a line defined by two points a and b.

DistancePointToLineSegment ( Vector2 p, Vector2 a, Vector2 b ) : float

Distance from a point p in 2d to a line segment defined by two points a and b.

DistanceToArc ( Vector3 center, Vector3 normal, Vector3 from, float angle, float radius ) : float

Pixel distance from mouse pointer to a 3D section of a disc.

DistanceToCircle ( Vector3 position, float radius ) : float

Pixel distance from mouse pointer to camera facing circle.

DistanceToDisc ( Vector3 center, Vector3 normal, float radius ) : float

Pixel distance from mouse pointer to a 3D disc.

DistanceToLine ( Vector3 p1, Vector3 p2 ) : float

Pixel distance from mouse pointer to line.

DistanceToPolyLine ( ) : float

Pixel distance from mouse pointer to a polyline.

DistanceToRectangle ( Vector3 position, Quaternion rotation, float size ) : float

Pixel distance from mouse pointer to a rectangle on screen.

GUIPointToWorldRay ( Vector2 position ) : Ray

Convert 2D GUI position to a world space ray.

GetHandleSize ( Vector3 position ) : float

Get world space size of a manipulator handle at given position.

PickGameObject ( Vector2 position, GameObject ignore, int &materialIndex ) : GameObject
PickGameObject ( Vector2 position, bool selectPrefabRoot ) : GameObject

Pick game object closest to specified position.

PickGameObject ( Vector2 position, bool selectPrefabRoot, GameObject ignore ) : GameObject
PickGameObject ( Vector2 position, int &materialIndex ) : GameObject
PickRectObjects ( Rect rect ) : UnityEngine.GameObject[]

Pick GameObjects that lie within a specified screen rectangle.

PickRectObjects ( Rect rect, bool selectPrefabRootsOnly ) : UnityEngine.GameObject[]

PointOnLineParameter ( Vector3 point, Vector3 linePoint, Vector3 lineDirection ) : float

Returns the parameter for the projection of the point on the given line.

PopCamera ( Camera camera ) : void

Retrieve all camera settings.

ProjectPointLine ( Vector3 point, Vector3 lineStart, Vector3 lineEnd ) : Vector3

Project point onto a line.

PushCamera ( Camera camera ) : void

Store all camera settings.

RaySnap ( Ray ray ) : object

Casts ray against the scene and report if an object lies in its path.

Repaint ( ) : void

Repaint the current view.

WorldPointToSizedRect ( Vector3 position, GUIContent content, GUIStyle style ) : Rect

Calculate a rectangle to display a 2D GUI element near a projected point in 3D space.

WorldToGUIPoint ( Vector3 world ) : Vector2

Convert world space point to a 2D GUI position.

Private Methods

Method Description
ApplyDottedWireMaterial ( ) : void
ApplyWireMaterial ( ) : void
BeginHandles ( ) : void
CalcRayPlaceOffset ( Transform objects, Vector3 normal ) : float
CameraNeedsToRenderIntoRT ( Camera camera ) : bool
DistanceToDiamond ( Vector3 position, Quaternion rotation, float size ) : float
DistanceToDiamondInternal ( Vector3 position, Quaternion rotation, float size, Vector2 mousePosition ) : float
DistanceToRectangleInternal ( Vector3 position, Quaternion rotation, Vector2 size ) : float
EndHandles ( ) : void
FindNearestVertex ( Vector2 guiPoint, Transform objectsToSearch, Vector3 &vertex ) : bool
FindSelectionBase ( GameObject go ) : GameObject
GetParametrization ( Vector2 x0, Vector2 x1, Vector2 x2 ) : float
INTERNAL_CALL_CalcRayPlaceOffset ( Transform objects, Vector3 &normal ) : float
INTERNAL_CALL_DistancePointBezier ( Vector3 &point, Vector3 &startPosition, Vector3 &endPosition, Vector3 &startTangent, Vector3 &endTangent ) : float
INTERNAL_CALL_Internal_FindNearestVertex ( Camera cam, Vector2 &screenPoint, Transform objectsToSearch, Transform ignoreObjects, Vector3 &vertex ) : bool
INTERNAL_CALL_Internal_PickClosestGO ( Camera cam, int layers, Vector2 &position, GameObject ignore, GameObject filter, int &materialIndex ) : GameObject
INTERNAL_CALL_Internal_PickRectObjects ( Camera cam, Rect &rect, bool selectPrefabRoots ) : UnityEngine.GameObject[]
INTERNAL_CALL_IntersectRayMesh ( Ray &ray, Mesh mesh, Matrix4x4 &matrix, RaycastHit &hit ) : bool
InitHandleMaterials ( ) : void
Internal_FindNearestVertex ( Camera cam, Vector2 screenPoint, Transform objectsToSearch, Transform ignoreObjects, Vector3 &vertex ) : bool
Internal_PickClosestGO ( Camera cam, int layers, Vector2 position, GameObject ignore, GameObject filter, int &materialIndex ) : GameObject
Internal_PickRectObjects ( Camera cam, Rect rect, bool selectPrefabRoots ) : UnityEngine.GameObject[]
Internal_Repaint ( ) : void
Internal_SetHandleWireTextureIndex ( int textureIndex ) : void
IntersectRayMesh ( Ray ray, Mesh mesh, Matrix4x4 matrix, RaycastHit &hit ) : bool
PickGameObject ( Vector2 position, GameObject ignore, GameObject filter, int &materialIndex ) : GameObject
PickGameObject ( Vector2 position, bool selectPrefabRoot, GameObject ignore, GameObject filter ) : GameObject
SetViewInfo ( Vector2 screenPosition ) : void

Method Details

AddControl() public static method

Record a distance measurement from a handle.

public static AddControl ( int controlId, float distance ) : void
controlId int
distance float
return void

AddDefaultControl() public static method

Add the ID for a default control. This will be picked if nothing else is.

public static AddDefaultControl ( int controlId ) : void
controlId int
return void

CalcLineTranslation() public static method

Map a mouse drag onto a movement along a line in 3D space.

public static CalcLineTranslation ( Vector2 src, Vector2 dest, Vector3 srcPosition, Vector3 constraintDir ) : float
src Vector2 The source point of the drag.
dest Vector2 The destination point of the drag.
srcPosition Vector3 The 3D position the dragged object had at src ray.
constraintDir Vector3 3D direction of constrained movement.
return float

ClosestPointToArc() public static method

Get the point on an arc (in 3D space) which is closest to the current mouse position.

public static ClosestPointToArc ( Vector3 center, Vector3 normal, Vector3 from, float angle, float radius ) : Vector3
center Vector3
normal Vector3
from Vector3
angle float
radius float
return Vector3

ClosestPointToDisc() public static method

Get the point on an disc (in 3D space) which is closest to the current mouse position.

public static ClosestPointToDisc ( Vector3 center, Vector3 normal, float radius ) : Vector3
center Vector3
normal Vector3
radius float
return Vector3

ClosestPointToPolyLine() public static method

Get the point on a polyline (in 3D space) which is closest to the current mouse position.

public static ClosestPointToPolyLine ( ) : Vector3
return Vector3

DistancePointBezier() public static method

Calculate distance between a point and a Bezier curve.

public static DistancePointBezier ( Vector3 point, Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent ) : float
point Vector3
startPosition Vector3
endPosition Vector3
startTangent Vector3
endTangent Vector3
return float

DistancePointLine() public static method

Calculate distance between a point and a line.

public static DistancePointLine ( Vector3 point, Vector3 lineStart, Vector3 lineEnd ) : float
point Vector3
lineStart Vector3
lineEnd Vector3
return float

DistancePointToLine() public static method

Distance from a point p in 2d to a line defined by two points a and b.

public static DistancePointToLine ( Vector2 p, Vector2 a, Vector2 b ) : float
p Vector2
a Vector2
b Vector2
return float

DistancePointToLineSegment() public static method

Distance from a point p in 2d to a line segment defined by two points a and b.

public static DistancePointToLineSegment ( Vector2 p, Vector2 a, Vector2 b ) : float
p Vector2
a Vector2
b Vector2
return float

DistanceToArc() public static method

Pixel distance from mouse pointer to a 3D section of a disc.

public static DistanceToArc ( Vector3 center, Vector3 normal, Vector3 from, float angle, float radius ) : float
center Vector3
normal Vector3
from Vector3
angle float
radius float
return float

DistanceToCircle() public static method

Pixel distance from mouse pointer to camera facing circle.

public static DistanceToCircle ( Vector3 position, float radius ) : float
position Vector3
radius float
return float

DistanceToDisc() public static method

Pixel distance from mouse pointer to a 3D disc.

public static DistanceToDisc ( Vector3 center, Vector3 normal, float radius ) : float
center Vector3
normal Vector3
radius float
return float

DistanceToLine() public static method

Pixel distance from mouse pointer to line.

public static DistanceToLine ( Vector3 p1, Vector3 p2 ) : float
p1 Vector3
p2 Vector3
return float

DistanceToPolyLine() public static method

Pixel distance from mouse pointer to a polyline.

public static DistanceToPolyLine ( ) : float
return float

DistanceToRectangle() public static method

Pixel distance from mouse pointer to a rectangle on screen.

public static DistanceToRectangle ( Vector3 position, Quaternion rotation, float size ) : float
position Vector3
rotation UnityEngine.Quaternion
size float
return float

GUIPointToWorldRay() public static method

Convert 2D GUI position to a world space ray.

public static GUIPointToWorldRay ( Vector2 position ) : Ray
position Vector2
return UnityEngine.Ray

GetHandleSize() public static method

Get world space size of a manipulator handle at given position.

public static GetHandleSize ( Vector3 position ) : float
position Vector3 The position of the handle in 3d space.
return float

PickGameObject() public static method

public static PickGameObject ( Vector2 position, GameObject ignore, int &materialIndex ) : GameObject
position Vector2
ignore UnityEngine.GameObject
materialIndex int
return UnityEngine.GameObject

PickGameObject() public static method

Pick game object closest to specified position.

public static PickGameObject ( Vector2 position, bool selectPrefabRoot ) : GameObject
position Vector2
selectPrefabRoot bool Select prefab.
return UnityEngine.GameObject

PickGameObject() public static method

public static PickGameObject ( Vector2 position, bool selectPrefabRoot, GameObject ignore ) : GameObject
position Vector2
selectPrefabRoot bool
ignore UnityEngine.GameObject
return UnityEngine.GameObject

PickGameObject() public static method

public static PickGameObject ( Vector2 position, int &materialIndex ) : GameObject
position Vector2
materialIndex int
return UnityEngine.GameObject

PickRectObjects() public static method

Pick GameObjects that lie within a specified screen rectangle.

public static PickRectObjects ( Rect rect ) : UnityEngine.GameObject[]
rect UnityEngine.Rect An screen rectangle specified with pixel coordinates.
return UnityEngine.GameObject[]

PickRectObjects() public static method

public static PickRectObjects ( Rect rect, bool selectPrefabRootsOnly ) : UnityEngine.GameObject[]
rect UnityEngine.Rect
selectPrefabRootsOnly bool
return UnityEngine.GameObject[]

PointOnLineParameter() public static method

Returns the parameter for the projection of the point on the given line.

public static PointOnLineParameter ( Vector3 point, Vector3 linePoint, Vector3 lineDirection ) : float
point Vector3
linePoint Vector3
lineDirection Vector3
return float

PopCamera() public static method

Retrieve all camera settings.

public static PopCamera ( Camera camera ) : void
camera UnityEngine.Camera
return void

ProjectPointLine() public static method

Project point onto a line.

public static ProjectPointLine ( Vector3 point, Vector3 lineStart, Vector3 lineEnd ) : Vector3
point Vector3
lineStart Vector3
lineEnd Vector3
return Vector3

PushCamera() public static method

Store all camera settings.

public static PushCamera ( Camera camera ) : void
camera UnityEngine.Camera
return void

RaySnap() public static method

Casts ray against the scene and report if an object lies in its path.

public static RaySnap ( Ray ray ) : object
ray UnityEngine.Ray
return object

Repaint() public static method

Repaint the current view.

public static Repaint ( ) : void
return void

WorldPointToSizedRect() public static method

Calculate a rectangle to display a 2D GUI element near a projected point in 3D space.

public static WorldPointToSizedRect ( Vector3 position, GUIContent content, GUIStyle style ) : Rect
position Vector3 The world-space position to use.
content UnityEngine.GUIContent The content to make room for.
style UnityEngine.GUIStyle The style to use. The style's alignment.
return UnityEngine.Rect

WorldToGUIPoint() public static method

Convert world space point to a 2D GUI position.

public static WorldToGUIPoint ( Vector3 world ) : Vector2
world Vector3 Point in world space.
return Vector2